libflame  revision_anchor
FLA_Givens2.h
Go to the documentation of this file.
1 /*
2 
3  Copyright (C) 2014, The University of Texas at Austin
4 
5  This file is part of libflame and is available under the 3-Clause
6  BSD license, which can be found in the LICENSE file at the top-level
7  directory, or at http://opensource.org/licenses/BSD-3-Clause
8 
9 */
10 
11 FLA_Error FLA_Givens2( FLA_Obj chi_1, FLA_Obj chi_2, FLA_Obj gamma, FLA_Obj sigma, FLA_Obj chi_1_new );
12 FLA_Error FLA_Givens2_ops( float* chi_1,
13  float* chi_2,
14  float* gamma,
15  float* sigma,
16  float* chi_1_new );
17 FLA_Error FLA_Givens2_opd( double* chi_1,
18  double* chi_2,
19  double* gamma,
20  double* sigma,
21  double* chi_1_new );
22 #define MAC_Givens2_ops( chi_1, chi_2, gamma, sigma, chi_1_new ) \
23 { \
24  float chi_1_orig = *(chi_1); \
25  float chi_2_orig = *(chi_2); \
26  float g, s; \
27  float norm_x; \
28 \
29  norm_x = ( float ) sqrt( ( float ) ( chi_1_orig * chi_1_orig + \
30  chi_2_orig * chi_2_orig ) ); \
31 \
32  g = chi_1_orig / norm_x; \
33  s = chi_2_orig / norm_x; \
34 \
35  if ( fabs( chi_1_orig ) > fabs( chi_2_orig ) && g < 0.0F ) \
36  { \
37  g = -g; \
38  s = -s; \
39  norm_x = -norm_x; \
40  } \
41 \
42  *(gamma) = g; \
43  *(sigma) = s; \
44  *(chi_1_new) = norm_x; \
45 \
46 }
47 
48 #define MAC_Givens2_opd( chi_1, chi_2, gamma, sigma, chi_1_new ) \
49 { \
50  double chi_1_orig = *(chi_1); \
51  double chi_2_orig = *(chi_2); \
52  double g, s; \
53  double norm_x; \
54 \
55  norm_x = ( double ) sqrt( chi_1_orig * chi_1_orig + \
56  chi_2_orig * chi_2_orig ); \
57 \
58  g = chi_1_orig / norm_x; \
59  s = chi_2_orig / norm_x; \
60 \
61  if ( fabs( chi_1_orig ) > fabs( chi_2_orig ) && g < 0.0 ) \
62  { \
63  g = -g; \
64  s = -s; \
65  norm_x = -norm_x; \
66  } \
67 \
68  *(gamma) = g; \
69  *(sigma) = s; \
70  *(chi_1_new) = norm_x; \
71 \
72 }
73 
FLA_Error FLA_Givens2_ops(float *chi_1, float *chi_2, float *gamma, float *sigma, float *chi_1_new)
Definition: FLA_Givens2.c:98
FLA_Error FLA_Givens2(FLA_Obj chi_1, FLA_Obj chi_2, FLA_Obj gamma, FLA_Obj sigma, FLA_Obj chi_1_new)
Definition: FLA_Givens2.c:13
FLA_Error FLA_Givens2_opd(double *chi_1, double *chi_2, double *gamma, double *sigma, double *chi_1_new)
Definition: FLA_Givens2.c:107
int FLA_Error
Definition: FLA_type_defs.h:47
Definition: FLA_type_defs.h:159