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_Trsm_luh_unb_var1(FLA_Diag diagA,FLA_Obj alpha,FLA_Obj A,FLA_Obj B)15 FLA_Error FLA_Trsm_luh_unb_var1( FLA_Diag diagA, FLA_Obj alpha, FLA_Obj A, FLA_Obj B )
16 {
17   FLA_Obj ATL,   ATR,      A00,  a01,     A02,
18           ABL,   ABR,      a10t, alpha11, a12t,
19                            A20,  a21,     A22;
20 
21   FLA_Obj BT,              B0,
22           BB,              b1t,
23                            B2;
24 
25   FLA_Scal_external( alpha, B );
26 
27   FLA_Part_2x2( A,    &ATL, &ATR,
28                       &ABL, &ABR,     0, 0, FLA_TL );
29 
30   FLA_Part_2x1( B,    &BT,
31                       &BB,            0, FLA_TOP );
32 
33   while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){
34 
35     FLA_Repart_2x2_to_3x3( ATL, /**/ ATR,       &A00,  /**/ &a01,     &A02,
36                         /* ************* */   /* ************************** */
37                                                 &a10t, /**/ &alpha11, &a12t,
38                            ABL, /**/ ABR,       &A20,  /**/ &a21,     &A22,
39                            1, 1, FLA_BR );
40 
41     FLA_Repart_2x1_to_3x1( BT,                &B0,
42                         /* ** */            /* *** */
43                                               &b1t,
44                            BB,                &B2,        1, FLA_BOTTOM );
45 
46     /*------------------------------------------------------------*/
47 
48     /* b1t = b1t - a01' * B0; */
49     FLA_Gemvc_external( FLA_TRANSPOSE, FLA_CONJUGATE, FLA_MINUS_ONE, B0, a01, FLA_ONE, b1t );
50 
51     /* b1t = b1t / alpha11'; */
52     if ( diagA != FLA_UNIT_DIAG )
53       FLA_Inv_scalc_external( FLA_CONJUGATE, alpha11, b1t );
54 
55     /*------------------------------------------------------------*/
56 
57     FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR,       A00,  a01,     /**/ A02,
58                                                      a10t, alpha11, /**/ a12t,
59                             /* ************** */  /* ************************ */
60                               &ABL, /**/ &ABR,       A20,  a21,     /**/ A22,
61                               FLA_TL );
62 
63     FLA_Cont_with_3x1_to_2x1( &BT,                B0,
64                                                   b1t,
65                             /* ** */           /* *** */
66                               &BB,                B2,     FLA_TOP );
67 
68   }
69 
70   return FLA_SUCCESS;
71 }
72 
73 #endif
74