libflame revision_anchor
Functions
FLA_Bsvd_sinval_v_opt_var1.c File Reference

(r)

Functions

FLA_Error FLA_Bsvd_sinval_v_opt_var1 (FLA_Obj tol, FLA_Obj thresh, FLA_Obj G, FLA_Obj H, FLA_Obj d, FLA_Obj e, FLA_Obj k)
 
FLA_Error FLA_Bsvd_sinval_v_ops_var1 (int m_A, int n_GH, int n_iter_allowed, float tol, float thresh, scomplex *buff_G, int rs_G, int cs_G, scomplex *buff_H, int rs_H, int cs_H, float *buff_d, int inc_d, float *buff_e, int inc_e, int *n_iter)
 
FLA_Error FLA_Bsvd_sinval_v_opd_var1 (int m_A, int n_GH, int n_iter_allowed, double tol, double thresh, dcomplex *buff_G, int rs_G, int cs_G, dcomplex *buff_H, int rs_H, int cs_H, double *buff_d, int inc_d, double *buff_e, int inc_e, int *n_iter)
 

Function Documentation

◆ FLA_Bsvd_sinval_v_opd_var1()

FLA_Error FLA_Bsvd_sinval_v_opd_var1 ( int  m_A,
int  n_GH,
int  n_iter_allowed,
double  tol,
double  thresh,
dcomplex buff_G,
int  rs_G,
int  cs_G,
dcomplex buff_H,
int  rs_H,
int  cs_H,
double buff_d,
int  inc_d,
double buff_e,
int  inc_e,
int n_iter 
)
204{
206 double one = bl1_d1();
207 //double* d_first;
208 //double* d_last_m1;
209 double* e_last;
210 //double* d_last;
211 double smax;
212 double smin;
213 double sminl;
214 double shift;
215 int k;
216
217 // Initialize pointers to some diagonal and superdiagonal elements
218 // that we will refer to later.
219 e_last = buff_e + (m_A-2)*inc_e;
220 //d_last_m1 = buff_d + (m_A-2)*inc_d;
221 //d_last = buff_d + (m_A-1)*inc_d;
222 //d_first = buff_d + (0 )*inc_d;
223
224 // Find the largest element of the diagonal or superdiagonal.
225 // This is used later when checking the shift.
227 buff_d, inc_d,
228 buff_e, inc_e,
229 &smax,
230 &smin );
231
232 // Perform some iterations.
233 for ( k = 0; k < n_iter_allowed; ++k )
234 {
235 dcomplex* g1 = buff_G + (k )*cs_G;
236 dcomplex* h1 = buff_H + (k )*cs_H;
237
238 /*------------------------------------------------------------*/
239
240 // Before we perform any rotations, check for pre-existing deflation.
242 tol,
243 buff_d, inc_d,
244 buff_e, inc_e,
245 &sminl );
246
247 // If r_val is positive, then deflation was found.
248 if ( 0 <= r_val )
249 {
250#ifdef PRINTF
251 printf( "FLA_Bsvd_sinval_v_opt_var1: Deflation detected in col %d, sval %d\n", r_val, m_A - 1 );
252 printf( "FLA_Bsvd_sinval_v_opt_var1: alpha11 alpha12 = %23.19e %23.19e\n", buff_d[r_val*inc_d], buff_e[r_val*inc_e] );
253 printf( "FLA_Bsvd_sinval_v_opt_var1: alpha22 = %43.19e\n", buff_d[(r_val+1)*inc_d] );
254#endif
255
256 // Set the off-diagonal element to zero.
257 buff_e[ (r_val)*inc_e ] = 0.0;
258
259 *n_iter = k;
260 return r_val;
261 }
262
263
264 // Compute a shift with the last 2x2 matrix.
266 tol,
267 sminl,
268 smax,
269 buff_d, inc_d,
270 buff_e, inc_e,
271 &shift );
272
273 // Perform a Francis step.
275 shift,
276 g1, rs_G,
277 h1, rs_H,
278 buff_d, inc_d,
279 buff_e, inc_e );
280
281 // Check for convergence using thresh.
283 {
284 *e_last = 0.0;
285 *n_iter = k + 1;
286 return m_A - 1;
287 }
288
289 /*------------------------------------------------------------*/
290 }
291
293 return FLA_FAILURE;
294}
FLA_Error FLA_Bsvd_compute_shift_opd(int m_A, double tol, double sminl, double smax, double *buff_d, int inc_d, double *buff_e, int inc_e, double *shift)
Definition FLA_Bsvd_compute_shift.c:130
FLA_Error FLA_Bsvd_find_converged_opd(int m_A, double tol, double *buff_d, int inc_d, double *buff_e, int inc_e, double *sminl)
Definition FLA_Bsvd_find_converged.c:117
FLA_Error FLA_Bsvd_find_max_min_opd(int m_A, double *buff_d, int inc_d, double *buff_e, int inc_e, double *smax, double *smin)
Definition FLA_Bsvd_find_max_min.c:103
FLA_Error FLA_Bsvd_francis_v_opd_var1(int m_A, double shift, dcomplex *buff_g, int inc_g, dcomplex *buff_h, int inc_h, double *buff_d, int inc_d, double *buff_e, int inc_e)
Definition FLA_Bsvd_francis_v_opt_var1.c:261
int FLA_Error
Definition FLA_type_defs.h:47
int i
Definition bl1_axmyv2.c:145
double bl1_d1(void)
Definition bl1_constants.c:54
Definition blis_type_defs.h:138

References bl1_d1(), FLA_Bsvd_compute_shift_opd(), FLA_Bsvd_find_converged_opd(), FLA_Bsvd_find_max_min_opd(), FLA_Bsvd_francis_v_opd_var1(), and i.

Referenced by FLA_Bsvd_iteracc_v_opd_var1(), and FLA_Bsvd_sinval_v_opt_var1().

◆ FLA_Bsvd_sinval_v_ops_var1()

FLA_Error FLA_Bsvd_sinval_v_ops_var1 ( int  m_A,
int  n_GH,
int  n_iter_allowed,
float  tol,
float  thresh,
scomplex buff_G,
int  rs_G,
int  cs_G,
scomplex buff_H,
int  rs_H,
int  cs_H,
float buff_d,
int  inc_d,
float buff_e,
int  inc_e,
int n_iter 
)
106{
108 float one = bl1_s1();
109 //float* d_first;
110 //float* d_last_m1;
111 float* e_last;
112 //float* d_last;
113 float smax;
114 float smin;
115 float sminl;
116 float shift;
117 int k;
118
119 // Initialize pointers to some diagonal and superdiagonal elements
120 // that we will refer to later.
121 e_last = buff_e + (m_A-2)*inc_e;
122 //d_last_m1 = buff_d + (m_A-2)*inc_d;
123 //d_last = buff_d + (m_A-1)*inc_d;
124 //d_first = buff_d + (0 )*inc_d;
125
126 // Find the largest element of the diagonal or superdiagonal.
127 // This is used later when checking the shift.
129 buff_d, inc_d,
130 buff_e, inc_e,
131 &smax,
132 &smin );
133
134 // Perform some iterations.
135 for ( k = 0; k < n_iter_allowed; ++k )
136 {
137 scomplex* g1 = buff_G + (k )*cs_G;
138 scomplex* h1 = buff_H + (k )*cs_H;
139
140 /*------------------------------------------------------------*/
141
142 // Before we perform any rotations, check for pre-existing deflation.
144 tol,
145 buff_d, inc_d,
146 buff_e, inc_e,
147 &sminl );
148
149 // If r_val is positive, then deflation was found.
150 if ( 0 <= r_val )
151 {
152 // Set the off-diagonal element to zero.
153 buff_e[ (r_val)*inc_e ] = 0.0F;
154
155 *n_iter = k;
156 return r_val;
157 }
158
159
160 // Compute a shift with the last 2x2 matrix.
162 tol,
163 sminl,
164 smax,
165 buff_d, inc_d,
166 buff_e, inc_e,
167 &shift );
168
169 // Perform a Francis step.
171 shift,
172 g1, rs_G,
173 h1, rs_H,
174 buff_d, inc_d,
175 buff_e, inc_e );
176
177 // Check for convergence using thresh.
179 {
180 *e_last = 0.0F;
181 *n_iter = k + 1;
182 return m_A - 1;
183 }
184
185 /*------------------------------------------------------------*/
186 }
187
189 return FLA_SUCCESS;
190}
FLA_Error FLA_Bsvd_compute_shift_ops(int m_A, float tol, float sminl, float smax, float *buff_d, int inc_d, float *buff_e, int inc_e, float *shift)
Definition FLA_Bsvd_compute_shift.c:75
FLA_Error FLA_Bsvd_find_converged_ops(int m_A, float tol, float *buff_d, int inc_d, float *buff_e, int inc_e, float *sminl)
Definition FLA_Bsvd_find_converged.c:68
FLA_Error FLA_Bsvd_find_max_min_ops(int m_A, float *buff_d, int inc_d, float *buff_e, int inc_e, float *smax, float *smin)
Definition FLA_Bsvd_find_max_min.c:68
FLA_Error FLA_Bsvd_francis_v_ops_var1(int m_A, float shift, scomplex *buff_g, int inc_g, scomplex *buff_h, int inc_h, float *buff_d, int inc_d, float *buff_e, int inc_e)
Definition FLA_Bsvd_francis_v_opt_var1.c:76
float bl1_s1(void)
Definition bl1_constants.c:47
Definition blis_type_defs.h:133

References bl1_s1(), FLA_Bsvd_compute_shift_ops(), FLA_Bsvd_find_converged_ops(), FLA_Bsvd_find_max_min_ops(), FLA_Bsvd_francis_v_ops_var1(), and i.

Referenced by FLA_Bsvd_iteracc_v_ops_var1(), and FLA_Bsvd_sinval_v_opt_var1().

◆ FLA_Bsvd_sinval_v_opt_var1()

FLA_Error FLA_Bsvd_sinval_v_opt_var1 ( FLA_Obj  tol,
FLA_Obj  thresh,
FLA_Obj  G,
FLA_Obj  H,
FLA_Obj  d,
FLA_Obj  e,
FLA_Obj  k 
)
17{
18 FLA_Datatype datatype;
19 int m_A, n_GH;
20 int rs_G, cs_G;
21 int rs_H, cs_H;
22 int inc_d;
23 int inc_e;
24
25 datatype = FLA_Obj_datatype( d );
26
28 n_GH = FLA_Obj_width( G );
29
32
35
38
39
40 switch ( datatype )
41 {
42 case FLA_FLOAT:
43 {
44 float* buff_tol = FLA_FLOAT_PTR( tol );
48 float* buff_d = FLA_FLOAT_PTR( d );
49 float* buff_e = FLA_FLOAT_PTR( e );
50 int* buff_k = FLA_INT_PTR( k );
51
53 n_GH,
54 9,
55 *buff_tol,
61 buff_k );
62
63 break;
64 }
65
66 case FLA_DOUBLE:
67 {
68 double* buff_tol = FLA_DOUBLE_PTR( tol );
72 double* buff_d = FLA_DOUBLE_PTR( d );
73 double* buff_e = FLA_DOUBLE_PTR( e );
74 int* buff_k = FLA_INT_PTR( k );
75
77 n_GH,
78 9,
79 *buff_tol,
85 buff_k );
86
87 break;
88 }
89 }
90
91 return FLA_SUCCESS;
92}
FLA_Error FLA_Bsvd_sinval_v_opd_var1(int m_A, int n_GH, int n_iter_allowed, double tol, double thresh, dcomplex *buff_G, int rs_G, int cs_G, dcomplex *buff_H, int rs_H, int cs_H, double *buff_d, int inc_d, double *buff_e, int inc_e, int *n_iter)
Definition FLA_Bsvd_sinval_v_opt_var1.c:194
FLA_Error FLA_Bsvd_sinval_v_ops_var1(int m_A, int n_GH, int n_iter_allowed, float tol, float thresh, scomplex *buff_G, int rs_G, int cs_G, scomplex *buff_H, int rs_H, int cs_H, float *buff_d, int inc_d, float *buff_e, int inc_e, int *n_iter)
Definition FLA_Bsvd_sinval_v_opt_var1.c:96
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_col_stride(FLA_Obj obj)
Definition FLA_Query.c:174
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

References FLA_Bsvd_sinval_v_opd_var1(), FLA_Bsvd_sinval_v_ops_var1(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_row_stride(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), FLA_Obj_width(), and i.