libflame  revision_anchor
Functions
FLA_Bidiag_UT_u_blf_var4.c File Reference

(r)

Functions

FLA_Error FLA_Bidiag_UT_u_blf_var4 (FLA_Obj A, FLA_Obj TU, FLA_Obj TV)
 

Function Documentation

◆ FLA_Bidiag_UT_u_blf_var4()

FLA_Error FLA_Bidiag_UT_u_blf_var4 ( FLA_Obj  A,
FLA_Obj  TU,
FLA_Obj  TV 
)

References FLA_Bidiag_UT_u_step_ofu_var4(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Cont_with_3x3_to_2x2(), FLA_Copy(), FLA_Copyt(), FLA_Gemm_external(), FLA_MINUS_ONE, FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_free(), 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_2x1_to_3x1(), FLA_Repart_2x2_to_3x3(), FLA_Set(), FLA_Triangularize(), and FLA_ZERO.

Referenced by FLA_Bidiag_UT_u().

14 {
15  FLA_Obj ATL, ATR, A00, A01, A02,
16  ABL, ABR, A10, A11, A12,
17  A20, A21, A22;
18  FLA_Obj UT, U0,
19  UB, U1,
20  U2;
21  FLA_Obj VT, V0,
22  VB, V1,
23  V2;
24  FLA_Obj YT, Y0,
25  YB, Y1,
26  Y2;
27  FLA_Obj ZT, Z0,
28  ZB, Z1,
29  Z2;
30  FLA_Obj TUL, TUR, TU0, TU1, TU2;
31  FLA_Obj TVL, TVR, TV0, TV1, TV2;
32 
33  FLA_Obj U, V, Y, Z;
34  FLA_Obj ABR_l, ABR_t;
35  FLA_Obj UB_l, U2_l;
36  FLA_Obj VB_l, V2_l;
37  FLA_Obj YB_l, Y2_l;
38  FLA_Obj ZB_l, Z2_l;
39  FLA_Obj TU1_tl;
40  FLA_Obj TV1_tl;
41  FLA_Obj none, none2, none3;
42  FLA_Obj VB_tl,
43  VB_bl;
44  FLA_Datatype datatype_A;
45  dim_t m_A, n_A;
46  dim_t b_alg, b;
47 
48  b_alg = FLA_Obj_length( TU );
49 
50  datatype_A = FLA_Obj_datatype( A );
51  m_A = FLA_Obj_length( A );
52  n_A = FLA_Obj_width( A );
53 
54  FLA_Obj_create( datatype_A, m_A, b_alg, 0, 0, &U );
55  FLA_Obj_create( datatype_A, n_A, b_alg, 0, 0, &V );
56  FLA_Obj_create( datatype_A, n_A, b_alg, 0, 0, &Y );
57  FLA_Obj_create( datatype_A, m_A, b_alg, 0, 0, &Z );
58 
59  FLA_Part_2x2( A, &ATL, &ATR,
60  &ABL, &ABR, 0, 0, FLA_TL );
61  FLA_Part_2x1( U, &UT,
62  &UB, 0, FLA_TOP );
63  FLA_Part_2x1( V, &VT,
64  &VB, 0, FLA_TOP );
65  FLA_Part_2x1( Y, &YT,
66  &YB, 0, FLA_TOP );
67  FLA_Part_2x1( Z, &ZT,
68  &ZB, 0, FLA_TOP );
69  FLA_Part_1x2( TU, &TUL, &TUR, 0, FLA_LEFT );
70  FLA_Part_1x2( TV, &TVL, &TVR, 0, FLA_LEFT );
71 
72  while ( FLA_Obj_min_dim( ABR ) > 0 )
73  {
74  b = min( FLA_Obj_min_dim( ABR ), b_alg );
75 
76  FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &A01, &A02,
77  /* ************* */ /* ******************** */
78  &A10, /**/ &A11, &A12,
79  ABL, /**/ ABR, &A20, /**/ &A21, &A22,
80  b, b, FLA_BR );
81  FLA_Repart_2x1_to_3x1( UT, &U0,
82  /* ** */ /* ** */
83  &U1,
84  UB, &U2, b, FLA_BOTTOM );
85  FLA_Repart_2x1_to_3x1( VT, &V0,
86  /* ** */ /* ** */
87  &V1,
88  VB, &V2, b, FLA_BOTTOM );
89  FLA_Repart_2x1_to_3x1( YT, &Y0,
90  /* ** */ /* ** */
91  &Y1,
92  YB, &Y2, b, FLA_BOTTOM );
93  FLA_Repart_2x1_to_3x1( ZT, &Z0,
94  /* ** */ /* ** */
95  &Z1,
96  ZB, &Z2, b, FLA_BOTTOM );
97  FLA_Repart_1x2_to_1x3( TUL, /**/ TUR, &TU0, /**/ &TU1, &TU2,
98  b, FLA_RIGHT );
99  FLA_Repart_1x2_to_1x3( TVL, /**/ TVR, &TV0, /**/ &TV1, &TV2,
100  b, FLA_RIGHT );
101 
102  /*------------------------------------------------------------*/
103 
104  FLA_Part_2x2( TU1, &TU1_tl, &none,
105  &none2, &none3, b, b, FLA_TL );
106 
107  FLA_Part_2x2( TV1, &TV1_tl, &none,
108  &none2, &none3, b, b, FLA_TL );
109 
110  FLA_Part_1x2( ABR, &ABR_l, &none, b, FLA_LEFT );
111  FLA_Part_2x1( ABR, &ABR_t,
112  &none, b, FLA_TOP );
113 
114  FLA_Part_1x2( UB, &UB_l, &none, b, FLA_LEFT );
115  FLA_Part_1x2( VB, &VB_l, &none, b, FLA_LEFT );
116  FLA_Part_1x2( YB, &YB_l, &none, b, FLA_LEFT );
117  FLA_Part_1x2( ZB, &ZB_l, &none, b, FLA_LEFT );
118 
119  FLA_Part_2x1( UB_l, &none,
120  &U2_l, b, FLA_TOP );
121  FLA_Part_2x1( VB_l, &none,
122  &V2_l, b, FLA_TOP );
123  FLA_Part_2x1( YB_l, &none,
124  &Y2_l, b, FLA_TOP );
125  FLA_Part_2x1( ZB_l, &none,
126  &Z2_l, b, FLA_TOP );
127 
128  // [ ABR, YB, ZB, TU1, TV1 ] = FLA_Bidiag_UT_u_step_unb_var4( ABR, TU1, TV1, b );
129  //FLA_Bidiag_UT_u_step_unb_var4( ABR, YB, ZB, TU1_tl, TV1_tl );
130  FLA_Bidiag_UT_u_step_ofu_var4( ABR, YB, ZB, TU1_tl, TV1_tl );
131  //FLA_Bidiag_UT_u_step_opt_var4( ABR, YB, ZB, TU1_tl, TV1_tl );
132 
133  if ( FLA_Obj_length( A22 ) > 0 )
134  {
135  // Build UB from ABR, with explicit unit subdiagonal and zeros.
136  FLA_Copy( ABR_l, UB_l );
137  FLA_Triangularize( FLA_LOWER_TRIANGULAR, FLA_UNIT_DIAG, UB_l );
138 
139  // Build VB from ABR, with explicit unit subdiagonal and zeros.
140  FLA_Copyt( FLA_TRANSPOSE, ABR_t, VB_l );
141  FLA_Part_2x1( VB_l, &VB_tl,
142  &VB_bl, 1, FLA_TOP );
143  FLA_Triangularize( FLA_LOWER_TRIANGULAR, FLA_UNIT_DIAG, VB_bl );
144  FLA_Set( FLA_ZERO, VB_tl );
145 
146  // A22 = A22 - U2 * Y2' - Z2 * V2';
147  FLA_Gemm_external( FLA_NO_TRANSPOSE, FLA_CONJ_TRANSPOSE,
148  FLA_MINUS_ONE, U2_l, Y2_l, FLA_ONE, A22 );
149  FLA_Gemm_external( FLA_NO_TRANSPOSE, FLA_CONJ_TRANSPOSE,
150  FLA_MINUS_ONE, Z2_l, V2_l, FLA_ONE, A22 );
151  }
152 
153  /*------------------------------------------------------------*/
154 
155  FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, A01, /**/ A02,
156  A10, A11, /**/ A12,
157  /* ************** */ /* ****************** */
158  &ABL, /**/ &ABR, A20, A21, /**/ A22,
159  FLA_TL );
160  FLA_Cont_with_3x1_to_2x1( &UT, U0,
161  U1,
162  /* ** */ /* ** */
163  &UB, U2, FLA_TOP );
164  FLA_Cont_with_3x1_to_2x1( &VT, V0,
165  V1,
166  /* ** */ /* ** */
167  &VB, V2, FLA_TOP );
168  FLA_Cont_with_3x1_to_2x1( &YT, Y0,
169  Y1,
170  /* ** */ /* ** */
171  &YB, Y2, FLA_TOP );
172  FLA_Cont_with_3x1_to_2x1( &ZT, Z0,
173  Z1,
174  /* ** */ /* ** */
175  &ZB, Z2, FLA_TOP );
176  FLA_Cont_with_1x3_to_1x2( &TUL, /**/ &TUR, TU0, TU1, /**/ TU2,
177  FLA_LEFT );
178  FLA_Cont_with_1x3_to_1x2( &TVL, /**/ &TVR, TV0, TV1, /**/ TV2,
179  FLA_LEFT );
180  }
181 
182  FLA_Obj_free( &U );
183  FLA_Obj_free( &V );
184  FLA_Obj_free( &Y );
185  FLA_Obj_free( &Z );
186 
187  return FLA_SUCCESS;
188 }
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_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_Error FLA_Obj_free(FLA_Obj *obj)
Definition: FLA_Obj.c:588
FLA_Obj FLA_MINUS_ONE
Definition: FLA_Init.c:22
FLA_Error FLA_Copy(FLA_Obj A, FLA_Obj B)
Definition: FLA_Copy.c:15
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_Copyt(FLA_Trans trans, FLA_Obj A, FLA_Obj B)
Definition: FLA_Copyt.c:15
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
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
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_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_Triangularize(FLA_Uplo uplo, FLA_Diag diag, FLA_Obj A)
Definition: FLA_Triangularize.c:13
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
int FLA_Datatype
Definition: FLA_type_defs.h:49
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_Bidiag_UT_u_step_ofu_var4(FLA_Obj A, FLA_Obj Y, FLA_Obj Z, FLA_Obj T, FLA_Obj S)
Definition: FLA_Bidiag_UT_u_fus_var4.c:35
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
FLA_Obj FLA_ZERO
Definition: FLA_Init.c:20
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition: FLA_Query.c:153