|
libflame revision_anchor
|
Go to the source code of this file.
Functions | |
| FLA_Error | FLA_QR_UT (FLA_Obj A, FLA_Obj T) |
| FLA_Error | FLA_QR_UT_internal (FLA_Obj A, FLA_Obj T, fla_qrut_t *cntl) |
| FLA_Error | FLA_QR_UT_copy_internal (FLA_Obj A, FLA_Obj T, FLA_Obj U, fla_qrut_t *cntl) |
| FLA_Error | FLA_QR_UT_create_T (FLA_Obj A, FLA_Obj *T) |
| FLA_Error | FLA_QR_UT_recover_tau (FLA_Obj T, FLA_Obj tau) |
| FLA_Error | FLA_QR_UT_solve (FLA_Obj A, FLA_Obj T, FLA_Obj B, FLA_Obj X) |
| FLA_Error | FLASH_QR_UT (FLA_Obj A, FLA_Obj TW) |
| FLA_Error | FLASH_QR_UT_create_hier_matrices (FLA_Obj A_flat, dim_t depth, dim_t *b_flash, FLA_Obj *A, FLA_Obj *TW) |
| FLA_Error | FLASH_QR_UT_solve (FLA_Obj A, FLA_Obj T, FLA_Obj B, FLA_Obj X) |
References FLA_Check_error_level(), FLA_QR_UT_check(), and FLA_QR_UT_internal().
{
FLA_Error r_val;
// Check parameters.
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_QR_UT_check( A, T );
// Invoke FLA_QR_UT_internal() with the standard control tree.
//r_val = FLA_QR_UT_internal( A, T, fla_qrut_cntl2 );
r_val = FLA_QR_UT_internal( A, T, fla_qrut_cntl_leaf );
return r_val;
}
| FLA_Error FLA_QR_UT_copy_internal | ( | FLA_Obj | A, |
| FLA_Obj | T, | ||
| FLA_Obj | U, | ||
| fla_qrut_t * | cntl | ||
| ) |
References FLA_Check_error_level(), FLA_QR_UT_copy_internal_check(), FLA_QR_UT_copy_task(), and FLASH_Queue_get_enabled().
Referenced by FLA_QR_UT_inc_blk_var2().
{
FLA_Error r_val = FLA_SUCCESS;
if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
FLA_QR_UT_copy_internal_check( A, T, U, cntl );
if ( FLASH_Queue_get_enabled() )
{
// Enqueue task.
ENQUEUE_FLASH_QR_UT_copy( *FLASH_OBJ_PTR_AT( A ),
*FLASH_OBJ_PTR_AT( T ),
*FLASH_OBJ_PTR_AT( U ),
NULL );
}
else
{
// Execute task immediately.
FLA_QR_UT_copy_task( *FLASH_OBJ_PTR_AT( A ),
*FLASH_OBJ_PTR_AT( T ),
*FLASH_OBJ_PTR_AT( U ),
NULL );
}
return r_val;
}
References FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_min_dim(), FLA_Obj_row_stride(), and FLA_Query_blocksize().
{
FLA_Datatype datatype;
dim_t b_alg, k;
dim_t rs_T, cs_T;
// Query the datatype of A.
datatype = FLA_Obj_datatype( A );
// Query the blocksize from the library.
b_alg = FLA_Query_blocksize( datatype, FLA_DIMENSION_MIN );
// Query the minimum dimension of A.
k = FLA_Obj_min_dim( A );
// Figure out whether T should be row-major or column-major.
if ( FLA_Obj_row_stride( A ) == 1 )
{
rs_T = 1;
cs_T = b_alg;
}
else // if ( FLA_Obj_col_stride( A ) == 1 )
{
rs_T = k;
cs_T = 1;
}
// Create a b_alg x k matrix to hold the block Householder transforms that
// will be accumulated within the QR factorization algorithm.
FLA_Obj_create( datatype, b_alg, k, rs_T, cs_T, T );
return FLA_SUCCESS;
}
| FLA_Error FLA_QR_UT_internal | ( | FLA_Obj | A, |
| FLA_Obj | T, | ||
| fla_qrut_t * | cntl | ||
| ) |
References FLA_Check_error_level(), FLA_QR_UT_blk_var1(), FLA_QR_UT_blk_var2(), FLA_QR_UT_blk_var3(), FLA_QR_UT_internal_check(), FLA_QR_UT_macro_task(), FLA_QR_UT_opt_var1(), FLA_QR_UT_opt_var2(), FLA_QR_UT_unb_var1(), FLA_QR_UT_unb_var2(), and FLASH_Queue_get_enabled().
Referenced by FLA_QR_UT(), FLA_QR_UT_blk_var1(), FLA_QR_UT_blk_var2(), FLA_QR_UT_blk_var3(), FLA_QR_UT_copy_task(), FLA_QR_UT_inc_blk_var1(), FLA_QR_UT_macro_task(), FLA_QR_UT_task(), and FLASH_QR_UT().
{
FLA_Error r_val = FLA_SUCCESS;
if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
FLA_QR_UT_internal_check( A, T, cntl );
if ( FLA_Cntl_matrix_type( cntl ) == FLA_HIER &&
FLA_Cntl_variant( cntl ) == FLA_SUBPROBLEM )
{
if ( FLASH_Queue_get_enabled( ) )
{
// Enqueue
ENQUEUE_FLASH_QR_UT_macro( A, *FLASH_OBJ_PTR_AT( T ), cntl );
}
else
{
// Execute
r_val = FLA_QR_UT_macro_task( A, *FLASH_OBJ_PTR_AT( T ), cntl );
}
}
else
{
if ( FLA_Cntl_variant( cntl ) == FLA_UNBLOCKED_VARIANT1 )
{
r_val = FLA_QR_UT_unb_var1( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_UNB_OPT_VARIANT1 )
{
r_val = FLA_QR_UT_opt_var1( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT1 )
{
r_val = FLA_QR_UT_blk_var1( A, T, cntl );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_UNBLOCKED_VARIANT2 )
{
r_val = FLA_QR_UT_unb_var2( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_UNB_OPT_VARIANT2 )
{
r_val = FLA_QR_UT_opt_var2( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT2 )
{
r_val = FLA_QR_UT_blk_var2( A, T, cntl );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT3 )
{
r_val = FLA_QR_UT_blk_var3( A, T, cntl );
}
else
{
FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
}
}
return r_val;
}
References FLA_Check_error_level(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Obj_length(), FLA_Obj_width(), FLA_Part_1x2(), FLA_Part_2x1(), FLA_QR_UT_recover_tau_check(), FLA_QR_UT_recover_tau_submatrix(), FLA_Repart_1x2_to_1x3(), and FLA_Repart_2x1_to_3x1().
{
FLA_Obj TL, TR, T0, T1, T2;
FLA_Obj tT, t0,
tB, t1,
t2;
dim_t b_alg, b;
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_QR_UT_recover_tau_check( T, t );
b_alg = FLA_Obj_length( T );
FLA_Part_1x2( T, &TL, &TR, 0, FLA_LEFT );
FLA_Part_2x1( t, &tT,
&tB, 0, FLA_TOP );
while ( FLA_Obj_width( TL ) < FLA_Obj_width( T ) ){
b = min( FLA_Obj_width( TR ), b_alg );
FLA_Repart_1x2_to_1x3( TL, /**/ TR, &T0, /**/ &T1, &T2,
b, FLA_RIGHT );
FLA_Repart_2x1_to_3x1( tT, &t0,
/* ** */ /* ** */
&t1,
tB, &t2, b, FLA_BOTTOM );
/*------------------------------------------------------------*/
FLA_QR_UT_recover_tau_submatrix( T1, t1 );
/*------------------------------------------------------------*/
FLA_Cont_with_1x3_to_1x2( &TL, /**/ &TR, T0, T1, /**/ T2,
FLA_LEFT );
FLA_Cont_with_3x1_to_2x1( &tT, t0,
t1,
/* ** */ /* ** */
&tB, t2, FLA_TOP );
}
return FLA_SUCCESS;
}
References FLA_Apply_Q_UT(), FLA_Apply_Q_UT_create_workspace(), FLA_Check_error_level(), FLA_Copy_external(), FLA_Obj_create_copy_of(), FLA_Obj_free(), FLA_Obj_width(), FLA_ONE, FLA_Part_2x1(), FLA_QR_UT_solve_check(), and FLA_Trsm_external().
{
FLA_Obj W, Y;
FLA_Obj AT, AB;
FLA_Obj YT, YB;
// Check parameters.
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_QR_UT_solve_check( A, T, B, X );
FLA_Apply_Q_UT_create_workspace( T, B, &W );
FLA_Obj_create_copy_of( FLA_NO_TRANSPOSE, B, &Y );
FLA_Apply_Q_UT( FLA_LEFT, FLA_CONJ_TRANSPOSE, FLA_FORWARD, FLA_COLUMNWISE,
A, T, W, Y );
FLA_Part_2x1( A, &AT,
&AB, FLA_Obj_width( A ), FLA_TOP );
FLA_Part_2x1( Y, &YT,
&YB, FLA_Obj_width( A ), FLA_TOP );
FLA_Trsm_external( FLA_LEFT, FLA_UPPER_TRIANGULAR, FLA_NO_TRANSPOSE,
FLA_NONUNIT_DIAG, FLA_ONE, AT, YT );
FLA_Copy_external( YT, X );
FLA_Obj_free( &Y );
FLA_Obj_free( &W );
return FLA_SUCCESS;
}
References FLA_Abort(), FLA_Check_error_level(), FLA_Print_message(), FLA_QR_UT_check(), FLA_QR_UT_internal(), FLASH_Obj_depth(), FLASH_Obj_scalar_length_tl(), FLASH_Obj_scalar_min_dim(), FLASH_Obj_scalar_width_tl(), FLASH_Queue_begin(), and FLASH_Queue_end().
{
FLA_Error r_val;
dim_t b_alg, b_flash;
// Check parameters.
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_QR_UT_check( A, TW );
// *** The current hierarchical QR_UT algorithm assumes that the matrix
// has a hierarchical depth of 1. We check for that here, because we
// anticipate that we'll use a more general algorithm in the future, and
// we don't want to forget to remove the constraint. ***
if ( FLASH_Obj_depth( A ) != 1 )
{
FLA_Print_message( "FLASH_QR_UT() currently only supports matrices of depth 1",
__FILE__, __LINE__ );
FLA_Abort();
}
// Inspect the length of TTL to get the blocksize used by the QR
// factorization, which will be our inner blocksize for Apply_Q_UT.
b_alg = FLASH_Obj_scalar_length_tl( TW );
b_flash = FLASH_Obj_scalar_width_tl( TW );
// The traditional (non-incremental) QR_UT algorithm-by-blocks requires
// that the algorithmic blocksize be equal to the storage blocksize.
if ( b_alg != b_flash )
{
FLA_Print_message( "FLASH_QR_UT() requires that b_alg == b_store",
__FILE__, __LINE__ );
FLA_Abort();
}
// The traditional (non-incremental) QR_UT algorithm-by-blocks requires
// that min_dim(A) % b_flash == 0.
if ( FLASH_Obj_scalar_min_dim( A ) % b_flash != 0 )
{
FLA_Print_message( "FLASH_QR_UT() requires that min_dim( A ) %% b_store == 0",
__FILE__, __LINE__ );
FLA_Abort();
}
// Begin a parallel region.
FLASH_Queue_begin();
// Invoke FLA_QR_UT_internal() with hierarchical control tree.
r_val = FLA_QR_UT_internal( A, TW, flash_qrut_cntl );
// End the parallel region.
FLASH_Queue_end();
return r_val;
}
| FLA_Error FLASH_QR_UT_create_hier_matrices | ( | FLA_Obj | A_flat, |
| dim_t | depth, | ||
| dim_t * | b_flash, | ||
| FLA_Obj * | A, | ||
| FLA_Obj * | TW | ||
| ) |
References FLA_Abort(), FLA_Obj_datatype(), FLA_Obj_min_dim(), FLA_Print_message(), FLASH_Obj_create_ext(), and FLASH_Obj_create_hier_copy_of_flat().
{
FLA_Datatype datatype;
dim_t m, n;
dim_t min_m_n;
// *** The current QR_UT algorithm implemented assumes that
// the matrix has a hierarchical depth of 1. We check for that here
// because we anticipate that we'll use a more general algorithm in the
// future, and we don't want to forget to remove the constraint. ***
if ( depth != 1 )
{
FLA_Print_message( "FLASH_QR_UT() currently only supports matrices of depth 1",
__FILE__, __LINE__ );
FLA_Abort();
}
// Create hierarchical copy of matrix A_flat.
FLASH_Obj_create_hier_copy_of_flat( A_flat, depth, b_flash, A );
// Query the datatype of matrix A_flat.
datatype = FLA_Obj_datatype( A_flat );
// Query the minimum dimension of A_flat.
min_m_n = FLA_Obj_min_dim( A_flat );
// Set the m and n dimensions of TW to be min_m_n.
m = min_m_n;
n = min_m_n;
// Create hierarchical matrices T and W.
FLASH_Obj_create_ext( datatype, m, n,
depth, b_flash, b_flash,
TW );
return FLA_SUCCESS;
}
References FLA_Check_error_level(), FLA_Obj_width(), FLA_ONE, FLA_Part_2x1(), FLA_QR_UT_solve_check(), FLASH_Apply_Q_UT(), FLASH_Apply_Q_UT_create_workspace(), FLASH_Copy(), FLASH_Obj_create_copy_of(), FLASH_Obj_free(), and FLASH_Trsm().
{
FLA_Obj W, Y;
FLA_Obj AT, AB;
FLA_Obj YT, YB;
// Check parameters.
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_QR_UT_solve_check( A, TW, B, X );
FLASH_Apply_Q_UT_create_workspace( TW, B, &W );
FLASH_Obj_create_copy_of( FLA_NO_TRANSPOSE, B, &Y );
FLASH_Apply_Q_UT( FLA_LEFT, FLA_CONJ_TRANSPOSE, FLA_FORWARD, FLA_COLUMNWISE,
A, TW, W, Y );
FLA_Part_2x1( A, &AT,
&AB, FLA_Obj_width( A ), FLA_TOP );
FLA_Part_2x1( Y, &YT,
&YB, FLA_Obj_width( A ), FLA_TOP );
FLASH_Trsm( FLA_LEFT, FLA_UPPER_TRIANGULAR, FLA_NO_TRANSPOSE, FLA_NONUNIT_DIAG,
FLA_ONE, AT, YT );
FLASH_Copy( YT, X );
FLASH_Obj_free( &Y );
FLASH_Obj_free( &W );
return FLA_SUCCESS;
}
1.7.4