Debian Codegraph @

src/lapack/dec/q/lqut/vars/flamec/FLA_LQ_UT_blk_var1.c

raw
1 /*
2
3 Copyright (C) 2014, The University of Texas at Austin
4
5 This file is part of libflame and is available under the 3-Clause
6 BSD license, which can be found in the LICENSE file at the top-level
7 directory, or at http://opensource.org/licenses/BSD-3-Clause
8
9 */
10
11 #include "FLAME.h"
12
13 FLA_Error FLA_LQ_UT_blk_var1( FLA_Obj A, FLA_Obj T, fla_lqut_t* cntl )
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
21 FLA_Obj T1T, T2B;
22
23 FLA_Obj AR1, AR2;
24
25 dim_t b_alg, b;
26
27 // Query the algorithmic blocksize by inspecting the length of T.
28 b_alg = FLA_Obj_length( T );
29
30 FLA_Part_2x2( A, &ATL, &ATR,
31 &ABL, &ABR, 0, 0, FLA_TL );
32
33 FLA_Part_1x2( T, &TL, &TR, 0, FLA_LEFT );
34
35 while ( FLA_Obj_min_dim( ABR ) > 0 ){
36
37 b = min( b_alg, FLA_Obj_min_dim( ABR ) );
38
39 FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &A01, &A02,
40 /* ************* */ /* ******************** */
41 &A10, /**/ &A11, &A12,
42 ABL, /**/ ABR, &A20, /**/ &A21, &A22,
43 b, b, FLA_BR );
44
45 FLA_Repart_1x2_to_1x3( TL, /**/ TR, &T0, /**/ &T1, &W12,
46 b, FLA_RIGHT );
47
48 /*------------------------------------------------------------*/
49
50 FLA_Part_2x1( T1, &T1T,
51 &T2B, b, FLA_TOP );
52
53 FLA_Merge_1x2( A11, A12, &AR1 );
54
55 // Perform an LQ factorization via the UT transform on AR1:
56 //
57 // ( A11 A12 ) -> L11 QR1
58 //
59 // where:
60 // - QR1 is formed from UR1 (which is stored row-wise above the
61 // diagonal of AR1) and T11 (which is stored to the upper triangle
62 // of T11).
63 // - L11 is stored to the lower triangle of AR1.
64
65 FLA_LQ_UT_internal( AR1, T1T,
66 FLA_Cntl_sub_lqut( cntl ));
67
68
69 if ( FLA_Obj_length( A21 ) > 0 )
70 {
71 FLA_Merge_1x2( A21, A22, &AR2 );
72
73 // Apply the Householder transforms associated with UR1 and T11 to
74 // AR2:
75 //
76 // ( A21 A22 ) := ( A21 A22 ) Q1
77 //
78 // where QR1 is formed from UR1 and T11.
79
80 FLA_Apply_Q_UT_internal( FLA_RIGHT, FLA_NO_TRANSPOSE, FLA_FORWARD, FLA_ROWWISE,
81 AR1, T1T, W12, AR2,
82 FLA_Cntl_sub_apqut( cntl ) );
83 }
84
85 /*------------------------------------------------------------*/
86
87 FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, A01, /**/ A02,
88 A10, A11, /**/ A12,
89 /* ************** */ /* ****************** */
90 &ABL, /**/ &ABR, A20, A21, /**/ A22,
91 FLA_TL );
92
93 FLA_Cont_with_1x3_to_1x2( &TL, /**/ &TR, T0, T1, /**/ W12,
94 FLA_LEFT );
95 }
96
97 return FLA_SUCCESS;
98 }
99