forked from google-deepmind/torch-cephes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #5 from Cactus-proj/dev
doc, test: init elliptic,error,hyper,misc
Showing
24 changed files
with
309 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Elliptic Functions | ||
|
||
* **ellpk**, [Complete elliptic integral of the first kind](doubldoc.md#ellpk) | ||
* **ellik**, [Incomplete elliptic integral of the first kind](doubldoc.md#ellik) | ||
* **ellpe**, [Complete elliptic integral of the second kind](doubldoc.md#ellpe) | ||
* **ellie**, [Incomplete elliptic integral of the second kind](doubldoc.md#ellie) | ||
* **ellpj**, [Jacobian elliptic functions](doubldoc.md#ellpj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Error Functions | ||
|
||
* **erf**, [Error function](doubldoc.md#erf) | ||
* **erfc**, [Complementary error function](doubldoc.md#erfc) | ||
* **ndtri**, [Inverse of normal distribution function](doubldoc.md#ndtri) | ||
* **dawsn**, [Dawson's Integral](doubldoc.md#dawsn) | ||
* **fresnl**, [Fresnel integral](doubldoc.md#fresnl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# cephes/hyper | ||
|
||
## Hypergeometric Functions | ||
|
||
* **hyp2f1**, [Gauss hypergeometric function](doubldoc.md#hyp2f1) | ||
* **hyperg**, [Confluent hypergeometric function](doubldoc.md#hyperg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# cephes/misc | ||
|
||
* **spence**, [Dilogarithm](doubldoc.md#spence) | ||
* **zeta**, [Zeta function of two arguments](doubldoc.md#zeta) | ||
* **zetac**, [Riemann zeta function of two arguments](doubldoc.md#zetac) | ||
* **struve**, [Struve function](doubldoc.md#struve) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef CEPHES_ELLIPTIC_H | ||
/** Cephes double precision special functions suite | ||
* | ||
* cephes/bessel | ||
*/ | ||
#define CEPHES_ELLIPTIC_H | ||
|
||
namespace cephes { | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif | ||
|
||
/** Elliptic Functions */ | ||
/* ellf/ellpk.c */ | ||
double ellpk(double x); | ||
/* ellf/ellik.c */ | ||
double ellik(double phi, double m); | ||
/* ellf/ellpe.c */ | ||
double ellpe(double x); | ||
/* ellf/ellie.c */ | ||
double ellie(double phi, double m); | ||
|
||
/* ellf/ellpj.c */ | ||
int ellpj(double u, double m, double *sn, double *cn, double *dn, double *ph); | ||
|
||
#if defined(__cplusplus) | ||
} // extern "C" | ||
#endif | ||
}; // ::cephes | ||
|
||
#endif // CEPHES_ELLIPTIC_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef CEPHES_ERROR_H | ||
/** Cephes double precision special functions suite | ||
* | ||
* cephes/bessel | ||
*/ | ||
#define CEPHES_ERROR_H | ||
|
||
namespace cephes { | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif | ||
|
||
/** Error Functions */ | ||
/* cephes/ndtr.c */ | ||
double erf(double x); | ||
double erfc(double a); | ||
double ndtr(double a); | ||
|
||
/* cephes/dawsn.c */ | ||
double dawsn(double xx); | ||
/* cephes/fresnl.c */ | ||
int fresnl(double xxa, double *ssa, double *cca); | ||
|
||
#if defined(__cplusplus) | ||
} // extern "C" | ||
#endif | ||
}; // ::cephes | ||
|
||
#endif // CEPHES_ERROR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef CEPHES_HYPER_H | ||
/** Cephes double precision special functions suite | ||
* | ||
* cephes/bessel | ||
*/ | ||
#define CEPHES_HYPER_H | ||
|
||
namespace cephes { | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif | ||
|
||
/** Hypergeometric Functions */ | ||
double hyp2f1(double a, double b, double c, double x); | ||
double hyperg(double a, double b, double x); | ||
|
||
#if defined(__cplusplus) | ||
} // extern "C" | ||
#endif | ||
}; // ::cephes | ||
|
||
#endif // CEPHES_HYPER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef CEPHES_MISC_H | ||
/** Cephes double precision special functions suite | ||
* | ||
* cephes/misc | ||
*/ | ||
#define CEPHES_MISC_H | ||
|
||
namespace cephes { | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif | ||
|
||
/* misc/spence.c */ | ||
double spence(double x); | ||
|
||
/* misc/zeta.c */ | ||
double zeta(double x, double q); | ||
/* misc/zetac.c */ | ||
double zetac(double x); | ||
|
||
double struve(double v, double x); | ||
|
||
#if defined(__cplusplus) | ||
} // extern "C" | ||
#endif | ||
}; // ::cephes | ||
|
||
#endif // CEPHES_MISC_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,3 @@ add_gtest(k0e) | |
add_gtest(k1) | ||
add_gtest(k1e) | ||
add_gtest(kn) | ||
|
||
add_gtest(psi) | ||
add_gtest(struve) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
add_gtest(expn) | ||
add_gtest(sici) | ||
add_gtest(shichi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <xtest.hpp> | ||
#include <cephes/exp_int.h> | ||
|
||
|
||
TEST(ExpN, Errors) { | ||
// n < 0 | ||
EXPECT_TRUE(cephes::expn(-1, 10.0) > 1e308); | ||
// x < 0 | ||
EXPECT_TRUE(cephes::expn(1, -1.0) > 1e308); | ||
// x > MAXLOG ≈ 709.78 | ||
EXPECT_EQ(cephes::expn(1, 800), 0.0); | ||
// x==0 && n < 2 | ||
EXPECT_TRUE(cephes::expn(1, 0.0) > 1e308); | ||
EXPECT_TRUE(cephes::expn(0, 0.0) > 1e308); | ||
} | ||
TEST(ExpN, CodecovTodo) { | ||
const double nan64 = std::numeric_limits<double>::quiet_NaN(); | ||
|
||
// x==0.0 && n >= 2 | ||
EXPECT_NE(cephes::expn(2, 0.0), nan64); | ||
EXPECT_NE(cephes::expn(10, 0.0), nan64); | ||
// n==0 | ||
EXPECT_NE(cephes::expn(0, 10.0), nan64); | ||
// n > 5000 | ||
EXPECT_NE(cephes::expn(5500, 10.0), nan64); | ||
// n <= 5000 && x > 1.0 | ||
// cfrac: continued fraction | ||
EXPECT_NE(cephes::expn(10, 10.0), nan64); | ||
// Power series expansion | ||
EXPECT_NE(cephes::expn(1, 0.5), nan64); | ||
EXPECT_NE(cephes::expn(10, 0.5), nan64); | ||
} |
Oops, something went wrong.