aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/matrix_power.cpp
diff options
context:
space:
mode:
authorGravatar Chen-Pang He <jdh8@ms63.hinet.net>2013-06-24 23:56:17 +0800
committerGravatar Chen-Pang He <jdh8@ms63.hinet.net>2013-06-24 23:56:17 +0800
commitb9fc9d8f32749b86bcd7a9b65bd0859e570976a3 (patch)
tree5bc74c0869a2a37d1c707907933197d01398b5a0 /unsupported/test/matrix_power.cpp
parentee8a28fb853d5bbf47bffb7e4c1adaabfe76d96c (diff)
Remove mat.pow * vec specialization, which causes segfault for mat.pow * mat.pow
Diffstat (limited to 'unsupported/test/matrix_power.cpp')
-rw-r--r--unsupported/test/matrix_power.cpp73
1 files changed, 10 insertions, 63 deletions
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<typename MatrixType, typename VectorType>
-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<MatrixType>::run(m1, m.rows());
- MatrixPower<MatrixType> mpow(m1);
-
- v1 = VectorType::Random(v.rows(), v.cols());
- p = internal::random<RealScalar>();
-
- 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<RealScalar>(tol)));
- }
-}
-
-template<typename MatrixType, typename VectorType>
-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<MatrixType>::run(m1, m.rows());
- MatrixPowerTriangular<MatrixType> mpow(m1);
-
- v1 = VectorType::Random(v.rows(), v.cols());
- p = internal::random<RealScalar>();
-
- 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<RealScalar>(tol)));
- }
-}
-
-template<typename MatrixType, typename VectorType>
-void testMatrixVector(const MatrixType& m, const VectorType& v, double tol)
-{
- testExponentLaws(m,tol);
- testProduct(m,v,tol);
- testTriangularProduct(m,v,tol);
-}
-
typedef Matrix<double,3,3,RowMajor> Matrix3dRowMajor;
typedef Matrix<long double,Dynamic,Dynamic> MatrixXe;
-typedef Matrix<long double,Dynamic,1> VectorXe;
-
+
void test_matrix_power()
{
CALL_SUBTEST_2(test2dRotation<double>(1e-13));
@@ -174,13 +121,13 @@ void test_matrix_power()
CALL_SUBTEST_1(test2dHyperbolicRotation<float>(1e-5));
CALL_SUBTEST_9(test2dHyperbolicRotation<long double>(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));
}