mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Use ReturnByValue to return result of ei_matrix_exponential() .
This commit is contained in:
@@ -61,7 +61,7 @@ void test2dRotation(double tol)
|
||||
std::cout << "test2dRotation: i = " << i << " error funm = " << relerr(C, B);
|
||||
VERIFY(C.isApprox(B, static_cast<T>(tol)));
|
||||
|
||||
ei_matrix_exponential(angle*A, &C);
|
||||
C = ei_matrix_exponential(angle*A);
|
||||
std::cout << " error expm = " << relerr(C, B) << "\n";
|
||||
VERIFY(C.isApprox(B, static_cast<T>(tol)));
|
||||
}
|
||||
@@ -86,7 +86,7 @@ void test2dHyperbolicRotation(double tol)
|
||||
std::cout << "test2dHyperbolicRotation: i = " << i << " error funm = " << relerr(C, B);
|
||||
VERIFY(C.isApprox(B, static_cast<T>(tol)));
|
||||
|
||||
ei_matrix_exponential(A, &C);
|
||||
C = ei_matrix_exponential(A);
|
||||
std::cout << " error expm = " << relerr(C, B) << "\n";
|
||||
VERIFY(C.isApprox(B, static_cast<T>(tol)));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void testPascal(double tol)
|
||||
std::cout << "testPascal: size = " << size << " error funm = " << relerr(C, B);
|
||||
VERIFY(C.isApprox(B, static_cast<T>(tol)));
|
||||
|
||||
ei_matrix_exponential(A, &C);
|
||||
C = ei_matrix_exponential(A);
|
||||
std::cout << " error expm = " << relerr(C, B) << "\n";
|
||||
VERIFY(C.isApprox(B, static_cast<T>(tol)));
|
||||
}
|
||||
@@ -137,10 +137,9 @@ void randomTest(const MatrixType& m, double tol)
|
||||
std::cout << "randomTest: error funm = " << relerr(identity, m2 * m3);
|
||||
VERIFY(identity.isApprox(m2 * m3, static_cast<RealScalar>(tol)));
|
||||
|
||||
ei_matrix_exponential(m1, &m2);
|
||||
ei_matrix_exponential(-m1, &m3);
|
||||
std::cout << " error expm = " << relerr(identity, m2 * m3) << "\n";
|
||||
VERIFY(identity.isApprox(m2 * m3, static_cast<RealScalar>(tol)));
|
||||
m2 = ei_matrix_exponential(m1) * ei_matrix_exponential(-m1);
|
||||
std::cout << " error expm = " << relerr(identity, m2) << "\n";
|
||||
VERIFY(identity.isApprox(m2, static_cast<RealScalar>(tol)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,10 +100,9 @@ void testMatrixExponential(const MatrixType& A)
|
||||
typedef std::complex<RealScalar> ComplexScalar;
|
||||
|
||||
for (int i = 0; i < g_repeat; i++) {
|
||||
MatrixType expA1, expA2;
|
||||
ei_matrix_exponential(A, &expA1);
|
||||
ei_matrix_function(A, StdStemFunctions<ComplexScalar>::exp, &expA2);
|
||||
VERIFY_IS_APPROX(expA1, expA2);
|
||||
MatrixType expA;
|
||||
ei_matrix_function(A, StdStemFunctions<ComplexScalar>::exp, &expA);
|
||||
VERIFY_IS_APPROX(ei_matrix_exponential(A), expA);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +110,10 @@ template<typename MatrixType>
|
||||
void testHyperbolicFunctions(const MatrixType& A)
|
||||
{
|
||||
for (int i = 0; i < g_repeat; i++) {
|
||||
MatrixType sinhA, coshA, expA;
|
||||
MatrixType sinhA, coshA;
|
||||
ei_matrix_sinh(A, &sinhA);
|
||||
ei_matrix_cosh(A, &coshA);
|
||||
ei_matrix_exponential(A, &expA);
|
||||
MatrixType expA = ei_matrix_exponential(A);
|
||||
VERIFY_IS_APPROX(sinhA, (expA - expA.inverse())/2);
|
||||
VERIFY_IS_APPROX(coshA, (expA + expA.inverse())/2);
|
||||
}
|
||||
@@ -136,8 +135,7 @@ void testGonioFunctions(const MatrixType& A)
|
||||
for (int i = 0; i < g_repeat; i++) {
|
||||
ComplexMatrix Ac = A.template cast<ComplexScalar>();
|
||||
|
||||
ComplexMatrix exp_iA;
|
||||
ei_matrix_exponential(imagUnit * Ac, &exp_iA);
|
||||
ComplexMatrix exp_iA = ei_matrix_exponential(imagUnit * Ac);
|
||||
|
||||
MatrixType sinA;
|
||||
ei_matrix_sin(A, &sinA);
|
||||
|
||||
Reference in New Issue
Block a user