libflame  revision_anchor
Functions
FLA_Tevd_find_perfshift.c File Reference

(r)

Functions

FLA_Error FLA_Tevd_find_perfshift_ops (int m_d, int m_l, 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 *ij_shift)
 
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)
 

Function Documentation

◆ FLA_Tevd_find_perfshift_opd()

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 
)

References FLA_Wilkshift_tridiag_opd(), and i.

Referenced by FLA_Tevd_eigval_v_opd_var3().

38 {
39  double* d1p;
40  double* e1p;
41  double* d2p;
42  double wilkshift;
43  int i;
44  int ij_cand;
45  double dist_cand;
46  double pshift_cand;
47 
48  d1p = buff_d + (m_d-2)*inc_d;
49  e1p = buff_e + (m_d-2)*inc_e;
50  d2p = buff_d + (m_d-1)*inc_d;
51 
52  if ( *buff_ls == -1 )
53  {
54  *ij_shift = -1;
55  return FLA_FAILURE;
56  }
57 
59  *e1p,
60  *d2p,
61  &wilkshift );
62 
63 /*
64  // If we have shifted here previously, use a Wilkinson shfit.
65  prev_shift = buff_pu[ (m_d-1)*inc_pu ];
66 
67  if ( prev_shift != 0.0 )
68  {
69  // *shift = prev_shift;
70  *shift = wilkshift;
71  return FLA_SUCCESS;
72  }
73 */
74  ij_cand = -1;
75 
76  // Find an available (unused) shift.
77  for ( i = 0; i < m_l; ++i )
78  {
79  int* status = buff_ls + (i )*inc_ls;
80 
81  if ( *status == 0 )
82  {
83  double* lambda1 = buff_l + (i )*inc_l;
84  ij_cand = i;
85  pshift_cand = *lambda1;
86  dist_cand = fabs( wilkshift - pshift_cand );
87  }
88  }
89 
90  if ( ij_cand == -1 )
91  {
92  *ij_shift = -1;
93  *buff_ls = -1;
94  return FLA_FAILURE;
95  }
96 
97  // Now try to find a shift closer to wilkshift than the
98  // first one we found.
99  for ( i = 0; i < m_l; ++i )
100  {
101  double* lambda1 = buff_l + (i )*inc_l;
102  int* status = buff_ls + (i )*inc_ls;
103  double dist = fabs( wilkshift - *lambda1 );
104 
105  if ( *status == 1 ) continue;
106 
107  if ( dist < dist_cand )
108  {
109  ij_cand = i;
110  pshift_cand = *lambda1;
111  dist_cand = dist;
112  }
113  }
114 
115  *ij_shift = ij_cand;
116 
117  return FLA_SUCCESS;
118 }
FLA_Error FLA_Wilkshift_tridiag_opd(double delta1, double epsilon, double delta2, double *kappa)
Definition: FLA_Wilkshift_tridiag.c:155
int i
Definition: bl1_axmyv2.c:145

◆ FLA_Tevd_find_perfshift_ops()

FLA_Error FLA_Tevd_find_perfshift_ops ( int  m_d,
int  m_l,
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 *  ij_shift 
)
22 {
23  FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
24 
25  return FLA_SUCCESS;
26 }