From b9fc9d8f32749b86bcd7a9b65bd0859e570976a3 Mon Sep 17 00:00:00 2001 From: Chen-Pang He Date: Mon, 24 Jun 2013 23:56:17 +0800 Subject: Remove mat.pow * vec specialization, which causes segfault for mat.pow * mat.pow --- unsupported/test/matrix_power.cpp | 73 ++++++--------------------------------- 1 file changed, 10 insertions(+), 63 deletions(-) (limited to 'unsupported/test/matrix_power.cpp') diff --git a/unsupported/test/matrix_power.cpp b/unsupported/test/matrix_power.cpp index 4bb2b4d03..b9d513b45 100644 --- a/unsupported/test/matrix_power.cpp +++ b/unsupported/test/matrix_power.cpp @@ -109,62 +109,9 @@ void testExponentLaws(const MatrixType& m, double tol) } } -template -void testProduct(const MatrixType& m, const VectorType& v, double tol) -{ - typedef typename MatrixType::RealScalar RealScalar; - MatrixType m1; - VectorType v1, v2, v3; - RealScalar p; - - for (int i=0; i < g_repeat; ++i) { - generateTestMatrix::run(m1, m.rows()); - MatrixPower mpow(m1); - - v1 = VectorType::Random(v.rows(), v.cols()); - p = internal::random(); - - v2.noalias() = mpow(p) * v1; - v3.noalias() = mpow(p).eval() * v1; - std::cout << "testProduct: error powerm = " << relerr(v2, v3) << '\n'; - VERIFY(v2.isApprox(v3, static_cast(tol))); - } -} - -template -void testTriangularProduct(const MatrixType& m, const VectorType& v, double tol) -{ - typedef typename MatrixType::RealScalar RealScalar; - MatrixType m1; - VectorType v1, v2, v3; - RealScalar p; - - for (int i=0; i < g_repeat; ++i) { - generateTriangularMatrix::run(m1, m.rows()); - MatrixPowerTriangular mpow(m1); - - v1 = VectorType::Random(v.rows(), v.cols()); - p = internal::random(); - - v2.noalias() = mpow(p) * v1; - v3.noalias() = mpow(p).eval() * v1; - std::cout << "testTriangularProduct: error powerm = " << relerr(v2, v3) << '\n'; - VERIFY(v2.isApprox(v3, static_cast(tol))); - } -} - -template -void testMatrixVector(const MatrixType& m, const VectorType& v, double tol) -{ - testExponentLaws(m,tol); - testProduct(m,v,tol); - testTriangularProduct(m,v,tol); -} - typedef Matrix Matrix3dRowMajor; typedef Matrix MatrixXe; -typedef Matrix VectorXe; - + void test_matrix_power() { CALL_SUBTEST_2(test2dRotation(1e-13)); @@ -174,13 +121,13 @@ void test_matrix_power() CALL_SUBTEST_1(test2dHyperbolicRotation(1e-5)); CALL_SUBTEST_9(test2dHyperbolicRotation(1e-14)); - CALL_SUBTEST_2(testMatrixVector(Matrix2d(), Vector2d(), 1e-13)); - CALL_SUBTEST_7(testMatrixVector(Matrix3dRowMajor(), MatrixXd(3,5), 1e-13)); - CALL_SUBTEST_3(testMatrixVector(Matrix4cd(), Vector4cd(), 1e-13)); - CALL_SUBTEST_4(testMatrixVector(MatrixXd(8,8), VectorXd(8), 2e-12)); - CALL_SUBTEST_1(testMatrixVector(Matrix2f(), Vector2f(), 1e-4)); - CALL_SUBTEST_5(testMatrixVector(Matrix3cf(), Vector3cf(), 1e-4)); - CALL_SUBTEST_8(testMatrixVector(Matrix4f(), Vector4f(), 1e-4)); - CALL_SUBTEST_6(testMatrixVector(MatrixXf(2,2), VectorXf(2), 1e-3)); // see bug 614 - CALL_SUBTEST_9(testMatrixVector(MatrixXe(7,7), VectorXe(7), 1e-13)); + CALL_SUBTEST_2(testExponentLaws(Matrix2d(), 1e-13)); + CALL_SUBTEST_7(testExponentLaws(Matrix3dRowMajor(), 1e-13)); + CALL_SUBTEST_3(testExponentLaws(Matrix4cd(), 1e-13)); + CALL_SUBTEST_4(testExponentLaws(MatrixXd(8,8), 2e-12)); + CALL_SUBTEST_1(testExponentLaws(Matrix2f(), 1e-4)); + CALL_SUBTEST_5(testExponentLaws(Matrix3cf(), 1e-4)); + CALL_SUBTEST_8(testExponentLaws(Matrix4f(), 1e-4)); + CALL_SUBTEST_6(testExponentLaws(MatrixXf(2,2), 1e-3)); // see bug 614 + CALL_SUBTEST_9(testExponentLaws(MatrixXe(7,7), 1e-13)); } -- cgit v1.2.3