libflame  revision_anchor
Functions
FLA_Bsvd_find_converged.c File Reference

(r)

Functions

FLA_Error FLA_Bsvd_find_converged (FLA_Obj tol, FLA_Obj d, FLA_Obj e, FLA_Obj sminl)
 
FLA_Error FLA_Bsvd_find_converged_ops (int m_A, float tol, float *buff_d, int inc_d, float *buff_e, int inc_e, float *sminl)
 
FLA_Error FLA_Bsvd_find_converged_opd (int m_A, double tol, double *buff_d, int inc_d, double *buff_e, int inc_e, double *sminl)
 

Function Documentation

◆ FLA_Bsvd_find_converged()

FLA_Error FLA_Bsvd_find_converged ( FLA_Obj  tol,
FLA_Obj  d,
FLA_Obj  e,
FLA_Obj  sminl 
)
14 {
15  FLA_Datatype datatype;
16  int m_A;
17  int inc_d;
18  int inc_e;
19 
20  datatype = FLA_Obj_datatype( d );
21 
22  m_A = FLA_Obj_vector_dim( d );
23 
24  inc_d = FLA_Obj_vector_inc( d );
25  inc_e = FLA_Obj_vector_inc( e );
26 
27 
28  switch ( datatype )
29  {
30  case FLA_FLOAT:
31  {
32  float* buff_tol = FLA_FLOAT_PTR( tol );
33  float* buff_d = FLA_FLOAT_PTR( d );
34  float* buff_e = FLA_FLOAT_PTR( e );
35  float* buff_sminl = FLA_FLOAT_PTR( sminl );
36 
38  *buff_tol,
39  buff_d, inc_d,
40  buff_e, inc_e,
41  buff_sminl );
42 
43  break;
44  }
45 
46  case FLA_DOUBLE:
47  {
48  double* buff_tol = FLA_DOUBLE_PTR( tol );
49  double* buff_d = FLA_DOUBLE_PTR( d );
50  double* buff_e = FLA_DOUBLE_PTR( e );
51  double* buff_sminl = FLA_DOUBLE_PTR( sminl );
52 
54  *buff_tol,
55  buff_d, inc_d,
56  buff_e, inc_e,
57  buff_sminl );
58 
59  break;
60  }
61  }
62 
63  return FLA_SUCCESS;
64 }
FLA_Error FLA_Bsvd_find_converged_ops(int m_A, float tol, float *buff_d, int inc_d, float *buff_e, int inc_e, float *sminl)
Definition: FLA_Bsvd_find_converged.c:68
FLA_Error FLA_Bsvd_find_converged_opd(int m_A, double tol, double *buff_d, int inc_d, double *buff_e, int inc_e, double *sminl)
Definition: FLA_Bsvd_find_converged.c:117
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

References FLA_Bsvd_find_converged_opd(), FLA_Bsvd_find_converged_ops(), FLA_Obj_datatype(), FLA_Obj_vector_dim(), and FLA_Obj_vector_inc().

◆ FLA_Bsvd_find_converged_opd()

FLA_Error FLA_Bsvd_find_converged_opd ( int  m_A,
double  tol,
double *  buff_d,
int  inc_d,
double *  buff_e,
int  inc_e,
double *  sminl 
)
122 {
123  double* epsilon_last;
124  double* delta_last;
125  double mu;
126  int i;
127 
128  epsilon_last = buff_e + (m_A-2)*inc_e;
129  delta_last = buff_d + (m_A-1)*inc_d;
130 
131  // Check convergence at the bottom of the matrix first.
132  if ( MAC_Bsvd_sinval_is_converged_opd( tol, *delta_last, *epsilon_last ) )
133  {
134  //*epsilon_last = 0.0;
135  *sminl = 0.0;
136  return m_A - 2;
137  }
138 
139  // If the last element is not yet converged, check interior elements.
140  // Also, accumulate sminl for later use when it comes time to check
141  // the shift.
142 
143  mu = fabs( *buff_d );
144  *sminl = mu;
145 
146  for ( i = 0; i < m_A - 1; ++i )
147  {
148  double* epsilon1 = buff_e + (i )*inc_e;
149  double* delta2 = buff_d + (i+1)*inc_d;
150 
151  // Check convergence of epsilon1 against the value of mu accumulated
152  // so far.
153  if ( MAC_Bsvd_sinval_is_converged_opd( tol, mu, *epsilon1 ) )
154  {
155 //printf( "FLA_Bsvd_sinval_find_converged: Split occurred in col %d\n", i );
156 //printf( "FLA_Bsvd_sinval_find_converged: mu alpha12 = %23.19e %23.19e\n", mu, *epsilon1 );
157 //printf( "FLA_Bsvd_sinval_find_converged: alpha22 = %43.19e\n", *delta2 );
158  //*epsilon1 = 0.0;
159  //return FLA_FAILURE;
160  return i;
161  }
162 
163  // Update mu and sminl.
164  mu = fabs( *delta2 ) * ( mu / ( mu + fabs( *epsilon1 ) ) );
165  *sminl = min( *sminl, mu );
166  }
167 
168  // Return with no convergence found.
169  return FLA_SUCCESS;
170 }
int i
Definition: bl1_axmyv2.c:145

References i.

Referenced by FLA_Bsvd_find_converged(), and FLA_Bsvd_sinval_v_opd_var1().

◆ FLA_Bsvd_find_converged_ops()

FLA_Error FLA_Bsvd_find_converged_ops ( int  m_A,
float  tol,
float *  buff_d,
int  inc_d,
float *  buff_e,
int  inc_e,
float *  sminl 
)
73 {
74  float* epsilon_last;
75  float* delta_last;
76  float mu;
77  int i;
78 
79  epsilon_last = buff_e + (m_A-2)*inc_e;
80  delta_last = buff_d + (m_A-1)*inc_d;
81 
82  // Check convergence at the bottom of the matrix first.
83  if ( MAC_Bsvd_sinval_is_converged_ops( tol, *delta_last, *epsilon_last ) )
84  {
85  *sminl = 0.0F;
86  return m_A - 2;
87  }
88 
89  // If the last element is not yet converged, check interior elements.
90  // Also, accumulate sminl for later use when it comes time to check
91  // the shift.
92 
93  mu = fabsf( *buff_d );
94  *sminl = mu;
95 
96  for ( i = 0; i < m_A - 1; ++i )
97  {
98  float* epsilon1 = buff_e + (i )*inc_e;
99  float* delta2 = buff_d + (i+1)*inc_d;
100 
101  // Check convergence of epsilon1 against the value of mu accumulated
102  // so far.
103  if ( MAC_Bsvd_sinval_is_converged_ops( tol, mu, *epsilon1 ) )
104  {
105  return i;
106  }
107 
108  // Update mu and sminl.
109  mu = fabsf( *delta2 ) * ( mu / ( mu + fabsf( *epsilon1 ) ) );
110  *sminl = min( *sminl, mu );
111  }
112 
113  // Return with no convergence found.
114  return FLA_SUCCESS;
115 }

References i.

Referenced by FLA_Bsvd_find_converged(), and FLA_Bsvd_sinval_v_ops_var1().