From 39d9f0275b8c9ef515b04f7b0e51f701edabbcad Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Wed, 17 Feb 2010 09:50:11 +0000 Subject: Update matrix_exponential test after API change in ei_matrix_function Apologies for forgetting this yesterday and not testing properly. --- unsupported/test/matrix_exponential.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'unsupported/test/matrix_exponential.cpp') diff --git a/unsupported/test/matrix_exponential.cpp b/unsupported/test/matrix_exponential.cpp index 6150439c5..86e942edb 100644 --- a/unsupported/test/matrix_exponential.cpp +++ b/unsupported/test/matrix_exponential.cpp @@ -57,7 +57,7 @@ void test2dRotation(double tol) angle = static_cast(pow(10, i / 5. - 2)); B << cos(angle), sin(angle), -sin(angle), cos(angle); - ei_matrix_function(angle*A, expfn, &C); + C = ei_matrix_function(angle*A, expfn); std::cout << "test2dRotation: i = " << i << " error funm = " << relerr(C, B); VERIFY(C.isApprox(B, static_cast(tol))); @@ -82,7 +82,7 @@ void test2dHyperbolicRotation(double tol) A << 0, angle*imagUnit, -angle*imagUnit, 0; B << ch, sh*imagUnit, -sh*imagUnit, ch; - ei_matrix_function(A, expfn, &C); + C = ei_matrix_function(A, expfn); std::cout << "test2dHyperbolicRotation: i = " << i << " error funm = " << relerr(C, B); VERIFY(C.isApprox(B, static_cast(tol))); @@ -106,7 +106,7 @@ void testPascal(double tol) for (int j=0; j<=i; j++) B(i,j) = static_cast(binom(i,j)); - ei_matrix_function(A, expfn, &C); + C = ei_matrix_function(A, expfn); std::cout << "testPascal: size = " << size << " error funm = " << relerr(C, B); VERIFY(C.isApprox(B, static_cast(tol))); @@ -132,10 +132,9 @@ void randomTest(const MatrixType& m, double tol) for(int i = 0; i < g_repeat; i++) { m1 = MatrixType::Random(rows, cols); - ei_matrix_function(m1, expfn, &m2); - ei_matrix_function(-m1, expfn, &m3); + m2 = ei_matrix_function(m1, expfn) * ei_matrix_function(-m1, expfn); std::cout << "randomTest: error funm = " << relerr(identity, m2 * m3); - VERIFY(identity.isApprox(m2 * m3, static_cast(tol))); + VERIFY(identity.isApprox(m2, static_cast(tol))); m2 = ei_matrix_exponential(m1) * ei_matrix_exponential(-m1); std::cout << " error expm = " << relerr(identity, m2) << "\n"; -- cgit v1.2.3