libflame  revision_anchor
Functions
FLA_Sort_evd.c File Reference

(r)

Functions

FLA_Error FLA_Sort_evd (FLA_Direct direct, FLA_Obj l, FLA_Obj V)
 
FLA_Error FLA_Sort_evd_f_ops (int m_A, float *l, int inc_l, float *V, int rs_V, int cs_V)
 
FLA_Error FLA_Sort_evd_b_ops (int m_A, float *l, int inc_l, float *V, int rs_V, int cs_V)
 
FLA_Error FLA_Sort_evd_f_opd (int m_A, double *l, int inc_l, double *V, int rs_V, int cs_V)
 
FLA_Error FLA_Sort_evd_b_opd (int m_A, double *l, int inc_l, double *V, int rs_V, int cs_V)
 
FLA_Error FLA_Sort_evd_f_opc (int m_A, float *l, int inc_l, scomplex *V, int rs_V, int cs_V)
 
FLA_Error FLA_Sort_evd_b_opc (int m_A, float *l, int inc_l, scomplex *V, int rs_V, int cs_V)
 
FLA_Error FLA_Sort_evd_f_opz (int m_A, double *l, int inc_l, dcomplex *V, int rs_V, int cs_V)
 
FLA_Error FLA_Sort_evd_b_opz (int m_A, double *l, int inc_l, dcomplex *V, int rs_V, int cs_V)
 

Function Documentation

◆ FLA_Sort_evd()

FLA_Error FLA_Sort_evd ( FLA_Direct  direct,
FLA_Obj  l,
FLA_Obj  V 
)

References FLA_Check_error_level(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_length(), FLA_Obj_row_stride(), FLA_Obj_vector_inc(), FLA_Sort_evd_b_opc(), FLA_Sort_evd_b_opd(), FLA_Sort_evd_b_ops(), FLA_Sort_evd_b_opz(), FLA_Sort_evd_check(), FLA_Sort_evd_f_opc(), FLA_Sort_evd_f_opd(), FLA_Sort_evd_f_ops(), and FLA_Sort_evd_f_opz().

Referenced by FLA_Hevd_lv_unb_var1(), and FLA_Hevd_lv_unb_var2().

14 {
15  FLA_Datatype datatype;
16  dim_t m_A;
17  dim_t rs_V, cs_V;
18  dim_t inc_l;
19 
20  if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
21  FLA_Sort_evd_check( direct, l, V );
22 
23  datatype = FLA_Obj_datatype( V );
24 
25  m_A = FLA_Obj_length( V );
26 
27  rs_V = FLA_Obj_row_stride( V );
28  cs_V = FLA_Obj_col_stride( V );
29 
30  inc_l = FLA_Obj_vector_inc( l );
31 
32  switch ( datatype )
33  {
34  case FLA_FLOAT:
35  {
36  float* l_p = ( float* ) FLA_FLOAT_PTR( l );
37  float* V_p = ( float* ) FLA_FLOAT_PTR( V );
38 
39  if ( direct == FLA_FORWARD )
40  FLA_Sort_evd_f_ops( m_A,
41  l_p, inc_l,
42  V_p, rs_V, cs_V );
43  else // if ( direct == FLA_BACKWARD )
44  FLA_Sort_evd_b_ops( m_A,
45  l_p, inc_l,
46  V_p, rs_V, cs_V );
47 
48  break;
49  }
50 
51  case FLA_DOUBLE:
52  {
53  double* l_p = ( double* ) FLA_DOUBLE_PTR( l );
54  double* V_p = ( double* ) FLA_DOUBLE_PTR( V );
55 
56  if ( direct == FLA_FORWARD )
57  FLA_Sort_evd_f_opd( m_A,
58  l_p, inc_l,
59  V_p, rs_V, cs_V );
60  else // if ( direct == FLA_BACKWARD )
61  FLA_Sort_evd_b_opd( m_A,
62  l_p, inc_l,
63  V_p, rs_V, cs_V );
64 
65  break;
66  }
67 
68  case FLA_COMPLEX:
69  {
70  float* l_p = ( float* ) FLA_FLOAT_PTR( l );
71  scomplex* V_p = ( scomplex* ) FLA_COMPLEX_PTR( V );
72 
73  if ( direct == FLA_FORWARD )
74  FLA_Sort_evd_f_opc( m_A,
75  l_p, inc_l,
76  V_p, rs_V, cs_V );
77  else // if ( direct == FLA_BACKWARD )
78  FLA_Sort_evd_b_opc( m_A,
79  l_p, inc_l,
80  V_p, rs_V, cs_V );
81 
82  break;
83  }
84 
85  case FLA_DOUBLE_COMPLEX:
86  {
87  double* l_p = ( double* ) FLA_DOUBLE_PTR( l );
88  dcomplex* V_p = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( V );
89 
90  if ( direct == FLA_FORWARD )
91  FLA_Sort_evd_f_opz( m_A,
92  l_p, inc_l,
93  V_p, rs_V, cs_V );
94  else // if ( direct == FLA_BACKWARD )
95  FLA_Sort_evd_b_opz( m_A,
96  l_p, inc_l,
97  V_p, rs_V, cs_V );
98 
99  break;
100  }
101 
102  }
103 
104  return FLA_SUCCESS;
105 }
unsigned long dim_t
Definition: FLA_type_defs.h:71
FLA_Error FLA_Sort_evd_b_opc(int m_A, float *l, int inc_l, scomplex *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:202
FLA_Error FLA_Sort_evd_f_opc(int m_A, float *l, int inc_l, scomplex *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:195
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition: FLA_Query.c:167
FLA_Error FLA_Sort_evd_b_opd(int m_A, double *l, int inc_l, double *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:159
FLA_Error FLA_Sort_evd_b_ops(int m_A, float *l, int inc_l, float *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:116
FLA_Error FLA_Sort_evd_f_opd(int m_A, double *l, int inc_l, double *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:123
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
Definition: blis_type_defs.h:132
FLA_Error FLA_Sort_evd_f_ops(int m_A, float *l, int inc_l, float *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:109
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
FLA_Error FLA_Sort_evd_b_opz(int m_A, double *l, int inc_l, dcomplex *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:245
int FLA_Datatype
Definition: FLA_type_defs.h:49
FLA_Error FLA_Sort_evd_check(FLA_Direct direct, FLA_Obj l, FLA_Obj V)
Definition: FLA_Sort_evd_check.c:13
dim_t FLA_Obj_col_stride(FLA_Obj obj)
Definition: FLA_Query.c:174
FLA_Error FLA_Sort_evd_f_opz(int m_A, double *l, int inc_l, dcomplex *V, int rs_V, int cs_V)
Definition: FLA_Sort_evd.c:209
dim_t FLA_Obj_vector_inc(FLA_Obj obj)
Definition: FLA_Query.c:145
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116
Definition: blis_type_defs.h:137

◆ FLA_Sort_evd_b_opc()

FLA_Error FLA_Sort_evd_b_opc ( int  m_A,
float *  l,
int  inc_l,
scomplex V,
int  rs_V,
int  cs_V 
)

Referenced by FLA_Sort_evd().

205 {
206  return FLA_SUCCESS;
207 }

◆ FLA_Sort_evd_b_opd()

FLA_Error FLA_Sort_evd_b_opd ( int  m_A,
double *  l,
int  inc_l,
double *  V,
int  rs_V,
int  cs_V 
)

References bl1_dswapv(), and i.

Referenced by FLA_Sort_evd().

162 {
163  int i, ii, j, k;
164  double p;
165 
166  for ( ii = 1; ii < m_A; ++ii )
167  {
168  i = ii - 1;
169  k = i;
170 
171  p = l[ i*inc_l ];
172 
173  for ( j = ii; j < m_A; ++j )
174  {
175  if ( l[ j*inc_l ] > p )
176  {
177  k = j;
178  p = l[ j*inc_l ];
179  }
180  }
181 
182  if ( k != i )
183  {
184  l[ k*inc_l ] = l[ i ];
185  l[ i ] = p;
186  bl1_dswapv( m_A,
187  V + i*cs_V, rs_V,
188  V + k*cs_V, rs_V );
189  }
190  }
191 
192  return FLA_SUCCESS;
193 }
void bl1_dswapv(int n, double *x, int incx, double *y, int incy)
Definition: bl1_swapv.c:23
int i
Definition: bl1_axmyv2.c:145

◆ FLA_Sort_evd_b_ops()

FLA_Error FLA_Sort_evd_b_ops ( int  m_A,
float *  l,
int  inc_l,
float *  V,
int  rs_V,
int  cs_V 
)

Referenced by FLA_Sort_evd().

119 {
120  return FLA_SUCCESS;
121 }

◆ FLA_Sort_evd_b_opz()

FLA_Error FLA_Sort_evd_b_opz ( int  m_A,
double *  l,
int  inc_l,
dcomplex V,
int  rs_V,
int  cs_V 
)

References bl1_zswapv(), and i.

Referenced by FLA_Sort_evd().

248 {
249  int i, ii, j, k;
250  double p;
251 
252  for ( ii = 1; ii < m_A; ++ii )
253  {
254  i = ii - 1;
255  k = i;
256 
257  p = l[ i*inc_l ];
258 
259  for ( j = ii; j < m_A; ++j )
260  {
261  if ( l[ j*inc_l ] > p )
262  {
263  k = j;
264  p = l[ j*inc_l ];
265  }
266  }
267 
268  if ( k != i )
269  {
270  l[ k*inc_l ] = l[ i ];
271  l[ i ] = p;
272  bl1_zswapv( m_A,
273  V + i*cs_V, rs_V,
274  V + k*cs_V, rs_V );
275  }
276  }
277 
278  return FLA_SUCCESS;
279 }
void bl1_zswapv(int n, dcomplex *x, int incx, dcomplex *y, int incy)
Definition: bl1_swapv.c:43
int i
Definition: bl1_axmyv2.c:145

◆ FLA_Sort_evd_f_opc()

FLA_Error FLA_Sort_evd_f_opc ( int  m_A,
float *  l,
int  inc_l,
scomplex V,
int  rs_V,
int  cs_V 
)

Referenced by FLA_Sort_evd().

198 {
199  return FLA_SUCCESS;
200 }

◆ FLA_Sort_evd_f_opd()

FLA_Error FLA_Sort_evd_f_opd ( int  m_A,
double *  l,
int  inc_l,
double *  V,
int  rs_V,
int  cs_V 
)

References bl1_dswapv(), and i.

Referenced by FLA_Sort_evd().

126 {
127  int i, ii, j, k;
128  double p;
129 
130  for ( ii = 1; ii < m_A; ++ii )
131  {
132  i = ii - 1;
133  k = i;
134 
135  p = l[ i*inc_l ];
136 
137  for ( j = ii; j < m_A; ++j )
138  {
139  if ( l[ j*inc_l ] < p )
140  {
141  k = j;
142  p = l[ j*inc_l ];
143  }
144  }
145 
146  if ( k != i )
147  {
148  l[ k*inc_l ] = l[ i ];
149  l[ i ] = p;
150  bl1_dswapv( m_A,
151  V + i*cs_V, rs_V,
152  V + k*cs_V, rs_V );
153  }
154  }
155 
156  return FLA_SUCCESS;
157 }
void bl1_dswapv(int n, double *x, int incx, double *y, int incy)
Definition: bl1_swapv.c:23
int i
Definition: bl1_axmyv2.c:145

◆ FLA_Sort_evd_f_ops()

FLA_Error FLA_Sort_evd_f_ops ( int  m_A,
float *  l,
int  inc_l,
float *  V,
int  rs_V,
int  cs_V 
)

Referenced by FLA_Sort_evd().

112 {
113  return FLA_SUCCESS;
114 }

◆ FLA_Sort_evd_f_opz()

FLA_Error FLA_Sort_evd_f_opz ( int  m_A,
double *  l,
int  inc_l,
dcomplex V,
int  rs_V,
int  cs_V 
)

References bl1_zswapv(), and i.

Referenced by FLA_Sort_evd().

212 {
213  int i, ii, j, k;
214  double p;
215 
216  for ( ii = 1; ii < m_A; ++ii )
217  {
218  i = ii - 1;
219  k = i;
220 
221  p = l[ i*inc_l ];
222 
223  for ( j = ii; j < m_A; ++j )
224  {
225  if ( l[ j*inc_l ] < p )
226  {
227  k = j;
228  p = l[ j*inc_l ];
229  }
230  }
231 
232  if ( k != i )
233  {
234  l[ k*inc_l ] = l[ i ];
235  l[ i ] = p;
236  bl1_zswapv( m_A,
237  V + i*cs_V, rs_V,
238  V + k*cs_V, rs_V );
239  }
240  }
241 
242  return FLA_SUCCESS;
243 }
void bl1_zswapv(int n, dcomplex *x, int incx, dcomplex *y, int incy)
Definition: bl1_swapv.c:43
int i
Definition: bl1_axmyv2.c:145