libflame  revision_anchor
Functions
FLA_Swap_external.c File Reference

(r)

Functions

FLA_Error FLA_Swap_external (FLA_Obj A, FLA_Obj B)
 

Function Documentation

◆ FLA_Swap_external()

FLA_Error FLA_Swap_external ( FLA_Obj  A,
FLA_Obj  B 
)

References bl1_cswapmt(), bl1_dswapmt(), bl1_sswapmt(), bl1_zswapmt(), FLA_Check_error_level(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_has_zero_dim(), FLA_Obj_is_conformal_to(), FLA_Obj_length(), FLA_Obj_row_stride(), FLA_Obj_width(), FLA_Param_map_flame_to_blis_trans(), and FLA_Swap_check().

Referenced by FLA_Swap().

14 {
15  FLA_Datatype datatype;
16  int m_B, n_B;
17  int rs_A, cs_A;
18  int rs_B, cs_B;
19  trans1_t blis_trans;
20 
21  if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
22  FLA_Swap_check( A, B );
23 
24  if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
25 
26  datatype = FLA_Obj_datatype( A );
27 
28  rs_A = FLA_Obj_row_stride( A );
29  cs_A = FLA_Obj_col_stride( A );
30 
31  m_B = FLA_Obj_length( B );
32  n_B = FLA_Obj_width( B );
33  rs_B = FLA_Obj_row_stride( B );
34  cs_B = FLA_Obj_col_stride( B );
35 
36  if ( FLA_Obj_is_conformal_to( FLA_NO_TRANSPOSE, A, B ) )
37  FLA_Param_map_flame_to_blis_trans( FLA_NO_TRANSPOSE, &blis_trans );
38  else // if ( FLA_Obj_is_conformal_to( FLA_TRANSPOSE, A, B ) )
39  FLA_Param_map_flame_to_blis_trans( FLA_TRANSPOSE, &blis_trans );
40 
41  switch ( datatype ){
42 
43  case FLA_FLOAT:
44  {
45  float* buff_A = ( float * ) FLA_FLOAT_PTR( A );
46  float* buff_B = ( float * ) FLA_FLOAT_PTR( B );
47 
48  bl1_sswapmt( blis_trans,
49  m_B,
50  n_B,
51  buff_A, rs_A, cs_A,
52  buff_B, rs_B, cs_B );
53 
54  break;
55  }
56 
57  case FLA_DOUBLE:
58  {
59  double* buff_A = ( double * ) FLA_DOUBLE_PTR( A );
60  double* buff_B = ( double * ) FLA_DOUBLE_PTR( B );
61 
62  bl1_dswapmt( blis_trans,
63  m_B,
64  n_B,
65  buff_A, rs_A, cs_A,
66  buff_B, rs_B, cs_B );
67 
68  break;
69  }
70 
71  case FLA_COMPLEX:
72  {
73  scomplex* buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
74  scomplex* buff_B = ( scomplex * ) FLA_COMPLEX_PTR( B );
75 
76  bl1_cswapmt( blis_trans,
77  m_B,
78  n_B,
79  buff_A, rs_A, cs_A,
80  buff_B, rs_B, cs_B );
81 
82  break;
83  }
84 
85  case FLA_DOUBLE_COMPLEX:
86  {
87  dcomplex* buff_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
88  dcomplex* buff_B = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( B );
89 
90  bl1_zswapmt( blis_trans,
91  m_B,
92  n_B,
93  buff_A, rs_A, cs_A,
94  buff_B, rs_B, cs_B );
95 
96  break;
97  }
98 
99  }
100 
101  return FLA_SUCCESS;
102 }
void bl1_sswapmt(trans1_t trans, int m, int n, float *a, int a_rs, int a_cs, float *b, int b_rs, int b_cs)
Definition: bl1_swapmt.c:13
void FLA_Param_map_flame_to_blis_trans(FLA_Trans trans, trans1_t *blis_trans)
Definition: FLA_Param.c:245
void bl1_cswapmt(trans1_t trans, int m, int n, scomplex *a, int a_rs, int a_cs, scomplex *b, int b_rs, int b_cs)
Definition: bl1_swapmt.c:147
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition: FLA_Query.c:167
void bl1_dswapmt(trans1_t trans, int m, int n, double *a, int a_rs, int a_cs, double *b, int b_rs, int b_cs)
Definition: bl1_swapmt.c:80
trans1_t
Definition: blis_type_defs.h:52
FLA_Bool FLA_Obj_is_conformal_to(FLA_Trans trans, FLA_Obj A, FLA_Obj B)
Definition: FLA_Query.c:438
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
void bl1_zswapmt(trans1_t trans, int m, int n, dcomplex *a, int a_rs, int a_cs, dcomplex *b, int b_rs, int b_cs)
Definition: bl1_swapmt.c:222
FLA_Bool FLA_Obj_has_zero_dim(FLA_Obj A)
Definition: FLA_Query.c:400
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
FLA_Error FLA_Swap_check(FLA_Obj A, FLA_Obj B)
Definition: FLA_Swap_check.c:13
Definition: blis_type_defs.h:132
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
int FLA_Datatype
Definition: FLA_type_defs.h:49
dim_t FLA_Obj_col_stride(FLA_Obj obj)
Definition: FLA_Query.c:174
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116
Definition: blis_type_defs.h:137