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_ruc_blk_var1(FLA_Diag diagA,FLA_Obj alpha,FLA_Obj A,FLA_Obj B,fla_trsm_t * cntl)15 FLA_Error FLA_Trsm_ruc_blk_var1( FLA_Diag diagA, FLA_Obj alpha, FLA_Obj A, FLA_Obj B, fla_trsm_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 BL,    BR,       B0,  B1,  B2;
22 
23   dim_t b;
24 
25   FLA_Scal_internal( alpha, B,
26                      FLA_Cntl_sub_scal( cntl ) );
27 
28   FLA_Part_2x2( A,    &ATL, &ATR,
29                       &ABL, &ABR,     0, 0, FLA_TL );
30 
31   FLA_Part_1x2( B,    &BL,  &BR,      0, FLA_LEFT );
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_1x2_to_1x3( BL,  /**/ BR,        &B0, /**/ &B1, &B2,
44                            b, FLA_RIGHT );
45 
46     /*------------------------------------------------------------*/
47 
48     /* B1 = B1 - B0 * A01; */
49     FLA_Gemm_internal( FLA_NO_TRANSPOSE, FLA_CONJ_NO_TRANSPOSE,
50                        FLA_MINUS_ONE, B0, A01, FLA_ONE, B1,
51                        FLA_Cntl_sub_gemm( cntl ) );
52 
53     /* B1 = B1 / triu( A11 ); */
54     FLA_Trsm_internal( FLA_RIGHT, FLA_UPPER_TRIANGULAR, FLA_CONJ_NO_TRANSPOSE, diagA,
55                        FLA_ONE, A11, B1,
56                        FLA_Cntl_sub_trsm( cntl ) );
57 
58     /*------------------------------------------------------------*/
59 
60     FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR,       A00, A01, /**/ A02,
61                                                      A10, A11, /**/ A12,
62                             /* ************** */  /* ****************** */
63                               &ABL, /**/ &ABR,       A20, A21, /**/ A22,
64                               FLA_TL );
65 
66     FLA_Cont_with_1x3_to_1x2( &BL,  /**/ &BR,        B0, B1, /**/ B2,
67                               FLA_LEFT );
68 
69   }
70 
71   return FLA_SUCCESS;
72 }
73 
74 #endif
75