From 319bf3130b1257856408b0481401f7c353f97470 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Tue, 16 Feb 2010 16:43:11 +0000 Subject: Use ReturnByValue to return result of ei_matrix_function(), ... --- unsupported/test/matrix_function.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'unsupported/test/matrix_function.cpp') diff --git a/unsupported/test/matrix_function.cpp b/unsupported/test/matrix_function.cpp index 25134f21d..4ff6d7f1e 100644 --- a/unsupported/test/matrix_function.cpp +++ b/unsupported/test/matrix_function.cpp @@ -100,9 +100,8 @@ void testMatrixExponential(const MatrixType& A) typedef std::complex ComplexScalar; for (int i = 0; i < g_repeat; i++) { - MatrixType expA; - ei_matrix_function(A, StdStemFunctions::exp, &expA); - VERIFY_IS_APPROX(ei_matrix_exponential(A), expA); + VERIFY_IS_APPROX(ei_matrix_exponential(A), + ei_matrix_function(A, StdStemFunctions::exp)); } } @@ -110,9 +109,8 @@ template void testHyperbolicFunctions(const MatrixType& A) { for (int i = 0; i < g_repeat; i++) { - MatrixType sinhA, coshA; - ei_matrix_sinh(A, &sinhA); - ei_matrix_cosh(A, &coshA); + MatrixType sinhA = ei_matrix_sinh(A); + MatrixType coshA = ei_matrix_cosh(A); MatrixType expA = ei_matrix_exponential(A); VERIFY_IS_APPROX(sinhA, (expA - expA.inverse())/2); VERIFY_IS_APPROX(coshA, (expA + expA.inverse())/2); @@ -137,13 +135,11 @@ void testGonioFunctions(const MatrixType& A) ComplexMatrix exp_iA = ei_matrix_exponential(imagUnit * Ac); - MatrixType sinA; - ei_matrix_sin(A, &sinA); + MatrixType sinA = ei_matrix_sin(A); ComplexMatrix sinAc = sinA.template cast(); VERIFY_IS_APPROX(sinAc, (exp_iA - exp_iA.inverse()) / (two*imagUnit)); - MatrixType cosA; - ei_matrix_cos(A, &cosA); + MatrixType cosA = ei_matrix_cos(A); ComplexMatrix cosAc = cosA.template cast(); VERIFY_IS_APPROX(cosAc, (exp_iA + exp_iA.inverse()) / 2); } -- cgit v1.2.3