libflame  revision_anchor
Functions
FLA_QR_UT_piv_unb_var2.c File Reference

(r)

Functions

FLA_Error FLA_QR_UT_piv_unb_var2 (FLA_Obj A, FLA_Obj T, FLA_Obj w, FLA_Obj p)
 

Function Documentation

◆ FLA_QR_UT_piv_unb_var2()

FLA_Error FLA_QR_UT_piv_unb_var2 ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  w,
FLA_Obj  p 
)

References FLA_Amax_external(), FLA_Apply_H2_UT_piv_row(), FLA_Apply_pivots(), FLA_Cont_with_3x1_to_2x1(), FLA_Cont_with_3x3_to_2x2(), FLA_Copyt_external(), FLA_Gemv_external(), FLA_Househ2_UT(), FLA_Merge_2x1(), FLA_MINUS_ONE, FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_free(), FLA_Obj_lt(), FLA_Obj_min_dim(), FLA_Obj_width(), FLA_ONE, FLA_Part_2x1(), FLA_Part_2x2(), FLA_QR_UT_piv_colnorm(), FLA_Repart_2x1_to_3x1(), FLA_Repart_2x2_to_3x3(), FLA_Set(), FLA_ZERO, and omega1.

Referenced by FLA_QR_UT_piv_internal().

14 {
15  FLA_Obj ATL, ATR, A00, a01, A02,
16  ABL, ABR, a10t, alpha11, a12t,
17  A20, a21, A22;
18 
19  FLA_Obj TTL, TTR, T00, t01, T02,
20  TBL, TBR, t10t, tau11, t12t,
21  T20, t21, T22;
22 
23  FLA_Obj pT, p0,
24  pB, pi1,
25  p2;
26 
27  FLA_Obj wT, w0,
28  wB, omega1,
29  w2;
30 
31  FLA_Obj ab1, v;
32 
33  // Create workspace
34  FLA_Obj_create( FLA_Obj_datatype( T ), 1, FLA_Obj_width( T ), 0, 0, &v );
35 
36  FLA_Part_2x2( A, &ATL, &ATR,
37  &ABL, &ABR, 0, 0, FLA_TL );
38 
39  FLA_Part_2x2( T, &TTL, &TTR,
40  &TBL, &TBR, 0, 0, FLA_TL );
41 
42  FLA_Part_2x1( p, &pT,
43  &pB, 0, FLA_TOP );
44 
45  FLA_Part_2x1( w, &wT,
46  &wB, 0, FLA_TOP );
47 
48  while ( FLA_Obj_min_dim( pB ) > 0 ) {
49 
50  FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &a01, &A02,
51  /* ************* */ /* ************************** */
52  &a10t, /**/ &alpha11, &a12t,
53  ABL, /**/ ABR, &A20, /**/ &a21, &A22,
54  1, 1, FLA_BR );
55 
56  FLA_Repart_2x2_to_3x3( TTL, /**/ TTR, &T00, /**/ &t01, &T02,
57  /* ************* */ /* ************************ */
58  &t10t, /**/ &tau11, &t12t,
59  TBL, /**/ TBR, &T20, /**/ &t21, &T22,
60  1, 1, FLA_BR );
61 
62  FLA_Repart_2x1_to_3x1( pT, &p0,
63  /* ** */ /* *** */
64  &pi1,
65  pB, &p2, 1, FLA_BOTTOM );
66 
67  FLA_Repart_2x1_to_3x1( wT, &w0,
68  /* ** */ /* *** */
69  &omega1,
70  wB, &w2, 1, FLA_BOTTOM );
71 
72  /*------------------------------------------------------------*/
73 
74 
75  // ** Ignore minus inputs for LAPACK compatability.
76  if ( FLA_Obj_lt( pi1, FLA_ZERO ) == FALSE )
77  {
78  // ** Determine pivot index
79  FLA_Amax_external( wB, pi1 );
80 
81  // ** BLIS returns -1 if it fails to search the maximum value
82  if ( FLA_Obj_lt( pi1, FLA_ZERO ) == TRUE )
83  FLA_Set( FLA_ZERO, pi1 );
84 
85  // ** Apply a pivot on column norms
86  FLA_Apply_pivots( FLA_LEFT, FLA_NO_TRANSPOSE, pi1, wB );
87 
88  // ** Apply a pivot on ABR
89  FLA_Apply_pivots( FLA_RIGHT, FLA_TRANSPOSE, pi1, ABR );
90 
91  // ** Apply a pivot on TTR
92  FLA_Apply_pivots( FLA_RIGHT, FLA_TRANSPOSE, pi1, TTR );
93  }
94  else
95  {
96  // ** Do not pivot.
97  FLA_Set( FLA_ZERO, pi1 );
98  }
99 
100  // ** Update the pivot column
101  FLA_Merge_2x1( alpha11,
102  a21, &ab1 );
103 
104  // ab1 = ab1 - ABL t01
105  FLA_Gemv_external( FLA_NO_TRANSPOSE, FLA_MINUS_ONE, ABL, t01, FLA_ONE, ab1 );
106 
107  // ** Find the householder reflector on that column
108  FLA_Househ2_UT( FLA_LEFT, alpha11,
109  a21, tau11 );
110 
111  // ** Update the pivot row
112  FLA_Apply_H2_UT_piv_row( tau11, a12t, a10t, T02,
113  a21, A22, A20, t12t,
114  v );
115 
116  // ** Apply pivots on ATR
117  FLA_Apply_pivots( FLA_RIGHT, FLA_TRANSPOSE, pi1, ATR );
118 
119  // ** Norm downdate w2 = w2 - columnwisenorm2(a12t)
121 
122  // ** Update T matrix
123  // t01 = a10t' + A20' * u21;
124  FLA_Copyt_external( FLA_CONJ_TRANSPOSE, a10t, t01 );
125  FLA_Gemv_external( FLA_CONJ_TRANSPOSE, FLA_ONE, A20, a21, FLA_ONE, t01 );
126 
127  /*------------------------------------------------------------*/
128 
129  FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, a01, /**/ A02,
130  a10t, alpha11, /**/ a12t,
131  /* ************** */ /* ************************ */
132  &ABL, /**/ &ABR, A20, a21, /**/ A22,
133  FLA_TL );
134 
135  FLA_Cont_with_3x3_to_2x2( &TTL, /**/ &TTR, T00, t01, /**/ T02,
136  t10t, tau11, /**/ t12t,
137  /* ************** */ /* ********************** */
138  &TBL, /**/ &TBR, T20, t21, /**/ T22,
139  FLA_TL );
140 
141  FLA_Cont_with_3x1_to_2x1( &pT, p0,
142  pi1,
143  /* ** */ /* *** */
144  &pB, p2, FLA_TOP );
145 
146  FLA_Cont_with_3x1_to_2x1( &wT, w0,
147  omega1,
148  /* ** */ /* *** */
149  &wB, w2, FLA_TOP );
150  }
151 
152  // Free the workspace
153  FLA_Obj_free( &v);
154 
155  return FLA_SUCCESS;
156 }
FLA_Error FLA_Obj_create(FLA_Datatype datatype, dim_t m, dim_t n, dim_t rs, dim_t cs, FLA_Obj *obj)
Definition: FLA_Obj.c:55
FLA_Error FLA_Repart_2x1_to_3x1(FLA_Obj AT, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj AB, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition: FLA_View.c:226
FLA_Error FLA_Househ2_UT(FLA_Side side, FLA_Obj chi_1, FLA_Obj x2, FLA_Obj tau)
Definition: FLA_Househ2_UT.c:16
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition: FLA_Obj.c:588
FLA_Error FLA_Gemv_external(FLA_Trans transa, FLA_Obj alpha, FLA_Obj A, FLA_Obj x, FLA_Obj beta, FLA_Obj y)
Definition: FLA_Gemv_external.c:13
FLA_Obj FLA_MINUS_ONE
Definition: FLA_Init.c:22
FLA_Error FLA_QR_UT_piv_colnorm(FLA_Obj alpha, FLA_Obj A, FLA_Obj b)
Definition: FLA_QR_UT_piv_colnorm.c:13
FLA_Error FLA_Repart_2x2_to_3x3(FLA_Obj ATL, FLA_Obj ATR, FLA_Obj *A00, FLA_Obj *A01, FLA_Obj *A02, FLA_Obj *A10, FLA_Obj *A11, FLA_Obj *A12, FLA_Obj ABL, FLA_Obj ABR, FLA_Obj *A20, FLA_Obj *A21, FLA_Obj *A22, dim_t mb, dim_t nb, FLA_Quadrant quadrant)
Definition: FLA_View.c:142
FLA_Error FLA_Apply_H2_UT_piv_row(FLA_Obj tau, FLA_Obj a1t, FLA_Obj u1t, FLA_Obj W, FLA_Obj u2, FLA_Obj A2, FLA_Obj U2, FLA_Obj w1t, FLA_Obj vt)
Definition: FLA_Apply_H2_UT_piv_row.c:14
FLA_Error FLA_Cont_with_3x1_to_2x1(FLA_Obj *AT, FLA_Obj A0, FLA_Obj A1, FLA_Obj *AB, FLA_Obj A2, FLA_Side side)
Definition: FLA_View.c:428
FLA_Error FLA_Copyt_external(FLA_Trans trans, FLA_Obj A, FLA_Obj B)
Definition: FLA_Copyt_external.c:13
FLA_Error FLA_Part_2x2(FLA_Obj A, FLA_Obj *A11, FLA_Obj *A12, FLA_Obj *A21, FLA_Obj *A22, dim_t mb, dim_t nb, FLA_Quadrant quadrant)
Definition: FLA_View.c:17
FLA_Obj FLA_ONE
Definition: FLA_Init.c:18
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
FLA_Bool FLA_Obj_lt(FLA_Obj A, FLA_Obj B)
Definition: FLA_Query.c:813
Definition: FLA_type_defs.h:158
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
FLA_Error FLA_Set(FLA_Obj alpha, FLA_Obj A)
Definition: FLA_Set.c:13
FLA_Error FLA_Part_2x1(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition: FLA_View.c:76
FLA_Error FLA_Cont_with_3x3_to_2x2(FLA_Obj *ATL, FLA_Obj *ATR, FLA_Obj A00, FLA_Obj A01, FLA_Obj A02, FLA_Obj A10, FLA_Obj A11, FLA_Obj A12, FLA_Obj *ABL, FLA_Obj *ABR, FLA_Obj A20, FLA_Obj A21, FLA_Obj A22, FLA_Quadrant quadrant)
Definition: FLA_View.c:304
FLA_Error FLA_Apply_pivots(FLA_Side side, FLA_Trans trans, FLA_Obj p, FLA_Obj A)
Definition: FLA_Apply_pivots.c:15
FLA_Error FLA_Amax_external(FLA_Obj x, FLA_Obj index)
Definition: FLA_Amax_external.c:13
FLA_Obj FLA_ZERO
Definition: FLA_Init.c:20
double *restrict omega1
Definition: bl1_axpyv2bdotaxpy.c:200
FLA_Error FLA_Merge_2x1(FLA_Obj AT, FLA_Obj AB, FLA_Obj *A)
Definition: FLA_View.c:541
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition: FLA_Query.c:153