libflame revision_anchor
Functions
FLA_LQ_UT.h File Reference

(r)

Go to the source code of this file.

Functions

FLA_Error FLA_LQ_UT (FLA_Obj A, FLA_Obj T)
 
FLA_Error FLA_LQ_UT_internal (FLA_Obj A, FLA_Obj T, fla_lqut_t *cntl)
 
FLA_Error FLA_LQ_UT_create_T (FLA_Obj A, FLA_Obj *T)
 
FLA_Error FLA_LQ_UT_recover_tau (FLA_Obj T, FLA_Obj tau)
 
FLA_Error FLA_LQ_UT_solve (FLA_Obj A, FLA_Obj T, FLA_Obj B, FLA_Obj X)
 
FLA_Error FLASH_LQ_UT (FLA_Obj A, FLA_Obj TW)
 
FLA_Error FLASH_LQ_UT_create_hier_matrices (FLA_Obj A_flat, dim_t depth, dim_t *b_flash, FLA_Obj *A, FLA_Obj *TW)
 
FLA_Error FLASH_LQ_UT_solve (FLA_Obj A, FLA_Obj T, FLA_Obj B, FLA_Obj X)
 
FLA_Error FLA_LQ_UT_form_Q (FLA_Obj A, FLA_Obj T, FLA_Obj Q)
 

Function Documentation

◆ FLA_LQ_UT()

FLA_Error FLA_LQ_UT ( FLA_Obj  A,
FLA_Obj  T 
)
16{
18
19 // Check parameters.
22
23 // Invoke FLA_LQ_UT_internal() with the standard control tree.
24 //r_val = FLA_LQ_UT_blk_var1( A, T, fla_lqut_cntl_leaf );
26
27 return r_val;
28}
fla_lqut_t * fla_lqut_cntl_leaf
Definition FLA_LQ_UT_cntl_init.c:16
FLA_Error FLA_LQ_UT_internal(FLA_Obj A, FLA_Obj T, fla_lqut_t *cntl)
Definition FLA_LQ_UT_internal.c:17
FLA_Error FLA_LQ_UT_check(FLA_Obj A, FLA_Obj T)
Definition FLA_LQ_UT_check.c:13
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
int FLA_Error
Definition FLA_type_defs.h:47
int i
Definition bl1_axmyv2.c:145

◆ FLA_LQ_UT_create_T()

FLA_Error FLA_LQ_UT_create_T ( FLA_Obj  A,
FLA_Obj T 
)
14{
15 FLA_Datatype datatype;
16 dim_t b_alg, k;
18
19 // Query the datatype of A.
20 datatype = FLA_Obj_datatype( A );
21
22 // Query the blocksize from the library.
24
25 // Scale the blocksize by a pre-set global constant.
26 b_alg = ( dim_t )( ( ( double ) b_alg ) * FLA_LQ_INNER_TO_OUTER_B_RATIO );
27
28 // Adjust the blocksize with respect to the min-dim of A.
30
31 // Query the length of A.
32 k = FLA_Obj_length( A );
33
34 // Figure out whether T should be row-major or column-major.
35 if ( FLA_Obj_row_stride( A ) == 1 )
36 {
37 rs_T = 1;
38 cs_T = b_alg;
39 }
40 else // if ( FLA_Obj_col_stride( A ) == 1 )
41 {
42 rs_T = k;
43 cs_T = 1;
44 }
45
46 // Create a b_alg x k matrix to hold the block Householder transforms that
47 // will be accumulated within the LQ factorization algorithm.
48 FLA_Obj_create( datatype, b_alg, k, rs_T, cs_T, T );
49
50 return FLA_SUCCESS;
51}
FLA_Error FLA_Obj_create(FLA_Datatype datatype, dim_t m, dim_t n, dim_t rs, dim_t cs, FLA_Obj *obj)
Definition FLA_Obj.c:55
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition FLA_Query.c:167
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
dim_t FLA_Query_blocksize(FLA_Datatype dt, FLA_Dimension dim)
Definition FLA_Blocksize.c:161
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition FLA_Query.c:153
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

References FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_length(), FLA_Obj_min_dim(), FLA_Obj_row_stride(), FLA_Query_blocksize(), and i.

◆ FLA_LQ_UT_form_Q()

FLA_Error FLA_LQ_UT_form_Q ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  Q 
)
14{
16
17 // Flip a base once.
19 if ( FLA_Obj_is( A, Q ) == FALSE )
21
22 // Dimensions of the both matrices should be flipped.
25
26 // Run the QR utility function.
27 r_val = FLA_QR_UT_form_Q( A, T, Q );
28
29 // Apply conjugation on Q as we use QR_UT_form_Q.
30 if ( FLA_Obj_is_complex( Q ) )
32
33 // Recover the base object.
34 if ( FLA_Obj_is( A, Q ) == FALSE )
37
38 return r_val;
39}
FLA_Error FLA_QR_UT_form_Q(FLA_Obj A, FLA_Obj T, FLA_Obj Q)
Definition FLA_QR_UT_form_Q.c:13
FLA_Error FLA_Obj_flip_view(FLA_Obj *obj)
Definition FLA_Obj.c:669
FLA_Error FLA_Obj_flip_base(FLA_Obj *obj)
Definition FLA_Obj.c:647
FLA_Bool FLA_Obj_is_complex(FLA_Obj A)
Definition FLA_Query.c:324
FLA_Bool FLA_Obj_is(FLA_Obj A, FLA_Obj B)
Definition FLA_Query.c:460
FLA_Error FLA_Conjugate(FLA_Obj A)
Definition FLA_Conjugate.c:13

References FLA_Conjugate(), FLA_Obj_flip_base(), FLA_Obj_flip_view(), FLA_Obj_is(), FLA_Obj_is_complex(), FLA_QR_UT_form_Q(), and i.

Referenced by FLA_Bidiag_UT_form_V_ext().

◆ FLA_LQ_UT_internal()

FLA_Error FLA_LQ_UT_internal ( FLA_Obj  A,
FLA_Obj  T,
fla_lqut_t cntl 
)
18{
20
23
24 if ( FLA_Cntl_matrix_type( cntl ) == FLA_HIER &&
26 {
28 {
29 // Enqueue
31 }
32 else
33 {
34 // Execute
35 r_val = FLA_LQ_UT_macro_task( A, T, cntl );
36 }
37 }
38 else
39 {
41 {
43 }
44 else if ( FLA_Cntl_variant( cntl ) == FLA_UNB_OPT_VARIANT1 )
45 {
47 }
48 else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT1 )
49 {
50 r_val = FLA_LQ_UT_blk_var1( A, T, cntl );
51 }
52 else if ( FLA_Cntl_variant( cntl ) == FLA_UNBLOCKED_VARIANT2 )
53 {
55 }
56 else if ( FLA_Cntl_variant( cntl ) == FLA_UNB_OPT_VARIANT2 )
57 {
59 }
60 else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT2 )
61 {
62 r_val = FLA_LQ_UT_blk_var2( A, T, cntl );
63 }
64 else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT3 )
65 {
66 r_val = FLA_LQ_UT_blk_var3( A, T, cntl );
67 }
68 else
69 {
71 }
72 }
73
74 return r_val;
75}
FLA_Bool FLASH_Queue_get_enabled(void)
Definition FLASH_Queue.c:171
FLA_Error FLA_LQ_UT_blk_var1(FLA_Obj A, FLA_Obj T, fla_lqut_t *cntl)
Definition FLA_LQ_UT_blk_var1.c:13
FLA_Error FLA_LQ_UT_blk_var2(FLA_Obj A, FLA_Obj T, fla_lqut_t *cntl)
Definition FLA_LQ_UT_blk_var2.c:13
FLA_Error FLA_LQ_UT_blk_var3(FLA_Obj A, FLA_Obj TW, fla_lqut_t *cntl)
Definition FLA_LQ_UT_blk_var3.c:13
FLA_Error FLA_LQ_UT_internal_check(FLA_Obj A, FLA_Obj T, fla_lqut_t *cntl)
Definition FLA_LQ_UT_internal_check.c:13
FLA_Error FLA_LQ_UT_opt_var1(FLA_Obj A, FLA_Obj t)
Definition FLA_LQ_UT_opt_var1.c:13
FLA_Error FLA_LQ_UT_opt_var2(FLA_Obj A, FLA_Obj T)
Definition FLA_LQ_UT_opt_var2.c:13
FLA_Error FLA_LQ_UT_unb_var1(FLA_Obj A, FLA_Obj t)
Definition FLA_LQ_UT_unb_var1.c:13
FLA_Error FLA_LQ_UT_unb_var2(FLA_Obj A, FLA_Obj T)
Definition FLA_LQ_UT_unb_var2.c:13
FLA_Error FLA_LQ_UT_macro_task(FLA_Obj A, FLA_Obj T, fla_lqut_t *cntl)
Definition FLA_LQ_UT_macro_task.c:15

References FLA_Check_error_level(), FLA_LQ_UT_blk_var1(), FLA_LQ_UT_blk_var2(), FLA_LQ_UT_blk_var3(), FLA_LQ_UT_internal_check(), FLA_LQ_UT_macro_task(), FLA_LQ_UT_opt_var1(), FLA_LQ_UT_opt_var2(), FLA_LQ_UT_unb_var1(), FLA_LQ_UT_unb_var2(), FLASH_Queue_get_enabled(), and i.

Referenced by FLA_LQ_UT(), FLA_LQ_UT_blk_var1(), FLA_LQ_UT_blk_var2(), FLA_LQ_UT_blk_var3(), FLA_LQ_UT_macro_task(), FLA_LQ_UT_task(), and FLASH_LQ_UT().

◆ FLA_LQ_UT_recover_tau()

FLA_Error FLA_LQ_UT_recover_tau ( FLA_Obj  T,
FLA_Obj  tau 
)
14{
15 return FLA_QR_UT_recover_tau( T, t );
16}
FLA_Error FLA_QR_UT_recover_tau(FLA_Obj T, FLA_Obj tau)
Definition FLA_QR_UT_recover_tau.c:15

References FLA_QR_UT_recover_tau(), and i.

◆ FLA_LQ_UT_solve()

FLA_Error FLA_LQ_UT_solve ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  B,
FLA_Obj  X 
)
14{
15 FLA_Obj W;
16 FLA_Obj AL, AR;
17 FLA_Obj XT, XB;
18
19 // Check parameters.
22
24
26 FLA_Part_2x1( X, &XT,
27 &XB, FLA_Obj_length( B ), FLA_TOP );
28
30
33
35
37 A, T, W, X );
38
39 FLA_Obj_free( &W );
40
41 return FLA_SUCCESS;
42}
FLA_Error FLA_Apply_Q_UT_create_workspace(FLA_Obj T, FLA_Obj B, FLA_Obj *W)
Definition FLA_Apply_Q_UT_create_workspace.c:13
FLA_Error FLA_LQ_UT_solve_check(FLA_Obj A, FLA_Obj T, FLA_Obj B, FLA_Obj X)
Definition FLA_LQ_UT_solve_check.c:13
FLA_Error FLA_Copy_external(FLA_Obj A, FLA_Obj B)
Definition FLA_Copy_external.c:13
FLA_Error FLA_Trsm_external(FLA_Side side, FLA_Uplo uplo, FLA_Trans trans, FLA_Diag diag, FLA_Obj alpha, FLA_Obj A, FLA_Obj B)
Definition FLA_Trsm_external.c:13
FLA_Obj FLA_ZERO
Definition FLA_Init.c:20
FLA_Obj FLA_ONE
Definition FLA_Init.c:18
FLA_Error FLA_Apply_Q_UT(FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj A, FLA_Obj T, FLA_Obj W, FLA_Obj B)
Definition FLA_Apply_Q_UT.c:16
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
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition FLA_Obj.c:588
FLA_Error FLA_Set(FLA_Obj alpha, FLA_Obj A)
Definition FLA_Set.c:13
Definition FLA_type_defs.h:159

References FLA_Apply_Q_UT(), FLA_Apply_Q_UT_create_workspace(), FLA_Check_error_level(), FLA_Copy_external(), FLA_LQ_UT_solve_check(), FLA_Obj_free(), FLA_Obj_length(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x1(), FLA_Set(), FLA_Trsm_external(), FLA_ZERO, and i.

◆ FLASH_LQ_UT()

FLA_Error FLASH_LQ_UT ( FLA_Obj  A,
FLA_Obj  TW 
)
17{
20
21 // Check parameters.
24
25 // *** The current hierarchical LQ_UT algorithm assumes that the matrix
26 // has a hierarchical depth of 1. We check for that here, because we
27 // anticipate that we'll use a more general algorithm in the future, and
28 // we don't want to forget to remove the constraint. ***
29 if ( FLASH_Obj_depth( A ) != 1 )
30 {
31 FLA_Print_message( "FLASH_LQ_UT() currently only supports matrices of depth 1",
33 FLA_Abort();
34 }
35
36 // Inspect the length of TTL to get the blocksize used by the LQ
37 // factorization, which will be our inner blocksize for Apply_Q_UT.
40
41 // The traditional (non-incremental) LQ_UT algorithm-by-blocks requires
42 // that the algorithmic blocksize be equal to the storage blocksize.
43 if ( b_alg != b_flash )
44 {
45 FLA_Print_message( "FLASH_LQ_UT() requires that b_alg == b_store",
47 FLA_Abort();
48 }
49
50 // The traditional (non-incremental) LQ_UT algorithm-by-blocks requires
51 // that min_dim(A) % b_flash == 0.
52 if ( FLASH_Obj_scalar_min_dim( A ) % b_flash != 0 )
53 {
54 FLA_Print_message( "FLASH_LQ_UT() requires that min_dim( A ) %% b_store == 0",
56 FLA_Abort();
57 }
58
59 // Begin a parallel region.
61
62 // Invoke FLA_LQ_UT_internal() with hierarchical control tree.
64
65 // End the parallel region.
67
68 return r_val;
69}
fla_lqut_t * flash_lqut_cntl
Definition FLASH_LQ_UT_cntl_init.c:16
void FLASH_Queue_begin(void)
Definition FLASH_Queue.c:59
void FLASH_Queue_end(void)
Definition FLASH_Queue.c:81
dim_t FLASH_Obj_scalar_length_tl(FLA_Obj H)
Definition FLASH_View.c:723
dim_t FLASH_Obj_depth(FLA_Obj H)
Definition FLASH_Obj.c:20
dim_t FLASH_Obj_scalar_min_dim(FLA_Obj H)
Definition FLASH_View.c:675
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

References FLA_Abort(), FLA_Check_error_level(), FLA_LQ_UT_check(), FLA_LQ_UT_internal(), FLA_Print_message(), flash_lqut_cntl, FLASH_Obj_depth(), FLASH_Obj_scalar_length_tl(), FLASH_Obj_scalar_min_dim(), FLASH_Obj_scalar_width_tl(), FLASH_Queue_begin(), FLASH_Queue_end(), and i.

◆ FLASH_LQ_UT_create_hier_matrices()

FLA_Error FLASH_LQ_UT_create_hier_matrices ( FLA_Obj  A_flat,
dim_t  depth,
dim_t b_flash,
FLA_Obj A,
FLA_Obj TW 
)
14{
15 FLA_Datatype datatype;
16 dim_t m, n;
18
19 // *** The current LQ_UT 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_LQ_UT() 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 // Query the minimum dimension of A_flat.
38
39 // Set the m and n dimensions of TW to be min_m_n.
40 m = min_m_n;
41 n = min_m_n;
42
43 // Create hierarchical matrices T and W.
44 FLASH_Obj_create_ext( datatype, m, n,
46 TW );
47
48 return FLA_SUCCESS;
49}
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

References FLA_Abort(), FLA_Obj_datatype(), FLA_Obj_min_dim(), FLA_Print_message(), FLASH_Obj_create_ext(), FLASH_Obj_create_hier_copy_of_flat(), and i.

◆ FLASH_LQ_UT_solve()

FLA_Error FLASH_LQ_UT_solve ( FLA_Obj  A,
FLA_Obj  T,
FLA_Obj  B,
FLA_Obj  X 
)
14{
15 FLA_Obj W;
16 FLA_Obj AL, AR;
17 FLA_Obj XT, XB;
18
19 // Check parameters.
22
24
26 FLA_Part_2x1( X, &XT,
27 &XB, FLA_Obj_length( B ), FLA_TOP );
28
29 FLASH_Copy( B, XT );
30
33
35
37 A, T, W, X );
38
39 FLASH_Obj_free( &W );
40
41 return FLA_SUCCESS;
42}
FLA_Error FLASH_Copy(FLA_Obj A, FLA_Obj B)
Definition FLASH_Copy.c:15
FLA_Error FLASH_Trsm(FLA_Side side, FLA_Uplo uplo, FLA_Trans trans, FLA_Diag diag, FLA_Obj alpha, FLA_Obj A, FLA_Obj B)
Definition FLASH_Trsm.c:15
FLA_Error FLASH_Apply_Q_UT(FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev, FLA_Obj A, FLA_Obj T, FLA_Obj W, FLA_Obj B)
Definition FLASH_Apply_Q_UT.c:16
void FLASH_Obj_free(FLA_Obj *H)
Definition FLASH_Obj.c:638
FLA_Error FLASH_Set(FLA_Obj alpha, FLA_Obj H)
Definition FLASH_Set.c:13
FLA_Error FLASH_Apply_Q_UT_create_workspace(FLA_Obj TW, FLA_Obj B, FLA_Obj *W)
Definition FLASH_Apply_Q_UT_create_workspace.c:13

References FLA_Check_error_level(), FLA_LQ_UT_solve_check(), FLA_Obj_length(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x1(), FLA_ZERO, FLASH_Apply_Q_UT(), FLASH_Apply_Q_UT_create_workspace(), FLASH_Copy(), FLASH_Obj_free(), FLASH_Set(), FLASH_Trsm(), and i.