diff options
author | Gael Guennebaud <g.gael@free.fr> | 2020-05-31 00:53:37 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2020-05-31 00:53:37 +0200 |
commit | 029a76e11559815b8e152ec81328119f8291a7ee (patch) | |
tree | cc45201dbbd3f61cefd6394699ffe8acd37f1a0e /test | |
parent | 99b7f7cb9c864e6cd73e0deb0f053e15f5a95616 (diff) |
Bug #1777: make the scalar and packet path consistent for the logistic function + respective unit test
Diffstat (limited to 'test')
-rw-r--r-- | test/packetmath.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/packetmath.cpp b/test/packetmath.cpp index 7f2e69a50..032c0e4c8 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -447,6 +447,21 @@ template<typename Scalar,typename Packet> void packetmath_real() VERIFY((numext::isnan)(data2[0])); } + { + internal::scalar_logistic_op<Scalar> logistic; + for (int i=0; i<size; ++i) + { + data1[i] = internal::random<Scalar>(-20,20); + } + internal::pstore(data2, logistic.packetOp(internal::pload<Packet>(data1))); + for (int i=0; i<PacketSize; ++i) { + VERIFY_IS_APPROX(data2[i],logistic(data1[i])); + #ifdef EIGEN_VECTORIZE // don't check for exactness when using the i387 FPU + VERIFY_IS_EQUAL(data2[i],logistic(data1[i])); + #endif + } + } + #if EIGEN_HAS_C99_MATH && (__cplusplus > 199711L) data1[0] = std::numeric_limits<Scalar>::infinity(); data1[1] = Scalar(-1); |