Functions | |
FLA_Error | FLASH_Apply_Q_UT_inc_create_workspace (FLA_Obj TW, FLA_Obj B, FLA_Obj *W) |
References FLA_Abort(), FLA_Obj_datatype(), FLA_Obj_width(), FLA_Part_2x2(), FLA_Print_message(), FLASH_Obj_create_ext(), FLASH_Obj_depth(), FLASH_Obj_scalar_length(), and FLASH_Obj_scalar_width().
00036 { 00037 FLA_Datatype datatype; 00038 FLA_Obj TWTL, TWTR, 00039 TWBL, TWBR; 00040 dim_t depth; 00041 dim_t b_alg; 00042 dim_t b_flash; 00043 dim_t m, n; 00044 00045 // Query the depth. 00046 depth = FLASH_Obj_depth( TW ); 00047 00048 // *** The current Apply_Q_UT_inc algorithm implemented assumes that 00049 // the matrix has a hierarchical depth of 1. We check for that here 00050 // because we anticipate that we'll use a more general algorithm in the 00051 // future, and we don't want to forget to remove the constraint. *** 00052 if ( depth != 1 ) 00053 { 00054 FLA_Print_message( "FLASH_Apply_Q_UT_inc() currently only supports matrices of depth 1", 00055 __FILE__, __LINE__ ); 00056 FLA_Abort(); 00057 } 00058 00059 // Query the datatype of matrix TW. 00060 datatype = FLA_Obj_datatype( TW ); 00061 00062 // Inspect the length of a the top-left element of TW to get the 00063 // algorithmic blocksize we'll use throughout the Apply_Q_UT_inc 00064 // algorithm. 00065 FLA_Part_2x2( TW, &TWTL, &TWTR, 00066 &TWBL, &TWBR, 1, 1, FLA_TL ); 00067 b_alg = FLASH_Obj_scalar_length( TWTL ); 00068 00069 // The width of the top-left element gives us the storage blocksize. 00070 b_flash = FLASH_Obj_scalar_width( TWTL ); 00071 00072 // The element length of W is 1. 00073 m = 1; 00074 00075 // Query the element (not scalar) width of the right-hand side 00076 // matrix B. This is done so we can create W with full blocks for the 00077 // right "edge cases" of B. 00078 n = FLA_Obj_width( B ); 00079 00080 // Create hierarchical matrix W. 00081 FLASH_Obj_create_ext( datatype, m * b_alg, n * b_flash, 00082 depth, &b_alg, &b_flash, 00083 W ); 00084 00085 return FLA_SUCCESS; 00086 }