mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Remove mat.pow * vec specialization, which causes segfault for mat.pow * mat.pow
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user