libflame revision_anchor
Functions
FLASH_Axpy_other.c File Reference

(r)

Functions

FLA_Error FLASH_Axpy_buffer_to_hier (FLA_Obj alpha, dim_t m, dim_t n, void *buffer, dim_t rs, dim_t cs, dim_t i, dim_t j, FLA_Obj H)
 
FLA_Error FLASH_Axpy_hier_to_buffer (FLA_Obj alpha, dim_t i, dim_t j, FLA_Obj H, dim_t m, dim_t n, void *buffer, dim_t rs, dim_t cs)
 
FLA_Error FLASH_Axpy_flat_to_hier (FLA_Obj alpha, FLA_Obj F, dim_t i, dim_t j, FLA_Obj H)
 
FLA_Error FLASH_Axpy_hier_to_flat (FLA_Obj alpha, dim_t i, dim_t j, FLA_Obj H, FLA_Obj F)
 
FLA_Error FLASH_Axpy_hierarchy (int direction, FLA_Obj alpha, FLA_Obj F, FLA_Obj *H)
 

Function Documentation

◆ FLASH_Axpy_buffer_to_hier()

FLA_Error FLASH_Axpy_buffer_to_hier ( FLA_Obj  alpha,
dim_t  m,
dim_t  n,
void buffer,
dim_t  rs,
dim_t  cs,
dim_t  i,
dim_t  j,
FLA_Obj  H 
)
14{
16 FLA_Datatype datatype;
18
20 {
23
26
27 e_val = FLA_Check_matrix_strides( m, n, rs, cs );
29
32 }
33
34 // Acquire the datatype from the hierarchical matrix object.
35 datatype = FLASH_Obj_datatype( H );
36
37 // Create a temporary conventional matrix object of the requested datatype
38 // and dimensions and attach the given buffer containing the incoming data.
40 FLA_Obj_attach_buffer( buffer, rs, cs, &flat_matrix );
41
42 // Recurse through H, adding in the corresponding elements of flat_matrix,
43 // starting at the (i,j) element offset.
45
46 // Free the object (but don't free the buffer!).
48
49 return FLA_SUCCESS;
50}
FLA_Error FLASH_Axpy_flat_to_hier(FLA_Obj alpha, FLA_Obj F, dim_t i, dim_t j, FLA_Obj H)
Definition FLASH_Axpy_other.c:93
FLA_Datatype FLASH_Obj_datatype(FLA_Obj H)
Definition FLASH_Obj.c:14
FLA_Error FLA_Check_matrix_strides(dim_t m, dim_t n, dim_t rs, dim_t cs)
Definition FLA_Check.c:1146
FLA_Error FLA_Check_if_scalar(FLA_Obj A)
Definition FLA_Check.c:373
FLA_Error FLA_Obj_create_without_buffer(FLA_Datatype datatype, dim_t m, dim_t n, FLA_Obj *obj)
Definition FLA_Obj.c:362
FLA_Error FLA_Obj_free_without_buffer(FLA_Obj *obj)
Definition FLA_Obj.c:615
FLA_Error FLA_Obj_attach_buffer(void *buffer, dim_t rs, dim_t cs, FLA_Obj *obj)
Definition FLA_Obj.c:522
FLA_Error FLA_Check_consistent_object_datatype(FLA_Obj A, FLA_Obj B)
Definition FLA_Check.c:339
FLA_Error FLA_Check_submatrix_dims_and_offset(dim_t m, dim_t n, dim_t i, dim_t j, FLA_Obj A)
Definition FLA_Check.c:834
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
int FLA_Error
Definition FLA_type_defs.h:47
int FLA_Datatype
Definition FLA_type_defs.h:49
int i
Definition bl1_axmyv2.c:145
Definition FLA_type_defs.h:159

References FLA_Check_consistent_object_datatype(), FLA_Check_error_level(), FLA_Check_if_scalar(), FLA_Check_matrix_strides(), FLA_Check_submatrix_dims_and_offset(), FLA_Obj_attach_buffer(), FLA_Obj_create_without_buffer(), FLA_Obj_free_without_buffer(), FLASH_Axpy_flat_to_hier(), FLASH_Obj_datatype(), and i.

◆ FLASH_Axpy_flat_to_hier()

FLA_Error FLASH_Axpy_flat_to_hier ( FLA_Obj  alpha,
FLA_Obj  F,
dim_t  i,
dim_t  j,
FLA_Obj  H 
)
94{
96 HBL, HBR;
99 dim_t m, n;
100
101 m = FLA_Obj_length( F );
102 n = FLA_Obj_width( F );
103
105 &HBL, &HBR, i, j, FLA_TL );
106
108 &HBR_bl, &HBR_br, m, n, FLA_TL );
109
111
113 &HBR_bl, &HBR_br );
114
116 &HBL, &HBR );
117
118 return FLA_SUCCESS;
119}
FLA_Error FLASH_Axpy_hierarchy(int direction, FLA_Obj alpha, FLA_Obj F, FLA_Obj *H)
Definition FLASH_Axpy_other.c:151
FLA_Error FLASH_Part_create_2x2(FLA_Obj A, FLA_Obj *ATL, FLA_Obj *ATR, FLA_Obj *ABL, FLA_Obj *ABR, dim_t n_rows, dim_t n_cols, FLA_Side side)
Definition FLASH_View.c:177
FLA_Error FLASH_Part_free_2x2(FLA_Obj *ATL, FLA_Obj *ATR, FLA_Obj *ABL, FLA_Obj *ABR)
Definition FLASH_View.c:589
dim_t FLA_Obj_width(FLA_Obj obj)
Definition FLA_Query.c:123
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
unsigned long dim_t
Definition FLA_type_defs.h:71

References FLA_Obj_length(), FLA_Obj_width(), FLASH_Axpy_hierarchy(), FLASH_Part_create_2x2(), FLASH_Part_free_2x2(), and i.

Referenced by FLASH_Axpy_buffer_to_hier().

◆ FLASH_Axpy_hier_to_buffer()

FLA_Error FLASH_Axpy_hier_to_buffer ( FLA_Obj  alpha,
dim_t  i,
dim_t  j,
FLA_Obj  H,
dim_t  m,
dim_t  n,
void buffer,
dim_t  rs,
dim_t  cs 
)
54{
56 FLA_Datatype datatype;
58
60 {
63
66
67 e_val = FLA_Check_matrix_strides( m, n, rs, cs );
69
72 }
73
74 // Acquire the datatype from the hierarchical matrix object.
75 datatype = FLASH_Obj_datatype( H );
76
77 // Create a temporary conventional matrix object of the requested datatype
78 // and dimensions and attach the given buffer containing the incoming data.
80 FLA_Obj_attach_buffer( buffer, rs, cs, &flat_matrix );
81
82 // Recurse through H, adding in the corresponding elements of flat_matrix,
83 // starting at the (i,j) element offset.
85
86 // Free the object (but don't free the buffer!).
88
89 return FLA_SUCCESS;
90}
FLA_Error FLASH_Axpy_hier_to_flat(FLA_Obj alpha, dim_t i, dim_t j, FLA_Obj H, FLA_Obj F)
Definition FLASH_Axpy_other.c:122

References FLA_Check_consistent_object_datatype(), FLA_Check_error_level(), FLA_Check_if_scalar(), FLA_Check_matrix_strides(), FLA_Check_submatrix_dims_and_offset(), FLA_Obj_attach_buffer(), FLA_Obj_create_without_buffer(), FLA_Obj_free_without_buffer(), FLASH_Axpy_hier_to_flat(), FLASH_Obj_datatype(), and i.

◆ FLASH_Axpy_hier_to_flat()

FLA_Error FLASH_Axpy_hier_to_flat ( FLA_Obj  alpha,
dim_t  i,
dim_t  j,
FLA_Obj  H,
FLA_Obj  F 
)
123{
124 FLA_Obj HTL, HTR,
125 HBL, HBR;
127 HBR_bl, HBR_br;
128 dim_t m, n;
129
130 m = FLA_Obj_length( F );
131 n = FLA_Obj_width( F );
132
134 &HBL, &HBR, i, j, FLA_TL );
135
137 &HBR_bl, &HBR_br, m, n, FLA_TL );
138
140
142 &HBR_bl, &HBR_br );
143
145 &HBL, &HBR );
146
147 return FLA_SUCCESS;
148}

References FLA_Obj_length(), FLA_Obj_width(), FLASH_Axpy_hierarchy(), FLASH_Part_create_2x2(), FLASH_Part_free_2x2(), and i.

Referenced by FLASH_Axpy_hier_to_buffer().

◆ FLASH_Axpy_hierarchy()

FLA_Error FLASH_Axpy_hierarchy ( int  direction,
FLA_Obj  alpha,
FLA_Obj  F,
FLA_Obj H 
)
152{
153 // Once we get down to a submatrix whose elements are scalars, we are down
154 // to our base case.
155 if ( FLA_Obj_elemtype( *H ) == FLA_SCALAR )
156 {
157 // Depending on which top-level function invoked us, we either axpy
158 // the source data in the flat matrix to the leaf-level submatrix of
159 // the hierarchical matrix, or axpy the data in the hierarchical
160 // submatrix to the flat matrix.
162 {
163#ifdef FLA_ENABLE_SCC
164 if ( FLA_is_owner() )
165#endif
167 }
168 else if ( direction == FLA_HIER_TO_FLAT )
169 {
170#ifdef FLA_ENABLE_SCC
171 if ( FLA_is_owner() )
172#endif
174 }
175 }
176 else
177 {
178 FLA_Obj HL, HR, H0, H1, H2;
179 FLA_Obj FL, FR, F0, F1, F2;
180
181 FLA_Obj H1T, H01,
182 H1B, H11,
183 H21;
184 FLA_Obj F1T, F01,
185 F1B, F11,
186 F21;
187
188 dim_t b_m;
189 dim_t b_n;
190
191 FLA_Part_1x2( *H, &HL, &HR, 0, FLA_LEFT );
192 FLA_Part_1x2( F, &FL, &FR, 0, FLA_LEFT );
193
194 while ( FLA_Obj_width( HL ) < FLA_Obj_width( *H ) )
195 {
196 FLA_Repart_1x2_to_1x3( HL, /**/ HR, &H0, /**/ &H1, &H2,
197 1, FLA_RIGHT );
198
199 // Get the scalar width of H1 and use that to determine the
200 // width of F1.
202
203 FLA_Repart_1x2_to_1x3( FL, /**/ FR, &F0, /**/ &F1, &F2,
204 b_n, FLA_RIGHT );
205
206 // -------------------------------------------------------------
207
209 &H1B, 0, FLA_TOP );
211 &F1B, 0, FLA_TOP );
212
213 while ( FLA_Obj_length( H1T ) < FLA_Obj_length( H1 ) )
214 {
216 /* ** */ /* *** */
217 &H11,
218 H1B, &H21, 1, FLA_BOTTOM );
219
220 // Get the scalar length of H11 and use that to determine the
221 // length of F11.
223
225 /* ** */ /* *** */
226 &F11,
227 F1B, &F21, b_m, FLA_BOTTOM );
228 // -------------------------------------------------------------
229
230 // Recursively axpy between F11 and H11.
233
234 // -------------------------------------------------------------
235
237 H11,
238 /* ** */ /* *** */
239 &H1B, H21, FLA_TOP );
241 F11,
242 /* ** */ /* *** */
243 &F1B, F21, FLA_TOP );
244 }
245
246 // -------------------------------------------------------------
247
248 FLA_Cont_with_1x3_to_1x2( &HL, /**/ &HR, H0, H1, /**/ H2,
249 FLA_LEFT );
250 FLA_Cont_with_1x3_to_1x2( &FL, /**/ &FR, F0, F1, /**/ F2,
251 FLA_LEFT );
252 }
253 }
254
255 return FLA_SUCCESS;
256}
dim_t FLASH_Obj_scalar_length(FLA_Obj H)
Definition FLASH_View.c:600
dim_t FLASH_Obj_scalar_width(FLA_Obj H)
Definition FLASH_View.c:641
FLA_Error FLA_Axpy_external(FLA_Obj alpha, FLA_Obj A, FLA_Obj B)
Definition FLA_Axpy_external.c:13
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_Cont_with_1x3_to_1x2(FLA_Obj *AL, FLA_Obj *AR, FLA_Obj A0, FLA_Obj A1, FLA_Obj A2, FLA_Side side)
Definition FLA_View.c:475
FLA_Error FLA_Part_1x2(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_View.c:110
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_Error FLA_Repart_1x2_to_1x3(FLA_Obj AL, FLA_Obj AR, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_View.c:267
FLA_Bool FLA_is_owner(void)
Definition FLA_Obj.c:33
FLA_Elemtype FLA_Obj_elemtype(FLA_Obj obj)
Definition FLA_Query.c:51

References FLA_Axpy_external(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_is_owner(), FLA_Obj_elemtype(), FLA_Obj_length(), FLA_Obj_width(), FLA_Part_1x2(), FLA_Part_2x1(), FLA_Repart_1x2_to_1x3(), FLA_Repart_2x1_to_3x1(), FLASH_Axpy_hierarchy(), FLASH_Obj_scalar_length(), and FLASH_Obj_scalar_width().

Referenced by FLASH_Axpy_flat_to_hier(), FLASH_Axpy_hier_to_flat(), and FLASH_Axpy_hierarchy().