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_Hemm_rl_unb_var2(FLA_Obj alpha,FLA_Obj A,FLA_Obj B,FLA_Obj beta,FLA_Obj C)15 FLA_Error FLA_Hemm_rl_unb_var2( FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C )
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,  b1t,  B2;
22 
23   FLA_Obj CL,    CR,       C0,  c1t,  C2;
24 
25   FLA_Scal_external( beta, C );
26 
27   FLA_Part_2x2( A,    &ATL, &ATR,
28                       &ABL, &ABR,     0, 0, FLA_TL );
29 
30   FLA_Part_1x2( B,    &BL,  &BR,      0, FLA_LEFT );
31 
32   FLA_Part_1x2( C,    &CL,  &CR,      0, FLA_LEFT );
33 
34   while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){
35 
36     FLA_Repart_2x2_to_3x3( ATL, /**/ ATR,       &A00,  /**/ &a01,     &A02,
37                         /* ************* */   /* ************************** */
38                                                 &a10t, /**/ &alpha11, &a12t,
39                            ABL, /**/ ABR,       &A20,  /**/ &a21,     &A22,
40                            1, 1, FLA_BR );
41 
42     FLA_Repart_1x2_to_1x3( BL,  /**/ BR,        &B0, /**/ &b1t, &B2,
43                            1, FLA_RIGHT );
44 
45     FLA_Repart_1x2_to_1x3( CL,  /**/ CR,        &C0, /**/ &c1t, &C2,
46                            1, FLA_RIGHT );
47 
48     /*------------------------------------------------------------*/
49 
50     /* c1t = c1t + B0 * a10t' */
51     FLA_Gemvc_external( FLA_NO_TRANSPOSE, FLA_CONJUGATE, alpha, B0, a10t, FLA_ONE, c1t );
52 
53     /* c1t = c1t + b1t * alpha11 */
54     FLA_Axpys_external( alpha, alpha11, b1t, FLA_ONE, c1t );
55 
56     /* c1t = c1t + B2 * a21 */
57     FLA_Gemv_external( FLA_NO_TRANSPOSE, alpha, B2, a21, FLA_ONE, c1t );
58 
59     /*------------------------------------------------------------*/
60 
61     FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR,       A00,  a01,     /**/ A02,
62                                                      a10t, alpha11, /**/ a12t,
63                             /* ************** */  /* ************************ */
64                               &ABL, /**/ &ABR,       A20,  a21,     /**/ A22,
65                               FLA_TL );
66 
67     FLA_Cont_with_1x3_to_1x2( &BL,  /**/ &BR,        B0, b1t, /**/ B2,
68                               FLA_LEFT );
69 
70     FLA_Cont_with_1x3_to_1x2( &CL,  /**/ &CR,        C0, c1t, /**/ C2,
71                               FLA_LEFT );
72 
73   }
74 
75   return FLA_SUCCESS;
76 }
77 
78 #endif
79