aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-23 10:13:21 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-23 10:13:21 -0500
commit44d0d667cd629a18e29b9c248633891c1b04f75c (patch)
tree9df7106246634e052c2686371f20e1c07325eeb0 /Eigen
parent06f11f337951982f240c161933229812c391e979 (diff)
4x4 inverse:
* change block selection threshold from 1e-2 to 1e-1 * add rigorous precision test
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/LU/Inverse.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/Eigen/src/LU/Inverse.h b/Eigen/src/LU/Inverse.h
index 306b5f60a..9d5e86845 100644
--- a/Eigen/src/LU/Inverse.h
+++ b/Eigen/src/LU/Inverse.h
@@ -235,8 +235,11 @@ struct ei_compute_inverse<MatrixType, ResultType, 4>
int good_row0, good_row1, good_i;
Matrix<RealScalar,6,1> absdet;
- // any 2x2 block with determinant above this threshold will be considered good enough
- RealScalar d = (matrix.col(0).squaredNorm()+matrix.col(1).squaredNorm()) * RealScalar(1e-2);
+ // any 2x2 block with determinant above this threshold will be considered good enough.
+ // The magic value 1e-1 here comes from experimentation. The bigger it is, the higher the precision,
+ // the slower the computation. This value 1e-1 gives precision almost as good as the brutal cofactors
+ // algorithm, both in average and in worst-case precision.
+ RealScalar d = (matrix.col(0).squaredNorm()+matrix.col(1).squaredNorm()) * RealScalar(1e-1);
#define ei_inv_size4_helper_macro(i,row0,row1) \
absdet[i] = ei_abs(matrix.coeff(row0,0)*matrix.coeff(row1,1) \
- matrix.coeff(row0,1)*matrix.coeff(row1,0)); \