aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-07-16 00:03:17 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-07-16 00:03:17 +0200
commit34490f1493f8111c131e471a3dc7f6fbe5687404 (patch)
treeed6a86263f90ffc965139ce2b91814d29c0c3311 /test
parent97c9445c60f307f6a59a212872173c256adf2acd (diff)
* bugfixes in Product, and test/product_selfadjoint
* speed up in the extraction of the matrix Q in Tridiagonalization
Diffstat (limited to 'test')
-rw-r--r--test/product_selfadjoint.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/product_selfadjoint.cpp b/test/product_selfadjoint.cpp
index 297bab1a9..29fbf11bf 100644
--- a/test/product_selfadjoint.cpp
+++ b/test/product_selfadjoint.cpp
@@ -77,12 +77,14 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
m2.template selfadjointView<UpperTriangular>().rank2update(-r1.adjoint(),r2.adjoint()*s3,s1);
VERIFY_IS_APPROX(m2, (m1 + (-s3*s1) * (r1.adjoint() * r2 + r2.adjoint() * r1)).template triangularView<UpperTriangular>().toDense());
- m2 = m1.template triangularView<LowerTriangular>();
- m2.block(1,1,rows-1,cols-1).template selfadjointView<LowerTriangular>().rank2update(v1.end(rows-1),v2.start(cols-1));
- m3 = m1;
- m3.block(1,1,rows-1,cols-1) += v1.end(rows-1) * v2.start(cols-1).adjoint()+ v2.start(cols-1) * v1.end(rows-1).adjoint();
- VERIFY_IS_APPROX(m2, m3.template triangularView<LowerTriangular>().toDense());
-
+ if (rows>1)
+ {
+ m2 = m1.template triangularView<LowerTriangular>();
+ m2.block(1,1,rows-1,cols-1).template selfadjointView<LowerTriangular>().rank2update(v1.end(rows-1),v2.start(cols-1));
+ m3 = m1;
+ m3.block(1,1,rows-1,cols-1) += v1.end(rows-1) * v2.start(cols-1).adjoint()+ v2.start(cols-1) * v1.end(rows-1).adjoint();
+ VERIFY_IS_APPROX(m2, m3.template triangularView<LowerTriangular>().toDense());
+ }
}
void test_product_selfadjoint()
@@ -93,7 +95,7 @@ void test_product_selfadjoint()
CALL_SUBTEST( product_selfadjoint(Matrix3d()) );
CALL_SUBTEST( product_selfadjoint(MatrixXcf(4, 4)) );
CALL_SUBTEST( product_selfadjoint(MatrixXcd(21,21)) );
- CALL_SUBTEST( product_selfadjoint(MatrixXd(4,4)) );
+ CALL_SUBTEST( product_selfadjoint(MatrixXd(14,14)) );
CALL_SUBTEST( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(17,17)) );
CALL_SUBTEST( product_selfadjoint(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(19, 19)) );
}