libflame revision_anchor
Functions
FLASH_util_prototypes.h File Reference

(r)

Go to the source code of this file.

Functions

double FLASH_Max_elemwise_diff (FLA_Obj A, FLA_Obj B)
 
FLA_Error FLASH_Random_matrix (FLA_Obj H)
 
FLA_Error FLASH_Random_spd_matrix (FLA_Uplo uplo, FLA_Obj H)
 
FLA_Error FLASH_Norm1 (FLA_Obj H, FLA_Obj norm)
 
FLA_Error FLASH_Obj_shift_diagonal (FLA_Conj conj, FLA_Obj sigma, FLA_Obj H)
 
FLA_Error FLASH_Set (FLA_Obj alpha, FLA_Obj H)
 
FLA_Error FLASH_Obj_create_diag_panel (FLA_Obj A, FLA_Obj *U)
 
FLA_Error FLASH_LU_find_zero_on_diagonal (FLA_Obj A)
 
FLA_Error FLASH_Triangularize (FLA_Uplo uplo, FLA_Diag diag, FLA_Obj A)
 
FLA_Error FLASH_Hermitianize (FLA_Uplo uplo, FLA_Obj A)
 
FLA_Error FLASH_LU_find_zero_on_diagonal_check (FLA_Obj A)
 

Function Documentation

◆ FLASH_Hermitianize()

FLA_Error FLASH_Hermitianize ( FLA_Uplo  uplo,
FLA_Obj  A 
)
14{
17
18 // Exit early if one dimension is zero.
19 if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
20
21 // Create a temporary flat copy of the hierarchical object.
23
24 // Hermitianize the flat matrix object as specified by uplo.
25 r_val = FLA_Hermitianize( uplo, A_flat );
26
27 // Copy the flat object's contents back to the hierarchical object.
29
30 // Free the temporary flat object.
32
33 return r_val;
34}
FLA_Error FLASH_Obj_create_flat_copy_of_hier(FLA_Obj H, FLA_Obj *F)
Definition FLASH_Obj.c:623
FLA_Error FLASH_Obj_hierarchify(FLA_Obj F, FLA_Obj H)
Definition FLASH_Obj.c:773
FLA_Bool FLA_Obj_has_zero_dim(FLA_Obj A)
Definition FLA_Query.c:400
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition FLA_Obj.c:588
int FLA_Error
Definition FLA_type_defs.h:47
FLA_Error FLA_Hermitianize(FLA_Uplo uplo, FLA_Obj A)
Definition FLA_Hermitianize.c:13
int i
Definition bl1_axmyv2.c:145
Definition FLA_type_defs.h:159

References FLA_Hermitianize(), FLA_Obj_free(), FLA_Obj_has_zero_dim(), FLASH_Obj_create_flat_copy_of_hier(), and FLASH_Obj_hierarchify().

◆ FLASH_LU_find_zero_on_diagonal()

FLA_Error FLASH_LU_find_zero_on_diagonal ( FLA_Obj  A)
14{
15 FLA_Obj ATL, ATR, A00, a01, A02,
17 A20, a21, A22;
18
20
23
24 if ( FLA_Obj_elemtype( A ) == FLA_SCALAR )
26
27 FLA_Part_2x2( A, &ATL, &ATR,
28 &ABL, &ABR, 0, 0, FLA_TL );
29
30 while ( FLA_Obj_length( ATL ) < FLA_Obj_min_dim( A ) ){
31
32 FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &a01, &A02,
33 /* ************* */ /* ************************** */
34 &a10t, /**/ &alpha11, &a12t,
35 ABL, /**/ ABR, &A20, /**/ &a21, &A22,
36 1, 1, FLA_BR );
37
38 /*------------------------------------------------------------*/
39
41
42 if ( e_val != FLA_SUCCESS )
44
45 /*------------------------------------------------------------*/
46
47 FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, a01, /**/ A02,
48 a10t, alpha11, /**/ a12t,
49 /* ************** */ /* ************************ */
50 &ABL, /**/ &ABR, A20, a21, /**/ A22,
51 FLA_TL );
52 }
53
54 return FLA_SUCCESS;
55}
FLA_Error FLASH_LU_find_zero_on_diagonal_check(FLA_Obj A)
Definition FLASH_LU_find_zero_on_diagonal_check.c:13
dim_t FLASH_Obj_scalar_length(FLA_Obj H)
Definition FLASH_View.c:600
FLA_Error FLA_Cont_with_3x3_to_2x2(FLA_Obj *ATL, FLA_Obj *ATR, FLA_Obj A00, FLA_Obj A01, FLA_Obj A02, FLA_Obj A10, FLA_Obj A11, FLA_Obj A12, FLA_Obj *ABL, FLA_Obj *ABR, FLA_Obj A20, FLA_Obj A21, FLA_Obj A22, FLA_Quadrant quadrant)
Definition FLA_View.c:304
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
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
FLA_Error FLA_Repart_2x2_to_3x3(FLA_Obj ATL, FLA_Obj ATR, FLA_Obj *A00, FLA_Obj *A01, FLA_Obj *A02, FLA_Obj *A10, FLA_Obj *A11, FLA_Obj *A12, FLA_Obj ABL, FLA_Obj ABR, FLA_Obj *A20, FLA_Obj *A21, FLA_Obj *A22, dim_t mb, dim_t nb, FLA_Quadrant quadrant)
Definition FLA_View.c:142
FLA_Elemtype FLA_Obj_elemtype(FLA_Obj obj)
Definition FLA_Query.c:51
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition FLA_Query.c:153
FLA_Error FLA_LU_find_zero_on_diagonal(FLA_Obj A)
Definition FLA_LU_find_zero_on_diagonal.c:13

References FLA_Check_error_level(), FLA_Cont_with_3x3_to_2x2(), FLA_LU_find_zero_on_diagonal(), FLA_Obj_elemtype(), FLA_Obj_length(), FLA_Obj_min_dim(), FLA_Part_2x2(), FLA_Repart_2x2_to_3x3(), FLASH_LU_find_zero_on_diagonal_check(), and FLASH_Obj_scalar_length().

Referenced by FLASH_LU_nopiv(), and FLASH_LU_piv().

◆ FLASH_LU_find_zero_on_diagonal_check()

FLA_Error FLASH_LU_find_zero_on_diagonal_check ( FLA_Obj  A)
14{
16
19
22
23 return FLA_SUCCESS;
24}
FLA_Error FLA_Check_nonconstant_object(FLA_Obj A)
Definition FLA_Check.c:954
FLA_Error FLA_Check_floating_object(FLA_Obj A)
Definition FLA_Check.c:232

References FLA_Check_floating_object(), and FLA_Check_nonconstant_object().

Referenced by FLASH_LU_find_zero_on_diagonal().

◆ FLASH_Max_elemwise_diff()

double FLASH_Max_elemwise_diff ( FLA_Obj  A,
FLA_Obj  B 
)
14{
16 double max_diff;
17
18 // Exit early if one dimension is zero.
19 if ( FLA_Obj_has_zero_dim( A ) ) return -1.0;
20
21 // Create a temporary flat copy of the hierarchical objects.
24
25 // Get the maximum element-wise diff.
27
28 // Free the temporary flat objects.
31
32 return max_diff;
33}
double FLA_Max_elemwise_diff(FLA_Obj A, FLA_Obj B)
Definition FLA_Max_elemwise_diff.c:13

References FLA_Max_elemwise_diff(), FLA_Obj_free(), FLA_Obj_has_zero_dim(), and FLASH_Obj_create_flat_copy_of_hier().

◆ FLASH_Norm1()

FLA_Error FLASH_Norm1 ( FLA_Obj  H,
FLA_Obj  norm 
)
14{
15 FLA_Obj F;
16
17 // Exit early if one dimension is zero.
18 if ( FLA_Obj_has_zero_dim( H ) )
19 {
21 return FLA_SUCCESS;
22 }
23
24 // Create a temporary flat copy of the hierarchical object.
26
27 // Compute the 1-norm of F and store it in norm.
28 FLA_Norm1( F, norm );
29
30 // Free the temporary flat object.
31 FLA_Obj_free( &F );
32
33 return FLA_SUCCESS;
34}
FLA_Obj FLA_ZERO
Definition FLA_Init.c:20
FLA_Error FLA_Norm1(FLA_Obj A, FLA_Obj norm)
Definition FLA_Norm1.c:13
FLA_Error FLA_Set(FLA_Obj alpha, FLA_Obj A)
Definition FLA_Set.c:13

References FLA_Norm1(), FLA_Obj_free(), FLA_Obj_has_zero_dim(), FLA_Set(), FLA_ZERO, and FLASH_Obj_create_flat_copy_of_hier().

◆ FLASH_Obj_create_diag_panel()

FLA_Error FLASH_Obj_create_diag_panel ( FLA_Obj  A,
FLA_Obj U 
)
14{
15 FLA_Datatype datatype;
19 dim_t m_U, n_U;
20
21 // Acquire the datatype of the matrix to be factored.
22 datatype = FLA_Obj_datatype( A );
23
24 // Acquire the storage blocksize of the top-left element.
26
27 // Get the number of storage blocks in the minimum dimension of A.
29
30 // Compute the scalar length and width of U.
31 m_U = b_flash;
33
34 // Create U with storage blocksize of b_flash.
35 FLASH_Obj_create( datatype, m_U, n_U, 1, &b_flash, U );
36
37 // The last, bottom-right-most diagonal block of A might be smaller
38 // than the other diagonal blocks. Compute the size of this block.
40
41 // If the remainder is zero, then A does not need its last block
42 // shrunk and thus it is ready as-is. However, if b_flash_last is
43 // non-zero, then we must manually adjust the size of the last block of
44 // U. Note that we are not freeing and re-allocating memory, just
45 // changing the size of the view into the last block.
46
47 if ( b_flash_last > 0 )
48 {
49 FLA_Obj UL, UR;
51 URBL, URBR;
53
54 // Repartition U so we can access the last block object.
55 FLA_Part_1x2( *U, &UL, &UR, 1, FLA_RIGHT );
56
57 // Dereference the 1x1 object reference to get a pointer to
58 // the actual block object in U.
60
61 // Repartition the last block object so that URTL is the
62 // correct size.
66
67 // Overwrite the original object pointed to by UR_p with the
68 // corrected object URTL.
69 *UR_p = URTL;
70 }
71
72 return FLA_SUCCESS;
73}
dim_t FLASH_Obj_scalar_length_tl(FLA_Obj H)
Definition FLASH_View.c:723
FLA_Error FLASH_Obj_create(FLA_Datatype datatype, dim_t m, dim_t n, dim_t depth, dim_t *b_mn, FLA_Obj *H)
Definition FLASH_Obj.c:143
dim_t FLASH_Obj_scalar_min_dim(FLA_Obj H)
Definition FLASH_View.c:675
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_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_datatype(), FLA_Obj_min_dim(), FLA_Part_1x2(), FLA_Part_2x2(), FLASH_Obj_create(), FLASH_Obj_scalar_length_tl(), and FLASH_Obj_scalar_min_dim().

Referenced by FLASH_LU_incpiv_opt1(), and FLASH_QR_UT_inc_opt1().

◆ FLASH_Obj_shift_diagonal()

FLA_Error FLASH_Obj_shift_diagonal ( FLA_Conj  conj,
FLA_Obj  sigma,
FLA_Obj  H 
)

◆ FLASH_Random_matrix()

FLA_Error FLASH_Random_matrix ( FLA_Obj  H)
14{
15 FLA_Obj F;
16
17 // Exit early if one dimension is zero.
18 if ( FLA_Obj_has_zero_dim( H ) ) return FLA_SUCCESS;
19
20 // Create a temporary flat copy of the hierarchical object.
22
23 // Randomize the flat matrix object.
25
26 // Copy the flat object's contents back to the hierarchical object.
28
29 // Free the temporary flat object.
30 FLA_Obj_free( &F );
31
32 return FLA_SUCCESS;
33}
FLA_Error FLA_Random_matrix(FLA_Obj A)
Definition FLA_Random_matrix.c:13

References FLA_Obj_free(), FLA_Obj_has_zero_dim(), FLA_Random_matrix(), FLASH_Obj_create_flat_copy_of_hier(), and FLASH_Obj_hierarchify().

◆ FLASH_Random_spd_matrix()

FLA_Error FLASH_Random_spd_matrix ( FLA_Uplo  uplo,
FLA_Obj  H 
)
14{
15 FLA_Obj F;
17
19 {
22 }
23
24 // Exit early if one dimension is zero.
25 if ( FLA_Obj_has_zero_dim( H ) ) return FLA_SUCCESS;
26
27 // Create a temporary flat copy of the hierarchical object.
29
30 // Randomize the flat matrix object to be SPD.
31 FLA_Random_spd_matrix( uplo, F );
32
33 // Copy the flat object's contents back to the hierarchical object.
35
36 // Free the temporary flat object.
37 FLASH_Obj_free( &F );
38
39 return FLA_SUCCESS;
40}
void FLASH_Obj_free(FLA_Obj *H)
Definition FLASH_Obj.c:638
FLA_Error FLA_Check_valid_uplo(FLA_Uplo uplo)
Definition FLA_Check.c:76
FLA_Error FLA_Random_spd_matrix(FLA_Uplo uplo, FLA_Obj A)
Definition FLA_Random_spd_matrix.c:13

References FLA_Check_error_level(), FLA_Check_valid_uplo(), FLA_Obj_has_zero_dim(), FLA_Random_spd_matrix(), FLASH_Obj_create_flat_copy_of_hier(), FLASH_Obj_free(), and FLASH_Obj_hierarchify().

◆ FLASH_Set()

FLA_Error FLASH_Set ( FLA_Obj  alpha,
FLA_Obj  H 
)
14{
15 FLA_Obj F;
16
17 // Exit early if one dimension is zero.
18 if ( FLA_Obj_has_zero_dim( H ) ) return FLA_SUCCESS;
19
20 // Create a temporary flat copy of the hierarchical object.
22
23 // Scale the flat matrix object by alpha.
24 FLA_Set( alpha, F );
25
26 // Copy the flat object's contents back to the hierarchical object.
28
29 // Free the temporary flat object.
30 FLA_Obj_free( &F );
31
32 return FLA_SUCCESS;
33}

References FLA_Obj_free(), FLA_Obj_has_zero_dim(), FLA_Set(), FLASH_Obj_create_flat_copy_of_hier(), and FLASH_Obj_hierarchify().

Referenced by FLASH_LQ_UT_solve().

◆ FLASH_Triangularize()

FLA_Error FLASH_Triangularize ( FLA_Uplo  uplo,
FLA_Diag  diag,
FLA_Obj  A 
)
14{
17
18 // Exit early if one dimension is zero.
19 if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
20
21 // Create a temporary flat copy of the hierarchical object.
23
24 // Triangularize the flat matrix object as specified by uplo and diag.
26
27 // Copy the flat object's contents back to the hierarchical object.
29
30 // Free the temporary flat object.
32
33 return r_val;
34}
FLA_Error FLA_Triangularize(FLA_Uplo uplo, FLA_Diag diag, FLA_Obj A)
Definition FLA_Triangularize.c:13

References FLA_Obj_free(), FLA_Obj_has_zero_dim(), FLA_Triangularize(), FLASH_Obj_create_flat_copy_of_hier(), and FLASH_Obj_hierarchify().