diff --git a/math/mathcore/inc/Math/CladDerivator.h b/math/mathcore/inc/Math/CladDerivator.h index 1c33e7cd3f1ca..1d5cdcf2f9a60 100644 --- a/math/mathcore/inc/Math/CladDerivator.h +++ b/math/mathcore/inc/Math/CladDerivator.h @@ -34,8 +34,7 @@ #include -namespace clad { -namespace custom_derivatives { +namespace clad::custom_derivatives { namespace TMath { template ValueAndPushforward Abs_pushforward(T x, T d_x) @@ -206,24 +205,9 @@ ValueAndPushforward TanH_pushforward(T x, T d_x) return {::TMath::TanH(x), (1. / ::TMath::Sq(::TMath::CosH(x))) * d_x}; } -#ifdef WIN32 -// Additional custom derivatives that can be removed -// after Issue #12108 in ROOT is resolved -// constexpr is removed -ValueAndPushforward Pi_pushforward() -{ - return {3.1415926535897931, 0.}; -} -// constexpr is removed -ValueAndPushforward Ln10_pushforward() -{ - return {2.3025850929940459, 0.}; -} -#endif } // namespace TMath -namespace ROOT { -namespace Math { +namespace ROOT::Math { inline void landau_pdf_pullback(double x, double xi, double x0, double d_out, double *d_x, double *d_xi, double *d_x0) { @@ -1092,13 +1076,16 @@ inline void inc_gamma_c_pullback(double a, double x, double _d_y, double *_d_a, } } +inline ValueAndPushforward digamma_pushforward(double x, double d_x) +{ + return {::ROOT::Math::digamma(x), ::ROOT::Math::trigamma(x) * d_x}; +} + #endif // R__HAS_MATHMORE -} // namespace Math -} // namespace ROOT +} // namespace ROOT::Math -} // namespace custom_derivatives -} // namespace clad +} // namespace clad::custom_derivatives // Forward declare BLAS functions. extern "C" void sgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k, diff --git a/math/mathmore/inc/Math/SpecFuncMathMore.h b/math/mathmore/inc/Math/SpecFuncMathMore.h index 564729efbb39f..897c637ac53bd 100644 --- a/math/mathmore/inc/Math/SpecFuncMathMore.h +++ b/math/mathmore/inc/Math/SpecFuncMathMore.h @@ -874,6 +874,7 @@ namespace Math { double wigner_9j(int two_ja, int two_jb, int two_jc, int two_jd, int two_je, int two_jf, int two_jg, int two_jh, int two_ji); double digamma(double x); + double trigamma(double x); } // namespace Math diff --git a/math/mathmore/src/SpecFuncMathMore.cxx b/math/mathmore/src/SpecFuncMathMore.cxx index 73ed6c98149fe..8d29b10cca3d2 100644 --- a/math/mathmore/src/SpecFuncMathMore.cxx +++ b/math/mathmore/src/SpecFuncMathMore.cxx @@ -482,5 +482,10 @@ double digamma(double x) return gsl_sf_psi(x); } +double trigamma(double x) +{ + return gsl_sf_psi_1(x); +} + } // namespace Math } // namespace ROOT