libflame  revision_anchor
Functions
FLASH_Apply_QUD_UT_inc_create_workspace.c File Reference

(r)

Functions

FLA_Error FLASH_Apply_QUD_UT_inc_create_workspace (FLA_Obj T, FLA_Obj R, FLA_Obj *W)
 

Function Documentation

◆ FLASH_Apply_QUD_UT_inc_create_workspace()

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().

14 {
15  FLA_Datatype datatype;
16  dim_t depth;
17  dim_t b_alg;
18  dim_t b_flash;
19  dim_t m, n;
20 
21  // Query the depth.
22  depth = FLASH_Obj_depth( T );
23 
24  // *** The current Apply_QUD_UT_inc algorithm implemented assumes that
25  // the matrix has a hierarchical depth of 1. We check for that here
26  // because we anticipate that we'll use a more general algorithm in the
27  // future, and we don't want to forget to remove the constraint. ***
28  if ( depth != 1 )
29  {
30  FLA_Print_message( "FLASH_Apply_QUD_UT_inc() currently only supports matrices of depth 1",
31  __FILE__, __LINE__ );
32  FLA_Abort();
33  }
34 
35  // Query the datatype of matrix T.
36  datatype = FLA_Obj_datatype( T );
37 
38  // Inspect the length of a the top-left element of T to get the
39  // algorithmic blocksize we'll use throughout the Apply_QUD_UT_inc
40  // algorithm.
41  b_alg = FLASH_Obj_scalar_length_tl( T );
42 
43  // The width of the top-left element gives us the storage blocksize.
44  b_flash = FLASH_Obj_scalar_width_tl( T );
45 
46  // Determine the element (not scalar) dimensions of the new hierarchical
47  // matrix W. By using the element dimensions, we will probably allocate
48  // more storage than we actually need (at the bottom and right edge cases)
49  // but this is simpler than computing the exact amount and the excess
50  // storage is usually small in practice.
51  m = FLA_Obj_length( R );
52  n = FLA_Obj_width( R );
53 
54  // Create hierarchical matrix W, with element dimensions conformal to R,
55  // where each block is b_alg-by-b_flash.
56  FLASH_Obj_create_ext( datatype, m * b_alg, n * b_flash,
57  depth, &b_alg, &b_flash,
58  W );
59 
60  return FLA_SUCCESS;
61 }
unsigned long dim_t
Definition: FLA_type_defs.h:71
dim_t FLASH_Obj_depth(FLA_Obj H)
Definition: FLASH_Obj.c:20
FLA_Error FLASH_Obj_create_ext(FLA_Datatype datatype, dim_t m, dim_t n, dim_t depth, dim_t *b_m, dim_t *b_n, FLA_Obj *H)
Definition: FLASH_Obj.c:151
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
dim_t FLASH_Obj_scalar_width_tl(FLA_Obj H)
Definition: FLASH_View.c:737
void FLA_Abort(void)
Definition: FLA_Error.c:248
void FLA_Print_message(char *str, char *file, int line)
Definition: FLA_Error.c:234
int FLA_Datatype
Definition: FLA_type_defs.h:49
dim_t FLASH_Obj_scalar_length_tl(FLA_Obj H)
Definition: FLASH_View.c:723
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116