18#ifndef OPAL_GSL_COMPAT_HH
19#define OPAL_GSL_COMPAT_HH
36 prev_handler = handler;
50inline double gsl_sf_erf(
double x) {
return std::erf(x); }
73 return std::tgamma(
static_cast<double>(n + 1));
76 for (
unsigned int i = 2; i <= n; ++i) {
77 result *=
static_cast<double>(i);
88 if (m > n)
return 0.0;
89 if (m == 0 || m == n)
return 1.0;
92 if (m > n / 2) m = n - m;
96 for (
unsigned int i = 0; i < m; ++i) {
97 result = result * (n - i) / (i + 1);
104 constexpr double GSL_POSINF = std::numeric_limits<double>::infinity();
105 constexpr double GSL_NEGINF = -std::numeric_limits<double>::infinity();
106 constexpr double GSL_NAN = std::numeric_limits<double>::quiet_NaN();
114inline double gsl_hypot(
double x,
double y) {
return std::hypot(x, y); }
117#define GSL_REAL(z) ((z).dat[0])
118#define GSL_IMAG(z) ((z).dat[1])
gsl_error_handler_t gsl_set_error_handler(gsl_error_handler_t handler)
Set a global error handler and return the previous handler.
double gsl_sf_gamma(double x)
Gamma function .
double gsl_sf_fact(unsigned int n)
Factorial (computed via for large ).
double gsl_sf_erf(double x)
Error function .
double gsl_sf_pow_int(double x, int n)
Integer power .
void(* gsl_error_handler_t)(const char *reason, const char *file, int line, int gsl_errno)
Signature of a GSL-style error handler callback.
double gsl_sf_choose(unsigned int n, unsigned int m)
Binomial coefficient .
double gsl_hypot(double x, double y)
Hypotenuse with overflow-safe std::hypot.
gsl_error_handler_t gsl_set_error_handler_off()
Disable error handling and return a null handler.
GSL-compatible math constants.
constexpr double GSL_NEGINF
constexpr double GSL_POSINF