updated product test to carefully test all scalar types

and fix an issue in the triangular test
This commit is contained in:
Gael Guennebaud 2008-05-12 10:26:10 +00:00
parent 45cda6704a
commit f0eb3d2d3b
2 changed files with 13 additions and 9 deletions

View File

@ -95,15 +95,19 @@ void EigenTest::testProduct()
{
for(int i = 0; i < m_repeat; i++) {
product(Matrix<float, 1, 1>());
product(Matrix<float, 3, 3>());
product(Matrix<float, 4, 2>());
product(Matrix4d());
product(MatrixXcf(3, 3));
product(MatrixXf(13, 25));
product(MatrixXi(4, 4));
product(MatrixXcd(20, 20));
}
// test a large matrix only once
product(MatrixXf(100,100));
for(int i = 0; i < m_repeat; i++) {
int rows = ei_random<int>(1,320);
int cols = ei_random<int>(1,320);
product(MatrixXf(rows, cols));
product(MatrixXd(rows, cols));
product(MatrixXi(rows, cols));
product(MatrixXcf(rows, cols));
product(MatrixXcd(rows, cols));
}
}
} // namespace Eigen

View File

@ -70,13 +70,13 @@ template<typename MatrixType> void triangular(const MatrixType& m)
// test overloaded operator=
m1.setZero();
m1.upper() = m2.transpose() * m2;
m1.upper() = (m2.transpose() * m2).lazy();
m3 = m2.transpose() * m2;
VERIFY_IS_APPROX(m3.lower().transpose(), m1);
// test overloaded operator=
m1.setZero();
m1.lower() = m2.transpose() * m2;
m1.lower() = (m2.transpose() * m2).lazy();
VERIFY_IS_APPROX(m3.lower(), m1);
// test back and forward subsitution