libflame revision_anchor
FLA_Hess_UT_blk_var3.c File Reference

(r)

Functions

FLA_Error FLA_Hess_UT_blk_var3 (FLA_Obj A, FLA_Obj T)
 

Function Documentation

◆ FLA_Hess_UT_blk_var3()

FLA_Error FLA_Hess_UT_blk_var3 ( FLA_Obj A,
FLA_Obj T )
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 ZT, Z0,
22 ZB, Z1,
23 Z2;
24 FLA_Obj TL, TR, T0, T1, T2;
25
26 FLA_Obj U, Z;
27 FLA_Obj ABR_l;
28 FLA_Obj UB_l;
29 FLA_Obj WT_l;
30 FLA_Obj T1_tl;
31 FLA_Obj none, none2, none3;
32 FLA_Obj UB_tl,
33 UB_bl;
34 FLA_Datatype datatype_A;
35 dim_t m_A;
36 dim_t b_alg, b, bb;
37
38 b_alg = FLA_Obj_length( T );
39
40 datatype_A = FLA_Obj_datatype( A );
41 m_A = FLA_Obj_length( A );
42
43 FLA_Obj_create( datatype_A, m_A, b_alg, 0, 0, &U );
44 FLA_Obj_create( datatype_A, m_A, b_alg, 0, 0, &Z );
45
46 FLA_Part_2x2( A, &ATL, &ATR,
47 &ABL, &ABR, 0, 0, FLA_TL );
48 FLA_Part_2x1( U, &UT,
49 &UB, 0, FLA_TOP );
50 FLA_Part_2x1( Z, &ZT,
51 &ZB, 0, FLA_TOP );
52 FLA_Part_1x2( T, &TL, &TR, 0, FLA_LEFT );
53
54 while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) )
55 {
56 b = min( FLA_Obj_length( ABR ), b_alg );
57
58 FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &A01, &A02,
59 /* ************* */ /* ******************** */
60 &A10, /**/ &A11, &A12,
61 ABL, /**/ ABR, &A20, /**/ &A21, &A22,
62 b, b, FLA_BR );
63 FLA_Repart_2x1_to_3x1( UT, &U0,
64 /* ** */ /* ** */
65 &U1,
66 UB, &U2, b, FLA_BOTTOM );
67 FLA_Repart_2x1_to_3x1( ZT, &Z0,
68 /* ** */ /* ** */
69 &Z1,
70 ZB, &Z2, b, FLA_BOTTOM );
71 FLA_Repart_1x2_to_1x3( TL, /**/ TR, &T0, /**/ &T1, &T2,
72 b, FLA_RIGHT );
73
74 /*------------------------------------------------------------*/
75
76 FLA_Part_2x2( T1, &T1_tl, &none,
77 &none2, &none3, b, b, FLA_TL );
78
79 bb = min( FLA_Obj_length( ABR ) - 1, b_alg );
80
81 FLA_Part_1x2( ABR, &ABR_l, &none, bb, FLA_LEFT );
82 FLA_Part_1x2( UB, &UB_l, &none, bb, FLA_LEFT );
83
84 // [ ABR, T1 ] = FLA_Hess_UT_step_unb_var3( ABR, T1, b );
85 //FLA_Hess_UT_step_unb_var3( ABR, T1_tl );
86 //FLA_Hess_UT_step_ofu_var3( ABR, T1_tl );
87 FLA_Hess_UT_step_opt_var3( ABR, T1_tl );
88
89 // Build UB from ABR, with explicit unit subdiagonal and zeros.
90 FLA_Copy_external( ABR_l, UB_l );
91 FLA_Part_2x1( UB_l, &UB_tl,
92 &UB_bl, 1, FLA_TOP );
93 FLA_Triangularize( FLA_LOWER_TRIANGULAR, FLA_UNIT_DIAG, UB_bl );
94 FLA_Set( FLA_ZERO, UB_tl );
95
96 // ATR = ATR - ATR * UB * inv( triu( T1 ) ) * UB' );
97 if ( FLA_Obj_length( ATR ) > 0 )
98 {
99 // NOTE: We use ZT as temporary workspace.
100 FLA_Part_1x2( ZT, &WT_l, &none, bb, FLA_LEFT );
101 FLA_Part_2x2( T1, &T1_tl, &none,
102 &none2, &none3, bb, bb, FLA_TL );
103
104 // WT_l = ATR * UB_l * inv( triu( T1 ) ).
105 FLA_Gemm_external( FLA_NO_TRANSPOSE, FLA_NO_TRANSPOSE,
106 FLA_ONE, ATR, UB_l, FLA_ZERO, WT_l );
107 FLA_Trsm_external( FLA_RIGHT, FLA_UPPER_TRIANGULAR,
108 FLA_NO_TRANSPOSE, FLA_NONUNIT_DIAG, FLA_ONE, T1_tl, WT_l );
109
110 // ATR = ATR - WT_l * UB_l'
111 FLA_Gemm_external( FLA_NO_TRANSPOSE, FLA_CONJ_TRANSPOSE,
112 FLA_MINUS_ONE, WT_l, UB_l, FLA_ONE, ATR );
113 }
114
115 /*------------------------------------------------------------*/
116
117 FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, A01, /**/ A02,
118 A10, A11, /**/ A12,
119 /* ************** */ /* ****************** */
120 &ABL, /**/ &ABR, A20, A21, /**/ A22,
121 FLA_TL );
122 FLA_Cont_with_3x1_to_2x1( &UT, U0,
123 U1,
124 /* ** */ /* ** */
125 &UB, U2, FLA_TOP );
126 FLA_Cont_with_3x1_to_2x1( &ZT, Z0,
127 Z1,
128 /* ** */ /* ** */
129 &ZB, Z2, FLA_TOP );
130 FLA_Cont_with_1x3_to_1x2( &TL, /**/ &TR, T0, T1, /**/ T2,
131 FLA_LEFT );
132 }
133
134 FLA_Obj_free( &U );
135 FLA_Obj_free( &Z );
136
137 return FLA_SUCCESS;
138}
FLA_Error FLA_Hess_UT_step_opt_var3(FLA_Obj A, FLA_Obj T)
Definition FLA_Hess_UT_opt_var3.c:18
FLA_Error FLA_Copy_external(FLA_Obj A, FLA_Obj B)
Definition FLA_Copy_external.c:13
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_Error FLA_Trsm_external(FLA_Side side, FLA_Uplo uplo, FLA_Trans trans, FLA_Diag diag, FLA_Obj alpha, FLA_Obj A, FLA_Obj B)
Definition FLA_Trsm_external.c:13
FLA_Obj FLA_MINUS_ONE
Definition FLA_Init.c:22
FLA_Obj FLA_ZERO
Definition FLA_Init.c:20
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_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
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_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_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
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition FLA_Obj.c:588
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition FLA_Query.c:13
int FLA_Datatype
Definition FLA_type_defs.h:49
unsigned long dim_t
Definition FLA_type_defs.h:71
FLA_Error FLA_Triangularize(FLA_Uplo uplo, FLA_Diag diag, FLA_Obj A)
Definition FLA_Triangularize.c:13
FLA_Error FLA_Set(FLA_Obj alpha, FLA_Obj A)
Definition FLA_Set.c:13
Definition FLA_type_defs.h:159

References FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Cont_with_3x3_to_2x2(), FLA_Copy_external(), FLA_Gemm_external(), FLA_Hess_UT_step_opt_var3(), FLA_MINUS_ONE, FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_free(), FLA_Obj_length(), 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(), FLA_Trsm_external(), and FLA_ZERO.

Referenced by FLA_Hess_UT_internal().