libflame  revision_anchor
Functions
FLA_Tevd_eigval_v.h File Reference

(r)

Go to the source code of this file.

Functions

FLA_Error FLA_Tevd_eigval_v_opt_var1 (FLA_Obj G, FLA_Obj d, FLA_Obj e, FLA_Obj n_iter)
 
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)
 
FLA_Error FLA_Tevd_eigval_v_ops_var3 (int m_A, int m_U, int n_G, scomplex *buff_G, int rs_G, int cs_G, float *buff_d, int inc_d, float *buff_e, int inc_e, float *buff_l, int inc_l, int *buff_ls, int inc_ls, float *buff_pu, int inc_pu, int *n_iter)
 
FLA_Error FLA_Tevd_eigval_v_opd_var3 (int m_A, int m_U, int n_G, dcomplex *buff_G, int rs_G, int cs_G, double *buff_d, int inc_d, double *buff_e, int inc_e, double *buff_l, int inc_l, int *buff_ls, int inc_ls, double *buff_pu, int inc_pu, 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 
)
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_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
int FLA_Error
Definition: FLA_type_defs.h:47
double FLA_Mach_params_opd(FLA_Machval machval)
Definition: FLA_Mach_params.c:74
FLA_Error FLA_Wilkshift_tridiag_opd(double delta1, double epsilon, double delta2, double *kappa)
Definition: FLA_Wilkshift_tridiag.c:155
Definition: blis_type_defs.h:138

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().

◆ FLA_Tevd_eigval_v_opd_var3()

FLA_Error FLA_Tevd_eigval_v_opd_var3 ( int  m_A,
int  m_U,
int  n_G,
dcomplex buff_G,
int  rs_G,
int  cs_G,
double *  buff_d,
int  inc_d,
double *  buff_e,
int  inc_e,
double *  buff_l,
int  inc_l,
int *  buff_ls,
int  inc_ls,
double *  buff_pu,
int  inc_pu,
int *  n_iter 
)
40 {
41  FLA_Error r_val;
42  double eps;
43  double safmin;
44  double* e_last;
45  double* d_last;
46  double* d_last_m1;
47  double shift;
48  int ij_shift;
49  int k;
50  int n_iter_allowed = n_G;
51 
52  // Query epsilon and safmin, which are used in the test for convergence.
53  eps = FLA_Mach_params_opd( FLA_MACH_EPS );
54  safmin = FLA_Mach_params_opd( FLA_MACH_SFMIN );
55 
56  // Initialize a pointer to the last sub-diagonal element and two
57  // more to the last and second last
58  e_last = &buff_e[ (m_A-2)*inc_e ];
59  d_last_m1 = &buff_d[ (m_A-2)*inc_d ];
60  d_last = &buff_d[ (m_A-1)*inc_d ];
61 
62 
63  for ( k = 0; k < n_iter_allowed; ++k )
64  {
65  dcomplex* g1 = buff_G + (k )*cs_G;
66 
67  /*------------------------------------------------------------*/
68 
69  // If we've converged, record k and return index of eigenvalue found.
70  // The reason we check before the Francis step (rather than after)
71  // is so we correctly handle situations where the last diagonal
72  // element has already converged from previous eigenvalue searches
73  // and thus no iteration is necessary. If we checked after the
74  // Francis step, we would have unnecessarily executed an additional
75  // Francis step's worth of rotations with a sub-optimal shift (since
76  // it would be using a 2x2 that was not "centered" properly).
77  if ( MAC_Tevd_eigval_converged_opd( eps, safmin, *d_last_m1, *e_last, *d_last ) )
78  {
79  *e_last = 0.0;
80  *n_iter = k;
81  return m_A - 1;
82  }
83 
85  m_U,
86  buff_d, inc_d,
87  buff_e, inc_e,
88  buff_l, inc_l,
89  buff_ls, inc_ls,
90  buff_pu, inc_pu,
91  &ij_shift );
92 
93  if ( ij_shift == -1 )
94  {
95  FLA_Wilkshift_tridiag_opd( *d_last_m1,
96  *e_last,
97  *d_last,
98  &shift );
99  }
100  else
101  {
102  shift = buff_l[ ij_shift*inc_l ];
103  }
104 
105  // Perform a Francis step.
106  r_val = FLA_Tevd_francis_v_opd_var1( m_A,
107  &shift,
108  g1, rs_G,
109  buff_d, inc_d,
110  buff_e, inc_e );
111 
112  if ( ij_shift >= 0 &&
113  MAC_Tevd_eigval_converged_opd( eps, safmin, *d_last_m1, *e_last, *d_last ) )
114  {
115  buff_ls[ ij_shift * inc_ls ] = 1;
116  *e_last = 0.0;
117  *n_iter = k + 1;
118  return m_A - 1;
119  }
120 
121  // Check for internal deflation.
122  if ( r_val != FLA_SUCCESS )
123  {
124 #ifdef PRINTF
125  printf( "FLA_Tevd_eigval_v_opt_var3: Internal deflation in col %d, eig %d\n", r_val, m_A - 1 );
126  printf( "FLA_Tevd_eigval_v_opt_var3: alpha11 = %23.19e\n", buff_d[r_val*inc_d] );
127  printf( "FLA_Tevd_eigval_v_opt_var3: alpha21 alpha22 = %23.19e %23.19e\n", buff_e[r_val*inc_e], buff_d[(r_val+1)*inc_d] );
128 #endif
129 
130  // Set the off-diagonal element to zero.
131  buff_e[ r_val*inc_e ] = 0.0;
132 
133  *n_iter = k + 1;
134  return r_val;
135  }
136 
137  /*------------------------------------------------------------*/
138  }
139 
140  *n_iter = n_iter_allowed;
141  return FLA_FAILURE;
142 }
FLA_Error FLA_Tevd_find_perfshift_opd(int m_d, int m_l, double *buff_d, int inc_d, double *buff_e, int inc_e, double *buff_l, int inc_l, int *buff_ls, int inc_ls, double *buff_pu, int inc_pu, int *ij_shift)
Definition: FLA_Tevd_find_perfshift.c:30

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

Referenced by FLA_Tevd_iteracc_v_opd_var3().

◆ 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 
)
81 {
82  return FLA_SUCCESS;
83 }

Referenced by FLA_Tevd_eigval_v_opt_var1().

◆ FLA_Tevd_eigval_v_ops_var3()

FLA_Error FLA_Tevd_eigval_v_ops_var3 ( int  m_A,
int  m_U,
int  n_G,
scomplex buff_G,
int  rs_G,
int  cs_G,
float *  buff_d,
int  inc_d,
float *  buff_e,
int  inc_e,
float *  buff_l,
int  inc_l,
int *  buff_ls,
int  inc_ls,
float *  buff_pu,
int  inc_pu,
int *  n_iter 
)
24 {
25  return FLA_SUCCESS;
26 }

◆ 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  n_iter 
)
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_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
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_width(FLA_Obj obj)
Definition: FLA_Query.c:123
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition: FLA_Query.c:167
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
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
Definition: blis_type_defs.h:133

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().