libflame revision_anchor
Functions
FLA_Househ2s_UT.c File Reference

(r)

Functions

FLA_Error FLA_Househ2s_UT (FLA_Side side, FLA_Obj chi_1, FLA_Obj x2, FLA_Obj alpha, FLA_Obj chi_1_minus_alpha, FLA_Obj tau)
 
FLA_Error FLA_Househ2s_UT_l_ops (int m_x2, float *chi_1, float *x2, int inc_x2, float *alpha, float *chi_1_minus_alpha, float *tau)
 
FLA_Error FLA_Househ2s_UT_l_opd (int m_x2, double *chi_1, double *x2, int inc_x2, double *alpha, double *chi_1_minus_alpha, double *tau)
 
FLA_Error FLA_Househ2s_UT_l_opc (int m_x2, scomplex *chi_1, scomplex *x2, int inc_x2, scomplex *alpha, scomplex *chi_1_minus_alpha, scomplex *tau)
 
FLA_Error FLA_Househ2s_UT_l_opz (int m_x2, dcomplex *chi_1, dcomplex *x2, int inc_x2, dcomplex *alpha, dcomplex *chi_1_minus_alpha, dcomplex *tau)
 
FLA_Error FLA_Househ2s_UT_r_ops (int m_x2, float *chi_1, float *x2, int inc_x2, float *alpha, float *chi_1_minus_alpha, float *tau)
 
FLA_Error FLA_Househ2s_UT_r_opd (int m_x2, double *chi_1, double *x2, int inc_x2, double *alpha, double *chi_1_minus_alpha, double *tau)
 
FLA_Error FLA_Househ2s_UT_r_opc (int m_x2, scomplex *chi_1, scomplex *x2, int inc_x2, scomplex *alpha, scomplex *chi_1_minus_alpha, scomplex *tau)
 
FLA_Error FLA_Househ2s_UT_r_opz (int m_x2, dcomplex *chi_1, dcomplex *x2, int inc_x2, dcomplex *alpha, dcomplex *chi_1_minus_alpha, dcomplex *tau)
 

Function Documentation

◆ FLA_Househ2s_UT()

FLA_Error FLA_Househ2s_UT ( FLA_Side  side,
FLA_Obj  chi_1,
FLA_Obj  x2,
FLA_Obj  alpha,
FLA_Obj  chi_1_minus_alpha,
FLA_Obj  tau 
)
17{
18 FLA_Datatype datatype;
19 int m_x2;
20 int inc_x2;
21
22 datatype = FLA_Obj_datatype( x2 );
23
26
29
30 switch ( datatype )
31 {
32 case FLA_FLOAT:
33 {
34 float* chi_1_p = ( float* ) FLA_FLOAT_PTR( chi_1 );
35 float* x2_p = ( float* ) FLA_FLOAT_PTR( x2 );
36 float* alpha_p = ( float* ) FLA_FLOAT_PTR( alpha );
38 float* tau_p = ( float* ) FLA_FLOAT_PTR( tau );
39
40 if ( side == FLA_LEFT )
42 chi_1_p,
43 x2_p, inc_x2,
44 alpha_p,
46 tau_p );
47 else // if ( side == FLA_RIGHT )
49 chi_1_p,
50 x2_p, inc_x2,
51 alpha_p,
53 tau_p );
54
55 break;
56 }
57
58 case FLA_DOUBLE:
59 {
60 double* chi_1_p = ( double* ) FLA_DOUBLE_PTR( chi_1 );
61 double* x2_p = ( double* ) FLA_DOUBLE_PTR( x2 );
62 double* alpha_p = ( double* ) FLA_DOUBLE_PTR( alpha );
64 double* tau_p = ( double* ) FLA_DOUBLE_PTR( tau );
65
66 if ( side == FLA_LEFT )
68 chi_1_p,
69 x2_p, inc_x2,
70 alpha_p,
72 tau_p );
73 else // if ( side == FLA_RIGHT )
75 chi_1_p,
76 x2_p, inc_x2,
77 alpha_p,
79 tau_p );
80
81 break;
82 }
83
84 case FLA_COMPLEX:
85 {
91
92 if ( side == FLA_LEFT )
94 chi_1_p,
95 x2_p, inc_x2,
96 alpha_p,
98 tau_p );
99 else // if ( side == FLA_RIGHT )
101 chi_1_p,
102 x2_p, inc_x2,
103 alpha_p,
105 tau_p );
106
107 break;
108 }
109
111 {
117
118 if ( side == FLA_LEFT )
120 chi_1_p,
121 x2_p, inc_x2,
122 alpha_p,
124 tau_p );
125 else // if ( side == FLA_RIGHT )
127 chi_1_p,
128 x2_p, inc_x2,
129 alpha_p,
131 tau_p );
132
133 break;
134 }
135 }
136
137 return FLA_SUCCESS;
138}
FLA_Error FLA_Househ2s_UT_l_opd(int m_x2, double *chi_1, double *x2, int inc_x2, double *alpha, double *chi_1_minus_alpha, double *tau)
Definition FLA_Househ2s_UT.c:237
FLA_Error FLA_Househ2s_UT_l_ops(int m_x2, float *chi_1, float *x2, int inc_x2, float *alpha, float *chi_1_minus_alpha, float *tau)
Definition FLA_Househ2s_UT.c:142
FLA_Error FLA_Househ2s_UT_r_opz(int m_x2, dcomplex *chi_1, dcomplex *x2, int inc_x2, dcomplex *alpha, dcomplex *chi_1_minus_alpha, dcomplex *tau)
Definition FLA_Househ2s_UT.c:610
FLA_Error FLA_Househ2s_UT_l_opz(int m_x2, dcomplex *chi_1, dcomplex *x2, int inc_x2, dcomplex *alpha, dcomplex *chi_1_minus_alpha, dcomplex *tau)
Definition FLA_Househ2s_UT.c:443
FLA_Error FLA_Househ2s_UT_l_opc(int m_x2, scomplex *chi_1, scomplex *x2, int inc_x2, scomplex *alpha, scomplex *chi_1_minus_alpha, scomplex *tau)
Definition FLA_Househ2s_UT.c:332
FLA_Error FLA_Househ2s_UT_r_opd(int m_x2, double *chi_1, double *x2, int inc_x2, double *alpha, double *chi_1_minus_alpha, double *tau)
Definition FLA_Househ2s_UT.c:572
FLA_Error FLA_Househ2s_UT_r_ops(int m_x2, float *chi_1, float *x2, int inc_x2, float *alpha, float *chi_1_minus_alpha, float *tau)
Definition FLA_Househ2s_UT.c:555
FLA_Error FLA_Househ2s_UT_r_opc(int m_x2, scomplex *chi_1, scomplex *x2, int inc_x2, scomplex *alpha, scomplex *chi_1_minus_alpha, scomplex *tau)
Definition FLA_Househ2s_UT.c:589
FLA_Error FLA_Househ2s_UT_check(FLA_Side side, FLA_Obj chi_1, FLA_Obj x2, FLA_Obj alpha, FLA_Obj chi_1_minus_alpha, FLA_Obj tau)
Definition FLA_Househ2s_UT_check.c:13
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
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
int i
Definition bl1_axmyv2.c:145
Definition blis_type_defs.h:138
Definition blis_type_defs.h:133

References FLA_Check_error_level(), FLA_Househ2s_UT_check(), FLA_Househ2s_UT_l_opc(), FLA_Househ2s_UT_l_opd(), FLA_Househ2s_UT_l_ops(), FLA_Househ2s_UT_l_opz(), FLA_Househ2s_UT_r_opc(), FLA_Househ2s_UT_r_opd(), FLA_Househ2s_UT_r_ops(), FLA_Househ2s_UT_r_opz(), FLA_Obj_datatype(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), and i.

Referenced by FLA_Bidiag_UT_u_step_unb_var3(), and FLA_Bidiag_UT_u_step_unb_var4().

◆ FLA_Househ2s_UT_l_opc()

FLA_Error FLA_Househ2s_UT_l_opc ( int  m_x2,
scomplex chi_1,
scomplex x2,
int  inc_x2,
scomplex alpha,
scomplex chi_1_minus_alpha,
scomplex tau 
)
338{
340 scomplex y[2];
341 float abs_chi_1;
342 float norm_x_2;
343 float norm_x;
346 int i_one = 1;
347 int i_two = 2;
348
349 //
350 // Compute the 2-norm of x_2:
351 //
352 // norm_x_2 := || x_2 ||_2
353 //
354
356 x2, inc_x2,
357 &norm_x_2 );
358
359 //
360 // If 2-norm of x_2 is zero, then return with trivial values.
361 //
362
363 if ( norm_x_2 == 0.0F )
364 {
365 alpha->real = -(chi_1->real);
366 alpha->imag = -(chi_1->imag);
367 chi_1_minus_alpha->real = 2.0F * chi_1->real;
368 chi_1_minus_alpha->imag = 2.0F * chi_1->imag;
369 tau->real = one_half.real;
370 tau->imag = one_half.imag;
371
372 return FLA_SUCCESS;
373 }
374
375 //
376 // Compute the absolute value (magnitude) of chi_1, which equals the 2-norm
377 // of chi_1:
378 //
379 // abs_chi_1 := | chi_1 | = || chi_1 ||_2
380 //
381
383 chi_1, i_one,
384 &abs_chi_1 );
385
386 //
387 // Compute the 2-norm of x via the two norms previously computed above:
388 //
389 // norm_x := || x ||_2 = || / chi_1 \ || = || / || chi_1 ||_2 \ ||
390 // || \ x_2 / ||_2 || \ || x_2 ||_2 / ||_2
391 //
392
393 y[0].real = abs_chi_1;
394 y[0].imag = 0.0;
395
396 y[1].real = norm_x_2;
397 y[1].imag = 0.0F;
398
400 y, i_one,
401 &norm_x );
402
403 //
404 // Compute alpha:
405 //
406 // alpha := - || x ||_2 * chi_1 / | chi_1 |
407 //
408
409 if ( abs_chi_1 == 0.0F )
410 {
411 alpha->real = norm_x * ( -1.0F );
412 alpha->imag = norm_x * ( -1.0F );
413 }
414 else
415 {
416 alpha->real = norm_x * ( -chi_1->real / abs_chi_1 );
417 alpha->imag = norm_x * ( -chi_1->imag / abs_chi_1 );
418 }
419
420 chi_1_minus_alpha->real = chi_1->real - alpha->real;
421 chi_1_minus_alpha->imag = chi_1->imag - alpha->imag;
422
423 //
424 // Compute tau:
425 //
426 // tau := ( 1 + u_2' * u_2 ) / 2
427 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_2' * x_2 ) /
428 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
429 // = 1/2 + ( || x ||_2 / | chi_1 - alpha | )^2
430 //
432
436 tau->imag = 0.0F;
437
438 return FLA_SUCCESS;
439}
FLA_Obj FLA_ONE_HALF
Definition FLA_Init.c:19
void bl1_cnrm2(int n, scomplex *x, int incx, float *norm)
Definition bl1_nrm2.c:35

References bl1_cnrm2(), FLA_ONE_HALF, and i.

Referenced by FLA_Househ2s_UT(), and FLA_Househ2s_UT_r_opc().

◆ FLA_Househ2s_UT_l_opd()

FLA_Error FLA_Househ2s_UT_l_opd ( int  m_x2,
double chi_1,
double x2,
int  inc_x2,
double alpha,
double chi_1_minus_alpha,
double tau 
)
243{
245 double y[2];
246 double abs_chi_1;
247 double norm_x_2;
248 double norm_x;
251 int i_one = 1;
252 int i_two = 2;
253
254 //
255 // Compute the 2-norm of x_2:
256 //
257 // norm_x_2 := || x_2 ||_2
258 //
259
261 x2, inc_x2,
262 &norm_x_2 );
263
264 //
265 // If 2-norm of x_2 is zero, then return with trivial values.
266 //
267
268 if ( norm_x_2 == 0.0 )
269 {
270 *alpha = -(*chi_1);
271 *chi_1_minus_alpha = 2.0 * (*chi_1);
272 *tau = one_half;
273
274 return FLA_SUCCESS;
275 }
276
277 //
278 // Compute the absolute value (magnitude) of chi_1, which equals the 2-norm
279 // of chi_1:
280 //
281 // abs_chi_1 := | chi_1 | = || chi_1 ||_2
282 //
283
285 chi_1, i_one,
286 &abs_chi_1 );
287
288 //
289 // Compute the 2-norm of x via the two norms previously computed above:
290 //
291 // norm_x := || x ||_2 = || / chi_1 \ || = || / || chi_1 ||_2 \ ||
292 // || \ x_2 / ||_2 || \ || x_2 ||_2 / ||_2
293 //
294
295 y[0] = abs_chi_1;
296 y[1] = norm_x_2;
297
299 y, i_one,
300 &norm_x );
301
302 //
303 // Compute alpha:
304 //
305 // alpha := - || x ||_2 * chi_1 / | chi_1 |
306 // = -sign( chi_1 ) * || x ||_2
307 //
308
309 *alpha = -dsign( *chi_1 ) * norm_x;
310
311 *chi_1_minus_alpha = (*chi_1) - (*alpha);
312
313 //
314 // Compute tau:
315 //
316 // tau := ( 1 + u_2' * u_2 ) / 2
317 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_2' * x_2 ) /
318 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
319 // = 1/2 + ( || x ||_2 / | chi_1 - alpha | )^2
320 //
322
326
327 return FLA_SUCCESS;
328}
void bl1_dnrm2(int n, double *x, int incx, double *norm)
Definition bl1_nrm2.c:24

References bl1_dnrm2(), FLA_ONE_HALF, and i.

Referenced by FLA_Househ2s_UT(), and FLA_Househ2s_UT_r_opd().

◆ FLA_Househ2s_UT_l_ops()

FLA_Error FLA_Househ2s_UT_l_ops ( int  m_x2,
float chi_1,
float x2,
int  inc_x2,
float alpha,
float chi_1_minus_alpha,
float tau 
)
148{
150 float y[2];
151 float abs_chi_1;
152 float norm_x_2;
153 float norm_x;
156 int i_one = 1;
157 int i_two = 2;
158
159 //
160 // Compute the 2-norm of x_2:
161 //
162 // norm_x_2 := || x_2 ||_2
163 //
164
166 x2, inc_x2,
167 &norm_x_2 );
168
169 //
170 // If 2-norm of x_2 is zero, then return with trivial values.
171 //
172
173 if ( norm_x_2 == 0.0F )
174 {
175 *alpha = -(*chi_1);
176 *chi_1_minus_alpha = 2.0F * (*chi_1);
177 *tau = one_half;
178
179 return FLA_SUCCESS;
180 }
181
182 //
183 // Compute the absolute value (magnitude) of chi_1, which equals the 2-norm
184 // of chi_1:
185 //
186 // abs_chi_1 := | chi_1 | = || chi_1 ||_2
187 //
188
190 chi_1, i_one,
191 &abs_chi_1 );
192
193 //
194 // Compute the 2-norm of x via the two norms previously computed above:
195 //
196 // norm_x := || x ||_2 = || / chi_1 \ || = || / || chi_1 ||_2 \ ||
197 // || \ x_2 / ||_2 || \ || x_2 ||_2 / ||_2
198 //
199
200 y[0] = abs_chi_1;
201 y[1] = norm_x_2;
202
204 y, i_one,
205 &norm_x );
206
207 //
208 // Compute alpha:
209 //
210 // alpha := - || x ||_2 * chi_1 / | chi_1 |
211 // = -sign( chi_1 ) * || x ||_2
212 //
213
214 *alpha = -ssign( *chi_1 ) * norm_x;
215
216 *chi_1_minus_alpha = (*chi_1) - (*alpha);
217
218 //
219 // Compute tau:
220 //
221 // tau := ( 1 + u_2' * u_2 ) / 2
222 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_2' * x_2 ) /
223 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
224 // = 1/2 + ( || x ||_2 / | chi_1 - alpha | )^2
225 //
227
231
232 return FLA_SUCCESS;
233}
void bl1_snrm2(int n, float *x, int incx, float *norm)
Definition bl1_nrm2.c:13

References bl1_snrm2(), FLA_ONE_HALF, and i.

Referenced by FLA_Househ2s_UT(), and FLA_Househ2s_UT_r_ops().

◆ FLA_Househ2s_UT_l_opz()

FLA_Error FLA_Househ2s_UT_l_opz ( int  m_x2,
dcomplex chi_1,
dcomplex x2,
int  inc_x2,
dcomplex alpha,
dcomplex chi_1_minus_alpha,
dcomplex tau 
)
449{
451 dcomplex y[2];
452 double abs_chi_1;
453 double norm_x_2;
454 double norm_x;
457 int i_one = 1;
458 int i_two = 2;
459
460 //
461 // Compute the 2-norm of x_2:
462 //
463 // norm_x_2 := || x_2 ||_2
464 //
465
467 x2, inc_x2,
468 &norm_x_2 );
469
470 //
471 // If 2-norm of x_2 is zero, then return with trivial values.
472 //
473
474 if ( norm_x_2 == 0.0 )
475 {
476 alpha->real = -(chi_1->real);
477 alpha->imag = -(chi_1->imag);
478 chi_1_minus_alpha->real = 2.0 * chi_1->real;
479 chi_1_minus_alpha->imag = 2.0 * chi_1->imag;
480 tau->real = one_half.real;
481 tau->imag = one_half.imag;
482
483 return FLA_SUCCESS;
484 }
485
486 //
487 // Compute the absolute value (magnitude) of chi_1, which equals the 2-norm
488 // of chi_1:
489 //
490 // abs_chi_1 := | chi_1 | = || chi_1 ||_2
491 //
492
494 chi_1, i_one,
495 &abs_chi_1 );
496
497 //
498 // Compute the 2-norm of x via the two norms previously computed above:
499 //
500 // norm_x := || x ||_2 = || / chi_1 \ || = || / || chi_1 ||_2 \ ||
501 // || \ x_2 / ||_2 || \ || x_2 ||_2 / ||_2
502 //
503
504 y[0].real = abs_chi_1;
505 y[0].imag = 0.0;
506
507 y[1].real = norm_x_2;
508 y[1].imag = 0.0;
509
511 y, i_one,
512 &norm_x );
513
514 //
515 // Compute alpha:
516 //
517 // alpha := - || x ||_2 * chi_1 / | chi_1 |
518 //
519
520 if ( abs_chi_1 == 0.0 )
521 {
522 alpha->real = norm_x * ( -1.0 );
523 alpha->imag = norm_x * ( -1.0 );
524 }
525 else
526 {
527 alpha->real = norm_x * ( -chi_1->real / abs_chi_1 );
528 alpha->imag = norm_x * ( -chi_1->imag / abs_chi_1 );
529 }
530
531 chi_1_minus_alpha->real = chi_1->real - alpha->real;
532 chi_1_minus_alpha->imag = chi_1->imag - alpha->imag;
533
534 //
535 // Compute tau:
536 //
537 // tau := ( 1 + u_2' * u_2 ) / 2
538 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_2' * x_2 ) /
539 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
540 // = 1/2 + ( || x ||_2 / | chi_1 - alpha | )^2
541 //
543
547 tau->imag = 0.0;
548
549 return FLA_SUCCESS;
550}
void bl1_znrm2(int n, dcomplex *x, int incx, double *norm)
Definition bl1_nrm2.c:46

References bl1_znrm2(), FLA_ONE_HALF, and i.

Referenced by FLA_Househ2s_UT(), and FLA_Househ2s_UT_r_opz().

◆ FLA_Househ2s_UT_r_opc()

FLA_Error FLA_Househ2s_UT_r_opc ( int  m_x2,
scomplex chi_1,
scomplex x2,
int  inc_x2,
scomplex alpha,
scomplex chi_1_minus_alpha,
scomplex tau 
)
595{
597 chi_1,
598 x2, inc_x2,
599 alpha,
601 tau );
602
603 //chi_1_minus_alpha->real = chi_1->real - alpha->real;
604 //chi_1_minus_alpha->imag = chi_1->imag - -alpha->imag;
605
606 return FLA_SUCCESS;
607}

References FLA_Househ2s_UT_l_opc(), and i.

Referenced by FLA_Bidiag_UT_u_step_ofc_var3(), FLA_Bidiag_UT_u_step_ofc_var4(), FLA_Bidiag_UT_u_step_opc_var3(), FLA_Bidiag_UT_u_step_opc_var4(), and FLA_Househ2s_UT().

◆ FLA_Househ2s_UT_r_opd()

FLA_Error FLA_Househ2s_UT_r_opd ( int  m_x2,
double chi_1,
double x2,
int  inc_x2,
double alpha,
double chi_1_minus_alpha,
double tau 
)

◆ FLA_Househ2s_UT_r_ops()

FLA_Error FLA_Househ2s_UT_r_ops ( int  m_x2,
float chi_1,
float x2,
int  inc_x2,
float alpha,
float chi_1_minus_alpha,
float tau 
)

◆ FLA_Househ2s_UT_r_opz()

FLA_Error FLA_Househ2s_UT_r_opz ( int  m_x2,
dcomplex chi_1,
dcomplex x2,
int  inc_x2,
dcomplex alpha,
dcomplex chi_1_minus_alpha,
dcomplex tau 
)
616{
618 chi_1,
619 x2, inc_x2,
620 alpha,
622 tau );
623
624 //chi_1_minus_alpha->real = chi_1->real - alpha->real;
625 //chi_1_minus_alpha->imag = chi_1->imag - -alpha->imag;
626
627 return FLA_SUCCESS;
628}

References FLA_Househ2s_UT_l_opz(), and i.

Referenced by FLA_Bidiag_UT_u_step_ofz_var3(), FLA_Bidiag_UT_u_step_ofz_var4(), FLA_Bidiag_UT_u_step_opz_var3(), FLA_Bidiag_UT_u_step_opz_var4(), and FLA_Househ2s_UT().