-add Ones, DiagonalMatrix, DiagonalCoeffs

-expand and improve unit-tests
-various renaming and improvements
This commit is contained in:
Benoit Jacob
2007-12-15 18:16:30 +00:00
parent fc7b2b5c20
commit 7c38475291
18 changed files with 405 additions and 64 deletions

View File

@@ -30,9 +30,9 @@ namespace Eigen {
template<typename MatrixType> void submatrices(const MatrixType& m)
{
/* this test covers the following files:
Transpose.h Conjugate.h Dot.h
Row.h Column.h Block.h DynBlock.h Minor.h DiagonalCoeffs.h
*/
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;
@@ -54,10 +54,6 @@ template<typename MatrixType> void submatrices(const MatrixType& m)
Scalar s1 = random<Scalar>();
/* this test covers the following files:
Row.h Column.h Block.h DynBlock.h Minor.h
*/
int r1 = random<int>(0,rows-1);
int r2 = random<int>(r1,rows-1);
int c1 = random<int>(0,cols-1);
@@ -91,6 +87,12 @@ template<typename MatrixType> void submatrices(const MatrixType& m)
//check operator(), both constant and non-constant, on minor()
m1.minor(r1,c1)(0,0) = m1.minor(0,0)(0,0);
}
//check diagonal()
VERIFY_IS_APPROX(m1.diagonal(), m1.transpose().diagonal());
m2.diagonal() = 2 * m1.diagonal();
m2.diagonal()[0] *= 3;
VERIFY_IS_APPROX(m2.diagonal()[0], static_cast<Scalar>(6) * m1.diagonal()[0]);
}
void EigenTest::testSubmatrices()