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 #ifdef FLA_ENABLE_NON_CRITICAL_CODE
14 
FLA_Trsv_uc_blk_var1(FLA_Diag diagA,FLA_Obj A,FLA_Obj x,fla_trsv_t * cntl)15 FLA_Error FLA_Trsv_uc_blk_var1( FLA_Diag diagA, FLA_Obj A, FLA_Obj x, fla_trsv_t* cntl )
16 {
17   FLA_Obj ATL,   ATR,      A00, A01, A02,
18           ABL,   ABR,      A10, A11, A12,
19                            A20, A21, A22;
20 
21   FLA_Obj xT,              x0,
22           xB,              x1,
23                            x2;
24 
25   dim_t b;
26 
27   FLA_Part_2x2( A,    &ATL, &ATR,
28                       &ABL, &ABR,     0, 0, FLA_TL );
29 
30   FLA_Part_2x1( x,    &xT,
31                       &xB,            0, FLA_TOP );
32 
33   while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){
34 
35     b = FLA_Determine_blocksize( ABR, FLA_BR, FLA_Cntl_blocksize( cntl ) );
36 
37     FLA_Repart_2x2_to_3x3( ATL, /**/ ATR,       &A00, /**/ &A01, &A02,
38                         /* ************* */   /* ******************** */
39                                                 &A10, /**/ &A11, &A12,
40                            ABL, /**/ ABR,       &A20, /**/ &A21, &A22,
41                            b, b, FLA_BR );
42 
43     FLA_Repart_2x1_to_3x1( xT,                &x0,
44                         /* ** */            /* ** */
45                                               &x1,
46                            xB,                &x2,        b, FLA_BOTTOM );
47 
48     /*------------------------------------------------------------*/
49 
50     /* x1 = x1 - A01' * x0 */
51     FLA_Gemv_internal( FLA_CONJ_TRANSPOSE,
52                        FLA_MINUS_ONE, A01, x0, FLA_ONE, x1,
53                        FLA_Cntl_sub_gemv( cntl ) );
54 
55     /* x1 = triu( A11' ) \ x1 */
56     FLA_Trsv_internal( FLA_UPPER_TRIANGULAR, FLA_CONJ_TRANSPOSE, diagA,
57                        A11, x1,
58                        FLA_Cntl_sub_trsv( cntl ) );
59 
60     /*------------------------------------------------------------*/
61 
62     FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR,       A00, A01, /**/ A02,
63                                                      A10, A11, /**/ A12,
64                             /* ************** */  /* ****************** */
65                               &ABL, /**/ &ABR,       A20, A21, /**/ A22,
66                               FLA_TL );
67 
68     FLA_Cont_with_3x1_to_2x1( &xT,                x0,
69                                                   x1,
70                             /* ** */           /* ** */
71                               &xB,                x2,     FLA_TOP );
72 
73   }
74 
75   return FLA_SUCCESS;
76 }
77 
78 #endif
79