libflame revision_anchor
Functions
FLA_Househ3UD_UT.c File Reference

(r)

Functions

FLA_Error FLA_Househ3UD_UT (FLA_Obj chi_0, FLA_Obj x1, FLA_Obj y2, FLA_Obj tau)
 
FLA_Error FLA_Househ3UD_UT_ops (int m_x1, int m_y2, float *chi_0, float *x1, int inc_x1, float *y2, int inc_y2, float *tau)
 
FLA_Error FLA_Househ3UD_UT_opd (int m_x1, int m_y2, double *chi_0, double *x1, int inc_x1, double *y2, int inc_y2, double *tau)
 
FLA_Error FLA_Househ3UD_UT_opc (int m_x1, int m_y2, scomplex *chi_0, scomplex *x1, int inc_x1, scomplex *y2, int inc_y2, scomplex *tau)
 
FLA_Error FLA_Househ3UD_UT_opz (int m_x1, int m_y2, dcomplex *chi_0, dcomplex *x1, int inc_x1, dcomplex *y2, int inc_y2, dcomplex *tau)
 

Function Documentation

◆ FLA_Househ3UD_UT()

FLA_Error FLA_Househ3UD_UT ( FLA_Obj  chi_0,
FLA_Obj  x1,
FLA_Obj  y2,
FLA_Obj  tau 
)
51{
52 FLA_Datatype datatype;
53 int m_x1;
54 int m_y2;
55 int inc_x1;
56 int inc_y2;
57
58 datatype = FLA_Obj_datatype( x1 );
59
64
67
68 switch ( datatype )
69 {
70 case FLA_FLOAT:
71 {
72 float* chi_0_p = ( float* ) FLA_FLOAT_PTR( chi_0 );
73 float* x1_p = ( float* ) FLA_FLOAT_PTR( x1 );
74 float* y2_p = ( float* ) FLA_FLOAT_PTR( y2 );
75 float* tau_p = ( float* ) FLA_FLOAT_PTR( tau );
76
78 m_y2,
79 chi_0_p,
80 x1_p, inc_x1,
81 y2_p, inc_y2,
82 tau_p );
83 break;
84 }
85
86 case FLA_DOUBLE:
87 {
88 double* chi_0_p = ( double* ) FLA_DOUBLE_PTR( chi_0 );
89 double* x1_p = ( double* ) FLA_DOUBLE_PTR( x1 );
90 double* y2_p = ( double* ) FLA_DOUBLE_PTR( y2 );
91 double* tau_p = ( double* ) FLA_DOUBLE_PTR( tau );
92
94 m_y2,
95 chi_0_p,
96 x1_p, inc_x1,
97 y2_p, inc_y2,
98 tau_p );
99 break;
100 }
101
102 case FLA_COMPLEX:
103 {
108
110 m_y2,
111 chi_0_p,
112 x1_p, inc_x1,
113 y2_p, inc_y2,
114 tau_p );
115 break;
116 }
117
119 {
124
126 m_y2,
127 chi_0_p,
128 x1_p, inc_x1,
129 y2_p, inc_y2,
130 tau_p );
131 break;
132 }
133 }
134
135 return FLA_SUCCESS;
136}
FLA_Error FLA_Househ3UD_UT_opz(int m_x1, int m_y2, dcomplex *chi_0, dcomplex *x1, int inc_x1, dcomplex *y2, int inc_y2, dcomplex *tau)
Definition FLA_Househ3UD_UT.c:527
FLA_Error FLA_Househ3UD_UT_opd(int m_x1, int m_y2, double *chi_0, double *x1, int inc_x1, double *y2, int inc_y2, double *tau)
Definition FLA_Househ3UD_UT.c:267
FLA_Error FLA_Househ3UD_UT_ops(int m_x1, int m_y2, float *chi_0, float *x1, int inc_x1, float *y2, int inc_y2, float *tau)
Definition FLA_Househ3UD_UT.c:140
FLA_Error FLA_Househ3UD_UT_opc(int m_x1, int m_y2, scomplex *chi_0, scomplex *x1, int inc_x1, scomplex *y2, int inc_y2, scomplex *tau)
Definition FLA_Househ3UD_UT.c:393
FLA_Error FLA_Househ3UD_UT_check(FLA_Obj chi_1, FLA_Obj x2, FLA_Obj y2, FLA_Obj tau)
Definition FLA_Househ3UD_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
x1
Definition bl1_dotsv2.c:374
Definition blis_type_defs.h:138
Definition blis_type_defs.h:133

References FLA_Check_error_level(), FLA_Househ3UD_UT_check(), FLA_Househ3UD_UT_opc(), FLA_Househ3UD_UT_opd(), FLA_Househ3UD_UT_ops(), FLA_Househ3UD_UT_opz(), FLA_Obj_datatype(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), i, and x1.

Referenced by FLA_UDdate_UT_unb_var1().

◆ FLA_Househ3UD_UT_opc()

FLA_Error FLA_Househ3UD_UT_opc ( int  m_x1,
int  m_y2,
scomplex chi_0,
scomplex x1,
int  inc_x1,
scomplex y2,
int  inc_y2,
scomplex tau 
)
399{
404 float abs_chi_0;
405 float norm_x_1;
406 float norm_y_2;
407 float lambda;
409 int i_one = 1;
410
411 //
412 // Compute the 2-norms of x_1 and y_2:
413 //
414 // norm_x_1 := || x_1 ||_2
415 // norm_y_2 := || y_2 ||_2
416 //
417
419 x1, inc_x1,
420 &norm_x_1 );
421
423 y2, inc_y2,
424 &norm_y_2 );
425
426 //
427 // If 2-norms of x_1, y_2 are zero, then return with trivial tau, chi_0 values.
428 //
429
430 if ( norm_x_1 == 0.0F &&
431 norm_y_2 == 0.0F )
432 {
433 chi_0->real = -(chi_0->real);
434 chi_0->imag = -(chi_0->imag);
435 tau->real = one_half.real;
436 tau->imag = one_half.imag;
437
438 return FLA_SUCCESS;
439 }
440
441 //
442 // Compute the absolute value (magnitude) of chi_0, which equals the 2-norm
443 // of chi_0:
444 //
445 // abs_chi_0 := | chi_0 | = || chi_0 ||_2
446 //
447
449 chi_0, i_one,
450 &abs_chi_0 );
451
452 //
453 // Compute lambda:
454 //
455 // lambda := sqrt( conj(chi0) chi0 + x1' x1 - y2' y2 )
456 //
457
460 norm_y_2 * norm_y_2 );
461
462 //
463 // Compute alpha:
464 //
465 // alpha := - lambda * chi_0 / | chi_0 |
466 //
467
468 alpha.real = -chi_0->real * lambda / abs_chi_0;
469 alpha.imag = -chi_0->imag * lambda / abs_chi_0;
470
471 //
472 // Overwrite x_1 and y_2 with u_1 and v_2, respectively:
473 //
474 // x_1 := x_1 / ( chi_0 - alpha )
475 // y_2 := y_2 / -( chi_0 - alpha )
476 //
477
478 chi_0_minus_alpha.real = chi_0->real - alpha.real;
479 chi_0_minus_alpha.imag = chi_0->imag - alpha.imag;
480
482 m_x1,
484 x1, inc_x1 );
485
488
490 m_y2,
492 y2, inc_y2 );
493
494 //
495 // Compute tau:
496 //
497 // tau := ( 1 + u_1' * u_1 - v_2' * v_2 ) / 2
498 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_1' * x_1 - y_2' * y_2 ) /
499 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
500 // = ( | chi_1 - alpha |^2 + || x_2 ||_2^2 - || y_2 ||_2^2 ) /
501 // ( 2 * | chi_1 - alpha |^2 )
502 //
503
506
507 tau->real = ( abs_sq_chi_0_minus_alpha +
509 norm_y_2 * norm_y_2 ) /
510 ( 2.0F * abs_sq_chi_0_minus_alpha );
511 tau->imag = 0.0F;
512
513 //
514 // Overwrite chi_0 with alpha:
515 //
516 // chi_0 := alpha
517 //
518
519 chi_0->real = alpha.real;
520 chi_0->imag = alpha.imag;
521
522 return FLA_SUCCESS;
523}
FLA_Obj FLA_ONE_HALF
Definition FLA_Init.c:19
void bl1_cinvscalv(conj1_t conj, int n, scomplex *alpha, scomplex *x, int incx)
Definition bl1_invscalv.c:52
void bl1_cnrm2(int n, scomplex *x, int incx, float *norm)
Definition bl1_nrm2.c:35
@ BLIS1_NO_CONJUGATE
Definition blis_type_defs.h:81

References bl1_cinvscalv(), bl1_cnrm2(), BLIS1_NO_CONJUGATE, FLA_ONE_HALF, i, and x1.

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_opc_var1().

◆ FLA_Househ3UD_UT_opd()

FLA_Error FLA_Househ3UD_UT_opd ( int  m_x1,
int  m_y2,
double chi_0,
double x1,
int  inc_x1,
double y2,
int  inc_y2,
double tau 
)
273{
275 double alpha;
276 double chi_0_minus_alpha;
278 double abs_chi_0;
279 double norm_x_1;
280 double norm_y_2;
281 double lambda;
283 int i_one = 1;
284
285 //
286 // Compute the 2-norms of x_1 and y_2:
287 //
288 // norm_x_1 := || x_1 ||_2
289 // norm_y_2 := || y_2 ||_2
290 //
291
293 x1, inc_x1,
294 &norm_x_1 );
295
297 y2, inc_y2,
298 &norm_y_2 );
299
300 //
301 // If 2-norms of x_1, y_2 are zero, then return with trivial tau, chi_0 values.
302 //
303
304 if ( norm_x_1 == 0.0 &&
305 norm_y_2 == 0.0 )
306 {
307 *chi_0 = -(*chi_0);
308 *tau = one_half;
309
310 return FLA_SUCCESS;
311 }
312
313 //
314 // Compute the absolute value (magnitude) of chi_0, which equals the 2-norm
315 // of chi_0:
316 //
317 // abs_chi_0 := | chi_0 | = || chi_0 ||_2
318 //
319
321 chi_0, i_one,
322 &abs_chi_0 );
323
324 //
325 // Compute lambda:
326 //
327 // lambda := sqrt( conj(chi0) chi0 + x1' x1 - y2' y2 )
328 //
329
332 norm_y_2 * norm_y_2 );
333
334 // Compute alpha:
335 //
336 // alpha := - lambda * chi_0 / | chi_0 |
337 // = -sign( chi_0 ) * lambda
338 //
339
340 alpha = -dsign( *chi_0 ) * lambda;
341
342 //
343 // Overwrite x_1 and y_2 with u_1 and v_2, respectively:
344 //
345 // x_1 := x_1 / ( chi_0 - alpha )
346 // y_2 := y_2 / -( chi_0 - alpha )
347 //
348
349 chi_0_minus_alpha = (*chi_0) - alpha;
350
352 m_x1,
354 x1, inc_x1 );
355
357
359 m_y2,
361 y2, inc_y2 );
362
363 //
364 // Compute tau:
365 //
366 // tau := ( 1 + u_1' * u_1 - v_2' * v_2 ) / 2
367 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_1' * x_1 - y_2' * y_2 ) /
368 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
369 // = ( | chi_1 - alpha |^2 + || x_2 ||_2^2 - || y_2 ||_2^2 ) /
370 // ( 2 * | chi_1 - alpha |^2 )
371 //
372
374
377 norm_y_2 * norm_y_2 ) /
378 ( 2.0 * abs_sq_chi_0_minus_alpha );
379
380 //
381 // Overwrite chi_0 with alpha:
382 //
383 // chi_0 := alpha
384 //
385
386 *chi_0 = alpha;
387
388 return FLA_SUCCESS;
389}
void bl1_dinvscalv(conj1_t conj, int n, double *alpha, double *x, int incx)
Definition bl1_invscalv.c:26
void bl1_dnrm2(int n, double *x, int incx, double *norm)
Definition bl1_nrm2.c:24

References bl1_dinvscalv(), bl1_dnrm2(), BLIS1_NO_CONJUGATE, FLA_ONE_HALF, i, and x1.

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_opd_var1().

◆ FLA_Househ3UD_UT_ops()

FLA_Error FLA_Househ3UD_UT_ops ( int  m_x1,
int  m_y2,
float chi_0,
float x1,
int  inc_x1,
float y2,
int  inc_y2,
float tau 
)
146{
148 float alpha;
149 float chi_0_minus_alpha;
151 float abs_chi_0;
152 float norm_x_1;
153 float norm_y_2;
154 float lambda;
156 int i_one = 1;
157
158 //
159 // Compute the 2-norms of x_1 and y_2:
160 //
161 // norm_x_1 := || x_1 ||_2
162 // norm_y_2 := || y_2 ||_2
163 //
164
166 x1, inc_x1,
167 &norm_x_1 );
168
170 y2, inc_y2,
171 &norm_y_2 );
172
173 //
174 // If 2-norms of x_1, y_2 are zero, then return with trivial tau, chi_0 values.
175 //
176
177 if ( norm_x_1 == 0.0F &&
178 norm_y_2 == 0.0F )
179 {
180 *chi_0 = -(*chi_0);
181 *tau = one_half;
182
183 return FLA_SUCCESS;
184 }
185
186 //
187 // Compute the absolute value (magnitude) of chi_0, which equals the 2-norm
188 // of chi_0:
189 //
190 // abs_chi_0 := | chi_0 | = || chi_0 ||_2
191 //
192
194 chi_0, i_one,
195 &abs_chi_0 );
196
197 //
198 // Compute lambda:
199 //
200 // lambda := sqrt( conj(chi0) chi0 + x1' x1 - y2' y2 )
201 //
202
205 norm_y_2 * norm_y_2 );
206
207 // Compute alpha:
208 //
209 // alpha := - lambda * chi_0 / | chi_0 |
210 // = -sign( chi_0 ) * lambda
211 //
212
213 alpha = -ssign( *chi_0 ) * lambda;
214
215
216 //
217 // Overwrite x_1 and y_2 with u_1 and v_2, respectively:
218 //
219 // x_1 := x_1 / ( chi_0 - alpha )
220 // y_2 := y_2 / -( chi_0 - alpha )
221 //
222
223 chi_0_minus_alpha = (*chi_0) - alpha;
224
226 m_x1,
228 x1, inc_x1 );
229
231
233 m_y2,
235 y2, inc_y2 );
236
237 //
238 // Compute tau:
239 //
240 // tau := ( 1 + u_1' * u_1 - v_2' * v_2 ) / 2
241 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_1' * x_1 - y_2' * y_2 ) /
242 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
243 // = ( | chi_1 - alpha |^2 + || x_2 ||_2^2 - || y_2 ||_2^2 ) /
244 // ( 2 * | chi_1 - alpha |^2 )
245 //
246
248
251 norm_y_2 * norm_y_2 ) /
252 ( 2.0F * abs_sq_chi_0_minus_alpha );
253
254 //
255 // Overwrite chi_0 with alpha:
256 //
257 // chi_0 := alpha
258 //
259
260 *chi_0 = alpha;
261
262 return FLA_SUCCESS;
263}
void bl1_sinvscalv(conj1_t conj, int n, float *alpha, float *x, int incx)
Definition bl1_invscalv.c:13
void bl1_snrm2(int n, float *x, int incx, float *norm)
Definition bl1_nrm2.c:13

References bl1_sinvscalv(), bl1_snrm2(), BLIS1_NO_CONJUGATE, FLA_ONE_HALF, i, and x1.

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_ops_var1().

◆ FLA_Househ3UD_UT_opz()

FLA_Error FLA_Househ3UD_UT_opz ( int  m_x1,
int  m_y2,
dcomplex chi_0,
dcomplex x1,
int  inc_x1,
dcomplex y2,
int  inc_y2,
dcomplex tau 
)
533{
538 double abs_chi_0;
539 double norm_x_1;
540 double norm_y_2;
541 double lambda;
543 int i_one = 1;
544
545 //
546 // Compute the 2-norms of x_1 and y_2:
547 //
548 // norm_x_1 := || x_1 ||_2
549 // norm_y_2 := || y_2 ||_2
550 //
551
553 x1, inc_x1,
554 &norm_x_1 );
555
557 y2, inc_y2,
558 &norm_y_2 );
559
560 //
561 // If 2-norms of x_1, y_2 are zero, then return with trivial tau, chi_0 values.
562 //
563
564 if ( norm_x_1 == 0.0 &&
565 norm_y_2 == 0.0 )
566 {
567 chi_0->real = -(chi_0->real);
568 chi_0->imag = -(chi_0->imag);
569 tau->real = one_half.real;
570 tau->imag = one_half.imag;
571
572 return FLA_SUCCESS;
573 }
574
575 //
576 // Compute the absolute value (magnitude) of chi_0, which equals the 2-norm
577 // of chi_0:
578 //
579 // abs_chi_0 := | chi_0 | = || chi_0 ||_2
580 //
581
583 chi_0, i_one,
584 &abs_chi_0 );
585
586 //
587 // Compute lambda:
588 //
589 // lambda := sqrt( conj(chi0) chi0 + x1' x1 - y2' y2 )
590 //
591
594 norm_y_2 * norm_y_2 );
595
596 //
597 // Compute alpha:
598 //
599 // alpha := - lambda * chi_0 / | chi_0 |
600 //
601
602 alpha.real = -chi_0->real * lambda / abs_chi_0;
603 alpha.imag = -chi_0->imag * lambda / abs_chi_0;
604
605 //
606 // Overwrite x_1 and y_2 with u_1 and v_2, respectively:
607 //
608 // x_1 := x_1 / ( chi_0 - alpha )
609 // y_2 := y_2 / -( chi_0 - alpha )
610 //
611
612 chi_0_minus_alpha.real = chi_0->real - alpha.real;
613 chi_0_minus_alpha.imag = chi_0->imag - alpha.imag;
614
616 m_x1,
618 x1, inc_x1 );
619
622
624 m_y2,
626 y2, inc_y2 );
627
628 //
629 // Compute tau:
630 //
631 // tau := ( 1 + u_1' * u_1 - v_2' * v_2 ) / 2
632 // = ( ( chi_1 - alpha ) * conj( chi_1 - alpha ) + x_1' * x_1 - y_2' * y_2 ) /
633 // ( 2 * ( chi_1 - alpha ) * conj( chi_1 - alpha ) )
634 // = ( | chi_1 - alpha |^2 + || x_2 ||_2^2 - || y_2 ||_2^2 ) /
635 // ( 2 * | chi_1 - alpha |^2 )
636 //
637
640
641 tau->real = ( abs_sq_chi_0_minus_alpha +
643 norm_y_2 * norm_y_2 ) /
644 ( 2.0 * abs_sq_chi_0_minus_alpha );
645 tau->imag = 0.0;
646
647 //
648 // Overwrite chi_0 with alpha:
649 //
650 // chi_0 := alpha
651 //
652
653 chi_0->real = alpha.real;
654 chi_0->imag = alpha.imag;
655
656 return FLA_SUCCESS;
657}
void bl1_zinvscalv(conj1_t conj, int n, dcomplex *alpha, dcomplex *x, int incx)
Definition bl1_invscalv.c:78
void bl1_znrm2(int n, dcomplex *x, int incx, double *norm)
Definition bl1_nrm2.c:46

References bl1_zinvscalv(), bl1_znrm2(), BLIS1_NO_CONJUGATE, FLA_ONE_HALF, i, and x1.

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_opz_var1().