|
libflame
revision_anchor
|
Functions | |
| FLA_Error | FLASH_Apply_QUD_UT_inc_create_workspace (FLA_Obj T, FLA_Obj R, FLA_Obj *W) |
| FLA_Error FLASH_Apply_QUD_UT_inc_create_workspace | ( | FLA_Obj | T, |
| FLA_Obj | R, | ||
| FLA_Obj * | W | ||
| ) |
References FLA_Abort(), FLA_Obj_datatype(), FLA_Obj_length(), FLA_Obj_width(), FLA_Print_message(), FLASH_Obj_create_ext(), FLASH_Obj_depth(), FLASH_Obj_scalar_length_tl(), and FLASH_Obj_scalar_width_tl().
Referenced by FLASH_UDdate_UT_inc_update_rhs().
{
FLA_Datatype datatype;
dim_t depth;
dim_t b_alg;
dim_t b_flash;
dim_t m, n;
// Query the depth.
depth = FLASH_Obj_depth( T );
// *** The current Apply_QUD_UT_inc 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_Apply_QUD_UT_inc() currently only supports matrices of depth 1",
__FILE__, __LINE__ );
FLA_Abort();
}
// Query the datatype of matrix T.
datatype = FLA_Obj_datatype( T );
// Inspect the length of a the top-left element of T to get the
// algorithmic blocksize we'll use throughout the Apply_QUD_UT_inc
// algorithm.
b_alg = FLASH_Obj_scalar_length_tl( T );
// The width of the top-left element gives us the storage blocksize.
b_flash = FLASH_Obj_scalar_width_tl( T );
// Determine the element (not scalar) dimensions of the new hierarchical
// matrix W. By using the element dimensions, we will probably allocate
// more storage than we actually need (at the bottom and right edge cases)
// but this is simpler than computing the exact amount and the excess
// storage is usually small in practice.
m = FLA_Obj_length( R );
n = FLA_Obj_width( R );
// Create hierarchical matrix W, with element dimensions conformal to R,
// where each block is b_alg-by-b_flash.
FLASH_Obj_create_ext( datatype, m * b_alg, n * b_flash,
depth, &b_alg, &b_flash,
W );
return FLA_SUCCESS;
}
1.7.6.1