|
libflame
revision_anchor
|
Go to the source code of this file.
Functions | |
| FLA_Error | FLA_LQ_UT (FLA_Obj A, FLA_Obj T) |
| FLA_Error | FLA_LQ_UT_internal (FLA_Obj A, FLA_Obj T, fla_lqut_t *cntl) |
| FLA_Error | FLA_LQ_UT_create_T (FLA_Obj A, FLA_Obj *T) |
| FLA_Error | FLA_LQ_UT_recover_tau (FLA_Obj T, FLA_Obj tau) |
| FLA_Error | FLA_LQ_UT_solve (FLA_Obj A, FLA_Obj T, FLA_Obj B, FLA_Obj X) |
| FLA_Error | FLASH_LQ_UT (FLA_Obj A, FLA_Obj TW) |
| FLA_Error | FLASH_LQ_UT_create_hier_matrices (FLA_Obj A_flat, dim_t depth, dim_t *b_flash, FLA_Obj *A, FLA_Obj *TW) |
| FLA_Error | FLASH_LQ_UT_solve (FLA_Obj A, FLA_Obj T, FLA_Obj B, FLA_Obj X) |
| FLA_Error | FLA_LQ_UT_form_Q (FLA_Obj A, FLA_Obj T, FLA_Obj Q) |
References FLA_Check_error_level(), FLA_LQ_UT_check(), and FLA_LQ_UT_internal().
{
FLA_Error r_val;
// Check parameters.
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_LQ_UT_check( A, T );
// Invoke FLA_LQ_UT_internal() with the standard control tree.
//r_val = FLA_LQ_UT_blk_var1( A, T, fla_lqut_cntl_leaf );
r_val = FLA_LQ_UT_internal( A, T, fla_lqut_cntl_leaf );
return r_val;
}
| FLA_Error FLA_LQ_UT_create_T | ( | FLA_Obj | A, |
| FLA_Obj * | T | ||
| ) |
References FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_length(), 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 );
// Scale the blocksize by a pre-set global constant.
b_alg = ( dim_t )( ( ( double ) b_alg ) * FLA_LQ_INNER_TO_OUTER_B_RATIO );
// Adjust the blocksize with respect to the min-dim of A.
b_alg = min(b_alg, FLA_Obj_min_dim( A ));
// Query the length of A.
k = FLA_Obj_length( 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 LQ factorization algorithm.
FLA_Obj_create( datatype, b_alg, k, rs_T, cs_T, T );
return FLA_SUCCESS;
}
| FLA_Error FLA_LQ_UT_form_Q | ( | FLA_Obj | A, |
| FLA_Obj | T, | ||
| FLA_Obj | Q | ||
| ) |
References FLA_Conjugate(), FLA_Obj_flip_base(), FLA_Obj_flip_view(), FLA_Obj_is(), FLA_Obj_is_complex(), and FLA_QR_UT_form_Q().
Referenced by FLA_Bidiag_UT_form_V_ext().
{
FLA_Error r_val = FLA_SUCCESS;
// Flip a base once.
FLA_Obj_flip_base( &A );
if ( FLA_Obj_is( A, Q ) == FALSE )
FLA_Obj_flip_base( &Q );
// Dimensions of the both matrices should be flipped.
FLA_Obj_flip_view( &A );
FLA_Obj_flip_view( &Q );
// Run the QR utility function.
r_val = FLA_QR_UT_form_Q( A, T, Q );
// Apply conjugation on Q as we use QR_UT_form_Q.
if ( FLA_Obj_is_complex( Q ) )
FLA_Conjugate( Q );
// Recover the base object.
if ( FLA_Obj_is( A, Q ) == FALSE )
FLA_Obj_flip_base( &Q );
FLA_Obj_flip_base( &A );
return r_val;
}
| FLA_Error FLA_LQ_UT_internal | ( | FLA_Obj | A, |
| FLA_Obj | T, | ||
| fla_lqut_t * | cntl | ||
| ) |
References FLA_Check_error_level(), FLA_LQ_UT_blk_var1(), FLA_LQ_UT_blk_var2(), FLA_LQ_UT_blk_var3(), FLA_LQ_UT_internal_check(), FLA_LQ_UT_macro_task(), FLA_LQ_UT_opt_var1(), FLA_LQ_UT_opt_var2(), FLA_LQ_UT_unb_var1(), FLA_LQ_UT_unb_var2(), and FLASH_Queue_get_enabled().
Referenced by FLA_LQ_UT(), FLA_LQ_UT_blk_var1(), FLA_LQ_UT_blk_var2(), FLA_LQ_UT_blk_var3(), FLA_LQ_UT_macro_task(), FLA_LQ_UT_task(), and FLASH_LQ_UT().
{
FLA_Error r_val = FLA_SUCCESS;
if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
FLA_LQ_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_LQ_UT_macro( A, T, cntl );
}
else
{
// Execute
r_val = FLA_LQ_UT_macro_task( A, T, cntl );
}
}
else
{
if ( FLA_Cntl_variant( cntl ) == FLA_UNBLOCKED_VARIANT1 )
{
r_val = FLA_LQ_UT_unb_var1( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_UNB_OPT_VARIANT1 )
{
r_val = FLA_LQ_UT_opt_var1( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT1 )
{
r_val = FLA_LQ_UT_blk_var1( A, T, cntl );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_UNBLOCKED_VARIANT2 )
{
r_val = FLA_LQ_UT_unb_var2( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_UNB_OPT_VARIANT2 )
{
r_val = FLA_LQ_UT_opt_var2( A, T );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT2 )
{
r_val = FLA_LQ_UT_blk_var2( A, T, cntl );
}
else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT3 )
{
r_val = FLA_LQ_UT_blk_var3( A, T, cntl );
}
else
{
FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
}
}
return r_val;
}
| FLA_Error FLA_LQ_UT_recover_tau | ( | FLA_Obj | T, |
| FLA_Obj | tau | ||
| ) |
References FLA_QR_UT_recover_tau().
{
return FLA_QR_UT_recover_tau( T, t );
}
References FLA_Apply_Q_UT(), FLA_Apply_Q_UT_create_workspace(), FLA_Check_error_level(), FLA_Copy_external(), FLA_LQ_UT_solve_check(), FLA_Obj_free(), FLA_Obj_length(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x1(), FLA_Set(), FLA_Trsm_external(), and FLA_ZERO.
{
FLA_Obj W;
FLA_Obj AL, AR;
FLA_Obj XT, XB;
// Check parameters.
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_LQ_UT_solve_check( A, T, B, X );
FLA_Apply_Q_UT_create_workspace( T, X, &W );
FLA_Part_1x2( A, &AL, &AR, FLA_Obj_length( A ), FLA_LEFT );
FLA_Part_2x1( X, &XT,
&XB, FLA_Obj_length( B ), FLA_TOP );
FLA_Copy_external( B, XT );
FLA_Trsm_external( FLA_LEFT, FLA_LOWER_TRIANGULAR, FLA_NO_TRANSPOSE,
FLA_NONUNIT_DIAG, FLA_ONE, AL, XT );
FLA_Set( FLA_ZERO, XB );
FLA_Apply_Q_UT( FLA_LEFT, FLA_NO_TRANSPOSE, FLA_FORWARD, FLA_ROWWISE,
A, T, W, X );
FLA_Obj_free( &W );
return FLA_SUCCESS;
}
| FLA_Error FLASH_LQ_UT | ( | FLA_Obj | A, |
| FLA_Obj | TW | ||
| ) |
References FLA_Abort(), FLA_Check_error_level(), FLA_LQ_UT_check(), FLA_LQ_UT_internal(), FLA_Print_message(), 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_LQ_UT_check( A, TW );
// *** The current hierarchical LQ_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_LQ_UT() currently only supports matrices of depth 1",
__FILE__, __LINE__ );
FLA_Abort();
}
// Inspect the length of TTL to get the blocksize used by the LQ
// 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) LQ_UT algorithm-by-blocks requires
// that the algorithmic blocksize be equal to the storage blocksize.
if ( b_alg != b_flash )
{
FLA_Print_message( "FLASH_LQ_UT() requires that b_alg == b_store",
__FILE__, __LINE__ );
FLA_Abort();
}
// The traditional (non-incremental) LQ_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_LQ_UT() requires that min_dim( A ) %% b_store == 0",
__FILE__, __LINE__ );
FLA_Abort();
}
// Begin a parallel region.
FLASH_Queue_begin();
// Invoke FLA_LQ_UT_internal() with hierarchical control tree.
r_val = FLA_LQ_UT_internal( A, TW, flash_lqut_cntl );
// End the parallel region.
FLASH_Queue_end();
return r_val;
}
| FLA_Error FLASH_LQ_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 LQ_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_LQ_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_LQ_UT_solve_check(), FLA_Obj_length(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x1(), FLA_ZERO, FLASH_Apply_Q_UT(), FLASH_Apply_Q_UT_create_workspace(), FLASH_Copy(), FLASH_Obj_free(), FLASH_Set(), and FLASH_Trsm().
{
FLA_Obj W;
FLA_Obj AL, AR;
FLA_Obj XT, XB;
// Check parameters.
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_LQ_UT_solve_check( A, T, B, X );
FLASH_Apply_Q_UT_create_workspace( T, X, &W );
FLA_Part_1x2( A, &AL, &AR, FLA_Obj_length( A ), FLA_LEFT );
FLA_Part_2x1( X, &XT,
&XB, FLA_Obj_length( B ), FLA_TOP );
FLASH_Copy( B, XT );
FLASH_Trsm( FLA_LEFT, FLA_LOWER_TRIANGULAR, FLA_NO_TRANSPOSE,
FLA_NONUNIT_DIAG, FLA_ONE, AL, XT );
FLASH_Set( FLA_ZERO, XB );
FLASH_Apply_Q_UT( FLA_LEFT, FLA_NO_TRANSPOSE, FLA_FORWARD, FLA_ROWWISE,
A, T, W, X );
FLASH_Obj_free( &W );
return FLA_SUCCESS;
}
1.7.6.1