aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/ConditionEstimator.h
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2016-04-05 16:40:48 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2016-04-05 16:40:48 -0700
commit4d07064a3d357453aab7fe668065ce89a31ee4ab (patch)
treedc52a44410f802a3bc64ce7e65a91ce2eae6c015 /Eigen/src/Core/ConditionEstimator.h
parentd7eeee0c1dfff084dd6b304328fd1e3b567e0177 (diff)
Fix bug in alternate lower bound calculation due to missing parentheses.
Make a few expressions more concise.
Diffstat (limited to 'Eigen/src/Core/ConditionEstimator.h')
-rw-r--r--Eigen/src/Core/ConditionEstimator.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h
index 35ec56128..9027aa2f7 100644
--- a/Eigen/src/Core/ConditionEstimator.h
+++ b/Eigen/src/Core/ConditionEstimator.h
@@ -134,8 +134,7 @@ typename Decomposition::RealScalar InverseMatrixL1NormEstimate(
if (n == 0) {
return 0;
}
- Vector v = Vector::Ones(n) / n;
- v = dec.solve(v);
+ Vector v = dec.solve(Vector::Ones(n) / n);
// lower_bound is a lower bound on
// ||inv(matrix)||_1 = sup_v ||inv(matrix) v||_1 / ||v||_1
@@ -155,11 +154,9 @@ typename Decomposition::RealScalar InverseMatrixL1NormEstimate(
int old_v_max_abs_index = v_max_abs_index;
for (int k = 0; k < 4; ++k) {
sign_vector = internal::SignOrUnity<Vector, RealVector, is_complex>::run(v);
- if (k > 0 && !is_complex) {
- if (sign_vector == old_sign_vector) {
- // Break if the solution stagnated.
- break;
- }
+ if (k > 0 && !is_complex && sign_vector == old_sign_vector) {
+ // Break if the solution stagnated.
+ break;
}
// v_max_abs_index = argmax |real( inv(matrix)^T * sign_vector )|
v = dec.adjoint().solve(sign_vector);
@@ -193,8 +190,9 @@ typename Decomposition::RealScalar InverseMatrixL1NormEstimate(
// Hager's algorithm to vastly underestimate ||matrix||_1.
Scalar alternating_sign = 1;
for (int i = 0; i < n; ++i) {
- v[i] = alternating_sign * static_cast<RealScalar>(1) +
- (static_cast<RealScalar>(i) / (static_cast<RealScalar>(n - 1)));
+ v[i] = alternating_sign *
+ (static_cast<RealScalar>(1) +
+ (static_cast<RealScalar>(i) / (static_cast<RealScalar>(n - 1))));
alternating_sign = -alternating_sign;
}
v = dec.solve(v);