libflame revision_anchor
FLA_Sort_bsvd_ext.c File Reference

(r)

Functions

FLA_Error FLA_Sort_bsvd_ext (FLA_Direct direct, FLA_Obj s, FLA_Bool apply_U, FLA_Obj U, FLA_Bool apply_V, FLA_Obj V, FLA_Bool apply_C, FLA_Obj C)
 
FLA_Error FLA_Sort_bsvd_ext_f_ops (int m_s, float *s, int inc_s, int m_U, float *U, int rs_U, int cs_U, int m_V, float *V, int rs_V, int cs_V, int n_C, float *C, int rs_C, int cs_C)
 
FLA_Error FLA_Sort_bsvd_ext_b_ops (int m_s, float *s, int inc_s, int m_U, float *U, int rs_U, int cs_U, int m_V, float *V, int rs_V, int cs_V, int n_C, float *C, int rs_C, int cs_C)
 
FLA_Error FLA_Sort_bsvd_ext_f_opd (int m_s, double *s, int inc_s, int m_U, double *U, int rs_U, int cs_U, int m_V, double *V, int rs_V, int cs_V, int n_C, double *C, int rs_C, int cs_C)
 
FLA_Error FLA_Sort_bsvd_ext_b_opd (int m_s, double *s, int inc_s, int m_U, double *U, int rs_U, int cs_U, int m_V, double *V, int rs_V, int cs_V, int n_C, double *C, int rs_C, int cs_C)
 
FLA_Error FLA_Sort_bsvd_ext_f_opc (int m_s, float *s, int inc_s, int m_U, scomplex *U, int rs_U, int cs_U, int m_V, scomplex *V, int rs_V, int cs_V, int n_C, scomplex *C, int rs_C, int cs_C)
 
FLA_Error FLA_Sort_bsvd_ext_b_opc (int m_s, float *s, int inc_s, int m_U, scomplex *U, int rs_U, int cs_U, int m_V, scomplex *V, int rs_V, int cs_V, int n_C, scomplex *C, int rs_C, int cs_C)
 
FLA_Error FLA_Sort_bsvd_ext_f_opz (int m_s, double *s, int inc_s, int m_U, dcomplex *U, int rs_U, int cs_U, int m_V, dcomplex *V, int rs_V, int cs_V, int n_C, dcomplex *C, int rs_C, int cs_C)
 
FLA_Error FLA_Sort_bsvd_ext_b_opz (int m_s, double *s, int inc_s, int m_U, dcomplex *U, int rs_U, int cs_U, int m_V, dcomplex *V, int rs_V, int cs_V, int n_C, dcomplex *C, int rs_C, int cs_C)
 

Function Documentation

◆ FLA_Sort_bsvd_ext()

FLA_Error FLA_Sort_bsvd_ext ( FLA_Direct direct,
FLA_Obj s,
FLA_Bool apply_U,
FLA_Obj U,
FLA_Bool apply_V,
FLA_Obj V,
FLA_Bool apply_C,
FLA_Obj C )
72{
73 FLA_Datatype datatype;
74 dim_t m_U, rs_U, cs_U;
75 dim_t m_V, rs_V, cs_V;
76 dim_t n_C, rs_C, cs_C;
77 dim_t m_s, inc_s;
78
79 //if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
80 // FLA_Sort_bsvd_check( direct, s,
81 // apply_U, U,
82 // apply_V, V,
83 // apply_C, C );
84
85 // Sort singular values only; quick sort
86 if ( apply_U == FALSE && apply_V == FALSE )
87 return FLA_Sort( direct, s );
88
89 // s dimensions must be provided.
90 m_s = FLA_Obj_vector_dim( s );
91 inc_s = FLA_Obj_vector_inc( s );
92
93 // Datatype of U, V and C must be consistent and must be defined from one of them.
94 FLA_SORT_BSVD_EXT_DEFINE_OBJ_VARIABLES( U, apply_U, datatype, m_U, FLA_Obj_length, rs_U, cs_U );
95 FLA_SORT_BSVD_EXT_DEFINE_OBJ_VARIABLES( V, apply_V, datatype, m_V, FLA_Obj_length, rs_V, cs_V );
96 FLA_SORT_BSVD_EXT_DEFINE_OBJ_VARIABLES( C, apply_C, datatype, n_C, FLA_Obj_width, rs_C, cs_C );
97
98 switch ( datatype )
99 {
100 case FLA_FLOAT:
101 {
102 float* s_p = ( float* ) FLA_FLOAT_PTR( s );
103 float* U_p = ( apply_U == TRUE ? ( float* ) FLA_FLOAT_PTR( U ) : NULL );
104 float* V_p = ( apply_V == TRUE ? ( float* ) FLA_FLOAT_PTR( V ) : NULL );
105 float* C_p = ( apply_C == TRUE ? ( float* ) FLA_FLOAT_PTR( C ) : NULL );
106
107 if ( direct == FLA_FORWARD )
108 FLA_Sort_bsvd_ext_f_ops( m_s, s_p, inc_s,
109 m_U, U_p, rs_U, cs_U,
110 m_V, V_p, rs_V, cs_V,
111 n_C, C_p, rs_C, cs_C );
112 else // if ( direct == FLA_BACKWARD )
113 FLA_Sort_bsvd_ext_b_ops( m_s, s_p, inc_s,
114 m_U, U_p, rs_U, cs_U,
115 m_V, V_p, rs_V, cs_V,
116 n_C, C_p, rs_C, cs_C );
117 break;
118 }
119 case FLA_DOUBLE:
120 {
121 double* s_p = ( double* ) FLA_DOUBLE_PTR( s );
122 double* U_p = ( apply_U == TRUE ? ( double* ) FLA_DOUBLE_PTR( U ) : NULL );
123 double* V_p = ( apply_V == TRUE ? ( double* ) FLA_DOUBLE_PTR( V ) : NULL );
124 double* C_p = ( apply_C == TRUE ? ( double* ) FLA_DOUBLE_PTR( C ) : NULL );
125
126 if ( direct == FLA_FORWARD )
127 FLA_Sort_bsvd_ext_f_opd( m_s, s_p, inc_s,
128 m_U, U_p, rs_U, cs_U,
129 m_V, V_p, rs_V, cs_V,
130 n_C, C_p, rs_C, cs_C );
131 else // if ( direct == FLA_BACKWARD )
132 FLA_Sort_bsvd_ext_b_opd( m_s, s_p, inc_s,
133 m_U, U_p, rs_U, cs_U,
134 m_V, V_p, rs_V, cs_V,
135 n_C, C_p, rs_C, cs_C );
136 break;
137 }
138 case FLA_COMPLEX:
139 {
140 float* s_p = ( float* ) FLA_FLOAT_PTR( s );
141 scomplex* U_p = ( apply_U == TRUE ? ( scomplex* ) FLA_COMPLEX_PTR( U ) : NULL );
142 scomplex* V_p = ( apply_V == TRUE ? ( scomplex* ) FLA_COMPLEX_PTR( V ) : NULL );
143 scomplex* C_p = ( apply_C == TRUE ? ( scomplex* ) FLA_COMPLEX_PTR( C ) : NULL );
144
145 if ( direct == FLA_FORWARD )
146 FLA_Sort_bsvd_ext_f_opc( m_s, s_p, inc_s,
147 m_U, U_p, rs_U, cs_U,
148 m_V, V_p, rs_V, cs_V,
149 n_C, C_p, rs_C, cs_C );
150 else // if ( direct == FLA_BACKWARD )
151 FLA_Sort_bsvd_ext_b_opc( m_s, s_p, inc_s,
152 m_U, U_p, rs_U, cs_U,
153 m_V, V_p, rs_V, cs_V,
154 n_C, C_p, rs_C, cs_C );
155 break;
156 }
157 case FLA_DOUBLE_COMPLEX:
158 {
159 double* s_p = ( double* ) FLA_DOUBLE_PTR( s );
160 dcomplex* U_p = ( apply_U == TRUE ? ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( U ) : NULL );
161 dcomplex* V_p = ( apply_V == TRUE ? ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( V ) : NULL );
162 dcomplex* C_p = ( apply_C == TRUE ? ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( C ) : NULL );
163
164 if ( direct == FLA_FORWARD )
165 FLA_Sort_bsvd_ext_f_opz( m_s, s_p, inc_s,
166 m_U, U_p, rs_U, cs_U,
167 m_V, V_p, rs_V, cs_V,
168 n_C, C_p, rs_C, cs_C );
169 else // if ( direct == FLA_BACKWARD )
170 FLA_Sort_bsvd_ext_b_opz( m_s, s_p, inc_s,
171 m_U, U_p, rs_U, cs_U,
172 m_V, V_p, rs_V, cs_V,
173 n_C, C_p, rs_C, cs_C );
174 break;
175 }
176 }
177 return FLA_SUCCESS;
178}
FLA_Error FLA_Sort_bsvd_ext_f_opd(int m_s, double *s, int inc_s, int m_U, double *U, int rs_U, int cs_U, int m_V, double *V, int rs_V, int cs_V, int n_C, double *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:203
FLA_Error FLA_Sort_bsvd_ext_f_ops(int m_s, float *s, int inc_s, int m_U, float *U, int rs_U, int cs_U, int m_V, float *V, int rs_V, int cs_V, int n_C, float *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:181
FLA_Error FLA_Sort_bsvd_ext_b_opd(int m_s, double *s, int inc_s, int m_U, double *U, int rs_U, int cs_U, int m_V, double *V, int rs_V, int cs_V, int n_C, double *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:213
FLA_Error FLA_Sort_bsvd_ext_f_opc(int m_s, float *s, int inc_s, int m_U, scomplex *U, int rs_U, int cs_U, int m_V, scomplex *V, int rs_V, int cs_V, int n_C, scomplex *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:225
FLA_Error FLA_Sort_bsvd_ext_b_ops(int m_s, float *s, int inc_s, int m_U, float *U, int rs_U, int cs_U, int m_V, float *V, int rs_V, int cs_V, int n_C, float *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:191
FLA_Error FLA_Sort_bsvd_ext_b_opz(int m_s, double *s, int inc_s, int m_U, dcomplex *U, int rs_U, int cs_U, int m_V, dcomplex *V, int rs_V, int cs_V, int n_C, dcomplex *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:257
FLA_Error FLA_Sort_bsvd_ext_f_opz(int m_s, double *s, int inc_s, int m_U, dcomplex *U, int rs_U, int cs_U, int m_V, dcomplex *V, int rs_V, int cs_V, int n_C, dcomplex *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:247
FLA_Error FLA_Sort_bsvd_ext_b_opc(int m_s, float *s, int inc_s, int m_U, scomplex *U, int rs_U, int cs_U, int m_V, scomplex *V, int rs_V, int cs_V, int n_C, scomplex *C, int rs_C, int cs_C)
Definition FLA_Sort_bsvd_ext.c:235
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
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
int FLA_Datatype
Definition FLA_type_defs.h:49
unsigned long dim_t
Definition FLA_type_defs.h:71
FLA_Error FLA_Sort(FLA_Direct direct, FLA_Obj x)
Definition FLA_Sort.c:18
Definition blis_type_defs.h:138
Definition blis_type_defs.h:133

References FLA_Obj_length(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), FLA_Obj_width(), FLA_Sort(), FLA_Sort_bsvd_ext_b_opc(), FLA_Sort_bsvd_ext_b_opd(), FLA_Sort_bsvd_ext_b_ops(), FLA_Sort_bsvd_ext_b_opz(), FLA_Sort_bsvd_ext_f_opc(), FLA_Sort_bsvd_ext_f_opd(), FLA_Sort_bsvd_ext_f_ops(), and FLA_Sort_bsvd_ext_f_opz().

◆ FLA_Sort_bsvd_ext_b_opc()

FLA_Error FLA_Sort_bsvd_ext_b_opc ( int m_s,
float * s,
int inc_s,
int m_U,
scomplex * U,
int rs_U,
int cs_U,
int m_V,
scomplex * V,
int rs_V,
int cs_V,
int n_C,
scomplex * C,
int rs_C,
int cs_C )
239{
240 int i, ii, j, k;
241 float p;
242 FLA_SORT_BSVD_EXT_BODY( BACKWARD, bl1_cswapv );
243 return FLA_SUCCESS;
244}
int i
Definition bl1_axmyv2.c:145
void bl1_cswapv(int n, scomplex *x, int incx, scomplex *y, int incy)
Definition bl1_swapv.c:33

References bl1_cswapv(), and i.

Referenced by FLA_Bsvd_ext_opt_var1(), and FLA_Sort_bsvd_ext().

◆ FLA_Sort_bsvd_ext_b_opd()

FLA_Error FLA_Sort_bsvd_ext_b_opd ( int m_s,
double * s,
int inc_s,
int m_U,
double * U,
int rs_U,
int cs_U,
int m_V,
double * V,
int rs_V,
int cs_V,
int n_C,
double * C,
int rs_C,
int cs_C )
217{
218 int i, ii, j, k;
219 double p;
220 FLA_SORT_BSVD_EXT_BODY( BACKWARD, bl1_dswapv );
221 return FLA_SUCCESS;
222}
void bl1_dswapv(int n, double *x, int incx, double *y, int incy)
Definition bl1_swapv.c:23

References bl1_dswapv(), and i.

Referenced by FLA_Bsvd_ext_opt_var1(), and FLA_Sort_bsvd_ext().

◆ FLA_Sort_bsvd_ext_b_ops()

FLA_Error FLA_Sort_bsvd_ext_b_ops ( int m_s,
float * s,
int inc_s,
int m_U,
float * U,
int rs_U,
int cs_U,
int m_V,
float * V,
int rs_V,
int cs_V,
int n_C,
float * C,
int rs_C,
int cs_C )
195{
196 int i, ii, j, k;
197 float p;
198 FLA_SORT_BSVD_EXT_BODY( BACKWARD, bl1_sswapv );
199 return FLA_SUCCESS;
200}
void bl1_sswapv(int n, float *x, int incx, float *y, int incy)
Definition bl1_swapv.c:13

References bl1_sswapv(), and i.

Referenced by FLA_Bsvd_ext_opt_var1(), and FLA_Sort_bsvd_ext().

◆ FLA_Sort_bsvd_ext_b_opz()

FLA_Error FLA_Sort_bsvd_ext_b_opz ( int m_s,
double * s,
int inc_s,
int m_U,
dcomplex * U,
int rs_U,
int cs_U,
int m_V,
dcomplex * V,
int rs_V,
int cs_V,
int n_C,
dcomplex * C,
int rs_C,
int cs_C )
261{
262 int i, ii, j, k;
263 double p;
264 FLA_SORT_BSVD_EXT_BODY( BACKWARD, bl1_zswapv );
265 return FLA_SUCCESS;
266}
void bl1_zswapv(int n, dcomplex *x, int incx, dcomplex *y, int incy)
Definition bl1_swapv.c:43

References bl1_zswapv(), and i.

Referenced by FLA_Bsvd_ext_opt_var1(), and FLA_Sort_bsvd_ext().

◆ FLA_Sort_bsvd_ext_f_opc()

FLA_Error FLA_Sort_bsvd_ext_f_opc ( int m_s,
float * s,
int inc_s,
int m_U,
scomplex * U,
int rs_U,
int cs_U,
int m_V,
scomplex * V,
int rs_V,
int cs_V,
int n_C,
scomplex * C,
int rs_C,
int cs_C )
229{
230 int i, ii, j, k;
231 float p;
232 FLA_SORT_BSVD_EXT_BODY( FORWARD, bl1_cswapv );
233 return FLA_SUCCESS;
234}

References bl1_cswapv(), and i.

Referenced by FLA_Sort_bsvd_ext().

◆ FLA_Sort_bsvd_ext_f_opd()

FLA_Error FLA_Sort_bsvd_ext_f_opd ( int m_s,
double * s,
int inc_s,
int m_U,
double * U,
int rs_U,
int cs_U,
int m_V,
double * V,
int rs_V,
int cs_V,
int n_C,
double * C,
int rs_C,
int cs_C )
207{
208 int i, ii, j, k;
209 float p;
210 FLA_SORT_BSVD_EXT_BODY( FORWARD, bl1_dswapv );
211 return FLA_SUCCESS;
212}

References bl1_dswapv(), and i.

Referenced by FLA_Sort_bsvd_ext().

◆ FLA_Sort_bsvd_ext_f_ops()

FLA_Error FLA_Sort_bsvd_ext_f_ops ( int m_s,
float * s,
int inc_s,
int m_U,
float * U,
int rs_U,
int cs_U,
int m_V,
float * V,
int rs_V,
int cs_V,
int n_C,
float * C,
int rs_C,
int cs_C )
185{
186 int i, ii, j, k;
187 float p;
188 FLA_SORT_BSVD_EXT_BODY( FORWARD, bl1_sswapv );
189 return FLA_SUCCESS;
190}

References bl1_sswapv(), and i.

Referenced by FLA_Sort_bsvd_ext().

◆ FLA_Sort_bsvd_ext_f_opz()

FLA_Error FLA_Sort_bsvd_ext_f_opz ( int m_s,
double * s,
int inc_s,
int m_U,
dcomplex * U,
int rs_U,
int cs_U,
int m_V,
dcomplex * V,
int rs_V,
int cs_V,
int n_C,
dcomplex * C,
int rs_C,
int cs_C )
251{
252 int i, ii, j, k;
253 double p;
254 FLA_SORT_BSVD_EXT_BODY( FORWARD, bl1_zswapv );
255 return FLA_SUCCESS;
256}

References bl1_zswapv(), and i.

Referenced by FLA_Sort_bsvd_ext().