libflame revision_anchor
Functions
FLA_Apply_Q_UT_rhfr.h File Reference

(r)

Go to the source code of this file.

Functions

FLA_Error FLA_Apply_Q_UT_rhfr_blk_var1 (FLA_Obj A, FLA_Obj T, FLA_Obj W, FLA_Obj B, fla_apqut_t *cntl)
 
FLA_Error FLA_Apply_Q_UT_rhfr_blk_var2 (FLA_Obj A, FLA_Obj T, FLA_Obj W, FLA_Obj B, fla_apqut_t *cntl)
 
FLA_Error FLA_Apply_Q_UT_rhfr_blk_var3 (FLA_Obj A, FLA_Obj T, FLA_Obj W, FLA_Obj B, fla_apqut_t *cntl)
 

Function Documentation

◆ FLA_Apply_Q_UT_rhfr_blk_var1()

FLA_Error FLA_Apply_Q_UT_rhfr_blk_var1 ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  W,
FLA_Obj  B,
fla_apqut_t cntl 
)
87{
88 FLA_Obj ATL, ATR, A00, A01, A02,
89 ABL, ABR, A10, A11, A12,
90 A20, A21, A22;
91
92 FLA_Obj TL, TR, T0, T1, T2;
93
95 T2B;
96
98 WBL, WBR;
99
100 FLA_Obj BL, BR, B0, B1, B2;
101
102 dim_t b_alg, b;
103 dim_t m_BR, n_BR;
104
105 // Query the algorithmic blocksize by inspecting the length of T.
107
108 // If m < n, then we have to initialize our partitionings carefully so
109 // that we begin in the proper location in A and B (since we traverse
110 // matrix A from BR to TL).
111 if ( FLA_Obj_length( A ) < FLA_Obj_width( A ) )
112 {
113 m_BR = 0;
115 }
116 else if ( FLA_Obj_length( A ) > FLA_Obj_width( A ) )
117 {
119 n_BR = 0;
120 }
121 else
122 {
123 m_BR = 0;
124 n_BR = 0;
125 }
126
127 FLA_Part_2x2( A, &ATL, &ATR,
128 &ABL, &ABR, m_BR, n_BR, FLA_BR );
129
130 // A and T are dependent; we determine T matrix w.r.t. A
132
133 // Be carefule that A contains reflector in row-wise;
134 // corresponding B should be partitioned with n_BR.
135 FLA_Part_1x2( B, &BL, &BR, n_BR, FLA_RIGHT );
136
137 while ( FLA_Obj_min_dim( ATL ) > 0 ){
138
139 b = min( b_alg, FLA_Obj_min_dim( ATL ) );
140
141 // Since T was filled from left to right, and since we need to access them
142 // in reverse order, we need to handle the case where the last block is
143 // smaller than the other b x b blocks.
144 if ( FLA_Obj_width( TR ) == 0 && FLA_Obj_width( T ) % b_alg > 0 )
145 b = FLA_Obj_width( T ) % b_alg;
146
147 FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, &A01, /**/ &A02,
148 &A10, &A11, /**/ &A12,
149 /* ************* */ /* ******************** */
150 ABL, /**/ ABR, &A20, &A21, /**/ &A22,
151 b, b, FLA_TL );
152
153 FLA_Repart_1x2_to_1x3( TL, /**/ TR, &T0, &T1, /**/ &T2,
154 b, FLA_LEFT );
155
156 FLA_Repart_1x2_to_1x3( BL, /**/ BR, &B0, &B1, /**/ &B2,
157 b, FLA_LEFT );
158
159 /*------------------------------------------------------------*/
160
161 FLA_Part_2x1( T1, &T1T,
162 &T2B, b, FLA_TOP );
163
164 FLA_Part_2x2( W, &WTL, &WTR,
165 &WBL, &WBR, b, FLA_Obj_length( B1 ), FLA_TL );
166
167 // WTL = B1^T;
168
170 FLA_Cntl_sub_copyt( cntl ) );
171
172 // U11 = triuu( A11 );
173 // U12 = A12;
174 // Let WTL^T be conformal to B1.
175 //
176 // WTL^T = ( B1 * U11^T + B2 * U12^T ) * inv( triu(T1T)' );
177 // WTL = inv( conj(triu(T1T)) ) * ( U11 * B1^T + U12 * B2^T );
178
181 FLA_ONE, A11, WTL,
182 FLA_Cntl_sub_trmm1( cntl ) );
183
186 FLA_Cntl_sub_gemm1( cntl ) );
187
190 FLA_ONE, T1T, WTL,
191 FLA_Cntl_sub_trsm( cntl ) );
192
193 // B2 = B2 - WTL^T * conj(U12);
194 // B1 = B1 - WTL^T * conj(U11);
195 // = B1 - ( U11' * WTL )^T;
196
199 FLA_Cntl_sub_gemm2( cntl ) );
200
204 FLA_Cntl_sub_trmm2( cntl ) );
205
207 FLA_Cntl_sub_axpyt( cntl ) );
208
209 /*------------------------------------------------------------*/
210
211 FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, /**/ A01, A02,
212 /* ************** */ /* ****************** */
213 A10, /**/ A11, A12,
214 &ABL, /**/ &ABR, A20, /**/ A21, A22,
215 FLA_BR );
216
217 FLA_Cont_with_1x3_to_1x2( &TL, /**/ &TR, T0, /**/ T1, T2,
218 FLA_RIGHT );
219
220 FLA_Cont_with_1x3_to_1x2( &BL, /**/ &BR, B0, /**/ B1, B2,
221 FLA_RIGHT );
222 }
223
224 return FLA_SUCCESS;
225}
FLA_Error FLA_Axpyt_internal(FLA_Trans trans, FLA_Obj alpha, FLA_Obj A, FLA_Obj B, fla_axpyt_t *cntl)
Definition FLA_Axpyt_internal.c:16
FLA_Error FLA_Copyt_internal(FLA_Trans trans, FLA_Obj A, FLA_Obj B, fla_copyt_t *cntl)
Definition FLA_Copyt_internal.c:16
FLA_Error FLA_Gemm_internal(FLA_Trans transa, FLA_Trans transb, FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C, fla_gemm_t *cntl)
Definition FLA_Gemm_internal.c:16
FLA_Error FLA_Trmm_internal(FLA_Side side, FLA_Uplo uplo, FLA_Trans transa, FLA_Diag diag, FLA_Obj alpha, FLA_Obj A, FLA_Obj B, fla_trmm_t *cntl)
Definition FLA_Trmm_internal.c:16
FLA_Error FLA_Trsm_internal(FLA_Side side, FLA_Uplo uplo, FLA_Trans transa, FLA_Diag diag, FLA_Obj alpha, FLA_Obj A, FLA_Obj B, fla_trsm_t *cntl)
Definition FLA_Trsm_internal.c:16
FLA_Obj FLA_MINUS_ONE
Definition FLA_Init.c:22
FLA_Obj FLA_ONE
Definition FLA_Init.c:18
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_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_Error FLA_Cont_with_1x3_to_1x2(FLA_Obj *AL, FLA_Obj *AR, FLA_Obj A0, FLA_Obj A1, FLA_Obj A2, FLA_Side side)
Definition FLA_View.c:475
dim_t FLA_Obj_width(FLA_Obj obj)
Definition FLA_Query.c:123
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_Part_2x1(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition FLA_View.c:76
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
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_Repart_1x2_to_1x3(FLA_Obj AL, FLA_Obj AR, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_View.c:267
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition FLA_Query.c:153
unsigned long dim_t
Definition FLA_type_defs.h:71
int i
Definition bl1_axmyv2.c:145
Definition FLA_type_defs.h:159

References FLA_Axpyt_internal(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x3_to_2x2(), FLA_Copyt_internal(), FLA_Gemm_internal(), FLA_MINUS_ONE, FLA_Obj_length(), FLA_Obj_min_dim(), FLA_Obj_width(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x1(), FLA_Part_2x2(), FLA_Repart_1x2_to_1x3(), FLA_Repart_2x2_to_3x3(), FLA_Trmm_internal(), FLA_Trsm_internal(), and i.

Referenced by FLA_Apply_Q_UT_rhfr().

◆ FLA_Apply_Q_UT_rhfr_blk_var2()

FLA_Error FLA_Apply_Q_UT_rhfr_blk_var2 ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  W,
FLA_Obj  B,
fla_apqut_t cntl 
)
14{
15 FLA_Obj BT, B0,
16 BB, B1,
17 B2;
18
19 FLA_Obj WL, WR, W0, W1, W2;
20
21 dim_t b;
22
23 FLA_Part_2x1( B, &BT,
24 &BB, 0, FLA_TOP );
25
26 FLA_Part_1x2( W, &WL, &WR, 0, FLA_LEFT );
27
28 while ( FLA_Obj_length( BT ) < FLA_Obj_length( B ) ){
29
31
33 /* ** */ /* ** */
34 &B1,
35 BB, &B2, b, FLA_BOTTOM );
36
37 FLA_Repart_1x2_to_1x3( WL, /**/ WR, &W0, /**/ &W1, &W2,
38 b, FLA_RIGHT );
39
40 /*------------------------------------------------------------*/
41
42 // B1 = B1 * Q';
44 A, T, W1, B1,
45 FLA_Cntl_sub_apqut( cntl ) );
46
47 /*------------------------------------------------------------*/
48
50 B1,
51 /* ** */ /* ** */
52 &BB, B2, FLA_TOP );
53
54 FLA_Cont_with_1x3_to_1x2( &WL, /**/ &WR, W0, W1, /**/ W2,
55 FLA_LEFT );
56 }
57
58 return FLA_SUCCESS;
59}
FLA_Error FLA_Apply_Q_UT_internal(FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj A, FLA_Obj T, FLA_Obj W, FLA_Obj B, fla_apqut_t *cntl)
Definition FLA_Apply_Q_UT_internal.c:17
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_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
dim_t FLA_Determine_blocksize(FLA_Obj A_unproc, FLA_Quadrant to_dir, fla_blocksize_t *cntl_blocksizes)
Definition FLA_Blocksize.c:234

References FLA_Apply_Q_UT_internal(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Determine_blocksize(), FLA_Obj_length(), FLA_Part_1x2(), FLA_Part_2x1(), FLA_Repart_1x2_to_1x3(), FLA_Repart_2x1_to_3x1(), and i.

Referenced by FLA_Apply_Q_UT_rhfr().

◆ FLA_Apply_Q_UT_rhfr_blk_var3()

FLA_Error FLA_Apply_Q_UT_rhfr_blk_var3 ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  W,
FLA_Obj  B,
fla_apqut_t cntl 
)
14{
15 FLA_Obj ATL, ATR, A00, A01, A02,
16 ABL, ABR, A10, A11, A12,
17 A20, A21, A22;
18
20 TWBL, TWBR, TW10, T11, W12,
21 TW20, TW21, TW22;
22
24 WBL, WBR;
25
26 FLA_Obj BL, BR, B0, B1, B2;
27
28 dim_t b, m_BR, n_BR;
29
30 // If m < n, then we have to initialize our partitionings carefully so
31 // that we begin in the proper location in A and B (since we traverse
32 // matrix A from BR to TL).
33 if ( FLA_Obj_length( A ) < FLA_Obj_width( A ) )
34 {
35 m_BR = 0;
37 }
38 else
39 {
40 m_BR = 0;
41 n_BR = 0;
42 }
43
44 FLA_Part_2x2( A, &ATL, &ATR,
45 &ABL, &ABR, m_BR, n_BR, FLA_BR );
46
48 &TWBL, &TWBR, 0, 0, FLA_BR );
49
51
52 while ( FLA_Obj_min_dim( ATL ) > 0 ){
53
55
56 // Since T was filled from TL to BR, and since we need to access them in
57 // reverse order, we need to handle the case where the bottom-right-most
58 // block is smaller than the other b x b blocks.
59 if ( FLA_Obj_width( TWBR ) == 0 &&
60 FLA_Obj_width( TW ) % b > 0 )
61 b = FLA_Obj_width( TW ) % b;
62
63 FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, &A01, /**/ &A02,
64 &A10, &A11, /**/ &A12,
65 /* ************* */ /* ******************** */
66 ABL, /**/ ABR, &A20, &A21, /**/ &A22,
67 b, b, FLA_TL );
68
69 FLA_Repart_2x2_to_3x3( TWTL, /**/ TWTR, &TW00, &TW01, /**/ &TW02,
70 &TW10, &T11, /**/ &W12,
71 /* *************** */ /* *********************** */
72 TWBL, /**/ TWBR, &TW20, &TW21, /**/ &TW22,
73 b, b, FLA_TL );
74
75 FLA_Repart_1x2_to_1x3( BL, /**/ BR, &B0, &B1, /**/ &B2,
76 b, FLA_LEFT );
77
78 /*------------------------------------------------------------*/
79
80 FLA_Part_2x2( W, &WTL, &WTR,
81 &WBL, &WBR, b, FLA_Obj_length( B1 ), FLA_TL );
82
83 // WTL = B1;
84
86 FLA_Cntl_sub_copyt( cntl ) );
87
88 // U11 = trilu( A11 );
89 // U12 = A12;
90 // Let WTL^T be conformal to B1.
91 //
92 // WTL^T = ( B1 * U11^T + B2 * U12^T ) * inv( triu(T1T)' );
93 // WTL = inv( conj(triu(T1T)) ) * ( U11 * B1^T + U12 * B2^T );
94
97 FLA_ONE, A11, WTL,
98 FLA_Cntl_sub_trmm1( cntl ) );
99
102 FLA_Cntl_sub_gemm1( cntl ) );
103
106 FLA_ONE, T11, WTL,
107 FLA_Cntl_sub_trsm( cntl ) );
108
109 // B2 = B2 - WTL^T * conj(U12);
110 // B1 = B1 - WTL^T * conj(U11);
111 // = B1 - ( U11' * WTL )^T;
112
115 FLA_Cntl_sub_gemm2( cntl ) );
116
120 FLA_Cntl_sub_trmm2( cntl ) );
121
123 FLA_Cntl_sub_axpyt( cntl ) );
124
125 /*------------------------------------------------------------*/
126
127 FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, /**/ A01, A02,
128 /* ************** */ /* ****************** */
129 A10, /**/ A11, A12,
130 &ABL, /**/ &ABR, A20, /**/ A21, A22,
131 FLA_BR );
132
134 /* **************** */ /* ********************* */
135 TW10, /**/ T11, W12,
136 &TWBL, /**/ &TWBR, TW20, /**/ TW21, TW22,
137 FLA_BR );
138
139 FLA_Cont_with_1x3_to_1x2( &BL, /**/ &BR, B0, /**/ B1, B2,
140 FLA_RIGHT );
141 }
142
143 return FLA_SUCCESS;
144}

References FLA_Axpyt_internal(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x3_to_2x2(), FLA_Copyt_internal(), FLA_Determine_blocksize(), FLA_Gemm_internal(), FLA_MINUS_ONE, FLA_Obj_length(), FLA_Obj_min_dim(), FLA_Obj_width(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x2(), FLA_Repart_1x2_to_1x3(), FLA_Repart_2x2_to_3x3(), FLA_Trmm_internal(), FLA_Trsm_internal(), and i.

Referenced by FLA_Apply_Q_UT_rhfr().