mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix implementation of complex expm1. Add tests that fail with previous implementation, but pass with the current one.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
381f8f3139
commit
88062b7fed
@@ -429,6 +429,11 @@ template<typename ArrayType> void array_complex(const ArrayType& m)
|
||||
VERIFY_IS_APPROX(m1.exp(), exp(m1));
|
||||
VERIFY_IS_APPROX(m1.exp() / m2.exp(),(m1-m2).exp());
|
||||
|
||||
VERIFY_IS_APPROX(m1.expm1(), expm1(m1));
|
||||
VERIFY_IS_APPROX(expm1(m1), exp(m1) - 1.);
|
||||
// Check for larger magnitude complex numbers that expm1 matches exp - 1.
|
||||
VERIFY_IS_APPROX(expm1(10. * m1), exp(10. * m1) - 1.);
|
||||
|
||||
VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1)));
|
||||
VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1)));
|
||||
VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1))));
|
||||
|
||||
Reference in New Issue
Block a user