libflame revision_anchor
Functions
FLA_Fill_with_cluster_dist.c File Reference

(r)

Functions

FLA_Error FLA_Fill_with_cluster_dist (FLA_Obj n_clusters, FLA_Obj cluster_width, FLA_Obj x)
 

Function Documentation

◆ FLA_Fill_with_cluster_dist()

FLA_Error FLA_Fill_with_cluster_dist ( FLA_Obj  n_clusters,
FLA_Obj  cluster_width,
FLA_Obj  x 
)
14{
15 FLA_Obj lT, l0,
16 lB, l1,
17 l2;
19 lT_last;
20 FLA_Obj l, k;
22 dim_t n_x;
23 int nc;
24 int n_regions;
25 int region_width;
27
28
31
34
36 n_regions = 2 * nc;
39
40 // Create a local counter to increment as we create the distribution.
41 FLA_Obj_create( dt_real, 1, 1, 0, 0, &k );
42
43 // Create a local vector l. We will work with this vector, which is
44 // the same length as x, so that we can use vertical partitioning.
45 FLA_Obj_create( dt_real, n_x, 1, 0, 0, &l );
46
47 // Initialize k to 1.
48 FLA_Set( FLA_ZERO, k );
49
50 FLA_Part_2x1( l, &lT,
51 &lB, 0, FLA_TOP );
52
54 {
56 /* ** */ /* ******* */
57 &l1,
59
60 /*------------------------------------------------------------*/
61
63
64 /*------------------------------------------------------------*/
65
67 l1,
68 /* ** */ /* ******* */
69 &lB, l2, FLA_TOP );
70
71
73 &lT_last, 1, FLA_BOTTOM );
74 FLA_Copy( lT_last, k );
75
76
78 /* ** */ /* ******* */
79 &l1,
81
82 /*------------------------------------------------------------*/
83
86
87 /*------------------------------------------------------------*/
88
90 l1,
91 /* ** */ /* ******* */
92 &lB, l2, FLA_TOP );
93
95 &lT_last, 1, FLA_BOTTOM );
96 FLA_Copy( lT_last, k );
98 }
99
100 if ( leftover_width > 0 )
102
103 // Normalize by last element.
104 //FLA_Part_2x1( l, &lT,
105 // &lB, 1, FLA_BOTTOM );
106 //FLA_Inv_scal( lB, l );
107
108 // Overwrite x with the distribution we created in l.
109 FLA_Copy( l, x );
110
111 FLA_Obj_free( &l );
112 FLA_Obj_free( &k );
113
114 return FLA_SUCCESS;
115}
FLA_Error FLA_Fill_with_cluster_dist_check(FLA_Obj n_clusters, FLA_Obj cluster_width, FLA_Obj x)
Definition FLA_Fill_with_cluster_dist_check.c:13
FLA_Error FLA_Copy(FLA_Obj A, FLA_Obj B)
Definition FLA_Copy.c:15
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_Fill_with_random_dist(FLA_Obj shift, FLA_Obj max, FLA_Obj x)
Definition FLA_Fill_with_random_dist.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
FLA_Error FLA_Fill_with_linear_dist(FLA_Obj shift, FLA_Obj delta, FLA_Obj x)
Definition FLA_Fill_with_linear_dist.c:13
FLA_Error FLA_Sort(FLA_Direct direct, FLA_Obj x)
Definition FLA_Sort.c:18
int i
Definition bl1_axmyv2.c:145
Definition FLA_type_defs.h:159

References FLA_Check_error_level(), FLA_Cont_with_3x1_to_2x1(), FLA_Copy(), FLA_Fill_with_cluster_dist_check(), FLA_Fill_with_linear_dist(), FLA_Fill_with_random_dist(), 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_Repart_2x1_to_3x1(), FLA_Set(), FLA_Sort(), FLA_ZERO, and i.