1 #ifndef _VIENNACL_LINALG_DETAIL_BISECT_GERSCHORIN_HPP_
2 #define _VIENNACL_LINALG_DETAIL_BISECT_GERSCHORIN_HPP_
53 template<
typename NumericT>
58 for (
unsigned int i = 1; i < (n - 1); ++i)
62 NumericT sum_abs_ni = fabsf(s[i]) + fabsf(s[i + 1]);
64 lg =
min(lg, d[i] - sum_abs_ni);
65 ug =
max(ug, d[i] + sum_abs_ni);
71 lg =
min(lg, d[0] - fabsf(s[1]));
72 ug =
max(ug, d[0] + fabsf(s[1]));
75 lg =
min(lg, d[n-1] - fabsf(s[n-1]));
76 ug =
max(ug, d[n-1] + fabsf(s[n-1]));
83 NumericT psi_0 = 11 * FLT_EPSILON * bnorm;
84 NumericT psi_n = 11 * FLT_EPSILON * bnorm;
86 lg = lg - bnorm * 2 *
static_cast<NumericT>(n) * FLT_EPSILON - psi_0;
87 ug = ug + bnorm * 2 *
static_cast<NumericT>(n) * FLT_EPSILON + psi_n;
94 #endif // _VIENNACL_LINALG_DETAIL_GERSCHORIN_H_
void computeGerschgorin(std::vector< NumericT > &d, std::vector< NumericT > &s, unsigned int n, NumericT &lg, NumericT &ug)
T max(const T &lhs, const T &rhs)
Maximum.
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
T min(const T &lhs, const T &rhs)
Minimum.