libflame  revision_anchor
Functions
FLA_Tevd_eigval_v_opt_var1.c File Reference

(r)

Functions

FLA_Error FLA_Tevd_eigval_v_opt_var1 (FLA_Obj G, FLA_Obj d, FLA_Obj e, FLA_Obj k)
 
FLA_Error FLA_Tevd_eigval_v_ops_var1 (int m_A, int n_G, scomplex *buff_G, int rs_G, int cs_G, float *buff_d, int inc_d, float *buff_e, int inc_e, int *n_iter)
 
FLA_Error FLA_Tevd_eigval_v_opd_var1 (int m_A, int n_G, dcomplex *buff_G, int rs_G, int cs_G, double *buff_d, int inc_d, double *buff_e, int inc_e, int *n_iter)
 

Function Documentation

◆ FLA_Tevd_eigval_v_opd_var1()

FLA_Error FLA_Tevd_eigval_v_opd_var1 ( int  m_A,
int  n_G,
dcomplex buff_G,
int  rs_G,
int  cs_G,
double *  buff_d,
int  inc_d,
double *  buff_e,
int  inc_e,
int *  n_iter 
)

References FLA_Mach_params_opd(), FLA_Tevd_francis_v_opd_var1(), and FLA_Wilkshift_tridiag_opd().

Referenced by FLA_Tevd_eigval_v_opt_var1(), and FLA_Tevd_iteracc_v_opd_var1().

93 {
94  FLA_Error r_val;
95  double eps;
96  double safmin;
97  double* e_last;
98  double* d_last;
99  double* d_last_m1;
100  double shift;
101  int k;
102  int n_iter_allowed = n_G;
103 
104  // Query epsilon and safmin, which are used in the test for convergence.
105  eps = FLA_Mach_params_opd( FLA_MACH_EPS );
106  safmin = FLA_Mach_params_opd( FLA_MACH_SFMIN );
107 
108  // Initialize a pointer to the last sub-diagonal element and two
109  // more to the last and second last
110  e_last = &buff_e[ (m_A-2)*inc_e ];
111  d_last_m1 = &buff_d[ (m_A-2)*inc_d ];
112  d_last = &buff_d[ (m_A-1)*inc_d ];
113 
114  for ( k = 0; k < n_iter_allowed; ++k )
115  {
116  dcomplex* g1 = buff_G + (k )*cs_G;
117 
118  /*------------------------------------------------------------*/
119 
120  // If we've converged, record k and return index of eigenvalue found.
121  // The reason we check before the Francis step (rather than after)
122  // is so we correctly handle situations where the last diagonal
123  // element has already converged from previous eigenvalue searches
124  // and thus no iteration is necessary. If we checked after the
125  // Francis step, we would have unnecessarily executed an additional
126  // Francis step's worth of rotations with a sub-optimal shift (since
127  // it would be using a 2x2 that was not "centered" properly).
128  if ( MAC_Tevd_eigval_converged_opd( eps, safmin, *d_last_m1, *e_last, *d_last ) )
129  {
130  *e_last = 0.0;
131  *n_iter = k;
132  return m_A - 1;
133  }
134 
135  // Compute a Wilkinson shift with the last 2x2 matrix.
136  FLA_Wilkshift_tridiag_opd( *d_last_m1,
137  *e_last,
138  *d_last,
139  &shift );
140 
141  // Perform a Francis step.
142  r_val = FLA_Tevd_francis_v_opd_var1( m_A,
143  &shift,
144  g1, rs_G,
145  buff_d, inc_d,
146  buff_e, inc_e );
147 
148  // Check for internal deflation.
149  if ( r_val != FLA_SUCCESS )
150  {
151 #ifdef PRINTF
152  printf( "FLA_Tevd_eigval_v_opt_var1: Internal deflation in col %d, eig %d\n", r_val, m_A - 1 );
153  printf( "FLA_Tevd_eigval_v_opt_var1: alpha11 = %23.19e\n", buff_d[r_val*inc_d] );
154  printf( "FLA_Tevd_eigval_v_opt_var1: alpha21 alpha22 = %23.19e %23.19e\n", buff_e[r_val*inc_e], buff_d[(r_val+1)*inc_d] );
155 #endif
156 
157  // Set the off-diagonal element to zero.
158  buff_e[ r_val*inc_e ] = 0.0;
159 
160  *n_iter = k + 1;
161  return r_val;
162  }
163 
164  /*------------------------------------------------------------*/
165  }
166 
167  *n_iter = n_iter_allowed;
168  return FLA_FAILURE;
169 }
FLA_Error FLA_Wilkshift_tridiag_opd(double delta1, double epsilon, double delta2, double *kappa)
Definition: FLA_Wilkshift_tridiag.c:155
FLA_Error FLA_Tevd_francis_v_opd_var1(int m_A, double *buff_shift, dcomplex *buff_g, int inc_g, double *buff_d, int inc_d, double *buff_e, int inc_e)
Definition: FLA_Tevd_francis_v_opt_var1.c:81
double FLA_Mach_params_opd(FLA_Machval machval)
Definition: FLA_Mach_params.c:74
int FLA_Error
Definition: FLA_type_defs.h:47
Definition: blis_type_defs.h:137

◆ FLA_Tevd_eigval_v_ops_var1()

FLA_Error FLA_Tevd_eigval_v_ops_var1 ( int  m_A,
int  n_G,
scomplex buff_G,
int  rs_G,
int  cs_G,
float *  buff_d,
int  inc_d,
float *  buff_e,
int  inc_e,
int *  n_iter 
)

Referenced by FLA_Tevd_eigval_v_opt_var1().

81 {
82  return FLA_SUCCESS;
83 }

◆ FLA_Tevd_eigval_v_opt_var1()

FLA_Error FLA_Tevd_eigval_v_opt_var1 ( FLA_Obj  G,
FLA_Obj  d,
FLA_Obj  e,
FLA_Obj  k 
)

References FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_row_stride(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), FLA_Obj_width(), FLA_Tevd_eigval_v_opd_var1(), and FLA_Tevd_eigval_v_ops_var1().

14 {
15  FLA_Datatype datatype;
16  int m_A, n_G;
17  int rs_G, cs_G;
18  int inc_d;
19  int inc_e;
20 
21  datatype = FLA_Obj_datatype( d );
22 
23  m_A = FLA_Obj_vector_dim( d );
24  n_G = FLA_Obj_width( G );
25 
26  rs_G = FLA_Obj_row_stride( G );
27  cs_G = FLA_Obj_col_stride( G );
28 
29  inc_d = FLA_Obj_vector_inc( d );
30  inc_e = FLA_Obj_vector_inc( e );
31 
32 
33  switch ( datatype )
34  {
35  case FLA_FLOAT:
36  {
37  scomplex* buff_G = FLA_COMPLEX_PTR( G );
38  float* buff_d = FLA_FLOAT_PTR( d );
39  float* buff_e = FLA_FLOAT_PTR( e );
40  int* buff_k = FLA_INT_PTR( k );
41 
43  n_G,
44  buff_G, rs_G, cs_G,
45  buff_d, inc_d,
46  buff_e, inc_e,
47  buff_k );
48 
49  break;
50  }
51 
52  case FLA_DOUBLE:
53  {
54  dcomplex* buff_G = FLA_DOUBLE_COMPLEX_PTR( G );
55  double* buff_d = FLA_DOUBLE_PTR( d );
56  double* buff_e = FLA_DOUBLE_PTR( e );
57  int* buff_k = FLA_INT_PTR( k );
58 
60  n_G,
61  buff_G, rs_G, cs_G,
62  buff_d, inc_d,
63  buff_e, inc_e,
64  buff_k );
65 
66  break;
67  }
68  }
69 
70  return FLA_SUCCESS;
71 }
FLA_Error FLA_Tevd_eigval_v_ops_var1(int m_A, int n_G, scomplex *buff_G, int rs_G, int cs_G, float *buff_d, int inc_d, float *buff_e, int inc_e, int *n_iter)
Definition: FLA_Tevd_eigval_v_opt_var1.c:75
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition: FLA_Query.c:167
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
Definition: blis_type_defs.h:132
dim_t FLA_Obj_vector_dim(FLA_Obj obj)
Definition: FLA_Query.c:137
FLA_Error FLA_Tevd_eigval_v_opd_var1(int m_A, int n_G, dcomplex *buff_G, int rs_G, int cs_G, double *buff_d, int inc_d, double *buff_e, int inc_e, int *n_iter)
Definition: FLA_Tevd_eigval_v_opt_var1.c:87
int FLA_Datatype
Definition: FLA_type_defs.h:49
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
Definition: blis_type_defs.h:137