diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-03-16 17:26:55 +0000 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-03-16 17:26:55 +0000 |
commit | 04a4e22c58a21e084e088e1f64d3b2f8e134debb (patch) | |
tree | 34dafc16b7fac88c12d6363ef94769c91322df2d /unsupported/test/matrix_function.cpp | |
parent | d536fef1bb44280bb96bbdc5418c033f17f982a8 (diff) |
API change: ei_matrix_exponential(A) --> A.exp(), etc
As discussed on mailing list; see
http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2010/02/msg00190.html
Diffstat (limited to 'unsupported/test/matrix_function.cpp')
-rw-r--r-- | unsupported/test/matrix_function.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/unsupported/test/matrix_function.cpp b/unsupported/test/matrix_function.cpp index e40af7b4e..16995d836 100644 --- a/unsupported/test/matrix_function.cpp +++ b/unsupported/test/matrix_function.cpp @@ -114,8 +114,7 @@ void testMatrixExponential(const MatrixType& A) typedef typename NumTraits<Scalar>::Real RealScalar; typedef std::complex<RealScalar> ComplexScalar; - VERIFY_IS_APPROX(ei_matrix_exponential(A), - ei_matrix_function(A, StdStemFunctions<ComplexScalar>::exp)); + VERIFY_IS_APPROX(A.exp(), A.matrixFunction(StdStemFunctions<ComplexScalar>::exp)); } template<typename MatrixType> @@ -123,10 +122,8 @@ void testHyperbolicFunctions(const MatrixType& A) { // Need to use absolute error because of possible cancellation when // adding/subtracting expA and expmA. - MatrixType expA = ei_matrix_exponential(A); - MatrixType expmA = ei_matrix_exponential(-A); - VERIFY_IS_APPROX_ABS(ei_matrix_sinh(A), (expA - expmA) / 2); - VERIFY_IS_APPROX_ABS(ei_matrix_cosh(A), (expA + expmA) / 2); + VERIFY_IS_APPROX_ABS(A.sinh(), (A.exp() - (-A).exp()) / 2); + VERIFY_IS_APPROX_ABS(A.cosh(), (A.exp() + (-A).exp()) / 2); } template<typename MatrixType> @@ -143,15 +140,13 @@ void testGonioFunctions(const MatrixType& A) ComplexMatrix Ac = A.template cast<ComplexScalar>(); - ComplexMatrix exp_iA = ei_matrix_exponential(imagUnit * Ac); - ComplexMatrix exp_miA = ei_matrix_exponential(-imagUnit * Ac); + ComplexMatrix exp_iA = (imagUnit * Ac).exp(); + ComplexMatrix exp_miA = (-imagUnit * Ac).exp(); - MatrixType sinA = ei_matrix_sin(A); - ComplexMatrix sinAc = sinA.template cast<ComplexScalar>(); + ComplexMatrix sinAc = A.sin().template cast<ComplexScalar>(); VERIFY_IS_APPROX_ABS(sinAc, (exp_iA - exp_miA) / (two*imagUnit)); - MatrixType cosA = ei_matrix_cos(A); - ComplexMatrix cosAc = cosA.template cast<ComplexScalar>(); + ComplexMatrix cosAc = A.cos().template cast<ComplexScalar>(); VERIFY_IS_APPROX_ABS(cosAc, (exp_iA + exp_miA) / 2); } |