libflame revision_anchor
Functions
FLA_Fill_with_logarithmic_dist.c File Reference

(r)

Functions

FLA_Error FLA_Fill_with_logarithmic_dist (FLA_Obj alpha, FLA_Obj x)
 

Function Documentation

◆ FLA_Fill_with_logarithmic_dist()

FLA_Error FLA_Fill_with_logarithmic_dist ( FLA_Obj  alpha,
FLA_Obj  x 
)
14{
15 FLA_Obj lT, l0,
16 lB, lambda1,
17 l2;
18 FLA_Obj l, k, alpha2;
20 dim_t n_x;
21
22
25
28
29 // Create a local counter to increment as we create the distribution.
30 FLA_Obj_create( dt_real, 1, 1, 0, 0, &k );
31
32 // Create a local vector l. We will work with this vector, which is
33 // the same length as x, so that we can use vertical partitioning.
34 FLA_Obj_create( dt_real, n_x, 1, 0, 0, &l );
35
36 // Create a local real scalar alpha2 of the same precision as
37 // alpha. Then copy alpha to alpha2, which will convert the
38 // complex value to real, if necessary (ie: if alpha is complex).
39 FLA_Obj_create( dt_real, 1, 1, 0, 0, &alpha2 );
41
42 // Initialize k to 0.
43 FLA_Set( FLA_ZERO, k );
44
45 FLA_Part_2x1( l, &lT,
46 &lB, 0, FLA_TOP );
47
48 while ( FLA_Obj_length( lB ) > 0 )
49 {
51 /* ** */ /* ******* */
52 &lambda1,
53 lB, &l2, 1, FLA_BOTTOM );
54
55 /*------------------------------------------------------------*/
56
57 // lambda1 = alpha^k;
59
60 // k = k + 1;
62
63 /*------------------------------------------------------------*/
64
66 lambda1,
67 /* ** */ /* ******* */
68 &lB, l2, FLA_TOP );
69 }
70
71 // Normalize by last element.
72 FLA_Part_2x1( l, &lT,
73 &lB, 1, FLA_BOTTOM );
74 FLA_Inv_scal( lB, l );
75
76 // Overwrite x with the distribution we created in l.
77 FLA_Copy( l, x );
78
79 FLA_Obj_free( &l );
80 FLA_Obj_free( &k );
82
83 return FLA_SUCCESS;
84}
FLA_Error FLA_Fill_with_logarithmic_dist_check(FLA_Obj alpha, FLA_Obj x)
Definition FLA_Fill_with_logarithmic_dist_check.c:13
FLA_Error FLA_Copy(FLA_Obj A, FLA_Obj B)
Definition FLA_Copy.c:15
FLA_Error FLA_Inv_scal(FLA_Obj alpha, FLA_Obj A)
Definition FLA_Inv_scal.c:13
FLA_Obj FLA_ZERO
Definition FLA_Init.c:20
FLA_Obj FLA_ONE
Definition FLA_Init.c:18
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
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
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
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_Datatype FLA_Obj_datatype_proj_to_real(FLA_Obj A)
Definition FLA_Query.c:23
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition FLA_Obj.c:588
dim_t FLA_Obj_vector_dim(FLA_Obj obj)
Definition FLA_Query.c:137
int FLA_Datatype
Definition FLA_type_defs.h:49
unsigned long dim_t
Definition FLA_type_defs.h:71
FLA_Error FLA_Pow(FLA_Obj base, FLA_Obj exp, FLA_Obj btoe)
Definition FLA_Pow.c:13
FLA_Error FLA_Mult_add(FLA_Obj alpha, FLA_Obj beta, FLA_Obj gamma)
Definition FLA_Mult_add.c:13
FLA_Error FLA_Set(FLA_Obj alpha, FLA_Obj A)
Definition FLA_Set.c:13
int i
Definition bl1_axmyv2.c:145
double *restrict alpha2
Definition bl1_dotv2axpyv2b.c:188
Definition FLA_type_defs.h:159

References alpha2, FLA_Check_error_level(), FLA_Cont_with_3x1_to_2x1(), FLA_Copy(), FLA_Fill_with_logarithmic_dist_check(), FLA_Inv_scal(), FLA_Mult_add(), FLA_Obj_create(), FLA_Obj_datatype_proj_to_real(), FLA_Obj_free(), FLA_Obj_length(), FLA_Obj_vector_dim(), FLA_ONE, FLA_Part_2x1(), FLA_Pow(), FLA_Repart_2x1_to_3x1(), FLA_Set(), FLA_ZERO, and i.