libflame revision_anchor
Functions
FLASH_Copy_other.c File Reference

(r)

Functions

FLA_Error FLASH_Copy_buffer_to_hier (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_Copy_hier_to_buffer (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_Copy_flat_to_hier (FLA_Obj F, dim_t i, dim_t j, FLA_Obj H)
 
FLA_Error FLASH_Copy_hier_to_flat (dim_t i, dim_t j, FLA_Obj H, FLA_Obj F)
 
FLA_Error FLASH_Copy_hierarchy (int direction, FLA_Obj F, FLA_Obj *H)
 

Function Documentation

◆ FLASH_Copy_buffer_to_hier()

FLA_Error FLASH_Copy_buffer_to_hier ( 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 {
21 e_val = FLA_Check_matrix_strides( m, n, rs, cs );
23
26 }
27
28 // Acquire the datatype from the hierarchical matrix object.
29 datatype = FLASH_Obj_datatype( H );
30
31 // Create a temporary conventional matrix object of the requested datatype
32 // and dimensions and attach the given buffer containing the incoming data.
34 FLA_Obj_attach_buffer( buffer, rs, cs, &flat_matrix );
35
36 // Recurse through H, adding in the corresponding elements of flat_matrix,
37 // starting at the (i,j) element offset.
39
40 // Free the object (but don't free the buffer!).
42
43 return FLA_SUCCESS;
44}
FLA_Error FLASH_Copy_flat_to_hier(FLA_Obj F, dim_t i, dim_t j, FLA_Obj H)
Definition FLASH_Copy_other.c:81
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_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_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_error_level(), 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_Copy_flat_to_hier(), FLASH_Obj_datatype(), and i.

◆ FLASH_Copy_flat_to_hier()

FLA_Error FLASH_Copy_flat_to_hier ( FLA_Obj  F,
dim_t  i,
dim_t  j,
FLA_Obj  H 
)
82{
84 HBL, HBR;
87 dim_t m, n;
88
89 m = FLA_Obj_length( F );
90 n = FLA_Obj_width( F );
91
93 &HBL, &HBR, i, j, FLA_TL );
94
96 &HBR_bl, &HBR_br, m, n, FLA_TL );
97
99
101 &HBR_bl, &HBR_br );
102
104 &HBL, &HBR );
105
106 return FLA_SUCCESS;
107}
FLA_Error FLASH_Copy_hierarchy(int direction, FLA_Obj F, FLA_Obj *H)
Definition FLASH_Copy_other.c:139
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_Copy_hierarchy(), FLASH_Part_create_2x2(), FLASH_Part_free_2x2(), and i.

Referenced by FLA_LQ_UT_macro_task(), FLA_LU_piv_macro_task(), FLA_QR_UT_macro_task(), FLASH_Copy_buffer_to_hier(), FLASH_Obj_create_hier_copy_of_flat(), FLASH_Obj_create_hier_copy_of_flat_ext(), and FLASH_Obj_hierarchify().

◆ FLASH_Copy_hier_to_buffer()

FLA_Error FLASH_Copy_hier_to_buffer ( dim_t  i,
dim_t  j,
FLA_Obj  H,
dim_t  m,
dim_t  n,
void buffer,
dim_t  rs,
dim_t  cs 
)
48{
50 FLA_Datatype datatype;
52
54 {
55 e_val = FLA_Check_matrix_strides( m, n, rs, cs );
57
60 }
61
62 // Acquire the datatype from the hierarchical matrix object.
63 datatype = FLASH_Obj_datatype( H );
64
65 // Create a temporary conventional matrix object of the requested datatype
66 // and dimensions and attach the given buffer containing the incoming data.
68 FLA_Obj_attach_buffer( buffer, rs, cs, &flat_matrix );
69
70 // Recurse through H, adding in the corresponding elements of flat_matrix,
71 // starting at the (i,j) element offset.
73
74 // Free the object (but don't free the buffer!).
76
77 return FLA_SUCCESS;
78}
FLA_Error FLASH_Copy_hier_to_flat(dim_t i, dim_t j, FLA_Obj H, FLA_Obj F)
Definition FLASH_Copy_other.c:110

References FLA_Check_error_level(), 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_Copy_hier_to_flat(), FLASH_Obj_datatype(), and i.

◆ FLASH_Copy_hier_to_flat()

FLA_Error FLASH_Copy_hier_to_flat ( dim_t  i,
dim_t  j,
FLA_Obj  H,
FLA_Obj  F 
)

◆ FLASH_Copy_hierarchy()

FLA_Error FLASH_Copy_hierarchy ( int  direction,
FLA_Obj  F,
FLA_Obj H 
)
140{
141 // Once we get down to a submatrix whose elements are scalars, we are down
142 // to our base case.
143 if ( FLA_Obj_elemtype( *H ) == FLA_SCALAR )
144 {
145 // Depending on which top-level function invoked us, we either copy
146 // the source data in the flat matrix to the leaf-level submatrix of
147 // the hierarchical matrix, or copy the data in the hierarchical
148 // submatrix to the flat matrix.
150 {
151#ifdef FLA_ENABLE_SCC
152 if ( FLA_is_owner() )
153#endif
154 FLA_Copy_external( F, *H );
155 }
156 else if ( direction == FLA_HIER_TO_FLAT )
157 {
158#ifdef FLA_ENABLE_SCC
159 if ( FLA_is_owner() )
160#endif
161 FLA_Copy_external( *H, F );
162 }
163 }
164 else
165 {
166 FLA_Obj HL, HR, H0, H1, H2;
167 FLA_Obj FL, FR, F0, F1, F2;
168
169 FLA_Obj H1T, H01,
170 H1B, H11,
171 H21;
172 FLA_Obj F1T, F01,
173 F1B, F11,
174 F21;
175
176 dim_t b_m;
177 dim_t b_n;
178
179 FLA_Part_1x2( *H, &HL, &HR, 0, FLA_LEFT );
180 FLA_Part_1x2( F, &FL, &FR, 0, FLA_LEFT );
181
182 while ( FLA_Obj_width( HL ) < FLA_Obj_width( *H ) )
183 {
184 FLA_Repart_1x2_to_1x3( HL, /**/ HR, &H0, /**/ &H1, &H2,
185 1, FLA_RIGHT );
186
187 // Get the scalar width of H1 and use that to determine the
188 // width of F1.
190
191 FLA_Repart_1x2_to_1x3( FL, /**/ FR, &F0, /**/ &F1, &F2,
192 b_n, FLA_RIGHT );
193
194 // -------------------------------------------------------------
195
197 &H1B, 0, FLA_TOP );
199 &F1B, 0, FLA_TOP );
200
201 while ( FLA_Obj_length( H1T ) < FLA_Obj_length( H1 ) )
202 {
204 /* ** */ /* *** */
205 &H11,
206 H1B, &H21, 1, FLA_BOTTOM );
207
208 // Get the scalar length of H11 and use that to determine the
209 // length of F11.
211
213 /* ** */ /* *** */
214 &F11,
215 F1B, &F21, b_m, FLA_BOTTOM );
216 // -------------------------------------------------------------
217
218 // Recursively copy between F11 and H11.
221
222 // -------------------------------------------------------------
223
225 H11,
226 /* ** */ /* *** */
227 &H1B, H21, FLA_TOP );
229 F11,
230 /* ** */ /* *** */
231 &F1B, F21, FLA_TOP );
232 }
233
234 // -------------------------------------------------------------
235
236 FLA_Cont_with_1x3_to_1x2( &HL, /**/ &HR, H0, H1, /**/ H2,
237 FLA_LEFT );
238 FLA_Cont_with_1x3_to_1x2( &FL, /**/ &FR, F0, F1, /**/ F2,
239 FLA_LEFT );
240 }
241 }
242
243 return FLA_SUCCESS;
244}
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_Copy_external(FLA_Obj A, FLA_Obj B)
Definition FLA_Copy_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_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Copy_external(), 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_Copy_hierarchy(), FLASH_Obj_scalar_length(), and FLASH_Obj_scalar_width().

Referenced by FLASH_Copy_flat_to_hier(), FLASH_Copy_hier_to_flat(), and FLASH_Copy_hierarchy().