mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
4x4 inverse:
* change block selection threshold from 1e-2 to 1e-1 * add rigorous precision test
This commit is contained in:
@@ -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)); \
|
||||
|
||||
Reference in New Issue
Block a user