libflame  revision_anchor
Functions
FLA_Apply_CAQ_UT_inc.h File Reference

(r)

Go to the source code of this file.

Functions

FLA_Error FLASH_Apply_CAQ_UT_inc (dim_t p, FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj A, FLA_Obj ATW, FLA_Obj R, FLA_Obj RTW, FLA_Obj W, FLA_Obj B)
 
FLA_Error FLA_Apply_CAQ_UT_inc_apply_panels (dim_t nb_part, FLA_Obj A, FLA_Obj ATW, FLA_Obj W, FLA_Obj B)
 
FLA_Error FLASH_Apply_CAQ_UT_inc_create_workspace (dim_t p, FLA_Obj TW, FLA_Obj B, FLA_Obj *W)
 
FLA_Error FLA_Apply_CAQ_UT_inc_internal (FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj R, FLA_Obj TW, FLA_Obj W1, FLA_Obj B, fla_apcaqutinc_t *cntl)
 
FLA_Error FLA_Apply_CAQ_UT_inc_lhfc (FLA_Obj R, FLA_Obj TW, FLA_Obj W1, FLA_Obj B, fla_apcaqutinc_t *cntl)
 

Function Documentation

◆ FLA_Apply_CAQ_UT_inc_apply_panels()

FLA_Error FLA_Apply_CAQ_UT_inc_apply_panels ( dim_t  nb_part,
FLA_Obj  A,
FLA_Obj  ATW,
FLA_Obj  W,
FLA_Obj  B 
)

References FLA_Cont_with_3x1_to_2x1(), FLA_Obj_length(), FLA_Part_2x1(), FLA_Repart_2x1_to_3x1(), and FLASH_Apply_Q_UT_inc().

Referenced by FLASH_Apply_CAQ_UT_inc().

14 {
15  FLA_Obj AT, A0,
16  AB, A1,
17  A2;
18 
19  FLA_Obj TWT, TW0,
20  TWB, TW1,
21  TW2;
22 
23  FLA_Obj WT, W0,
24  WB, W1,
25  W2;
26 
27  FLA_Obj BT, B0,
28  BB, B1,
29  B2;
30 
31  dim_t b;
32 
33  FLA_Part_2x1( A, &AT,
34  &AB, 0, FLA_TOP );
35 
36  FLA_Part_2x1( TW, &TWT,
37  &TWB, 0, FLA_TOP );
38 
39  FLA_Part_2x1( W, &WT,
40  &WB, 0, FLA_TOP );
41 
42  FLA_Part_2x1( B, &BT,
43  &BB, 0, FLA_TOP );
44 
45  while ( FLA_Obj_length( AB ) > 0 ){
46 
47  b = min( nb_part, FLA_Obj_length( AB ) );
48 
49  FLA_Repart_2x1_to_3x1( AT, &A0,
50  /* ** */ /* ** */
51  &A1,
52  AB, &A2, b, FLA_BOTTOM );
53 
54  FLA_Repart_2x1_to_3x1( TWT, &TW0,
55  /* ** */ /* ** */
56  &TW1,
57  TWB, &TW2, b, FLA_BOTTOM );
58 
59  // NOTE: we use a blocksize of 1 for W since it has exactly nb_part
60  // rows (where each row is a row panels of b_alg x b_flash blocks).
61  FLA_Repart_2x1_to_3x1( WT, &W0,
62  /* ** */ /* ** */
63  &W1,
64  WB, &W2, 1, FLA_BOTTOM );
65 
66  FLA_Repart_2x1_to_3x1( BT, &B0,
67  /* ** */ /* ** */
68  &B1,
69  BB, &B2, b, FLA_BOTTOM );
70 
71  /*------------------------------------------------------------*/
72 
73  // Apply incremental Q's associated with each block A1 to the
74  // corresponding block of right-hand side B1.
75  FLASH_Apply_Q_UT_inc( FLA_LEFT, FLA_CONJ_TRANSPOSE, FLA_FORWARD, FLA_COLUMNWISE,
76  A1, TW1, W1, B1 );
77 
78  /*------------------------------------------------------------*/
79 
80  FLA_Cont_with_3x1_to_2x1( &AT, A0,
81  A1,
82  /* ** */ /* ** */
83  &AB, A2, FLA_TOP );
84 
85  FLA_Cont_with_3x1_to_2x1( &TWT, TW0,
86  TW1,
87  /* ** */ /* ** */
88  &TWB, TW2, FLA_TOP );
89 
90  FLA_Cont_with_3x1_to_2x1( &WT, W0,
91  W1,
92  /* ** */ /* ** */
93  &WB, W2, FLA_TOP );
94 
95  FLA_Cont_with_3x1_to_2x1( &BT, B0,
96  B1,
97  /* ** */ /* ** */
98  &BB, B2, FLA_TOP );
99  }
100 
101  return FLA_SUCCESS;
102 }
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
unsigned long dim_t
Definition: FLA_type_defs.h:71
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
Definition: FLA_type_defs.h:158
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
FLA_Error FLASH_Apply_Q_UT_inc(FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj A, FLA_Obj TW, FLA_Obj W1, FLA_Obj B)
Definition: FLASH_Apply_Q_UT_inc.c:18
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116

◆ FLA_Apply_CAQ_UT_inc_internal()

FLA_Error FLA_Apply_CAQ_UT_inc_internal ( FLA_Side  side,
FLA_Trans  trans,
FLA_Direct  direct,
FLA_Store  storev,
FLA_Obj  R,
FLA_Obj  TW,
FLA_Obj  W1,
FLA_Obj  B,
fla_apcaqutinc_t cntl 
)

References FLA_Apply_CAQ_UT_inc_internal_check(), FLA_Apply_CAQ_UT_inc_lhfc(), and FLA_Check_error_level().

Referenced by FLASH_Apply_CAQ_UT_inc().

16 {
17  FLA_Error r_val = FLA_SUCCESS;
18 
19  if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
20  FLA_Apply_CAQ_UT_inc_internal_check( side, trans, direct, storev, R, TW, W, B, cntl );
21 
22  if ( side == FLA_LEFT )
23  {
24  if ( trans == FLA_NO_TRANSPOSE )
25  {
26  if ( direct == FLA_FORWARD )
27  {
28  if ( storev == FLA_COLUMNWISE )
29  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
30  else if ( storev == FLA_ROWWISE )
31  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
32  }
33  else if ( direct == FLA_BACKWARD )
34  {
35  if ( storev == FLA_COLUMNWISE )
36  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
37  else if ( storev == FLA_ROWWISE )
38  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
39  }
40  }
41  else if ( trans == FLA_TRANSPOSE || trans == FLA_CONJ_TRANSPOSE )
42  {
43  if ( direct == FLA_FORWARD )
44  {
45  if ( storev == FLA_COLUMNWISE )
46  r_val = FLA_Apply_CAQ_UT_inc_lhfc( R, TW, W, B, cntl );
47  else if ( storev == FLA_ROWWISE )
48  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
49  }
50  else if ( direct == FLA_BACKWARD )
51  {
52  if ( storev == FLA_COLUMNWISE )
53  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
54  else if ( storev == FLA_ROWWISE )
55  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
56  }
57  }
58  }
59  else if ( side == FLA_RIGHT )
60  {
61  if ( trans == FLA_NO_TRANSPOSE )
62  {
63  if ( direct == FLA_FORWARD )
64  {
65  if ( storev == FLA_COLUMNWISE )
66  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
67  else if ( storev == FLA_ROWWISE )
68  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
69  }
70  else if ( direct == FLA_BACKWARD )
71  {
72  if ( storev == FLA_COLUMNWISE )
73  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
74  else if ( storev == FLA_ROWWISE )
75  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
76  }
77  }
78  else if ( trans == FLA_TRANSPOSE || trans == FLA_CONJ_TRANSPOSE )
79  {
80  if ( direct == FLA_FORWARD )
81  {
82  if ( storev == FLA_COLUMNWISE )
83  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
84  else if ( storev == FLA_ROWWISE )
85  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
86  }
87  else if ( direct == FLA_BACKWARD )
88  {
89  if ( storev == FLA_COLUMNWISE )
90  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
91  else if ( storev == FLA_ROWWISE )
92  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
93  }
94  }
95  }
96 
97  return r_val;
98 }
FLA_Error FLA_Apply_CAQ_UT_inc_internal_check(FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj R, FLA_Obj TW, FLA_Obj W, FLA_Obj B, fla_apcaqutinc_t *cntl)
Definition: FLA_Apply_CAQ_UT_inc_internal_check.c:13
int FLA_Error
Definition: FLA_type_defs.h:47
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
FLA_Error FLA_Apply_CAQ_UT_inc_lhfc(FLA_Obj R, FLA_Obj TW, FLA_Obj W1, FLA_Obj B, fla_apcaqutinc_t *cntl)
Definition: FLA_Apply_CAQ_UT_inc_lhfc.c:13

◆ FLA_Apply_CAQ_UT_inc_lhfc()

FLA_Error FLA_Apply_CAQ_UT_inc_lhfc ( FLA_Obj  R,
FLA_Obj  TW,
FLA_Obj  W1,
FLA_Obj  B,
fla_apcaqutinc_t cntl 
)

References FLA_Apply_CAQ_UT_inc_lhfc_blk_var1().

Referenced by FLA_Apply_CAQ_UT_inc_internal().

14 {
15  return FLA_Apply_CAQ_UT_inc_lhfc_blk_var1( R, TW, W1, B, cntl );
16 }
FLA_Error FLA_Apply_CAQ_UT_inc_lhfc_blk_var1(FLA_Obj R, FLA_Obj TW, FLA_Obj W1, FLA_Obj B, fla_apcaqutinc_t *cntl)
Definition: FLA_Apply_CAQ_UT_inc_lhfc_blk_var1.c:13

◆ FLASH_Apply_CAQ_UT_inc()

FLA_Error FLASH_Apply_CAQ_UT_inc ( dim_t  p,
FLA_Side  side,
FLA_Trans  trans,
FLA_Direct  direct,
FLA_Store  storev,
FLA_Obj  A,
FLA_Obj  ATW,
FLA_Obj  R,
FLA_Obj  RTW,
FLA_Obj  W,
FLA_Obj  B 
)

References FLA_Apply_CAQ_UT_inc_apply_panels(), FLA_Apply_CAQ_UT_inc_check(), FLA_Apply_CAQ_UT_inc_internal(), FLA_CAQR_UT_inc_compute_blocks_per_part(), FLA_Check_error_level(), FLA_Part_2x1(), FLASH_Queue_begin(), and FLASH_Queue_end().

Referenced by FLASH_CAQR_UT_inc_solve().

18 {
19  FLA_Error r_val;
20  dim_t nb_part;
21  FLA_Obj WT, WB;
22 
23  // Check parameters.
24  if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
25  FLA_Apply_CAQ_UT_inc_check( side, trans, direct, storev, A, ATW, R, RTW, W, B );
26 
27  // Compute the partition length from the number of partitions.
29 
30  // Begin a parallel region.
32 
33  // Apply the individual Q's from the incremental QR factorizations.
34  FLA_Apply_CAQ_UT_inc_apply_panels( nb_part, A, ATW, W, B );
35 
36  FLA_Part_2x1( W, &WT,
37  &WB, 1, FLA_TOP );
38 
39  // Apply the Q from the factorization of the upper triangular R's.
40  r_val = FLA_Apply_CAQ_UT_inc_internal( side, trans, direct, storev,
41  R, RTW, WT, B, flash_apcaqutinc_cntl );
42 
43 
44  // End the parallel region.
46 
47  return r_val;
48 }
void FLASH_Queue_end(void)
Definition: FLASH_Queue.c:81
FLA_Error FLA_Apply_CAQ_UT_inc_internal(FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj R, FLA_Obj TW, FLA_Obj W1, FLA_Obj B, fla_apcaqutinc_t *cntl)
Definition: FLA_Apply_CAQ_UT_inc_internal.c:13
unsigned long dim_t
Definition: FLA_type_defs.h:71
FLA_Error FLA_Apply_CAQ_UT_inc_apply_panels(dim_t nb_part, FLA_Obj A, FLA_Obj ATW, FLA_Obj W, FLA_Obj B)
Definition: FLA_Apply_CAQ_UT_inc_apply_panels.c:13
int FLA_Error
Definition: FLA_type_defs.h:47
void FLASH_Queue_begin(void)
Definition: FLASH_Queue.c:59
Definition: FLA_type_defs.h:158
dim_t FLA_CAQR_UT_inc_compute_blocks_per_part(dim_t p, FLA_Obj A)
Definition: FLA_CAQR_UT_inc_compute_p_length.c:13
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
FLA_Error FLA_Apply_CAQ_UT_inc_check(FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj A, FLA_Obj ATW, FLA_Obj R, FLA_Obj RTW, FLA_Obj W, FLA_Obj B)
Definition: FLA_Apply_CAQ_UT_inc_check.c:13
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
fla_apcaqutinc_t * flash_apcaqutinc_cntl
Definition: FLASH_Apply_CAQ_UT_inc_cntl_init.c:15

◆ FLASH_Apply_CAQ_UT_inc_create_workspace()

FLA_Error FLASH_Apply_CAQ_UT_inc_create_workspace ( dim_t  p,
FLA_Obj  TW,
FLA_Obj  B,
FLA_Obj W 
)

References FLA_Abort(), FLA_Obj_datatype(), 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_CAQR_UT_inc_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_CAQ_UT_inc algorithm implemented assumes that
25  // the matrix has a hierarchical depth of 1.
26  if ( depth != 1 )
27  {
28  FLA_Print_message( "FLASH_Apply_CAQ_UT_inc() currently only supports matrices of depth 1",
29  __FILE__, __LINE__ );
30  FLA_Abort();
31  }
32 
33  // Query the datatype of matrix TW.
34  datatype = FLA_Obj_datatype( TW );
35 
36  // Inspect the length of a the top-left element of TW to get the
37  // algorithmic blocksize we'll use throughout the Apply_CAQ_UT_inc
38  // algorithm.
39  b_alg = FLASH_Obj_scalar_length_tl( TW );
40 
41  // The width of the top-left element gives us the storage blocksize.
42  b_flash = FLASH_Obj_scalar_width_tl( TW );
43 
44  // The element length of W need to be p: one panel for each
45  // factorized subproblem.
46  m = p;
47 
48  // Query the element (not scalar) width of the right-hand side
49  // matrix B. This is done so we can create W with full blocks for the
50  // right "edge cases" of B.
51  n = FLA_Obj_width( B );
52 
53  // Create hierarchical matrix W.
54  FLASH_Obj_create_ext( datatype, m * b_alg, n * b_flash,
55  depth, &b_alg, &b_flash,
56  W );
57 
58  return FLA_SUCCESS;
59 }
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