FLA_Error FLA_Gemv_t_blk_var6( FLA_Obj alpha, FLA_Obj A, FLA_Obj x, FLA_Obj beta, FLA_Obj y, fla_gemv_t* cntl ) { FLA_Obj AT, A0, AB, A1, A2; FLA_Obj xT, x0, xB, x1, x2; dim_t b; FLA_Scal_internal( beta, y, FLA_Cntl_sub_scal( cntl ) ); FLA_Part_2x1( A, &AT, &AB, 0, FLA_BOTTOM ); FLA_Part_2x1( x, &xT, &xB, 0, FLA_BOTTOM ); while ( FLA_Obj_length( AB ) < FLA_Obj_length( A ) ){ b = FLA_Determine_blocksize( AT, FLA_TOP, FLA_Cntl_blocksize( cntl ) ); FLA_Repart_2x1_to_3x1( AT, &A0, &A1, /* ** */ /* ** */ AB, &A2, b, FLA_TOP ); FLA_Repart_2x1_to_3x1( xT, &x0, &x1, /* ** */ /* ** */ xB, &x2, b, FLA_TOP ); /*------------------------------------------------------------*/ /* y = alpha * A1' * x1 + y */ FLA_Gemv_internal( FLA_TRANSPOSE, alpha, A1, x1, FLA_ONE, y, FLA_Cntl_sub_gemv( cntl ) ); /*------------------------------------------------------------*/ FLA_Cont_with_3x1_to_2x1( &AT, A0, /* ** */ /* ** */ A1, &AB, A2, FLA_BOTTOM ); FLA_Cont_with_3x1_to_2x1( &xT, x0, /* ** */ /* ** */ x1, &xB, x2, FLA_BOTTOM ); } return FLA_SUCCESS; }
FLA_Error FLA_Gemv_n_blk_var1( FLA_Obj alpha, FLA_Obj A, FLA_Obj x, FLA_Obj beta, FLA_Obj y, fla_gemv_t* cntl ) { FLA_Obj AT, A0, AB, A1, A2; FLA_Obj yT, y0, yB, y1, y2; dim_t b; FLA_Part_2x1( A, &AT, &AB, 0, FLA_TOP ); FLA_Part_2x1( y, &yT, &yB, 0, FLA_TOP ); while ( FLA_Obj_length( AT ) < FLA_Obj_length( A ) ){ b = FLA_Determine_blocksize( AB, FLA_BOTTOM, FLA_Cntl_blocksize( cntl ) ); FLA_Repart_2x1_to_3x1( AT, &A0, /* ** */ /* ** */ &A1, AB, &A2, b, FLA_BOTTOM ); FLA_Repart_2x1_to_3x1( yT, &y0, /* ** */ /* ** */ &y1, yB, &y2, b, FLA_BOTTOM ); /*------------------------------------------------------------*/ /* y1 = alpha * A1 * x + y1; */ FLA_Gemv_internal( FLA_NO_TRANSPOSE, alpha, A1, x, beta, y1, FLA_Cntl_sub_gemv( cntl ) ); /*------------------------------------------------------------*/ FLA_Cont_with_3x1_to_2x1( &AT, A0, A1, /* ** */ /* ** */ &AB, A2, FLA_TOP ); FLA_Cont_with_3x1_to_2x1( &yT, y0, y1, /* ** */ /* ** */ &yB, y2, FLA_TOP ); } return FLA_SUCCESS; }
FLA_Error FLA_Gemv_t_blk_var2( FLA_Obj alpha, FLA_Obj A, FLA_Obj x, FLA_Obj beta, FLA_Obj y, fla_gemv_t* cntl ) { FLA_Obj AL, AR, A0, A1, A2; FLA_Obj yT, y0, yB, y1, y2; dim_t b; FLA_Part_1x2( A, &AL, &AR, 0, FLA_RIGHT ); FLA_Part_2x1( y, &yT, &yB, 0, FLA_BOTTOM ); while ( FLA_Obj_width( AR ) < FLA_Obj_width( A ) ){ b = FLA_Determine_blocksize( AL, FLA_LEFT, FLA_Cntl_blocksize( cntl ) ); FLA_Repart_1x2_to_1x3( AL, /**/ AR, &A0, &A1, /**/ &A2, b, FLA_LEFT ); FLA_Repart_2x1_to_3x1( yT, &y0, &y1, /* ** */ /* ** */ yB, &y2, b, FLA_TOP ); /*------------------------------------------------------------*/ /* y1 = alpha * A1' * x + y1 */ FLA_Gemv_internal( FLA_TRANSPOSE, alpha, A1, x, beta, y1, FLA_Cntl_sub_gemv( cntl ) ); /*------------------------------------------------------------*/ FLA_Cont_with_1x3_to_1x2( &AL, /**/ &AR, A0, /**/ A1, A2, FLA_RIGHT ); FLA_Cont_with_3x1_to_2x1( &yT, y0, /* ** */ /* ** */ y1, &yB, y2, FLA_BOTTOM ); } return FLA_SUCCESS; }
FLA_Error FLA_Gemv( FLA_Trans transa, FLA_Obj alpha, FLA_Obj A, FLA_Obj x, FLA_Obj beta, FLA_Obj y ) { FLA_Error r_val; // Check parameters. if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING ) FLA_Gemv_check( transa, alpha, A, x, beta, y ); #ifdef FLA_ENABLE_BLAS2_FRONT_END_CNTL_TREES // Invoke FLA_Gemv_internal() with flat control tree that simply calls // external wrapper. r_val = FLA_Gemv_internal( transa, alpha, A, x, beta, y, fla_gemv_cntl_blas ); #else r_val = FLA_Gemv_external( transa, alpha, A, x, beta, y ); #endif return r_val; }
FLA_Error FLASH_Gemv( FLA_Trans transa, FLA_Obj alpha, FLA_Obj A, FLA_Obj x, FLA_Obj beta, FLA_Obj y ) { FLA_Error r_val; FLA_Bool enable_supermatrix; // Check parameters. if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING ) FLA_Gemv_check( transa, alpha, A, x, beta, y ); // Find the status of SuperMatrix. enable_supermatrix = FLASH_Queue_get_enabled(); // Temporarily disable SuperMatrix. FLASH_Queue_disable(); // Execute tasks. r_val = FLA_Gemv_internal( transa, alpha, A, x, beta, y, flash_gemv_cntl_fm_rp ); // Restore SuperMatrix to its previous status. if ( enable_supermatrix ) FLASH_Queue_enable(); return r_val; }
FLA_Error FLA_Trsv_lc_blk_var1( FLA_Diag diagA, FLA_Obj A, FLA_Obj x, fla_trsv_t* cntl ) { FLA_Obj ATL, ATR, A00, A01, A02, ABL, ABR, A10, A11, A12, A20, A21, A22; FLA_Obj xT, x0, xB, x1, x2; dim_t b; FLA_Part_2x2( A, &ATL, &ATR, &ABL, &ABR, 0, 0, FLA_BR ); FLA_Part_2x1( x, &xT, &xB, 0, FLA_BOTTOM ); while ( FLA_Obj_length( ABR ) < FLA_Obj_length( A ) ){ b = FLA_Determine_blocksize( ATL, FLA_TL, FLA_Cntl_blocksize( cntl ) ); FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, &A01, /**/ &A02, &A10, &A11, /**/ &A12, /* ************* */ /* ******************** */ ABL, /**/ ABR, &A20, &A21, /**/ &A22, b, b, FLA_TL ); FLA_Repart_2x1_to_3x1( xT, &x0, &x1, /* ** */ /* ** */ xB, &x2, b, FLA_TOP ); /*------------------------------------------------------------*/ /* x1 = x1 - A21' * x2; */ FLA_Gemv_internal( FLA_CONJ_TRANSPOSE, FLA_MINUS_ONE, A21, x2, FLA_ONE, x1, FLA_Cntl_sub_gemv( cntl ) ); /* x1 = tril( A11' ) \ x1; */ FLA_Trsv_internal( FLA_LOWER_TRIANGULAR, FLA_CONJ_TRANSPOSE, diagA, A11, x1, FLA_Cntl_sub_trsv( cntl ) ); /*------------------------------------------------------------*/ FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, /**/ A01, A02, /* ************** */ /* ****************** */ A10, /**/ A11, A12, &ABL, /**/ &ABR, A20, /**/ A21, A22, FLA_BR ); FLA_Cont_with_3x1_to_2x1( &xT, x0, /* ** */ /* ** */ x1, &xB, x2, FLA_BOTTOM ); } return FLA_SUCCESS; }