From 9afd1324fd809631cd0762908629c30d72e61b40 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sun, 10 May 2009 16:24:39 +0000 Subject: constant Diagonal ---> DiagonalBits introduce ei_is_diagonal to check for it DiagonalCoeffs ---> Diagonal and allow Index to by Dynamic -> add MatrixBase::diagonal(int) with unittest and doc --- test/submatrices.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/submatrices.cpp b/test/submatrices.cpp index e34650842..596a8a20e 100644 --- a/test/submatrices.cpp +++ b/test/submatrices.cpp @@ -109,7 +109,6 @@ template void submatrices(const MatrixType& m) 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(6) * m1.diagonal()[0]); const int BlockRows = EIGEN_ENUM_MIN(MatrixType::RowsAtCompileTime,2); const int BlockCols = EIGEN_ENUM_MIN(MatrixType::ColsAtCompileTime,5); @@ -152,6 +151,14 @@ template void submatrices(const MatrixType& m) m2.template diagonal() = 2 * m1.template diagonal(); m2.template diagonal()[0] *= 3; VERIFY_IS_APPROX(m2.template diagonal()[0], static_cast(6) * m1.template diagonal()[0]); + + m2.diagonal(N1) = 2 * m1.diagonal(N1); + m2.diagonal(N1)[0] *= 3; + VERIFY_IS_APPROX(m2.diagonal(N1)[0], static_cast(6) * m1.diagonal(N1)[0]); + + m2.diagonal(N2) = 2 * m1.diagonal(N2); + m2.diagonal(N2)[0] *= 3; + VERIFY_IS_APPROX(m2.diagonal(N2)[0], static_cast(6) * m1.diagonal(N2)[0]); } // stress some basic stuffs with block matrices -- cgit v1.2.3