Skip to content

Commit

Permalink
Merge pull request #1704 from borglab/cephes-license
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal authored Jan 12, 2024
2 parents 7cd46f8 + 04bee2b commit 3f32b0a
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 148 deletions.
7 changes: 7 additions & 0 deletions gtsam/3rdparty/cephes/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 changes: 22 additions & 0 deletions gtsam/3rdparty/cephes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# README

This is a vendored version of the Cephes Mathematical Library. The source code can be found on [netlib.org](https://www.netlib.org/cephes/).

The software is provided with an [MIT License](https://smath.com/en-US/view/CephesMathLibrary/license).

## Original Readme

Some software in this archive may be from the book _Methods and
Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster
International, 1989) or from the Cephes Mathematical Library, a
commercial product. In either event, it is copyrighted by the author.
What you see here may be used freely but it comes with no support or
guarantee.

The two known misprints in the book are repaired here in the
source listings for the gamma function and the incomplete beta
integral.


Stephen L. Moshier
[email protected]
303 changes: 155 additions & 148 deletions gtsam/3rdparty/cephes/cephes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,159 +2,166 @@
#define CEPHES_H

#include "cephes/cephes_names.h"
#include "dllexport.h"

#ifdef __cplusplus
extern "C" {
#endif

extern int airy(double x, double *ai, double *aip, double *bi, double *bip);

extern double bdtrc(double k, int n, double p);
extern double bdtr(double k, int n, double p);
extern double bdtri(double k, int n, double y);

extern double besselpoly(double a, double lambda, double nu);

extern double beta(double a, double b);
extern double lbeta(double a, double b);

extern double btdtr(double a, double b, double x);

extern double cbrt(double x);
extern double chbevl(double x, double array[], int n);
extern double chdtrc(double df, double x);
extern double chdtr(double df, double x);
extern double chdtri(double df, double y);
extern double dawsn(double xx);

extern double ellie(double phi, double m);
extern double ellik(double phi, double m);
extern double ellpe(double x);

extern int ellpj(double u, double m, double *sn, double *cn, double *dn, double *ph);
extern double ellpk(double x);
extern double exp10(double x);
extern double exp2(double x);

extern double expn(int n, double x);

extern double fdtrc(double a, double b, double x);
extern double fdtr(double a, double b, double x);
extern double fdtri(double a, double b, double y);

extern int fresnl(double xxa, double *ssa, double *cca);
extern double Gamma(double x);
extern double lgam(double x);
extern double lgam_sgn(double x, int *sign);
extern double gammasgn(double x);

extern double gdtr(double a, double b, double x);
extern double gdtrc(double a, double b, double x);
extern double gdtri(double a, double b, double y);

extern double hyp2f1(double a, double b, double c, double x);
extern double hyperg(double a, double b, double x);
extern double threef0(double a, double b, double c, double x, double *err);

extern double i0(double x);
extern double i0e(double x);
extern double i1(double x);
extern double i1e(double x);
extern double igamc(double a, double x);
extern double igam(double a, double x);
extern double igam_fac(double a, double x);
extern double igamci(double a, double q);
extern double igami(double a, double p);

extern double incbet(double aa, double bb, double xx);
extern double incbi(double aa, double bb, double yy0);

extern double iv(double v, double x);
extern double j0(double x);
extern double y0(double x);
extern double j1(double x);
extern double y1(double x);

extern double jn(int n, double x);
extern double jv(double n, double x);
extern double k0(double x);
extern double k0e(double x);
extern double k1(double x);
extern double k1e(double x);
extern double kn(int nn, double x);

extern double nbdtrc(int k, int n, double p);
extern double nbdtr(int k, int n, double p);
extern double nbdtri(int k, int n, double p);

extern double ndtr(double a);
extern double log_ndtr(double a);
extern double erfc(double a);
extern double erf(double x);
extern double erfinv(double y);
extern double erfcinv(double y);
extern double ndtri(double y0);

extern double pdtrc(double k, double m);
extern double pdtr(double k, double m);
extern double pdtri(int k, double y);

extern double poch(double x, double m);

extern double psi(double x);

extern double rgamma(double x);
extern double round(double x);

extern int shichi(double x, double *si, double *ci);
extern int sici(double x, double *si, double *ci);

extern double radian(double d, double m, double s);
extern double sindg(double x);
extern double sinpi(double x);
extern double cosdg(double x);
extern double cospi(double x);

extern double spence(double x);

extern double stdtr(int k, double t);
extern double stdtri(int k, double p);

extern double struve_h(double v, double x);
extern double struve_l(double v, double x);
extern double struve_power_series(double v, double x, int is_h, double *err);
extern double struve_asymp_large_z(double v, double z, int is_h, double *err);
extern double struve_bessel_series(double v, double z, int is_h, double *err);

extern double yv(double v, double x);

extern double tandg(double x);
extern double cotdg(double x);

extern double log1p(double x);
extern double log1pmx(double x);
extern double expm1(double x);
extern double cosm1(double x);
extern double lgam1p(double x);

extern double yn(int n, double x);
extern double zeta(double x, double q);
extern double zetac(double x);

extern double smirnov(int n, double d);
extern double smirnovi(int n, double p);
extern double smirnovp(int n, double d);
extern double smirnovc(int n, double d);
extern double smirnovci(int n, double p);
extern double kolmogorov(double x);
extern double kolmogi(double p);
extern double kolmogp(double x);
extern double kolmogc(double x);
extern double kolmogci(double p);

extern double lanczos_sum_expg_scaled(double x);

extern double owens_t(double h, double a);
CEPHES_EXTERN_EXPORT int airy(double x, double *ai, double *aip, double *bi,
double *bip);

CEPHES_EXTERN_EXPORT double bdtrc(double k, int n, double p);
CEPHES_EXTERN_EXPORT double bdtr(double k, int n, double p);
CEPHES_EXTERN_EXPORT double bdtri(double k, int n, double y);

CEPHES_EXTERN_EXPORT double besselpoly(double a, double lambda, double nu);

CEPHES_EXTERN_EXPORT double beta(double a, double b);
CEPHES_EXTERN_EXPORT double lbeta(double a, double b);

CEPHES_EXTERN_EXPORT double btdtr(double a, double b, double x);

CEPHES_EXTERN_EXPORT double cbrt(double x);
CEPHES_EXTERN_EXPORT double chbevl(double x, double array[], int n);
CEPHES_EXTERN_EXPORT double chdtrc(double df, double x);
CEPHES_EXTERN_EXPORT double chdtr(double df, double x);
CEPHES_EXTERN_EXPORT double chdtri(double df, double y);
CEPHES_EXTERN_EXPORT double dawsn(double xx);

CEPHES_EXTERN_EXPORT double ellie(double phi, double m);
CEPHES_EXTERN_EXPORT double ellik(double phi, double m);
CEPHES_EXTERN_EXPORT double ellpe(double x);

CEPHES_EXTERN_EXPORT int ellpj(double u, double m, double *sn, double *cn,
double *dn, double *ph);
CEPHES_EXTERN_EXPORT double ellpk(double x);
CEPHES_EXTERN_EXPORT double exp10(double x);
CEPHES_EXTERN_EXPORT double exp2(double x);

CEPHES_EXTERN_EXPORT double expn(int n, double x);

CEPHES_EXTERN_EXPORT double fdtrc(double a, double b, double x);
CEPHES_EXTERN_EXPORT double fdtr(double a, double b, double x);
CEPHES_EXTERN_EXPORT double fdtri(double a, double b, double y);

CEPHES_EXTERN_EXPORT int fresnl(double xxa, double *ssa, double *cca);
CEPHES_EXTERN_EXPORT double Gamma(double x);
CEPHES_EXTERN_EXPORT double lgam(double x);
CEPHES_EXTERN_EXPORT double lgam_sgn(double x, int *sign);
CEPHES_EXTERN_EXPORT double gammasgn(double x);

CEPHES_EXTERN_EXPORT double gdtr(double a, double b, double x);
CEPHES_EXTERN_EXPORT double gdtrc(double a, double b, double x);
CEPHES_EXTERN_EXPORT double gdtri(double a, double b, double y);

CEPHES_EXTERN_EXPORT double hyp2f1(double a, double b, double c, double x);
CEPHES_EXTERN_EXPORT double hyperg(double a, double b, double x);
CEPHES_EXTERN_EXPORT double threef0(double a, double b, double c, double x,
double *err);

CEPHES_EXTERN_EXPORT double i0(double x);
CEPHES_EXTERN_EXPORT double i0e(double x);
CEPHES_EXTERN_EXPORT double i1(double x);
CEPHES_EXTERN_EXPORT double i1e(double x);
CEPHES_EXTERN_EXPORT double igamc(double a, double x);
CEPHES_EXTERN_EXPORT double igam(double a, double x);
CEPHES_EXTERN_EXPORT double igam_fac(double a, double x);
CEPHES_EXTERN_EXPORT double igamci(double a, double q);
CEPHES_EXTERN_EXPORT double igami(double a, double p);

CEPHES_EXTERN_EXPORT double incbet(double aa, double bb, double xx);
CEPHES_EXTERN_EXPORT double incbi(double aa, double bb, double yy0);

CEPHES_EXTERN_EXPORT double iv(double v, double x);
CEPHES_EXTERN_EXPORT double j0(double x);
CEPHES_EXTERN_EXPORT double y0(double x);
CEPHES_EXTERN_EXPORT double j1(double x);
CEPHES_EXTERN_EXPORT double y1(double x);

CEPHES_EXTERN_EXPORT double jn(int n, double x);
CEPHES_EXTERN_EXPORT double jv(double n, double x);
CEPHES_EXTERN_EXPORT double k0(double x);
CEPHES_EXTERN_EXPORT double k0e(double x);
CEPHES_EXTERN_EXPORT double k1(double x);
CEPHES_EXTERN_EXPORT double k1e(double x);
CEPHES_EXTERN_EXPORT double kn(int nn, double x);

CEPHES_EXTERN_EXPORT double nbdtrc(int k, int n, double p);
CEPHES_EXTERN_EXPORT double nbdtr(int k, int n, double p);
CEPHES_EXTERN_EXPORT double nbdtri(int k, int n, double p);

CEPHES_EXTERN_EXPORT double ndtr(double a);
CEPHES_EXTERN_EXPORT double log_ndtr(double a);
CEPHES_EXTERN_EXPORT double erfc(double a);
CEPHES_EXTERN_EXPORT double erf(double x);
CEPHES_EXTERN_EXPORT double erfinv(double y);
CEPHES_EXTERN_EXPORT double erfcinv(double y);
CEPHES_EXTERN_EXPORT double ndtri(double y0);

CEPHES_EXTERN_EXPORT double pdtrc(double k, double m);
CEPHES_EXTERN_EXPORT double pdtr(double k, double m);
CEPHES_EXTERN_EXPORT double pdtri(int k, double y);

CEPHES_EXTERN_EXPORT double poch(double x, double m);

CEPHES_EXTERN_EXPORT double psi(double x);

CEPHES_EXTERN_EXPORT double rgamma(double x);
CEPHES_EXTERN_EXPORT double round(double x);

CEPHES_EXTERN_EXPORT int shichi(double x, double *si, double *ci);
CEPHES_EXTERN_EXPORT int sici(double x, double *si, double *ci);

CEPHES_EXTERN_EXPORT double radian(double d, double m, double s);
CEPHES_EXTERN_EXPORT double sindg(double x);
CEPHES_EXTERN_EXPORT double sinpi(double x);
CEPHES_EXTERN_EXPORT double cosdg(double x);
CEPHES_EXTERN_EXPORT double cospi(double x);

CEPHES_EXTERN_EXPORT double spence(double x);

CEPHES_EXTERN_EXPORT double stdtr(int k, double t);
CEPHES_EXTERN_EXPORT double stdtri(int k, double p);

CEPHES_EXTERN_EXPORT double struve_h(double v, double x);
CEPHES_EXTERN_EXPORT double struve_l(double v, double x);
CEPHES_EXTERN_EXPORT double struve_power_series(double v, double x, int is_h,
double *err);
CEPHES_EXTERN_EXPORT double struve_asymp_large_z(double v, double z, int is_h,
double *err);
CEPHES_EXTERN_EXPORT double struve_bessel_series(double v, double z, int is_h,
double *err);

CEPHES_EXTERN_EXPORT double yv(double v, double x);

CEPHES_EXTERN_EXPORT double tandg(double x);
CEPHES_EXTERN_EXPORT double cotdg(double x);

CEPHES_EXTERN_EXPORT double log1p(double x);
CEPHES_EXTERN_EXPORT double log1pmx(double x);
CEPHES_EXTERN_EXPORT double expm1(double x);
CEPHES_EXTERN_EXPORT double cosm1(double x);
CEPHES_EXTERN_EXPORT double lgam1p(double x);

CEPHES_EXTERN_EXPORT double yn(int n, double x);
CEPHES_EXTERN_EXPORT double zeta(double x, double q);
CEPHES_EXTERN_EXPORT double zetac(double x);

CEPHES_EXTERN_EXPORT double smirnov(int n, double d);
CEPHES_EXTERN_EXPORT double smirnovi(int n, double p);
CEPHES_EXTERN_EXPORT double smirnovp(int n, double d);
CEPHES_EXTERN_EXPORT double smirnovc(int n, double d);
CEPHES_EXTERN_EXPORT double smirnovci(int n, double p);
CEPHES_EXTERN_EXPORT double kolmogorov(double x);
CEPHES_EXTERN_EXPORT double kolmogi(double p);
CEPHES_EXTERN_EXPORT double kolmogp(double x);
CEPHES_EXTERN_EXPORT double kolmogc(double x);
CEPHES_EXTERN_EXPORT double kolmogci(double p);

CEPHES_EXTERN_EXPORT double lanczos_sum_expg_scaled(double x);

CEPHES_EXTERN_EXPORT double owens_t(double h, double a);

#ifdef __cplusplus
}
Expand Down
25 changes: 25 additions & 0 deletions gtsam/3rdparty/cephes/dllexport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Macros for exporting DLL symbols on Windows
// Usage example:
// In header file:
// class CEPHES_EXPORT MyClass { ... };
//
// Results in the following declarations:
// When included while compiling the library itself:
// class __declspec(dllexport) MyClass { ... };
// When included while compiling other code against the library:
// class __declspec(dllimport) MyClass { ... };

#pragma once

#ifdef _WIN32
# define CEPHES_EXPORT __declspec(dllimport)
# define CEPHES_EXTERN_EXPORT __declspec(dllimport)
#else
#ifdef __APPLE__
# define CEPHES_EXPORT __attribute__((visibility("default")))
# define CEPHES_EXTERN_EXPORT extern
#else
# define CEPHES_EXPORT
# define CEPHES_EXTERN_EXPORT extern
#endif
#endif

0 comments on commit 3f32b0a

Please sign in to comment.