mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 04:35:57 +08:00
fix bug #70
Was trying to apply stupid invertibility check to top-left 2x2 corner.
This commit is contained in:
parent
a161a70696
commit
8d31f58ea1
@ -29,8 +29,8 @@
|
|||||||
*** Part 1 : optimized implementations for fixed-size 2,3,4 cases ***
|
*** Part 1 : optimized implementations for fixed-size 2,3,4 cases ***
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
template<typename MatrixType>
|
template<typename XprType, typename MatrixType>
|
||||||
void ei_compute_inverse_in_size2_case(const MatrixType& matrix, MatrixType* result)
|
void ei_compute_inverse_in_size2_case(const XprType& matrix, MatrixType* result)
|
||||||
{
|
{
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
const Scalar invdet = Scalar(1) / matrix.determinant();
|
const Scalar invdet = Scalar(1) / matrix.determinant();
|
||||||
@ -94,8 +94,7 @@ bool ei_compute_inverse_in_size4_case_helper(const MatrixType& matrix, MatrixTyp
|
|||||||
typedef Block<MatrixType,2,2> XprBlock22;
|
typedef Block<MatrixType,2,2> XprBlock22;
|
||||||
typedef typename MatrixBase<XprBlock22>::PlainMatrixType Block22;
|
typedef typename MatrixBase<XprBlock22>::PlainMatrixType Block22;
|
||||||
Block22 P_inverse;
|
Block22 P_inverse;
|
||||||
if(ei_compute_inverse_in_size2_case_with_check(matrix.template block<2,2>(0,0), &P_inverse))
|
ei_compute_inverse_in_size2_case(matrix.template block<2,2>(0,0), &P_inverse);
|
||||||
{
|
|
||||||
const Block22 Q = matrix.template block<2,2>(0,2);
|
const Block22 Q = matrix.template block<2,2>(0,2);
|
||||||
const Block22 P_inverse_times_Q = P_inverse * Q;
|
const Block22 P_inverse_times_Q = P_inverse * Q;
|
||||||
const XprBlock22 R = matrix.template block<2,2>(2,0);
|
const XprBlock22 R = matrix.template block<2,2>(2,0);
|
||||||
@ -111,11 +110,6 @@ bool ei_compute_inverse_in_size4_case_helper(const MatrixType& matrix, MatrixTyp
|
|||||||
result->template block<2,2>(0,2) = - Z;
|
result->template block<2,2>(0,2) = - Z;
|
||||||
result->template block<2,2>(0,0) = P_inverse + Z * R_times_P_inverse;
|
result->template block<2,2>(0,0) = P_inverse + Z * R_times_P_inverse;
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user