libflame  revision_anchor
Functions
FLASH_Random_matrix.c File Reference

(r)

Functions

FLA_Error FLASH_Random_matrix (FLA_Obj H)
 

Function Documentation

◆ FLASH_Random_matrix()

FLA_Error FLASH_Random_matrix ( FLA_Obj  H)

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

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.
24  FLA_Random_matrix( F );
25 
26  // Copy the flat object's contents back to the hierarchical object.
27  FLASH_Obj_hierarchify( F, H );
28 
29  // Free the temporary flat object.
30  FLA_Obj_free( &F );
31 
32  return FLA_SUCCESS;
33 }
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition: FLA_Obj.c:588
FLA_Error FLASH_Obj_hierarchify(FLA_Obj F, FLA_Obj H)
Definition: FLASH_Obj.c:773
FLA_Error FLA_Random_matrix(FLA_Obj A)
Definition: FLA_Random_matrix.c:13
Definition: FLA_type_defs.h:158
FLA_Bool FLA_Obj_has_zero_dim(FLA_Obj A)
Definition: FLA_Query.c:400
FLA_Error FLASH_Obj_create_flat_copy_of_hier(FLA_Obj H, FLA_Obj *F)
Definition: FLASH_Obj.c:623