libflame revision_anchor
Functions
FLA_Fill_with_geometric_dist.c File Reference

(r)

Functions

FLA_Error FLA_Fill_with_geometric_dist (FLA_Obj alpha, FLA_Obj x)
 

Function Documentation

◆ FLA_Fill_with_geometric_dist()

FLA_Error FLA_Fill_with_geometric_dist ( FLA_Obj  alpha,
FLA_Obj  x 
)
14{
15 FLA_Obj lT, l0,
16 lB, lambda1,
17 l2;
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 // Create a temporary scalar.
43 FLA_Obj_create( dt_real, 1, 1, 0, 0, &temp );
44
45 // Initialize k to 0.
46 FLA_Set( FLA_ZERO, k );
47
48 FLA_Part_2x1( l, &lT,
49 &lB, 0, FLA_TOP );
50
51 while ( FLA_Obj_length( lB ) > 0 )
52 {
54 /* ** */ /* ******* */
55 &lambda1,
56 lB, &l2, 1, FLA_BOTTOM );
57
58 /*------------------------------------------------------------*/
59
60 // lambda1 = alpha * (1 - alpha)^k;
63 FLA_Pow( temp, k, lambda1 );
65
66 // k = k + 1;
68
69 /*------------------------------------------------------------*/
70
72 lambda1,
73 /* ** */ /* ******* */
74 &lB, l2, FLA_TOP );
75 }
76
77 // Normalize by first element.
78 //FLA_Part_2x1( l, &lT,
79 // &lB, 1, FLA_TOP );
80 //FLA_Inv_scal( lT, l );
81
82 // Overwrite x with the distribution we created in l.
83 // If x is complex, then this is where the conversion between
84 // datatypes happens.
85 FLA_Copy( l, x );
86
87 FLA_Obj_free( &l );
88 FLA_Obj_free( &k );
91
92 return FLA_SUCCESS;
93}
FLA_Error FLA_Fill_with_geometric_dist_check(FLA_Obj alpha, FLA_Obj x)
Definition FLA_Fill_with_geometric_dist_check.c:13
FLA_Error FLA_Copy(FLA_Obj A, FLA_Obj B)
Definition FLA_Copy.c:15
FLA_Error FLA_Scal(FLA_Obj alpha, FLA_Obj A)
Definition FLA_Scal.c:15
FLA_Obj FLA_MINUS_ONE
Definition FLA_Init.c:22
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
dcomplex temp
Definition bl1_axpyv2b.c:301
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_geometric_dist_check(), FLA_MINUS_ONE, 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_Scal(), FLA_Set(), FLA_ZERO, i, and temp.