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 
)

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(), and FLA_Obj_vector_inc().

Referenced by FLA_UDdate_UT_unb_var1().

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 
60  m_x1 = FLA_Obj_vector_dim( x1 );
61  m_y2 = FLA_Obj_vector_dim( y2 );
62  inc_x1 = FLA_Obj_vector_inc( x1 );
63  inc_y2 = FLA_Obj_vector_inc( y2 );
64 
65  if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
66  FLA_Househ3UD_UT_check( chi_0, x1, y2, tau );
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  {
104  scomplex* chi_0_p = ( scomplex* ) FLA_COMPLEX_PTR( chi_0 );
105  scomplex* x1_p = ( scomplex* ) FLA_COMPLEX_PTR( x1 );
106  scomplex* y2_p = ( scomplex* ) FLA_COMPLEX_PTR( y2 );
107  scomplex* tau_p = ( scomplex* ) FLA_COMPLEX_PTR( tau );
108 
109  FLA_Househ3UD_UT_opc( m_x1,
110  m_y2,
111  chi_0_p,
112  x1_p, inc_x1,
113  y2_p, inc_y2,
114  tau_p );
115  break;
116  }
117 
118  case FLA_DOUBLE_COMPLEX:
119  {
120  dcomplex* chi_0_p = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( chi_0 );
121  dcomplex* x1_p = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( x1 );
122  dcomplex* y2_p = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( y2 );
123  dcomplex* tau_p = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( tau );
124 
125  FLA_Househ3UD_UT_opz( m_x1,
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_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_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_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
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_check(FLA_Obj chi_1, FLA_Obj x2, FLA_Obj y2, FLA_Obj tau)
Definition: FLA_Househ3UD_UT_check.c:13
Definition: blis_type_defs.h:132
dim_t FLA_Obj_vector_dim(FLA_Obj obj)
Definition: FLA_Query.c:137
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
int FLA_Datatype
Definition: FLA_type_defs.h:49
dim_t FLA_Obj_vector_inc(FLA_Obj obj)
Definition: FLA_Query.c:145
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
Definition: blis_type_defs.h:137

◆ 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 
)

References bl1_cinvscalv(), bl1_cnrm2(), BLIS1_NO_CONJUGATE, FLA_ONE_HALF, scomplex::imag, and scomplex::real.

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_opc_var1().

399 {
400  scomplex one_half = *FLA_COMPLEX_PTR( FLA_ONE_HALF );
401  scomplex alpha;
402  scomplex chi_0_minus_alpha;
403  scomplex neg_chi_0_minus_alpha;
404  float abs_chi_0;
405  float norm_x_1;
406  float norm_y_2;
407  float lambda;
408  float abs_sq_chi_0_minus_alpha;
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 
418  bl1_cnrm2( m_x1,
419  x1, inc_x1,
420  &norm_x_1 );
421 
422  bl1_cnrm2( m_y2,
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 
448  bl1_cnrm2( i_one,
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 
458  lambda = ( float ) sqrt( abs_chi_0 * abs_chi_0 +
459  norm_x_1 * norm_x_1 -
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,
483  &chi_0_minus_alpha,
484  x1, inc_x1 );
485 
486  neg_chi_0_minus_alpha.real = -chi_0_minus_alpha.real;
487  neg_chi_0_minus_alpha.imag = -chi_0_minus_alpha.imag;
488 
490  m_y2,
491  &neg_chi_0_minus_alpha,
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 
504  abs_sq_chi_0_minus_alpha = chi_0_minus_alpha.real * chi_0_minus_alpha.real +
505  chi_0_minus_alpha.imag * chi_0_minus_alpha.imag;
506 
507  tau->real = ( abs_sq_chi_0_minus_alpha +
508  norm_x_1 * norm_x_1 -
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 }
float real
Definition: blis_type_defs.h:134
Definition: blis_type_defs.h:81
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
Definition: blis_type_defs.h:132
void bl1_cinvscalv(conj1_t conj, int n, scomplex *alpha, scomplex *x, int incx)
Definition: bl1_invscalv.c:52
float imag
Definition: blis_type_defs.h:134

◆ 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 
)

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

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_opd_var1().

273 {
274  double one_half = *FLA_DOUBLE_PTR( FLA_ONE_HALF );
275  double alpha;
276  double chi_0_minus_alpha;
277  double neg_chi_0_minus_alpha;
278  double abs_chi_0;
279  double norm_x_1;
280  double norm_y_2;
281  double lambda;
282  double abs_sq_chi_0_minus_alpha;
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 
292  bl1_dnrm2( m_x1,
293  x1, inc_x1,
294  &norm_x_1 );
295 
296  bl1_dnrm2( m_y2,
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 
320  bl1_dnrm2( i_one,
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 
330  lambda = sqrt( abs_chi_0 * abs_chi_0 +
331  norm_x_1 * norm_x_1 -
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,
353  &chi_0_minus_alpha,
354  x1, inc_x1 );
355 
356  neg_chi_0_minus_alpha = -chi_0_minus_alpha;
357 
359  m_y2,
360  &neg_chi_0_minus_alpha,
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 
373  abs_sq_chi_0_minus_alpha = chi_0_minus_alpha * chi_0_minus_alpha;
374 
375  *tau = ( abs_sq_chi_0_minus_alpha +
376  norm_x_1 * norm_x_1 -
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 }
Definition: blis_type_defs.h:81
FLA_Obj FLA_ONE_HALF
Definition: FLA_Init.c:19
void bl1_dinvscalv(conj1_t conj, int n, double *alpha, double *x, int incx)
Definition: bl1_invscalv.c:26
x1
Definition: bl1_dotsv2.c:374
void bl1_dnrm2(int n, double *x, int incx, double *norm)
Definition: bl1_nrm2.c:24

◆ 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 
)

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

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_ops_var1().

146 {
147  float one_half = *FLA_FLOAT_PTR( FLA_ONE_HALF );
148  float alpha;
149  float chi_0_minus_alpha;
150  float neg_chi_0_minus_alpha;
151  float abs_chi_0;
152  float norm_x_1;
153  float norm_y_2;
154  float lambda;
155  float abs_sq_chi_0_minus_alpha;
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 
165  bl1_snrm2( m_x1,
166  x1, inc_x1,
167  &norm_x_1 );
168 
169  bl1_snrm2( m_y2,
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 
193  bl1_snrm2( i_one,
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 
203  lambda = ( float ) sqrt( abs_chi_0 * abs_chi_0 +
204  norm_x_1 * norm_x_1 -
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,
227  &chi_0_minus_alpha,
228  x1, inc_x1 );
229 
230  neg_chi_0_minus_alpha = -chi_0_minus_alpha;
231 
233  m_y2,
234  &neg_chi_0_minus_alpha,
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 
247  abs_sq_chi_0_minus_alpha = chi_0_minus_alpha * chi_0_minus_alpha;
248 
249  *tau = ( abs_sq_chi_0_minus_alpha +
250  norm_x_1 * norm_x_1 -
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 }
Definition: blis_type_defs.h:81
FLA_Obj FLA_ONE_HALF
Definition: FLA_Init.c:19
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
x1
Definition: bl1_dotsv2.c:374

◆ 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 
)

References bl1_zinvscalv(), bl1_znrm2(), BLIS1_NO_CONJUGATE, FLA_ONE_HALF, dcomplex::imag, and dcomplex::real.

Referenced by FLA_Househ3UD_UT(), and FLA_UDdate_UT_opz_var1().

533 {
534  dcomplex one_half = *FLA_DOUBLE_COMPLEX_PTR( FLA_ONE_HALF );
535  dcomplex alpha;
536  dcomplex chi_0_minus_alpha;
537  dcomplex neg_chi_0_minus_alpha;
538  double abs_chi_0;
539  double norm_x_1;
540  double norm_y_2;
541  double lambda;
542  double abs_sq_chi_0_minus_alpha;
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 
552  bl1_znrm2( m_x1,
553  x1, inc_x1,
554  &norm_x_1 );
555 
556  bl1_znrm2( m_y2,
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 
582  bl1_znrm2( i_one,
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 
592  lambda = sqrt( abs_chi_0 * abs_chi_0 +
593  norm_x_1 * norm_x_1 -
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,
617  &chi_0_minus_alpha,
618  x1, inc_x1 );
619 
620  neg_chi_0_minus_alpha.real = -chi_0_minus_alpha.real;
621  neg_chi_0_minus_alpha.imag = -chi_0_minus_alpha.imag;
622 
624  m_y2,
625  &neg_chi_0_minus_alpha,
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 
638  abs_sq_chi_0_minus_alpha = chi_0_minus_alpha.real * chi_0_minus_alpha.real +
639  chi_0_minus_alpha.imag * chi_0_minus_alpha.imag;
640 
641  tau->real = ( abs_sq_chi_0_minus_alpha +
642  norm_x_1 * norm_x_1 -
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
double imag
Definition: blis_type_defs.h:139
Definition: blis_type_defs.h:81
FLA_Obj FLA_ONE_HALF
Definition: FLA_Init.c:19
void bl1_znrm2(int n, dcomplex *x, int incx, double *norm)
Definition: bl1_nrm2.c:46
double real
Definition: blis_type_defs.h:139
Definition: blis_type_defs.h:137