libflame  revision_anchor
Functions
FLASH_Apply_Q_UT_create_workspace.c File Reference

(r)

Functions

FLA_Error FLASH_Apply_Q_UT_create_workspace (FLA_Obj TW, FLA_Obj B, FLA_Obj *W)
 

Function Documentation

◆ FLASH_Apply_Q_UT_create_workspace()

FLA_Error FLASH_Apply_Q_UT_create_workspace ( FLA_Obj  TW,
FLA_Obj  B,
FLA_Obj W 
)

References FLA_Abort(), FLA_Obj_datatype(), FLA_Print_message(), FLASH_Obj_create_ext(), FLASH_Obj_depth(), FLASH_Obj_scalar_length_tl(), FLASH_Obj_scalar_width(), and FLASH_Obj_scalar_width_tl().

Referenced by FLASH_LQ_UT_solve(), and FLASH_QR_UT_solve().

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( TW );
23 
24  // *** The current Apply_Q_UT 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_Q_UT() currently only supports matrices of depth 1",
31  __FILE__, __LINE__ );
32  FLA_Abort();
33  }
34 
35  // Query the datatype of matrix TW.
36  datatype = FLA_Obj_datatype( TW );
37 
38  // Inspect the dimensions of a the top-left element of TW to get the
39  // algorithmic/storage blocksize we'll use throughout the Apply_Q_UT
40  // algorithm.
41  b_alg = FLASH_Obj_scalar_length_tl( TW );
42  b_flash = FLASH_Obj_scalar_width_tl( TW );
43 
44  // The traditional (non-incremental) Apply_Q_UT algorithm-by-blocks
45  // requires that the algorithmic blocksize be equal to the storage
46  // blocksize.
47  if ( b_alg != b_flash )
48  {
49  FLA_Print_message( "FLASH_Apply_Q_UT() requires that b_alg == b_store",
50  __FILE__, __LINE__ );
51  FLA_Abort();
52  }
53 
54  // The scalar length of W should be the algorithmc/storage blocksize
55  // encoded in TW.
56  m = b_alg;
57 
58  // Query the scalar (not element) width of the right-hand side
59  // matrix B.
60  n = FLASH_Obj_scalar_width( B );
61 
62  // Create hierarchical matrix W.
63  FLASH_Obj_create_ext( datatype, m, n,
64  depth, &b_alg, &b_flash,
65  W );
66 
67  return FLA_SUCCESS;
68 }
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 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 FLASH_Obj_scalar_width(FLA_Obj H)
Definition: FLASH_View.c:641