libflame revision_anchor
Functions
FLA_Misc.c File Reference

(r)

Functions

FLA_Error FLA_Obj_copy_view (FLA_Obj A, FLA_Obj *B)
 
void FLA_Obj_extract_real_scalar (FLA_Obj alpha, double *alpha_value)
 
void FLA_Obj_extract_complex_scalar (FLA_Obj alpha, dcomplex *alpha_value)
 
void FLA_Obj_extract_real_part (FLA_Obj a, FLA_Obj b)
 
void FLA_Obj_extract_imag_part (FLA_Obj a, FLA_Obj b)
 
void FLA_Obj_set_real_part (FLA_Obj alpha, FLA_Obj B)
 
void FLA_Obj_set_imag_part (FLA_Obj alpha, FLA_Obj B)
 
FLA_Error FLA_Obj_fshow (FILE *file, char *s1, FLA_Obj A, char *format, char *s2)
 
FLA_Error FLA_Obj_show (char *s1, FLA_Obj A, char *format, char *s2)
 

Function Documentation

◆ FLA_Obj_copy_view()

FLA_Error FLA_Obj_copy_view ( FLA_Obj  A,
FLA_Obj B 
)
16{
18
21
22 // Set the m_inner and n_inner fields of a temporary copy of A.
23 A_view = A;
24 A_view.m_inner = FLASH_Obj_scalar_length( A );
25 A_view.n_inner = FLASH_Obj_scalar_width( A );
26
27 // Copy the modified view into B.
28 *B = A_view;
29
30 return FLA_SUCCESS;
31}
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_Obj_copy_view_check(FLA_Obj A, FLA_Obj *B)
Definition FLA_Obj_copy_view_check.c:13
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
int i
Definition bl1_axmyv2.c:145
Definition FLA_type_defs.h:159

References FLA_Check_error_level(), FLA_Obj_copy_view_check(), FLASH_Obj_scalar_length(), FLASH_Obj_scalar_width(), FLA_Obj_view::m_inner, and FLA_Obj_view::n_inner.

◆ FLA_Obj_extract_complex_scalar()

void FLA_Obj_extract_complex_scalar ( FLA_Obj  alpha,
dcomplex alpha_value 
)
49{
52
54 {
56 alpha_value->real = ( double ) temp.real;
57 alpha_value->imag = ( double ) temp.imag;
58 }
59 else
61}
FLA_Error FLA_Obj_extract_complex_scalar_check(FLA_Obj alpha, dcomplex *alpha_value)
Definition FLA_Obj_extract_complex_scalar_check.c:13
FLA_Bool FLA_Obj_is_single_precision(FLA_Obj A)
Definition FLA_Query.c:341
dcomplex temp
Definition bl1_axpyv2b.c:301
double real
Definition blis_type_defs.h:139
double imag
Definition blis_type_defs.h:139
Definition blis_type_defs.h:133

References FLA_Check_error_level(), FLA_Obj_extract_complex_scalar_check(), FLA_Obj_is_single_precision(), dcomplex::imag, dcomplex::real, and temp.

◆ FLA_Obj_extract_imag_part()

void FLA_Obj_extract_imag_part ( FLA_Obj  a,
FLA_Obj  b 
)
121{
122 FLA_Datatype datatype;
123 int m, inc_a, inc_b;
124
127
128 datatype = FLA_Obj_datatype( a );
129
130 m = FLA_Obj_vector_dim( a );
133
134 switch ( datatype )
135 {
136 case FLA_FLOAT:
137 {
138 float* buff_b = FLA_FLOAT_PTR( b );
139 float* buff_0 = FLA_FLOAT_PTR( FLA_ZERO );
140 bl1_ssetv( m,
141 buff_0,
142 buff_b, inc_b );
143 break;
144 }
145 case FLA_DOUBLE:
146 {
147 double* buff_b = FLA_DOUBLE_PTR( b );
148 double* buff_0 = FLA_DOUBLE_PTR( FLA_ZERO );
149 bl1_dsetv( m,
150 buff_0,
151 buff_b, inc_b );
152 break;
153 }
154 case FLA_COMPLEX:
155 {
156 float* buff_a = FLA_FLOAT_PTR( a );
157 float* buff_b = FLA_FLOAT_PTR( b );
158 bl1_scopy( m,
159 ++buff_a, inc_a*2,
160 buff_b, inc_b );
161 break;
162 }
163 case FLA_DOUBLE_COMPLEX:
164 {
165 double* buff_a = FLA_DOUBLE_PTR( a );
166 double* buff_b = FLA_DOUBLE_PTR( b );
167 bl1_dcopy( m,
168 ++buff_a, inc_a*2,
169 buff_b, inc_b );
170 break;
171 }
172 }
173}
FLA_Error FLA_Obj_extract_imag_part_check(FLA_Obj a, FLA_Obj b)
Definition FLA_Obj_extract_imag_part_check.c:13
FLA_Obj FLA_ZERO
Definition FLA_Init.c:20
dim_t FLA_Obj_vector_inc(FLA_Obj obj)
Definition FLA_Query.c:145
dim_t FLA_Obj_vector_dim(FLA_Obj obj)
Definition FLA_Query.c:137
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition FLA_Query.c:13
int FLA_Datatype
Definition FLA_type_defs.h:49
void bl1_dcopy(int m, double *x, int incx, double *y, int incy)
Definition bl1_copy.c:26
void bl1_scopy(int m, float *x, int incx, float *y, int incy)
Definition bl1_copy.c:13
void bl1_dsetv(int m, double *sigma, double *x, int incx)
Definition bl1_setv.c:39
void bl1_ssetv(int m, float *sigma, float *x, int incx)
Definition bl1_setv.c:26

References bl1_dcopy(), bl1_dsetv(), bl1_scopy(), bl1_ssetv(), FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_extract_imag_part_check(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), and FLA_ZERO.

◆ FLA_Obj_extract_real_part()

void FLA_Obj_extract_real_part ( FLA_Obj  a,
FLA_Obj  b 
)
66{
67 FLA_Datatype datatype;
68 int m, inc_a, inc_b;
69
72
73 datatype = FLA_Obj_datatype( a );
74
75 m = FLA_Obj_vector_dim( a );
78
79 switch ( datatype )
80 {
81 case FLA_FLOAT:
82 {
83 float* buff_a = FLA_FLOAT_PTR( a );
84 float* buff_b = FLA_FLOAT_PTR( b );
85 bl1_scopy( m,
86 buff_a, inc_a,
87 buff_b, inc_b );
88 break;
89 }
90 case FLA_DOUBLE:
91 {
92 double* buff_a = FLA_DOUBLE_PTR( a );
93 double* buff_b = FLA_DOUBLE_PTR( b );
94 bl1_dcopy( m,
95 buff_a, inc_a,
96 buff_b, inc_b );
97 break;
98 }
99 case FLA_COMPLEX:
100 {
101 float* buff_a = FLA_FLOAT_PTR( a );
102 float* buff_b = FLA_FLOAT_PTR( b );
103 bl1_scopy( m,
104 buff_a, inc_a*2,
105 buff_b, inc_b );
106 break;
107 }
108 case FLA_DOUBLE_COMPLEX:
109 {
110 double* buff_a = FLA_DOUBLE_PTR( a );
111 double* buff_b = FLA_DOUBLE_PTR( b );
112 bl1_dcopy( m,
113 buff_a, inc_a*2,
114 buff_b, inc_b );
115 break;
116 }
117 }
118}
FLA_Error FLA_Obj_extract_real_part_check(FLA_Obj a, FLA_Obj b)
Definition FLA_Obj_extract_real_part_check.c:13

References bl1_dcopy(), bl1_scopy(), FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_extract_real_part_check(), FLA_Obj_vector_dim(), and FLA_Obj_vector_inc().

Referenced by FLA_QR_UT_piv_colnorm().

◆ FLA_Obj_extract_real_scalar()

void FLA_Obj_extract_real_scalar ( FLA_Obj  alpha,
double alpha_value 
)
36{
39
42 else
44}
FLA_Error FLA_Obj_extract_real_scalar_check(FLA_Obj alpha, double *alpha_value)
Definition FLA_Obj_extract_real_scalar_check.c:13

References FLA_Check_error_level(), FLA_Obj_extract_real_scalar_check(), and FLA_Obj_is_single_precision().

◆ FLA_Obj_fshow()

FLA_Error FLA_Obj_fshow ( FILE file,
char s1,
FLA_Obj  A,
char format,
char s2 
)
283{
284 FLA_Datatype datatype;
285 dim_t i, j, m, n;
286 dim_t rs, cs;
287
290
291 datatype = FLA_Obj_datatype( A );
292 m = FLA_Obj_length( A );
293 n = FLA_Obj_width( A );
294 rs = FLA_Obj_row_stride( A );
295 cs = FLA_Obj_col_stride( A );
296
297 fprintf( file, "%s\n", s1 );
298
299 switch ( datatype ){
300
301 case FLA_CONSTANT:
302 {
303 int* consti = FLA_INT_PTR( A );
304 float* consts = FLA_FLOAT_PTR( A );
305 double* constd = FLA_DOUBLE_PTR( A );
308
309 fprintf( file, "int = %d\n", *consti );
310 fprintf( file, "float = %e\n", *consts );
311 fprintf( file, "double = %e\n", *constd );
312 fprintf( file, "scomplex = %e + %e\n", constc->real, constc->imag );
313 fprintf( file, "dcomplex = %e + %e\n", constz->real, constc->imag );
314
315 break;
316 }
317
318 case FLA_FLOAT:
319 {
320 float *buffer = ( float * ) FLA_FLOAT_PTR( A );
321
322 for ( i = 0; i < m; i++ )
323 {
324 for ( j = 0; j < n; j++ )
325 {
326 fprintf( file, format, buffer[ j*cs + i*rs ] );
327 fprintf( file, " " );
328 }
329 fprintf( file, "\n" );
330 }
331
332 break;
333 }
334
335 case FLA_DOUBLE:
336 {
337 double *buffer = ( double * ) FLA_DOUBLE_PTR( A );
338
339 for ( i = 0; i < m; i++ )
340 {
341 for ( j = 0; j < n; j++ )
342 {
343 fprintf( file, format, buffer[ j*cs + i*rs ] );
344 fprintf( file, " " );
345 }
346 fprintf( file, "\n" );
347 }
348
349 break;
350 }
351
352 case FLA_COMPLEX:
353 {
354 scomplex *buffer = ( scomplex * ) FLA_COMPLEX_PTR( A );
355
356 for ( i = 0; i < m; i++ )
357 {
358 for ( j = 0; j < n; j++ )
359 {
360 //fprintf( file, format, buffer[ j*cs + i*rs ].real, buffer[ j*cs + i*rs ].imag );
361 //fprintf( file, " " );
362 fprintf( file, format, buffer[ j*cs + i*rs ].real );
363 fprintf( file, " + i * " );
364 fprintf( file, format, buffer[ j*cs + i*rs ].imag );
365 fprintf( file, " " );
366 }
367 fprintf( file, "\n" );
368 }
369
370 break;
371 }
372
374 {
375 dcomplex *buffer = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
376
377 for ( i = 0; i < m; i++ )
378 {
379 for ( j = 0; j < n; j++ )
380 {
381 //fprintf( file, format, buffer[ j*cs + i*rs ].real, buffer[ j*cs + i*rs ].imag );
382 //fprintf( file, " " );
383 fprintf( file, format, buffer[ j*cs + i*rs ].real );
384 fprintf( file, " + i * " );
385 fprintf( file, format, buffer[ j*cs + i*rs ].imag );
386 fprintf( file, " " );
387 }
388 fprintf( file, "\n" );
389 }
390
391 break;
392 }
393
394 case FLA_INT:
395 {
396 int *buffer = ( int * ) FLA_INT_PTR( A );
397
398 for ( i = 0; i < m; i++ )
399 {
400 for ( j = 0; j < n; j++ )
401 {
402 fprintf( file, format, buffer[ j*cs + i*rs ] );
403 fprintf( file, " " );
404 }
405 fprintf( file, "\n" );
406 }
407
408 break;
409 }
410
411 }
412
413 fprintf( file, "%s\n", s2 );
414
415 return FLA_SUCCESS;
416}
FLA_Error FLA_Obj_fshow_check(FILE *file, char *s1, FLA_Obj obj, char *format, char *s2)
Definition FLA_Obj_fshow_check.c:13
float real
Definition FLA_f2c.h:30
dim_t FLA_Obj_width(FLA_Obj obj)
Definition FLA_Query.c:123
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition FLA_Query.c:167
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
dim_t FLA_Obj_col_stride(FLA_Obj obj)
Definition FLA_Query.c:174
unsigned long dim_t
Definition FLA_type_defs.h:71
rho_c imag
Definition bl1_axpyv2bdotaxpy.c:483
Definition blis_type_defs.h:138

References FLA_Check_error_level(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_fshow_check(), FLA_Obj_length(), FLA_Obj_row_stride(), FLA_Obj_width(), i, imag, scomplex::imag, scomplex::real, and dcomplex::real.

Referenced by FLA_Obj_show().

◆ FLA_Obj_set_imag_part()

void FLA_Obj_set_imag_part ( FLA_Obj  alpha,
FLA_Obj  B 
)
230{
231 dim_t m_B;
232 dim_t n_B;
233 dim_t rs_B;
234 dim_t cs_B;
235 dim_t i, j;
236
237 m_B = FLA_Obj_length( B );
238 n_B = FLA_Obj_width( B );
241
244
245 if ( FLA_Obj_is_complex( B ) )
246 {
247 if ( FLA_Obj_datatype( B ) == FLA_COMPLEX )
248 {
249 float* buff_alpha = FLA_FLOAT_PTR( alpha );
251
252 for ( j = 0; j < n_B; ++j )
253 {
254 for ( i = 0; i < m_B; ++i )
255 {
256 scomplex* beta11 = buff_B + rs_B * i + cs_B * j;
257
259 }
260 }
261 }
262 else if ( FLA_Obj_datatype( B ) == FLA_DOUBLE_COMPLEX )
263 {
264 double* buff_alpha = FLA_DOUBLE_PTR( alpha );
266
267 for ( j = 0; j < n_B; ++j )
268 {
269 for ( i = 0; i < m_B; ++i )
270 {
271 dcomplex* beta11 = buff_B + rs_B * i + cs_B * j;
272
274 }
275 }
276 }
277 }
278}
FLA_Error FLA_Obj_set_imag_part_check(FLA_Obj alpha, FLA_Obj beta)
Definition FLA_Obj_set_imag_part_check.c:13
FLA_Bool FLA_Obj_is_complex(FLA_Obj A)
Definition FLA_Query.c:324
float imag
Definition blis_type_defs.h:134

References FLA_Check_error_level(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_is_complex(), FLA_Obj_length(), FLA_Obj_row_stride(), FLA_Obj_set_imag_part_check(), FLA_Obj_width(), i, scomplex::imag, and dcomplex::imag.

Referenced by FLA_Bidiag_UT_l_realify_unb(), and FLA_Bidiag_UT_u_realify_unb().

◆ FLA_Obj_set_real_part()

void FLA_Obj_set_real_part ( FLA_Obj  alpha,
FLA_Obj  B 
)
177{
178 dim_t m_B;
179 dim_t n_B;
180 dim_t rs_B;
181 dim_t cs_B;
182 dim_t i, j;
183
184 m_B = FLA_Obj_length( B );
185 n_B = FLA_Obj_width( B );
188
191
192 if ( FLA_Obj_is_complex( B ) )
193 {
194 if ( FLA_Obj_datatype( B ) == FLA_COMPLEX )
195 {
196 float* buff_alpha = FLA_FLOAT_PTR( alpha );
198
199 for ( j = 0; j < n_B; ++j )
200 {
201 for ( i = 0; i < m_B; ++i )
202 {
203 scomplex* beta11 = buff_B + rs_B * i + cs_B * j;
204
206 }
207 }
208 }
209 else if ( FLA_Obj_datatype( B ) == FLA_DOUBLE_COMPLEX )
210 {
211 double* buff_alpha = FLA_DOUBLE_PTR( alpha );
213
214 for ( j = 0; j < n_B; ++j )
215 {
216 for ( i = 0; i < m_B; ++i )
217 {
218 dcomplex* beta11 = buff_B + rs_B * i + cs_B * j;
219
221 }
222 }
223 }
224 }
225}
FLA_Error FLA_Obj_set_real_part_check(FLA_Obj alpha, FLA_Obj beta)
Definition FLA_Obj_set_real_part_check.c:13
float real
Definition blis_type_defs.h:134

References FLA_Check_error_level(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_is_complex(), FLA_Obj_length(), FLA_Obj_row_stride(), FLA_Obj_set_real_part_check(), FLA_Obj_width(), i, scomplex::real, and dcomplex::real.

◆ FLA_Obj_show()

FLA_Error FLA_Obj_show ( char s1,
FLA_Obj  A,
char format,
char s2 
)
421{
424
425 return FLA_Obj_fshow( stdout, s1, A, format, s2 );
426}
FLA_Error FLA_Obj_fshow(FILE *file, char *s1, FLA_Obj A, char *format, char *s2)
Definition FLA_Misc.c:282
FLA_Error FLA_Obj_show_check(char *s1, FLA_Obj obj, char *format, char *s2)
Definition FLA_Obj_show_check.c:13

References FLA_Check_error_level(), FLA_Obj_fshow(), and FLA_Obj_show_check().

Referenced by FLASH_Obj_show().