diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-02-16 16:43:11 +0000 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-02-16 16:43:11 +0000 |
commit | 319bf3130b1257856408b0481401f7c353f97470 (patch) | |
tree | 44c16e180c745b600ec5f2c93903125217e51d20 /unsupported/test/matrix_function.cpp | |
parent | 25019f08366a027e783617b4b8bd86f00237a5ee (diff) |
Use ReturnByValue to return result of ei_matrix_function(), ...
Diffstat (limited to 'unsupported/test/matrix_function.cpp')
-rw-r--r-- | unsupported/test/matrix_function.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
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<RealScalar> ComplexScalar; for (int i = 0; i < g_repeat; i++) { - MatrixType expA; - ei_matrix_function(A, StdStemFunctions<ComplexScalar>::exp, &expA); - VERIFY_IS_APPROX(ei_matrix_exponential(A), expA); + VERIFY_IS_APPROX(ei_matrix_exponential(A), + ei_matrix_function(A, StdStemFunctions<ComplexScalar>::exp)); } } @@ -110,9 +109,8 @@ template<typename MatrixType> 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<ComplexScalar>(); 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<ComplexScalar>(); VERIFY_IS_APPROX(cosAc, (exp_iA + exp_iA.inverse()) / 2); } |