diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-11-19 22:01:13 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-11-19 22:01:13 -0500 |
commit | 6cbf662f14d8fd0606d9e9c6f7052e5dcc52b2ae (patch) | |
tree | 07a6779772e9840882b62d62f6bb4b76e34668d8 /Eigen | |
parent | eac3232095baf7c69e8ff7a6b636ffcf03db156b (diff) |
* don't laugh, but these bugs took me forever to fix.
* expand unit tests to make sure to catch them: they nearly escaped the existing tests as these memory violations were highly dependent on the numbers of rows and cols.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/TriangularMatrix.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index 1286bf6a6..1a8f6493d 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -410,7 +410,7 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, StrictlyLowerTriang { for(int i = j+1; i < dst.rows(); ++i) dst.copyCoeff(i, j, src); - int maxi = std::min(j, dst.rows()); + int maxi = std::min(j, dst.rows()-1); if (ClearOpposite) for(int i = 0; i <= maxi; ++i) dst.coeffRef(i, j) = 0; @@ -432,9 +432,9 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, UnitUpperTriangular { for(int i = maxi+1; i < dst.rows(); ++i) dst.coeffRef(i, j) = 0; - dst.coeffRef(j, j) = 1; } } + dst.diagonal().setOnes(); } }; template<typename Derived1, typename Derived2, bool ClearOpposite> @@ -451,9 +451,9 @@ struct ei_triangular_assignment_selector<Derived1, Derived2, UnitLowerTriangular { for(int i = 0; i < maxi; ++i) dst.coeffRef(i, j) = 0; - dst.coeffRef(j, j) = 1; } } + dst.diagonal().setOnes(); } }; |