Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 9 additions & 22 deletions math/mathcore/inc/Math/CladDerivator.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

#include <stdexcept>

namespace clad {
namespace custom_derivatives {
namespace clad::custom_derivatives {
namespace TMath {
template <typename T>
ValueAndPushforward<T, T> Abs_pushforward(T x, T d_x)
Expand Down Expand Up @@ -206,24 +205,9 @@ ValueAndPushforward<T, T> 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<Double_t, Double_t> Pi_pushforward()
{
return {3.1415926535897931, 0.};
}
// constexpr is removed
ValueAndPushforward<Double_t, Double_t> 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)
{
Expand Down Expand Up @@ -1092,13 +1076,16 @@ inline void inc_gamma_c_pullback(double a, double x, double _d_y, double *_d_a,
}
}

inline ValueAndPushforward<double, double> 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,
Expand Down
1 change: 1 addition & 0 deletions math/mathmore/inc/Math/SpecFuncMathMore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions math/mathmore/src/SpecFuncMathMore.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading