From 82c5438c95a587708483d3bb0933b9166d7bb303 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 23 Jul 2009 21:22:51 +0200 Subject: split and add unit tests for symm and syrk, the .rank*update() functions now returns a reference to *this --- test/product_selfadjoint.cpp | 68 -------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'test/product_selfadjoint.cpp') diff --git a/test/product_selfadjoint.cpp b/test/product_selfadjoint.cpp index 2cacc8e5e..efa487ab1 100644 --- a/test/product_selfadjoint.cpp +++ b/test/product_selfadjoint.cpp @@ -94,65 +94,6 @@ template void product_selfadjoint(const MatrixType& m) } } -template void symm(const MatrixType& m) -{ - typedef typename MatrixType::Scalar Scalar; - typedef typename NumTraits::Real RealScalar; - typedef Matrix Rhs1; - typedef Matrix Rhs2; - typedef Matrix Rhs3; - - int rows = m.rows(); - int cols = m.cols(); - - MatrixType m1 = MatrixType::Random(rows, cols), - m2 = MatrixType::Random(rows, cols); - - m1 = (m1+m1.adjoint()).eval(); - - Rhs1 rhs1 = Rhs1::Random(cols, ei_random(1,320)), rhs12, rhs13; - Rhs2 rhs2 = Rhs2::Random(ei_random(1,320), rows), rhs22, rhs23; - Rhs3 rhs3 = Rhs3::Random(cols, ei_random(1,320)), rhs32, rhs33; - - Scalar s1 = ei_random(), - s2 = ei_random(); - - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView() * (s2*rhs1), - rhs13 = (s1*m1) * (s2*rhs1)); - - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView() * (s2*rhs1), - rhs13 = (s1*m1) * (s2*rhs1)); - - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs22 = (s1*m2).template selfadjointView() * (s2*rhs2.adjoint()), - rhs23 = (s1*m1) * (s2*rhs2.adjoint())); - - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs22 = (s1*m2).template selfadjointView() * (s2*rhs2.adjoint()), - rhs23 = (s1*m1) * (s2*rhs2.adjoint())); - - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs22 = (s1*m2.adjoint()).template selfadjointView() * (s2*rhs2.adjoint()), - rhs23 = (s1*m1.adjoint()) * (s2*rhs2.adjoint())); - - // test row major = <...> - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs32 = (s1*m2).template selfadjointView() * (s2*rhs3), - rhs33 = (s1*m1) * (s2 * rhs3)); - - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs32 = (s1*m2.adjoint()).template selfadjointView() * (s2*rhs3).conjugate(), - rhs33 = (s1*m1.adjoint()) * (s2*rhs3).conjugate()); - - // test matrix * selfadjoint - m2 = m1.template triangularView(); - VERIFY_IS_APPROX(rhs22 = (rhs2) * (m2).template selfadjointView(), - rhs23 = (rhs2) * (m1)); - VERIFY_IS_APPROX(rhs22 = (s2*rhs2) * (s1*m2).template selfadjointView(), - rhs23 = (s2*rhs2) * (s1*m1)); -} void test_product_selfadjoint() { for(int i = 0; i < g_repeat ; i++) { @@ -165,13 +106,4 @@ void test_product_selfadjoint() CALL_SUBTEST( product_selfadjoint(Matrix(17,17)) ); CALL_SUBTEST( product_selfadjoint(Matrix,Dynamic,Dynamic,RowMajor>(19, 19)) ); } - - for(int i = 0; i < g_repeat ; i++) - { - int s; - s = ei_random(10,320); - CALL_SUBTEST( symm(MatrixXf(s, s)) ); - s = ei_random(10,320); - CALL_SUBTEST( symm(MatrixXcd(s, s)) ); - } } -- cgit v1.2.3