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_rut_unb_var2(FLA_Diag diagA,FLA_Obj alpha,FLA_Obj A,FLA_Obj B)15 FLA_Error FLA_Trsm_rut_unb_var2( 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 BL,    BR,       B0,  b1,  B2;
22 
23   FLA_Scal_external( alpha, B );
24 
25   FLA_Part_2x2( A,    &ATL, &ATR,
26                       &ABL, &ABR,     0, 0, FLA_BR );
27 
28   FLA_Part_1x2( B,    &BL,  &BR,      0, FLA_RIGHT );
29 
30   while ( FLA_Obj_length( ABR ) < FLA_Obj_length( A ) ){
31 
32     FLA_Repart_2x2_to_3x3( ATL, /**/ ATR,       &A00,  &a01,     /**/ &A02,
33                                                 &a10t, &alpha11, /**/ &a12t,
34                         /* ************* */   /* ************************** */
35                            ABL, /**/ ABR,       &A20,  &a21,     /**/ &A22,
36                            1, 1, FLA_TL );
37 
38     FLA_Repart_1x2_to_1x3( BL,  /**/ BR,        &B0, &b1, /**/ &B2,
39                            1, FLA_LEFT );
40 
41     /*------------------------------------------------------------*/
42 
43     /* b1 = b1 / alpha11; */
44     if ( diagA != FLA_UNIT_DIAG )
45       FLA_Inv_scal_external( alpha11, b1 );
46 
47     /* B0 = B0 - b1 * a01'; */
48     FLA_Ger_external( FLA_MINUS_ONE, b1, a01, B0 );
49 
50     /*------------------------------------------------------------*/
51 
52     FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR,       A00,  /**/ a01,     A02,
53                             /* ************** */  /* ************************ */
54                                                      a10t, /**/ alpha11, a12t,
55                               &ABL, /**/ &ABR,       A20,  /**/ a21,     A22,
56                               FLA_BR );
57 
58     FLA_Cont_with_1x3_to_1x2( &BL,  /**/ &BR,        B0, /**/ b1, B2,
59                               FLA_RIGHT );
60 
61   }
62 
63   return FLA_SUCCESS;
64 }
65 
66 #endif
67