Skip to content
Merged
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
48 changes: 41 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,42 @@ const XSF_HEADERS: &[&str] = &[
];
// e.g. `("spam", "if->d")` becomes `double xsf_spam(int x0, float x1)`
const XSF_TYPES: &[(&str, &str)] = &[
// airy.h
// TODO: `airyb`, `airyzo`, `airy`, `airye`, `itairy`
// alg.h
("cbrt", "d->d"),
// bessel.h
// TODO: `it1j0y0`, `it2j0y0`, `it1i0k0`, `it2i0k0`
// TODO: `rctj`, `rcty`,
// TODO: `cyl_hankel_1`, `cyl_hankel_1e`, `cyl_hankel_2`, `cyl_hankel_2e`
("cyl_bessel_j", "dd->d"), // TODO: complex
("cyl_bessel_je", "dd->d"), // TODO: complex
("cyl_bessel_j0", "d->d"),
("cyl_bessel_j1", "d->d"),
("cyl_bessel_y", "dd->d"), // TODO: complex
("cyl_bessel_ye", "dd->d"), // TODO: complex
("cyl_bessel_y0", "d->d"),
("cyl_bessel_y1", "d->d"),
("cyl_bessel_i", "dd->d"), // TODO: complex
("cyl_bessel_ie", "dd->d"), // TODO: complex
("cyl_bessel_i0", "d->d"),
("cyl_bessel_i0e", "d->d"),
("cyl_bessel_i1", "d->d"),
("cyl_bessel_i1e", "d->d"),
("cyl_bessel_k", "dd->d"), // TODO: complex
("cyl_bessel_ke", "dd->d"), // TODO: complex
("cyl_bessel_k0", "d->d"),
("cyl_bessel_k0e", "d->d"),
("cyl_bessel_k1", "d->d"),
("cyl_bessel_k1e", "d->d"),
("besselpoly", "ddd->d"),
// beta.h
("beta", "dd->d"),
("betaln", "dd->d"),
// binom.h
// cdflib.h (TODO: `gdtrib`)
("binom", "dd->d"),
// cdflib.h
// TODO: `gdtrib`
// digamma.h
("digamma", "d->d"),
// erf.h
Expand All @@ -62,7 +90,8 @@ const XSF_TYPES: &[(&str, &str)] = &[
("erfi", "d->d"),
("voigt_profile", "ddd->d"),
("dawsn", "d->d"),
// evalpoly.h (TODO: `cevalpoly`)
// evalpoly.h
// TODO: `cevalpoly`
// exp.h
("expm1", "d->d"),
("exp2", "d->d"),
Expand All @@ -71,7 +100,8 @@ const XSF_TYPES: &[(&str, &str)] = &[
("exp1", "d->d"),
("expi", "d->d"),
("scaled_exp1", "d->d"),
// fresnel.h (TODO: `fresnel`, `fcszo`)
// fresnel.h
// TODO: `fresnel`, `fcszo`
// gamma.h
("gamma", "d->d"), // TODO: complex
("gammaln", "d->d"),
Expand All @@ -86,7 +116,8 @@ const XSF_TYPES: &[(&str, &str)] = &[
// iv_ratio.h
("iv_ratio", "dd->d"),
("iv_ratio_c", "dd->d"),
// kelvin.h (TODO: `kelvin`, `klvnzo`)
// kelvin.h
// TODO: `kelvin`, `klvnzo`
("ber", "d->d"),
("bei", "d->d"),
("ker", "d->d"),
Expand All @@ -95,7 +126,8 @@ const XSF_TYPES: &[(&str, &str)] = &[
("beip", "d->d"),
("kerp", "d->d"),
("keip", "d->d"),
// legendre.h (TODO: `assoc_legendre_p`, `lqn`, `lqmn`)
// legendre.h
// TODO: `assoc_legendre_p`, `lqn`, `lqmn`
("legendre_p", "id->d"),
("sph_legendre_p", "iid->d"),
// log_exp.h
Expand All @@ -112,10 +144,12 @@ const XSF_TYPES: &[(&str, &str)] = &[
// loggamma.h
("loggamma", "d->d"),
("rgamma", "d->d"),
// mathieu.h (TODO: `cen`, `sem`, `mcm1`, `msm1`, `mcm2`, `msm2`)
// mathieu.h
// TODO: `cen`, `sem`, `mcm1`, `msm1`, `mcm2`, `msm2`
("cem_cva", "dd->d"),
("sem_cva", "dd->d"),
// specfun.h (TODO: `chyp2f1`, `cerf`)
// specfun.h
// TODO: `chyp2f1`, `cerf`
("hypu", "ddd->d"),
("hyp1f1", "ddd->d"),
("pmv", "ddd->d"),
Expand Down
80 changes: 78 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,82 @@ macro_rules! xsf_impl {
// alg.h
xsf_impl!(cbrt, xsf_cbrt, "Cube root", x: f64);

// bessel.h
xsf_impl!(cyl_bessel_j, xsf_cyl_bessel_j, "Bessel function, 1st kind", v: f64, x: f64);
xsf_impl!(
cyl_bessel_je,
xsf_cyl_bessel_je,
"Exponentially scaled Bessel function, 1st kind",
v: f64,
x: f64
);
xsf_impl!(cyl_bessel_y, xsf_cyl_bessel_y, "Bessel function, 2nd kind", v: f64, x: f64);
xsf_impl!(
cyl_bessel_ye,
xsf_cyl_bessel_ye,
"Exponentially scaled Bessel function, 2nd kind",
v: f64,
x: f64
);
xsf_impl!(cyl_bessel_i, xsf_cyl_bessel_i, "Modified Bessel function, 1st kind", v: f64, x: f64);
xsf_impl!(
cyl_bessel_ie,
xsf_cyl_bessel_ie,
"Exponentially scaled modified Bessel function, 1st kind",
v: f64,
x: f64
);
xsf_impl!(cyl_bessel_k, xsf_cyl_bessel_k, "Modified Bessel function, 2nd kind", v: f64, x: f64);
xsf_impl!(
cyl_bessel_ke,
xsf_cyl_bessel_ke,
"Exponentially scaled modified Bessel function, 2nd kind",
v: f64,
x: f64
);

xsf_impl!(cyl_bessel_j0, xsf_cyl_bessel_j0, "Bessel function, 1st kind, order 0", x: f64);
xsf_impl!(cyl_bessel_j1, xsf_cyl_bessel_j1, "Bessel function, 1st kind, order 1", x: f64);
xsf_impl!(cyl_bessel_y0, xsf_cyl_bessel_y0, "Bessel function, 2nd kind, order 0", x: f64);
xsf_impl!(cyl_bessel_y1, xsf_cyl_bessel_y1, "Bessel function, 2nd kind, order 1", x: f64);
xsf_impl!(cyl_bessel_i0, xsf_cyl_bessel_i0, "Modified Bessel function, 1st kind, order 0", x: f64);
xsf_impl!(
cyl_bessel_i0e,
xsf_cyl_bessel_i0e,
"Exponentially scaled modified Bessel function, 1st kind, order 0",
x: f64
);
xsf_impl!(cyl_bessel_i1, xsf_cyl_bessel_i1, "Modified Bessel function, 1st kind, order 1", x: f64);
xsf_impl!(
cyl_bessel_i1e,
xsf_cyl_bessel_i1e,
"Exponentially scaled modified Bessel function, 1st kind, order 1",
x: f64
);
xsf_impl!(cyl_bessel_k0, xsf_cyl_bessel_k0, "Modified Bessel function, 2nd kind, order 0", x: f64);
xsf_impl!(
cyl_bessel_k0e,
xsf_cyl_bessel_k0e,
"Exponentially scaled modified Bessel function, 2nd kind, order 0",
x: f64
);
xsf_impl!(cyl_bessel_k1, xsf_cyl_bessel_k1, "Modified Bessel function, 2nd kind, order 1", x: f64);
xsf_impl!(
cyl_bessel_k1e,
xsf_cyl_bessel_k1e,
"Exponentially scaled modified Bessel function, 2nd kind, order 1",
x: f64
);

xsf_impl!(
besselpoly,
xsf_besselpoly,
"Weighted integral of the Bessel function of the first kind",
a: f64,
lambda: f64,
nu: f64
);

// beta.h
xsf_impl!(beta, xsf_beta, "Beta function", a: f64, b: f64);
xsf_impl!(betaln, xsf_betaln, "Natural log of `|beta|`", a: f64, b: f64);
Expand Down Expand Up @@ -74,14 +150,14 @@ xsf_impl!(hyp2f1, xsf_hyp2f1, "Gauss hypergeometric function `2F1`", a: f64, b:
xsf_impl!(
iv_ratio,
xsf_iv_ratio,
"Compute `iv(v,x)/iv(v-1,x)` of the modified Bessel function of the first kind",
"Compute `iv(v,x)/iv(v-1,x)` of the modified Bessel function, 1st kind",
v: f64,
x: f64
);
xsf_impl!(
iv_ratio_c,
xsf_iv_ratio_c,
"Compute `iv(v,x)/iv(v-1,x)` of the modified Bessel function of the first kind",
"Compute `iv(v,x)/iv(v-1,x)` of the modified Bessel function, 1st kind",
v: f64,
x: f64
);
Expand Down
Loading