libflame  revision_anchor
Functions
FLA_QR_UT_piv_blk_var2.c File Reference

(r)

Functions

FLA_Error FLA_QR_UT_piv_blk_var2 (FLA_Obj A, FLA_Obj T, FLA_Obj w, FLA_Obj p, fla_qrut_t *cntl)
 

Function Documentation

◆ FLA_QR_UT_piv_blk_var2()

FLA_Error FLA_QR_UT_piv_blk_var2 ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  w,
FLA_Obj  p,
fla_qrut_t cntl 
)

References FLA_Apply_pivots(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Cont_with_3x3_to_2x2(), FLA_Gemm_external(), 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_QR_UT_piv_internal(), FLA_Repart_1x2_to_1x3(), FLA_Repart_2x1_to_3x1(), FLA_Repart_2x2_to_3x3(), and w1.

Referenced by FLA_QR_UT_piv_internal().

14 {
15  FLA_Obj ATL, ATR, A00, A01, A02,
16  ABL, ABR, A10, A11, A12,
17  A20, A21, A22;
18 
19  FLA_Obj TL, TR, T0, T1, W12;
20  FLA_Obj TT, TB;
21 
22  FLA_Obj pT, p0,
23  pB, p1,
24  p2;
25 
26  FLA_Obj wT, w0,
27  wB, w1,
28  w2;
29 
30  dim_t b_alg, b;
31 
32  // Query the algorithmic blocksize by inspecting the length of T.
33  b_alg = FLA_Obj_length( T );
34 
35  FLA_Part_2x2( A, &ATL, &ATR,
36  &ABL, &ABR, 0, 0, FLA_TL );
37 
38  FLA_Part_1x2( T, &TL, &TR, 0, FLA_LEFT );
39 
40  FLA_Part_2x1( p, &pT,
41  &pB, 0, FLA_TOP );
42 
43  FLA_Part_2x1( w, &wT,
44  &wB, 0, FLA_TOP );
45 
46  while ( FLA_Obj_min_dim( ABR ) > 0 ){
47 
48  b = min( b_alg, FLA_Obj_min_dim( ABR ) );
49 
50  FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &A01, &A02,
51  /* ************* */ /* ******************** */
52  &A10, /**/ &A11, &A12,
53  ABL, /**/ ABR, &A20, /**/ &A21, &A22,
54  b, b, FLA_BR );
55 
56  FLA_Repart_1x2_to_1x3( TL, /**/ TR, &T0, /**/ &T1, &W12,
57  b, FLA_RIGHT );
58 
59  FLA_Repart_2x1_to_3x1( pT, &p0,
60  /* ** */ /* ** */
61  &p1,
62  pB, &p2, b, FLA_BOTTOM );
63 
64  FLA_Repart_2x1_to_3x1( wT, &w0,
65  /* ** */ /* ** */
66  &w1,
67  wB, &w2, b, FLA_BOTTOM );
68 
69  /*------------------------------------------------------------*/
70 
71  // ** Reshape T matrices to match the blocksize b
72  FLA_Part_2x1( TR, &TT,
73  &TB, b, FLA_TOP );
74 
75  // ** Perform a unblocked (BLAS2-oriented) QR factorization
76  // with pivoting via the UT transform on ABR:
77  //
78  // ABR -> QB1 R11
79  //
80  // where:
81  // - QB1 is formed from UB1 (which is stored column-wise below the
82  // diagonal of ( A11 A21 )^T and the upper-triangle of T1.
83  // - R11 is stored to ( A11 A12 ).
84  // - W12 stores T and partial updates for FLA_Apply_Q_UT_piv_var.
85  FLA_QR_UT_piv_internal( ABR, TT, wB, p1,
86  FLA_Cntl_sub_qrut( cntl ) );
87 
88  if ( FLA_Obj_width( A12 ) > 0 )
89  {
90  // ** Block update
91  FLA_Part_2x1( W12, &TT,
92  &TB, b, FLA_TOP );
93 
94  FLA_Gemm_external( FLA_NO_TRANSPOSE, FLA_NO_TRANSPOSE,
95  FLA_MINUS_ONE, A21, TT, FLA_ONE, A22 );
96  }
97 
98  // ** Apply pivots to previous columns.
99  FLA_Apply_pivots( FLA_RIGHT, FLA_TRANSPOSE, p1, ATR );
100 
101  /*------------------------------------------------------------*/
102 
103  FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, A01, /**/ A02,
104  A10, A11, /**/ A12,
105  /* ************** */ /* ****************** */
106  &ABL, /**/ &ABR, A20, A21, /**/ A22,
107  FLA_TL );
108 
109  FLA_Cont_with_1x3_to_1x2( &TL, /**/ &TR, T0, T1, /**/ W12,
110  FLA_LEFT );
111 
112  FLA_Cont_with_3x1_to_2x1( &pT, p0,
113  p1,
114  /* ** */ /* ** */
115  &pB, p2, FLA_TOP );
116 
117  FLA_Cont_with_3x1_to_2x1( &wT, w0,
118  w1,
119  /* ** */ /* ** */
120  &wB, w2, FLA_TOP );
121  }
122 
123  return FLA_SUCCESS;
124 }
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_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
unsigned long dim_t
Definition: FLA_type_defs.h:71
FLA_Obj FLA_MINUS_ONE
Definition: FLA_Init.c:22
double *restrict w1
Definition: bl1_dotsv3.c:172
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_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_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
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_QR_UT_piv_internal(FLA_Obj A, FLA_Obj T, FLA_Obj w, FLA_Obj p, fla_qrut_t *cntl)
Definition: FLA_QR_UT_piv_internal.c:13
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
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116
FLA_Error FLA_Gemm_external(FLA_Trans transa, FLA_Trans transb, FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C)
Definition: FLA_Gemm_external.c:13
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition: FLA_Query.c:153