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 
FLA_Gemv_n_blk_var5(FLA_Obj alpha,FLA_Obj A,FLA_Obj x,FLA_Obj beta,FLA_Obj y,fla_gemv_t * cntl)13 FLA_Error FLA_Gemv_n_blk_var5( FLA_Obj alpha, FLA_Obj A, FLA_Obj x, FLA_Obj beta, FLA_Obj y, fla_gemv_t* cntl )
14 {
15   FLA_Obj AL,    AR,       A0,  A1,  A2;
16 
17   FLA_Obj xT,              x0,
18           xB,              x1,
19                            x2;
20 
21   dim_t b;
22 
23   FLA_Scal_internal( beta, y,
24                      FLA_Cntl_sub_scal( cntl ) );
25 
26   FLA_Part_1x2( A,    &AL,  &AR,      0, FLA_LEFT );
27 
28   FLA_Part_2x1( x,    &xT,
29                       &xB,            0, FLA_TOP );
30 
31   while ( FLA_Obj_width( AL ) < FLA_Obj_width( A ) ){
32 
33     b = FLA_Determine_blocksize( AR, FLA_RIGHT, FLA_Cntl_blocksize( cntl ) );
34 
35     FLA_Repart_1x2_to_1x3( AL,  /**/ AR,        &A0, /**/ &A1, &A2,
36                            b, FLA_RIGHT );
37 
38     FLA_Repart_2x1_to_3x1( xT,                &x0,
39                         /* ** */            /* ** */
40                                               &x1,
41                            xB,                &x2,        b, FLA_BOTTOM );
42 
43     /*------------------------------------------------------------*/
44 
45     /*   y = alpha * A1 * x1 + y;   */
46     FLA_Gemv_internal( FLA_NO_TRANSPOSE,
47                        alpha, A1, x1, FLA_ONE, y,
48                        FLA_Cntl_sub_gemv( cntl ) );
49 
50     /*------------------------------------------------------------*/
51 
52     FLA_Cont_with_1x3_to_1x2( &AL,  /**/ &AR,        A0, A1, /**/ A2,
53                               FLA_LEFT );
54 
55     FLA_Cont_with_3x1_to_2x1( &xT,                x0,
56                                                   x1,
57                             /* ** */           /* ** */
58                               &xB,                x2,     FLA_TOP );
59 
60   }
61 
62   return FLA_SUCCESS;
63 }
64