10 #ifndef EIGEN_CONDITIONESTIMATOR_H 11 #define EIGEN_CONDITIONESTIMATOR_H 17 template <
typename Vector,
typename RealVector,
bool IsComplex>
20 const RealVector v_abs = v.cwiseAbs();
22 .select(Vector::Ones(v.size()), v.cwiseQuotient(v_abs));
27 template <
typename Vector>
31 .select(-Vector::Ones(v.size()), Vector::Ones(v.size()));
55 template <
typename Decomposition>
66 const Index n = dec.rows();
71 #ifdef __INTEL_COMPILER 73 #pragma warning ( disable : 2259 ) 75 Vector
v = dec.solve(Vector::Ones(n) /
Scalar(n));
76 #ifdef __INTEL_COMPILER 84 RealScalar lower_bound = v.template lpNorm<1>();
91 RealScalar old_lower_bound = lower_bound;
92 Vector sign_vector(n);
93 Vector old_sign_vector;
94 Index v_max_abs_index = -1;
95 Index old_v_max_abs_index = v_max_abs_index;
96 for (
int k = 0; k < 4; ++k)
99 if (k > 0 && !is_complex && sign_vector == old_sign_vector) {
104 v = dec.adjoint().solve(sign_vector);
105 v.real().cwiseAbs().maxCoeff(&v_max_abs_index);
106 if (v_max_abs_index == old_v_max_abs_index) {
111 v = dec.solve(Vector::Unit(n, v_max_abs_index));
112 lower_bound = v.template lpNorm<1>();
113 if (lower_bound <= old_lower_bound) {
118 old_sign_vector = sign_vector;
120 old_v_max_abs_index = v_max_abs_index;
121 old_lower_bound = lower_bound;
137 alternating_sign = -alternating_sign;
140 const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 *
RealScalar(n));
141 return numext::maxi(lower_bound, alternate_lower_bound);
157 template <
typename Decomposition>
168 : (
RealScalar(1) / inverse_matrix_norm) / matrix_norm);
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Decomposition::RealScalar rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition &dec)
Reciprocal condition number estimator.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
NumTraits< Scalar >::Real RealScalar
static Vector run(const Vector &v)
Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomposition &dec)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
static Vector run(const Vector &v)