FLASH_QR_UT_inc_create_hier_matrices.c File Reference

(r)


Functions

FLA_Error FLASH_QR_UT_inc_create_hier_matrices (FLA_Obj A_flat, dim_t depth, dim_t *b_flash, dim_t b_alg, FLA_Obj *A, FLA_Obj *TW)
dim_t FLASH_QR_UT_inc_determine_alg_blocksize (FLA_Obj A)

Function Documentation

FLA_Error FLASH_QR_UT_inc_create_hier_matrices ( FLA_Obj  A_flat,
dim_t  depth,
dim_t b_flash,
dim_t  b_alg,
FLA_Obj A,
FLA_Obj TW 
)

References FLA_Abort(), FLA_Obj_datatype(), FLA_Obj_length(), FLA_Obj_width(), FLA_Print_message(), FLASH_Obj_create_ext(), FLASH_Obj_create_hier_copy_of_flat(), and FLASH_QR_UT_inc_determine_alg_blocksize().

00036 {
00037     FLA_Datatype datatype;
00038     dim_t        m, n;
00039     
00040     // *** The current QR_UT_inc algorithm implemented assumes that
00041     // the matrix has a hierarchical depth of 1. We check for that here
00042     // because we anticipate that we'll use a more general algorithm in the
00043     // future, and we don't want to forget to remove the constraint. ***
00044     if ( depth != 1 )
00045     {
00046        FLA_Print_message( "FLASH_QR_UT_inc() currently only supports matrices of depth 1",
00047                           __FILE__, __LINE__ );
00048        FLA_Abort();
00049     }
00050 
00051     // Create hierarchical copy of matrix A_flat.
00052     FLASH_Obj_create_hier_copy_of_flat( A_flat, depth, b_flash, A );
00053 
00054     // Query the datatype of matrix A_flat.
00055     datatype = FLA_Obj_datatype( A_flat );
00056     
00057     // If the user passed in zero for b_alg, then we need to set the
00058     // algorithmic (inner) blocksize to a reasonable default value.
00059     if ( b_alg == 0 )
00060     {
00061         b_alg = FLASH_QR_UT_inc_determine_alg_blocksize( *A );
00062     }
00063 
00064     // Query the element (not scalar) dimensions of the new hierarchical
00065     // matrix. This is done so we can create TH with full blocks for the
00066     // bottom and right "edge cases" of A.
00067     m = FLA_Obj_length( *A );
00068     n = FLA_Obj_width ( *A );
00069 
00070     // Create hierarchical matrices T and W. T is lower triangular where
00071     // each block is b_alg-by-b_flash and W is strictly upper triangular
00072     // where each block is b_alg-by-b_flash. So we can create them
00073     // simultaneously as part of the same hierarchical matrix.
00074     FLASH_Obj_create_ext( datatype, m * b_alg, n * b_flash[0], 
00075                           depth, &b_alg, b_flash, 
00076                           TW );
00077        
00078     return FLA_SUCCESS;
00079 }

dim_t FLASH_QR_UT_inc_determine_alg_blocksize ( FLA_Obj  A  ) 

References FLA_Obj_length().

Referenced by FLASH_QR_UT_inc_create_hier_matrices().

00083 {
00084     dim_t b_alg;
00085     dim_t b_flash;
00086 
00087     // Acquire the storage blocksize.
00088     b_flash = FLA_Obj_length( *FLASH_OBJ_PTR_AT( A ) );
00089 
00090     // Scale the storage blocksize by a pre-defined scalar to arrive at a
00091     // reasonable algorithmic blocksize, but make sure it's at least 1.
00092     b_alg = max( b_flash * FLA_QR_INNER_TO_OUTER_B_RATIO, 1 );
00093 
00094     return b_alg;
00095 }


Generated on Mon Jul 6 05:45:56 2009 for libflame by  doxygen 1.5.9