libflame  revision_anchor
Functions
FLA_QR_UT_piv_unb_var1.c File Reference

(r)

Functions

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

Function Documentation

◆ FLA_QR_UT_piv_unb_var1()

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

References FLA_Amax_external(), FLA_Apply_H2_UT(), 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_1x2(), FLA_MINUS_ONE, FLA_Obj_le(), FLA_Obj_min_dim(), FLA_Obj_width(), FLA_ONE, FLA_Part_1x2(), 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().

15 {
16  FLA_Obj AL, AR;
17 
18  FLA_Obj ATL, ATR, A00, a01, A02,
19  ABL, ABR, a10t, alpha11, a12t,
20  A20, a21, A22;
21 
22  FLA_Obj AT, A0,
23  AB, a1t,
24  A2;
25  FLA_Obj AB1, AT1, at1;
26 
27  FLA_Obj TTL, TTR, T00, t01, T02,
28  TBL, TBR, t10t, tau11, t12t,
29  T20, t21, T22;
30 
31  FLA_Obj pT, p0,
32  pB, pi1,
33  p2;
34 
35  FLA_Obj wT, w0,
36  wB, omega1,
37  w2;
38 
39  dim_t nb = FLA_Obj_width ( A ) - FLA_Obj_width( T );
40  //dim_t mb = FLA_Obj_length( A ) - FLA_Obj_width( T );
41 
42  FLA_Part_1x2( A, &AL, &AR, nb, FLA_RIGHT );
43 
44  FLA_Part_2x2( AL, &ATL, &ATR,
45  &ABL, &ABR, 0, 0, FLA_TL );
46 
47  FLA_Part_2x1( AR, &AT,
48  &AB, 0, FLA_TOP );
49 
50  FLA_Part_2x2( T, &TTL, &TTR,
51  &TBL, &TBR, 0, 0, FLA_TL );
52 
53  FLA_Part_2x1( p, &pT,
54  &pB, 0, FLA_TOP );
55 
56  FLA_Part_2x1( w, &wT,
57  &wB, 0, FLA_TOP );
58 
59  while ( FLA_Obj_min_dim( ABR ) > 0 ){
60 
61  FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &a01, &A02,
62  /* ************* */ /* ************************** */
63  &a10t, /**/ &alpha11, &a12t,
64  ABL, /**/ ABR, &A20, /**/ &a21, &A22,
65  1, 1, FLA_BR );
66 
67  FLA_Repart_2x1_to_3x1( AT, &A0,
68  /* ** */ /* *** */
69  &a1t,
70  AB, &A2, 1, FLA_BOTTOM );
71 
72  FLA_Repart_2x2_to_3x3( TTL, /**/ TTR, &T00, /**/ &t01, &T02,
73  /* ************* */ /* ************************ */
74  &t10t, /**/ &tau11, &t12t,
75  TBL, /**/ TBR, &T20, /**/ &t21, &T22,
76  1, 1, FLA_BR );
77 
78  FLA_Repart_2x1_to_3x1( pT, &p0,
79  /* ** */ /* *** */
80  &pi1,
81  pB, &p2, 1, FLA_BOTTOM );
82 
83  FLA_Repart_2x1_to_3x1( wT, &w0,
84  /* ** */ /* *** */
85  &omega1,
86  wB, &w2, 1, FLA_BOTTOM );
87 
88  /*------------------------------------------------------------*/
89 
90 
91  // Ignore minus inputs for LAPACK compatability.
92  if ( FLA_Obj_le( pi1, FLA_ZERO ) == FALSE )
93  {
94  // Determine pivot index
95  FLA_Amax_external( wB, pi1 );
96  FLA_Apply_pivots( FLA_LEFT, FLA_NO_TRANSPOSE, pi1, wB );
97 
98  // Apply pivots
99  FLA_Merge_1x2( ABR, AB, &AB1 );
100  FLA_Apply_pivots( FLA_RIGHT, FLA_TRANSPOSE, pi1, AB1 );
101  }
102  else
103  {
104  // Do not pivot.
105  FLA_Set( FLA_ZERO, pi1 );
106  }
107 
108  // Compute tau11 and u21 from alpha11 and a21 such that tau11 and u21
109  // determine a Householder transform H such that applying H from the
110  // left to the column vector consisting of alpha11 and a21 annihilates
111  // the entries in a21 (and updates alpha11).
112  FLA_Househ2_UT( FLA_LEFT,
113  alpha11,
114  a21, tau11 );
115 
116  // Apply H to (a12t A22)^T
117  // / a12t \ = H / a12t \
118  // \ A22 / \ A22 /
119  //
120  // where H is formed from tau11 and u21.
121  FLA_Merge_1x2( A22, A2, &AB1 );
122  FLA_Merge_1x2( a12t, a1t, &at1 );
123 
124  FLA_Apply_H2_UT( FLA_LEFT, tau11, a21, at1,
125  AB1 );
126 
127  // t01 = a10t' + A20' * u21;
128  FLA_Copyt_external( FLA_CONJ_TRANSPOSE, a10t, t01 );
129  FLA_Gemv_external( FLA_CONJ_TRANSPOSE, FLA_ONE, A20, a21, FLA_ONE, t01 );
130 
131  // Apply pivots to previous rows
132  if ( FLA_Obj_le( pi1, FLA_ZERO ) == FALSE )
133  {
134  FLA_Merge_1x2( ATR, AT, &AT1 );
135  FLA_Apply_pivots( FLA_RIGHT, FLA_TRANSPOSE, pi1, AT1 );
136  }
137 
138  // Norm downdate w2 = alpha w2 + beta columnwisenorm2(a12t)
140 
141  /*------------------------------------------------------------*/
142 
143  FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, a01, /**/ A02,
144  a10t, alpha11, /**/ a12t,
145  /* ************** */ /* ************************ */
146  &ABL, /**/ &ABR, A20, a21, /**/ A22,
147  FLA_TL );
148 
149  FLA_Cont_with_3x1_to_2x1( &AT, A0,
150  a1t,
151  /* ** */ /* *** */
152  &AB, A2, FLA_TOP );
153 
154  FLA_Cont_with_3x3_to_2x2( &TTL, /**/ &TTR, T00, t01, /**/ T02,
155  t10t, tau11, /**/ t12t,
156  /* ************** */ /* ********************** */
157  &TBL, /**/ &TBR, T20, t21, /**/ T22,
158  FLA_TL );
159 
160  FLA_Cont_with_3x1_to_2x1( &pT, p0,
161  pi1,
162  /* ** */ /* *** */
163  &pB, p2, FLA_TOP );
164 
165  FLA_Cont_with_3x1_to_2x1( &wT, w0,
166  omega1,
167  /* ** */ /* *** */
168  &wB, w2, FLA_TOP );
169  }
170 
171  return FLA_SUCCESS;
172 }
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
unsigned long dim_t
Definition: FLA_type_defs.h:71
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_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_Apply_H2_UT(FLA_Side side, FLA_Obj tau, FLA_Obj u2, FLA_Obj a1, FLA_Obj A2)
Definition: FLA_Apply_H2_UT.c:13
FLA_Error FLA_Copyt_external(FLA_Trans trans, FLA_Obj A, FLA_Obj B)
Definition: FLA_Copyt_external.c:13
FLA_Error FLA_Merge_1x2(FLA_Obj AL, FLA_Obj AR, FLA_Obj *A)
Definition: FLA_View.c:562
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
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_Bool FLA_Obj_le(FLA_Obj A, FLA_Obj B)
Definition: FLA_Query.c:890
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_Part_1x2(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition: FLA_View.c:110
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
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition: FLA_Query.c:153