diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-11-04 11:46:17 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-11-04 11:46:17 -0500 |
commit | 4c456d4211bead14edf2a6b11bfa9617b455b7e4 (patch) | |
tree | 21a98448d1ed1264cff88ed14c65296a48ef80a1 /Eigen | |
parent | 3979f6d8aad001174160774b49b747430a7686b5 (diff) |
fix bug in svd solve reported on forum, was apparently assuming square matrix, not sure how the unit test could work.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/SVD/SVD.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Eigen/src/SVD/SVD.h b/Eigen/src/SVD/SVD.h index da01cf396..99272258e 100644 --- a/Eigen/src/SVD/SVD.h +++ b/Eigen/src/SVD/SVD.h @@ -426,8 +426,11 @@ bool SVD<MatrixType>::solve(const MatrixBase<OtherDerived> &b, ResultType* resul else aux.coeffRef(i) /= si; } - - result->col(j) = m_matV * aux; + const int cols = m_matV.rows(); + const int minsize = std::min(rows,cols); + result->col(j).start(minsize) = aux.start(minsize); + if(cols>rows) result->col(j).end(cols-minsize).setZero(); + result->col(j) = m_matV * result->col(j); } return true; } |