aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/triangular.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-19 19:20:19 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-19 19:20:19 -0500
commit88b551e89bd34367c12f0ba540ee1134c6897ba1 (patch)
tree484bee0e6c4e3abc83c7ff6ca817162be92f7e9a /test/triangular.cpp
parenta20a744adc5414f9a79ae0637de9c3227c3dd420 (diff)
* fix compilation of unit-tests (sorry, had tested only 1 channel)
* remove buggy (superfluous?) specialization in the meta-unroller
Diffstat (limited to 'test/triangular.cpp')
-rw-r--r--test/triangular.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/test/triangular.cpp b/test/triangular.cpp
index 3c89a8abb..a10b457a7 100644
--- a/test/triangular.cpp
+++ b/test/triangular.cpp
@@ -141,7 +141,10 @@ template<typename MatrixType> void triangular_rect(const MatrixType& m)
{
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
- typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
+ enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
+ typedef Matrix<Scalar, Rows, 1> VectorType;
+ typedef Matrix<Scalar, Rows, Rows> RMatrixType;
+
int rows = m.rows();
int cols = m.cols();
@@ -153,10 +156,10 @@ template<typename MatrixType> void triangular_rect(const MatrixType& m)
r1(rows, cols),
r2(rows, cols),
mzero = MatrixType::Zero(rows, cols),
- mones = MatrixType::Ones(rows, cols),
- identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime>
+ mones = MatrixType::Ones(rows, cols);
+ RMatrixType identity = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime>
::Identity(rows, rows),
- square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime>
+ square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime>
::Random(rows, rows);
VectorType v1 = VectorType::Random(rows),
v2 = VectorType::Random(rows),
@@ -172,8 +175,6 @@ template<typename MatrixType> void triangular_rect(const MatrixType& m)
VERIFY(!m2.isLowerTriangular());
}
-// VERIFY_IS_APPROX(m1up.transpose() * m2, m1.upper().transpose().lower() * m2);
-
// test overloaded operator+=
r1.setZero();
r2.setZero();
@@ -227,25 +228,30 @@ template<typename MatrixType> void triangular_rect(const MatrixType& m)
m3.setZero();
m3.template triangularView<UpperTriangular>().setOnes();
VERIFY_IS_APPROX(m2,m3);
-
}
void test_triangular()
{
- for(int i = 0; i < g_repeat ; i++) {
+ for(int i = 0; i < g_repeat ; i++)
+ {
+
+#ifdef EIGEN_TEST_PART_7
+ int r = ei_random<int>(2,20);
+ int c = ei_random<int>(2,20);
+#endif
+
CALL_SUBTEST_1( triangular_square(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( triangular_square(Matrix<float, 2, 2>()) );
CALL_SUBTEST_3( triangular_square(Matrix3d()) );
CALL_SUBTEST_4( triangular_square(MatrixXcf(4, 4)) );
CALL_SUBTEST_5( triangular_square(Matrix<std::complex<float>,8, 8>()) );
CALL_SUBTEST_6( triangular_square(MatrixXcd(17,17)) );
- CALL_SUBTEST_7( triangular_square(Matrix<float,Dynamic,Dynamic,RowMajor>(5, 5)) );
+ CALL_SUBTEST_7( triangular_square(Matrix<float,Dynamic,Dynamic,RowMajor>(r, r)) );
CALL_SUBTEST_8( triangular_rect(Matrix<float, 4, 5>()) );
CALL_SUBTEST_9( triangular_rect(Matrix<double, 6, 2>()) );
CALL_SUBTEST_4( triangular_rect(MatrixXcf(4, 10)) );
CALL_SUBTEST_6( triangular_rect(MatrixXcd(11, 3)) );
- CALL_SUBTEST_7( triangular_rect(Matrix<float,Dynamic,Dynamic,RowMajor>(7, 6)) );
-
+ CALL_SUBTEST_7( triangular_rect(Matrix<float,Dynamic,Dynamic,RowMajor>(r, c)) );
}
}