aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-19 22:01:13 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-19 22:01:13 -0500
commit6cbf662f14d8fd0606d9e9c6f7052e5dcc52b2ae (patch)
tree07a6779772e9840882b62d62f6bb4b76e34668d8 /Eigen
parenteac3232095baf7c69e8ff7a6b636ffcf03db156b (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.h6
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();
}
};