SimpleMath: fixed matrix.llt().inverse() (was using unused variable).

master
Martin Felis 2020-11-20 22:54:07 +01:00
parent 17336be8d6
commit 17a8a0347f
1 changed files with 4 additions and 5 deletions

View File

@ -1555,7 +1555,6 @@ private:
typedef Matrix<value_type, Derived::RowsAtCompileTime, 1> ColumnVector;
bool mIsFactorized;
Matrix<value_type, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> mQ;
Derived mL;
public:
@ -1624,13 +1623,13 @@ public:
Derived inverse() const {
assert (mIsFactorized);
VectorXd rhs_temp = VectorXd::Zero(mQ.cols());
MatrixXXd result (mQ.cols(), mQ.cols());
VectorXd rhs_temp = VectorXd::Zero(mL.cols());
MatrixXXd result (mL.cols(), mL.cols());
for (unsigned int i = 0; i < mQ.cols(); i++) {
for (unsigned int i = 0; i < mL.cols(); i++) {
rhs_temp[i] = 1.;
result.block(0, i, mQ.cols(), 1) = solve(rhs_temp);
result.block(0, i, mL.cols(), 1) = solve(rhs_temp);
rhs_temp[i] = 0.;
}