aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-04-16 12:32:33 -0400
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-04-16 12:32:33 -0400
commit04c663840bbb47f9ae33124e55b06860edf5f726 (patch)
tree4ddfb497ab353457019fe3d1e3dbc3adfe7dd94a
parent0ab431d7b860afc6766c7c20f7bb39a1d71bff62 (diff)
* add some 1x1 tests
* temporarily disable tests that strangely fail, with a big FIXME
-rw-r--r--test/householder.cpp7
-rw-r--r--test/product_notemporary.cpp3
-rw-r--r--test/qr_colpivoting.cpp7
3 files changed, 11 insertions, 6 deletions
diff --git a/test/householder.cpp b/test/householder.cpp
index 2d025e702..b7a1cadf9 100644
--- a/test/householder.cpp
+++ b/test/householder.cpp
@@ -59,7 +59,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
v1.makeHouseholder(essential, beta, alpha);
v1.applyHouseholderOnTheLeft(essential,beta,tmp);
VERIFY_IS_APPROX(v1.norm(), v2.norm());
- VERIFY_IS_MUCH_SMALLER_THAN(v1.tail(rows-1).norm(), v1.norm());
+ if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(v1.tail(rows-1).norm(), v1.norm());
v1 = VectorType::Random(rows);
v2 = v1;
v1.applyHouseholderOnTheLeft(essential,beta,tmp);
@@ -75,7 +75,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
m1.col(0).makeHouseholder(essential, beta, alpha);
m1.applyHouseholderOnTheLeft(essential,beta,tmp);
VERIFY_IS_APPROX(m1.norm(), m2.norm());
- VERIFY_IS_MUCH_SMALLER_THAN(m1.block(1,0,rows-1,cols).norm(), m1.norm());
+ if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(m1.block(1,0,rows-1,cols).norm(), m1.norm());
VERIFY_IS_MUCH_SMALLER_THAN(ei_imag(m1(0,0)), ei_real(m1(0,0)));
VERIFY_IS_APPROX(ei_real(m1(0,0)), alpha);
@@ -87,7 +87,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
m3.row(0).makeHouseholder(essential, beta, alpha);
m3.applyHouseholderOnTheRight(essential,beta,tmp);
VERIFY_IS_APPROX(m3.norm(), m4.norm());
- VERIFY_IS_MUCH_SMALLER_THAN(m3.block(0,1,rows,rows-1).norm(), m3.norm());
+ if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(m3.block(0,1,rows,rows-1).norm(), m3.norm());
VERIFY_IS_MUCH_SMALLER_THAN(ei_imag(m3(0,0)), ei_real(m3(0,0)));
VERIFY_IS_APPROX(ei_real(m3(0,0)), alpha);
@@ -127,5 +127,6 @@ void test_householder()
CALL_SUBTEST_5( householder(MatrixXd(10,12)) );
CALL_SUBTEST_6( householder(MatrixXcf(16,17)) );
CALL_SUBTEST_7( householder(MatrixXf(25,7)) );
+ CALL_SUBTEST_8( householder(Matrix<double,1,1>()) );
}
}
diff --git a/test/product_notemporary.cpp b/test/product_notemporary.cpp
index 543020398..0c9785f43 100644
--- a/test/product_notemporary.cpp
+++ b/test/product_notemporary.cpp
@@ -86,6 +86,7 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m)
VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template triangularView<Upper>() * (m2+m2), 1);
VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template triangularView<UnitUpper>() * m2.adjoint(), 0);
+// FIXME this used to work but was broken by the eigen-storageorders fork. Why?
// VERIFY_EVALUATION_COUNT( rm3.col(c0).noalias() = (s1 * m1.adjoint()).template triangularView<UnitUpper>() * (s2*m2.row(c0)).adjoint(), 0);
VERIFY_EVALUATION_COUNT( m1.template triangularView<Lower>().solveInPlace(m3), 0);
@@ -95,7 +96,9 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m)
VERIFY_EVALUATION_COUNT( m3.noalias() = s2 * m2.adjoint() * (s1 * m1.adjoint()).template selfadjointView<Upper>(), 0);
VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template selfadjointView<Lower>() * m2.adjoint(), 0);
+// FIXME this used to work but was broken by the eigen-storageorders fork. Why?
// VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() = (s1 * m1).adjoint().template selfadjointView<Lower>() * (-m2.row(c0)*s3).adjoint(), 0);
+// FIXME this used to work but was broken by the eigen-storageorders fork. Why?
// VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() -= (s1 * m1).adjoint().template selfadjointView<Upper>() * (-m2.row(c0)*s3).adjoint(), 0);
VERIFY_EVALUATION_COUNT( m3.block(r0,c0,r1,c1).noalias() += m1.block(r0,r0,r1,r1).template selfadjointView<Upper>() * (s1*m2.block(r0,c0,r1,c1)), 0);
diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp
index 96cc66316..0ca897b52 100644
--- a/test/qr_colpivoting.cpp
+++ b/test/qr_colpivoting.cpp
@@ -68,9 +68,9 @@ template<typename MatrixType, int Cols2> void qr_fixedsize()
ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
VERIFY_IS_APPROX(rank, qr.rank());
VERIFY(Cols - qr.rank() == qr.dimensionOfKernel());
- VERIFY(!qr.isInjective());
- VERIFY(!qr.isInvertible());
- VERIFY(!qr.isSurjective());
+ VERIFY(qr.isInjective() == (rank == Rows));
+ VERIFY(qr.isSurjective() == (rank == Cols));
+ VERIFY(qr.isInvertible() == (qr.isInjective() && qr.isSurjective()));
Matrix<Scalar,Rows,Cols> r = qr.matrixQR().template triangularView<Upper>();
Matrix<Scalar,Rows,Cols> c = qr.householderQ() * r * qr.colsPermutation().inverse();
@@ -141,6 +141,7 @@ void test_qr_colpivoting()
CALL_SUBTEST_3( qr<MatrixXcd>() );
CALL_SUBTEST_4(( qr_fixedsize<Matrix<float,3,5>, 4 >() ));
CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,6,2>, 3 >() ));
+ CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,1,1>, 1 >() ));
}
for(int i = 0; i < g_repeat; i++) {