27#include <gsl/gsl_combination.h>
28#include <gsl/gsl_randist.h>
29#include <gsl/gsl_rng.h>
30#include <gsl/gsl_sf.h>
37#define BESSEL_K_THRES 1.0e2
42double FC_FUNC_(oct_gamma, OCT_GAMMA)(
const double *x) {
43 return gsl_sf_gamma(*x);
46double FC_FUNC_(oct_incomplete_gamma, OCT_INCOMPLETE_GAMMA)(
const double *a,
48 return gsl_sf_gamma_inc_Q(*a, *x);
51double FC_FUNC_(oct_sph_bessel, OCT_SPH_BESSEL)(
const fint *
l,
54 return gsl_sf_bessel_j0(*x);
56 return gsl_sf_bessel_j1(*x);
58 return gsl_sf_bessel_j2(*x);
60 return gsl_sf_bessel_jl(*
l, *x);
64double FC_FUNC_(oct_bessel, OCT_BESSEL)(
const fint *n,
const double *x) {
65 return gsl_sf_bessel_Jn(*n, *x);
68double FC_FUNC_(oct_bessel_in, OCT_BESSEL_IN)(
const fint *n,
const double *x) {
69 return gsl_sf_bessel_In(*n, *x);
72double FC_FUNC_(oct_bessel_j0, OCT_BESSEL_J0)(
const double *x) {
73 return gsl_sf_bessel_J0(*x);
76double FC_FUNC_(oct_bessel_j1, OCT_BESSEL_J1)(
const double *x) {
77 return gsl_sf_bessel_J1(*x);
80double FC_FUNC_(oct_bessel_k0, OCT_BESSEL_K0)(
const double *x) {
81 if (*x > BESSEL_K_THRES) {
84 return gsl_sf_bessel_K0(*x);
88double FC_FUNC_(oct_bessel_k1, OCT_BESSEL_K1)(
const double *x) {
89 if (*x > BESSEL_K_THRES) {
92 return gsl_sf_bessel_K1(*x);
97double FC_FUNC_(oct_erfc, OCT_ERFC)(
const double *x) {
104 return gsl_sf_erfc(*x);
108double FC_FUNC_(oct_erf, OCT_ERF)(
const double *x) {
115 return gsl_sf_erf(*x);
118double FC_FUNC_(oct_legendre_sphplm, OCT_LEGENDRE_SPHPLM)(
const fint *
l,
121 return gsl_sf_legendre_sphPlm(*
l, *m, *x);
125double FC_FUNC_(oct_sf_laguerre_n, OCT_SF_LAGUERRE_N)(
const int *n,
128 return gsl_sf_laguerre_n(*n, *a, *x);
133void FC_FUNC_(oct_combination_init, OCT_COMBINATION_INIT)(gsl_combination **c,
136 *c = gsl_combination_calloc(*n, *k);
139void FC_FUNC_(oct_combination_next, OCT_COMBINATION_NEXT)(gsl_combination **c,
141 *next = gsl_combination_next(((gsl_combination *)(*c)));
144void FC_FUNC_(oct_get_combination, OCT_GET_COMBINATION)(gsl_combination **c,
147 for (
i = 0;
i < ((gsl_combination *)(*c))->k;
i++) {
148 comb[
i] = (
fint)((gsl_combination *)(*c))->data[
i];
152void FC_FUNC_(oct_combination_end, OCT_COMBINATION_END)(gsl_combination **c) {
153 gsl_combination_free(((gsl_combination *)(*c)));
157void FC_FUNC_(oct_ran_init, OCT_RAN_INIT)(gsl_rng **r) {
159 *r = gsl_rng_alloc(gsl_rng_default);
162void FC_FUNC_(oct_ran_end, OCT_RAN_END)(gsl_rng **r) { gsl_rng_free(*r); }
165double FC_FUNC_(oct_ran_gaussian, OCT_RAN_GAUSSIAN)(
const gsl_rng **r,
166 const double *
sigma) {
167 return gsl_ran_gaussian(*r, *
sigma);
170double FC_FUNC_(oct_ran_flat, OCT_RAN_FLAT)(
const gsl_rng **r,
const double *a,
172 return gsl_ran_flat(*r, *a, *b);
175void FC_FUNC_(oct_strerror, OCT_STRERROR)(
const fint *err,
176 STR_F_TYPE res STR_ARG1) {
179 c = gsl_strerror(*err);
real(real64), dimension(:,:), allocatable sigma
S_E matrix.