libflame revision_anchor
FLA_Random_spd_matrix.c File Reference

(r)

Functions

FLA_Error FLA_Random_spd_matrix (FLA_Uplo uplo, FLA_Obj A)
 

Function Documentation

◆ FLA_Random_spd_matrix()

FLA_Error FLA_Random_spd_matrix ( FLA_Uplo uplo,
FLA_Obj A )
14{
15 FLA_Obj R;
16
17 if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
19
20 // Create a temporary object R conformal to A.
21 FLA_Obj_create_conf_to( FLA_NO_TRANSPOSE, A, &R );
22
23 // Randomize R to be an uplo-triangular matrix. Note that the diagonal of R
24 // needs to be positive to ensure that R * R' is SPD/HPD.
25 FLA_Random_tri_matrix( uplo, FLA_NONUNIT_DIAG, R );
26
27 if ( uplo == FLA_LOWER_TRIANGULAR )
28 {
29 // A = R * R';
30 FLA_Herk_external( uplo, FLA_NO_TRANSPOSE, FLA_ONE, R, FLA_ZERO, A );
31 }
32 else // if ( uplo == FLA_UPPER_TRIANGULAR )
33 {
34 // A = R' * R;
35 FLA_Herk_external( uplo, FLA_CONJ_TRANSPOSE, FLA_ONE, R, FLA_ZERO, A );
36 }
37
38 // Free R.
39 FLA_Obj_free( &R );
40
41 return FLA_SUCCESS;
42}
FLA_Error FLA_Random_spd_matrix_check(FLA_Uplo uplo, FLA_Obj A)
Definition FLA_Random_spd_matrix_check.c:13
FLA_Error FLA_Herk_external(FLA_Uplo uplo, FLA_Trans trans, FLA_Obj alpha, FLA_Obj A, FLA_Obj beta, FLA_Obj C)
Definition FLA_Herk_external.c:13
FLA_Obj FLA_ZERO
Definition FLA_Init.c:20
FLA_Obj FLA_ONE
Definition FLA_Init.c:18
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
FLA_Error FLA_Obj_create_conf_to(FLA_Trans trans, FLA_Obj old, FLA_Obj *obj)
Definition FLA_Obj.c:286
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition FLA_Obj.c:588
FLA_Error FLA_Random_tri_matrix(FLA_Uplo uplo, FLA_Diag diag, FLA_Obj A)
Definition FLA_Random_tri_matrix.c:13
Definition FLA_type_defs.h:159

References FLA_Check_error_level(), FLA_Herk_external(), FLA_Obj_create_conf_to(), FLA_Obj_free(), FLA_ONE, FLA_Random_spd_matrix_check(), FLA_Random_tri_matrix(), and FLA_ZERO.

Referenced by FLASH_Random_spd_matrix().