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_Syrk_lt_unb_var1(FLA_Obj alpha,FLA_Obj A,FLA_Obj beta,FLA_Obj C)15 FLA_Error FLA_Syrk_lt_unb_var1( FLA_Obj alpha, FLA_Obj A, FLA_Obj beta, FLA_Obj C )
16 {
17   FLA_Obj AL,    AR,       A0,  a1,  A2;
18 
19   FLA_Obj CTL,   CTR,      C00,  c01,     C02,
20           CBL,   CBR,      c10t, gamma11, c12t,
21                            C20,  c21,     C22;
22 
23   FLA_Scalr_external( FLA_LOWER_TRIANGULAR, beta, C );
24 
25   FLA_Part_1x2( A,    &AL,  &AR,      0, FLA_LEFT );
26 
27   FLA_Part_2x2( C,    &CTL, &CTR,
28                       &CBL, &CBR,     0, 0, FLA_TL );
29 
30   while ( FLA_Obj_width( AL ) < FLA_Obj_width( A ) ){
31 
32     FLA_Repart_1x2_to_1x3( AL,  /**/ AR,        &A0, /**/ &a1, &A2,
33                            1, FLA_RIGHT );
34 
35     FLA_Repart_2x2_to_3x3( CTL, /**/ CTR,       &C00,  /**/ &c01,     &C02,
36                         /* ************* */   /* ************************** */
37                                                 &c10t, /**/ &gamma11, &c12t,
38                            CBL, /**/ CBR,       &C20,  /**/ &c21,     &C22,
39                            1, 1, FLA_BR );
40 
41     /*------------------------------------------------------------*/
42 
43     /* c10t    = c10t    + A0' * a1 */
44     FLA_Gemv_external( FLA_TRANSPOSE, alpha, A0, a1, FLA_ONE, c10t );
45 
46     /* gamma11 = gamma11 + a1' * a1 */
47     FLA_Dots_external( alpha, a1, a1, FLA_ONE, gamma11 );
48 
49     /*------------------------------------------------------------*/
50 
51     FLA_Cont_with_1x3_to_1x2( &AL,  /**/ &AR,        A0, a1, /**/ A2,
52                               FLA_LEFT );
53 
54     FLA_Cont_with_3x3_to_2x2( &CTL, /**/ &CTR,       C00,  c01,     /**/ C02,
55                                                      c10t, gamma11, /**/ c12t,
56                             /* ************** */  /* ************************ */
57                               &CBL, /**/ &CBR,       C20,  c21,     /**/ C22,
58                               FLA_TL );
59 
60   }
61 
62   return FLA_SUCCESS;
63 }
64 
65 #endif
66