libflame revision_anchor
Functions
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

◆ FLASH_QR_UT_inc_create_hier_matrices()

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 
)
14{
15 FLA_Datatype datatype;
16 dim_t m, n;
18
19 // *** The current QR_UT_inc algorithm implemented assumes that
20 // the matrix has a hierarchical depth of 1. We check for that here
21 // because we anticipate that we'll use a more general algorithm in the
22 // future, and we don't want to forget to remove the constraint. ***
23 if ( depth != 1 )
24 {
25 FLA_Print_message( "FLASH_QR_UT_inc() currently only supports matrices of depth 1",
27 FLA_Abort();
28 }
29
30 // Create hierarchical copy of matrix A_flat.
32
33 // Query the datatype of matrix A_flat.
34 datatype = FLA_Obj_datatype( A_flat );
35
36 // If the user passed in zero for b_alg, then we need to set the
37 // algorithmic (inner) blocksize to a reasonable default value.
38 if ( b_alg == 0 )
39 {
41 }
42
43 // Query the element (not scalar) dimensions of the new hierarchical
44 // matrix. This is done so we can create T with full blocks for the
45 // bottom and right "edge cases" of A.
46 m = FLA_Obj_length( *A );
47 n = FLA_Obj_width( *A );
48
49 // Create hierarchical matrices T and W. T is lower triangular where
50 // each block is b_alg-by-b_flash and W is strictly upper triangular
51 // where each block is b_alg-by-b_flash. So we can create them
52 // simultaneously as part of the same hierarchical matrix.
53 FLASH_Obj_create_ext( datatype, m * b_alg, n * b_flash[0],
55 TW );
56
57 // If the bottom-right-most block along the diagonal is a partial block,
58 // adjust the view of the corresponding T block.
60
61 if ( n_last > 0 )
62 {
64 TWBL, TWBR;
67 TWB, TW1,
68 TW2;
70
72 &TWBL, &TWBR, n-1, n-1, FLA_TL );
73
75 &TWB, 0, FLA_TOP );
76
77 while ( FLA_Obj_length( TWB ) > 0 )
78 {
80 /* *** */ /* *** */
81 &TW1,
82 TWB, &TW2, 1, FLA_BOTTOM );
83
84 // -----------------------------------------------------------
85
87
89
90 *TW1p = TWL;
91 TW1p->m_inner = TW1p->m;
92 TW1p->n_inner = TW1p->n;
93
94 // -----------------------------------------------------------
95
97 TW1,
98 /* *** */ /* *** */
99 &TWB, TW2, FLA_TOP );
100 }
101
102
103 }
104
105 return FLA_SUCCESS;
106}
dim_t FLASH_QR_UT_inc_determine_alg_blocksize(FLA_Obj A)
Definition FLASH_QR_UT_inc_create_hier_matrices.c:109
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_Error FLASH_Obj_create_hier_copy_of_flat(FLA_Obj F, dim_t depth, dim_t *b_mn, FLA_Obj *H)
Definition FLASH_Obj.c:591
dim_t FLASH_Obj_scalar_width(FLA_Obj H)
Definition FLASH_View.c:641
FLA_Error FLA_Part_2x2(FLA_Obj A, FLA_Obj *A11, FLA_Obj *A12, FLA_Obj *A21, FLA_Obj *A22, dim_t mb, dim_t nb, FLA_Quadrant quadrant)
Definition FLA_View.c:17
FLA_Error FLA_Cont_with_3x1_to_2x1(FLA_Obj *AT, FLA_Obj A0, FLA_Obj A1, FLA_Obj *AB, FLA_Obj A2, FLA_Side side)
Definition FLA_View.c:428
FLA_Error FLA_Repart_2x1_to_3x1(FLA_Obj AT, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj AB, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition FLA_View.c:226
dim_t FLA_Obj_width(FLA_Obj obj)
Definition FLA_Query.c:123
FLA_Error FLA_Part_1x2(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_View.c:110
FLA_Error FLA_Part_2x1(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition FLA_View.c:76
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
void FLA_Abort(void)
Definition FLA_Error.c:248
void FLA_Print_message(char *str, char *file, int line)
Definition FLA_Error.c:234
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition FLA_Query.c:13
int FLA_Datatype
Definition FLA_type_defs.h:49
unsigned long dim_t
Definition FLA_type_defs.h:71
int i
Definition bl1_axmyv2.c:145
Definition FLA_type_defs.h:159

References FLA_Abort(), FLA_Cont_with_3x1_to_2x1(), FLA_Obj_datatype(), FLA_Obj_length(), FLA_Obj_width(), FLA_Part_1x2(), FLA_Part_2x1(), FLA_Part_2x2(), FLA_Print_message(), FLA_Repart_2x1_to_3x1(), FLASH_Obj_create_ext(), FLASH_Obj_create_hier_copy_of_flat(), FLASH_Obj_scalar_width(), FLASH_QR_UT_inc_determine_alg_blocksize(), and i.

◆ FLASH_QR_UT_inc_determine_alg_blocksize()

dim_t FLASH_QR_UT_inc_determine_alg_blocksize ( FLA_Obj  A)
110{
111 dim_t b_alg;
113
114 // Acquire the storage blocksize.
116
117 // Scale the storage blocksize by a pre-defined scalar to arrive at a
118 // reasonable algorithmic blocksize, but make sure it's at least 1.
119 b_alg = ( dim_t ) max( ( double ) b_flash * FLA_QR_INNER_TO_OUTER_B_RATIO, 1 );
120
121 return b_alg;
122}

References FLA_Obj_length(), and i.

Referenced by FLASH_QR_UT_inc_create_hier_matrices().