Fix bugs reported by Timothy Hunter:

* CholeskyWithoutSqrt with 1x1 matrices
 * .part<Diagonal>()
Updated unit tests to handle these cases
This commit is contained in:
Gael Guennebaud
2008-09-03 20:52:26 +00:00
parent e14aa8c8aa
commit c29c7b0ea9
4 changed files with 9 additions and 2 deletions

View File

@@ -79,7 +79,6 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
}
#endif
if (rows>1)
{
CholeskyWithoutSquareRoot<SquareMatrixType> cholnosqrt(symm);
VERIFY(cholnosqrt.isPositiveDefinite());

View File

@@ -81,6 +81,8 @@ template<typename MatrixType> void triangular(const MatrixType& m)
m1.template part<Eigen::Lower>() = (m2.transpose() * m2).lazy();
VERIFY_IS_APPROX(m3.template part<Eigen::Lower>(), m1);
VERIFY_IS_APPROX(m3.template part<Diagonal>(), m3.diagonal().asDiagonal());
m1 = MatrixType::Random(rows, cols);
for (int i=0; i<rows; ++i)
while (ei_abs2(m1(i,i))<1e-3) m1(i,i) = ei_random<Scalar>();