From 34490f1493f8111c131e471a3dc7f6fbe5687404 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 16 Jul 2009 00:03:17 +0200 Subject: * bugfixes in Product, and test/product_selfadjoint * speed up in the extraction of the matrix Q in Tridiagonalization --- test/product_selfadjoint.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'test/product_selfadjoint.cpp') 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 void product_selfadjoint(const MatrixType& m) m2.template selfadjointView().rank2update(-r1.adjoint(),r2.adjoint()*s3,s1); VERIFY_IS_APPROX(m2, (m1 + (-s3*s1) * (r1.adjoint() * r2 + r2.adjoint() * r1)).template triangularView().toDense()); - m2 = m1.template triangularView(); - m2.block(1,1,rows-1,cols-1).template selfadjointView().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().toDense()); - + if (rows>1) + { + m2 = m1.template triangularView(); + m2.block(1,1,rows-1,cols-1).template selfadjointView().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().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(17,17)) ); CALL_SUBTEST( product_selfadjoint(Matrix,Dynamic,Dynamic,RowMajor>(19, 19)) ); } -- cgit v1.2.3