diff options
author | 2016-04-13 14:24:06 -0700 | |
---|---|---|
committer | 2016-04-13 14:24:06 -0700 | |
commit | 29862532599ca4d0e02ab759813604fa1f2e2067 (patch) | |
tree | 7749eb6e65c6564c1ca08bd2753e750df294da21 /Eigen/src/Core | |
parent | d5de1a8220a2638698e2903fe2fd8326fada8d9e (diff) |
Cleaned up the implementation of digamma
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/SpecialFunctions.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Eigen/src/Core/SpecialFunctions.h b/Eigen/src/Core/SpecialFunctions.h index adb055b15..a3857ae1f 100644 --- a/Eigen/src/Core/SpecialFunctions.h +++ b/Eigen/src/Core/SpecialFunctions.h @@ -281,20 +281,18 @@ struct digamma_impl { */ Scalar p, q, nz, s, w, y; - bool negative; + bool negative = false; const Scalar maxnum = NumTraits<Scalar>::infinity(); - const Scalar m_pi = EIGEN_PI; + const Scalar m_pi(EIGEN_PI); - negative = 0; - nz = 0.0; - - const Scalar zero = 0.0; - const Scalar one = 1.0; - const Scalar half = 0.5; + const Scalar zero = Scalar(0); + const Scalar one = Scalar(1); + const Scalar half = Scalar(0.5); + nz = zero; if (x <= zero) { - negative = one; + negative = true; q = x; p = numext::floor(q); if (p == q) { @@ -463,7 +461,7 @@ template <typename Scalar> struct igammac_impl { EIGEN_DEVICE_FUNC static Scalar run(Scalar a, Scalar x) { - /* igamc() + /* igamc() * * Incomplete gamma integral (modified for Eigen) * @@ -618,7 +616,7 @@ template <typename Scalar> struct igamma_impl { EIGEN_DEVICE_FUNC static Scalar run(Scalar a, Scalar x) { - /* igam() + /* igam() * Incomplete gamma integral * * |