2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 16:32:10 +00:00

56 Commits

Author SHA1 Message Date
René Ferdinand Rivera Morell
41f07b0794 Add support for modular build structure. (#1160)
* Make the library modular usable.

* Fix -Wundef warnings

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add missing NO_LIB usage requirements.

* Remove boost-root relative include path.

* Add missing import-search for cconfig/predef checks.

* Add requires-b2 check to top-level build file.

* Sync upstream.

* Fix typo in test framework reference.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Switch to /boost/test//included target for header only mode of Boost.Test.

* Adjust doc build to avoid boost-root references.

* Update build deps.

* Fix project props not applying to the no_eh.obj compile.

* Update build deps.

* Add missing import-search.

* Fix float128_type checks to actually disable tests. Problem was that build is a non-free feature. Which can't be acquired through a usage requirement.

* GPU Batch 7

Fix igamma_large support on device

Add GPU support to toms748

Add GPU support to igamma_inv

Add GPU markers to gamma_inva

Add GPU Markers to lgamma_small

Remove STL usage from gamma

Remove NVRTC workaround

Fix fraction use of STL headers

Mark gamma functions in fwd

Disable declval on all GPU platforms

Disable more unneeded code on device

Add forward decl for NVRTC tgamma

Disable unneeded items for all GPU

Change workaround for missing overloads

Rearrange definition location

Add include path to cuda now that workaround is removed

Fix NVRTC incompatibility with recursion and forward decls

Add tgamma_ratio CUDA and NVRTC testing

Fix NVRTC handling of gamma_p_derivative

Add gamma_p_derivative CUDA and NVRTC testing

Remove recursion from gamma_incomplete_imp

Add SYCL testing of igamma, igamma_inv, and igamma_inva

Ignore literal-range warnings

Remove use of static const char* for function name

Fix missing CUDA header

Remove calls under NVRTC to fwd decl

Add more nvrtc workarounds

Use builtin erfc instead of header cycle

Add CUDA and NVRTC testing of gamma_p_inv

Adjust tolerances

Add GPU support to chi squared dist

Fix static local variable

Add chi squared dist SYCL testing

Add chi squared dist CUDA testing

Add chi squared dist NVRTC testing

Add GPU support to weibull dist

Add weibull dist SYCL testing

Add weibull dist CUDA testing

Add weibull dist NVRTC testing

* Fix policy macro definition for MSVC platforms

* Don't add quadmath lib for has_128bit_floatmax_t check. It was accidentally copy+pasted.

* Fix incorrect name for float128 type check that caused it to not apear.

---------

Co-authored-by: Matt Borland <matt@mattborland.com>
2024-09-06 08:45:23 -04:00
jzmaddock
2de293b13f Remove unneeded library dependencies from Jamfiles. 2021-05-18 20:51:03 +01:00
jzmaddock
5f178548e0 Fix inspect issues under reporting/ 2021-03-30 11:34:39 +01:00
jzmaddock
5a1a3027c8 Remove unused html file.
See https://github.com/boostorg/math/issues/457
[CI SKIP]
2020-12-17 18:11:19 +00:00
jzmaddock
48ba13b408 Remove unused large SVG's.
[CI SKIP]
See https://github.com/boostorg/math/issues/457.
2020-12-17 18:06:47 +00:00
jzmaddock
64154c2d4b Update history, regenerate docs.
Add some missing files.
[CI SKIP]
2020-10-19 18:19:34 +01:00
Evan Miller
18ed616376 Kolmogorov-Smirnov distribution (#422)
* Kolmogorov-Smirnov distribution #421

Add a new distribution, kolmogorov_smirnov_distribution, which takes a
parameter that represents the number of observations used in a
Kolmogorov-Smirnov test. (The K-S test is a popular test for comparing
two CDFs, but the test statistic is not implemented here.)

This implementation includes Kolmogorov's original 1st order Taylor
expansion. There is a literature on the distribution's other
mathematical properties (higher order terms and exact version); this
literature is summarized in the main header file for anyone who may
want to expand the implementation later.

The CDF is implemented using a Jacobi theta function, and the PDF is a
hand-rolled derivative of that function. Quantiles plug the CDF and PDF
into a Newton-Raphson iteration. The mean and variance have nice
closed-form expressions, and the mode uses a dumb run-time maximizer.

This commit includes graphs, a ULP plotter for the PDF, and the usual
compilation and numerical tests. The test file is on the small side, but
it integrates the distribution from zero to infinity, and covers the
quantiles pretty well. As of now the numerical tests only verify
self-consistency (e.g. distribution moments and CDF-quantile relations),
so there's room to add some external checks.

* Implement skewness for K-S distribution [CI SKIP]

The third moment integrates nicely with the help of Apery's constant
(zeta_three). Verify the result via quadrature.

* Implement kurtosis for the K-S distribution

Verify the result via quadrature.
2020-09-04 08:48:51 -04:00
jzmaddock
09c0d37178 Merge pull request #418 from boostorg/mp_erf
Update multiprecision erf to improve precision and performance.
2020-08-20 18:21:44 +01:00
Evan Miller
d7141cd353 Jacobi Theta functions (#394)
* Jacobi Theta functions

Implementations, tests, and ULP plotting programs are provided for the
four Jacobi Theta functions per #373. Twenty-four public C++ functions
are provided in all, covering various precision-preserving scenarios.

Documentation for collaborators is provided in the code comments. Proper
documentation for end users will be provided when the implementation and
APIs are finalized.

Some tests are failing; this implementation is meant to start a
conversation. The core dilemma faced by the author was that large values
of |q| resulted in slow convergence, and sometimes wildly inaccurate
results. Following the implementation note in DLMF 20.14, I added code
to switch over to the imaginary versions of the theta functions when |q|
> 0.85.  This restored accuracy such that all of the identity tests
passed for a loose-enough epsilon, but then lost precision to the point
that the Wolfram Alpha spot checks failed. It is the author's hope that
someone with floating-point experience can tame the exponential dragons
and squeeze the ULPs back down to a reasonable range when |q| is large.

When #392 is merged I will add more thorough value tests, although I
fully expect them to fail until the underlying precision issues are
resolved.

As a final note, the precision issues do not affect the z=0 case - the
ULP plots indicate these return values within 2 ULP across all valid
|q|. So that's a start.

* [CI SKIP] Jacobi theta: Add special-value tests and more

* Add tests covering z=0 special values from MathWorld

* Add missing real_concept header

* Replace M_PI and friends with constants::pi etc

* Use BOOST_MATH_STD_USING in more places

* Jacobi theta: Test two more of Watson's identities [CI SKIP]

See https://mathworld.wolfram.com/JacobiThetaFunctions.html

(Equations 48 and 49)

* Improve precision of Jacobi theta functions [CI SKIP]

Rewrite the private imaginary versions to use double-sided summations
following DLMF 20.13.4 and 20.13.5. This cuts down the worst of the
precision issues by a factor of 10, and gets more of the tests to pass.

I am confident enough in the code path to eliminate the compile-time
__JACOBI_THETA_USE_IMAGINARY flag. In fact the imaginary-z code paths
are now enabled for all |q| > 0.04, i.e. most legal values of q.

More extensive tests will be needed to illuminate any remaining
precision issues.

* Jacobi theta: Make changes suggested in #394 [CI SKIP]

* Add LICENSE notice to main file

* Document convergence criteria

* Eliminate eps*eps = 0 logic. This causes some disagreement with the
zero returned by Wolfram Alpha for z=0, q > 0.99 in the fourth function.
Mathematically, the fourth function is never exactly zero, so I don't
trust Wolfram here.

* Per code-review comments, remove multiplications by floating-point 2.

* Tweak the plotting programs to display their titles, and to uniformly
use `float` as their CoarseType and `long double` as their
`PreciseType`.

* Add quadrature tests to Jacobi theta functions [CI SKIP]

The quadrature tests revealed a problem in the m1 functions: they too
should switch to the _IMAGINARY logic for q > exp(-pi), or will suffer
from slow convergence. Fix them.

Also tighten tolerances for many tests from sqrt(eps) to 100 * eps.

* Test Jacobi thetas against elliptic functions and elliptic integrals [CI SKIP]

See:

* https://dlmf.nist.gov/22.2
* https://dlmf.nist.gov/20.9#i

* Test Jacobi Thetas against their Laplace transforms [CI SKIP]

See:

* https://dlmf.nist.gov/20.10#ii

I did find some disagreement, and dropped the negative sign from the
theta1 equation. DLMF's theta2 and theta3 Laplace transform equations do
not agree at all with the computed values - will need to investigate.

In the meantime, the two implemented equations agree to 4 EPS so I am
keeping them.

* Add a note on using log1p with Jacobi theta functions [CI SKIP]

See discussion:

* https://github.com/boostorg/math/pull/394#issuecomment-655871762

* Add random data tests to Jacobi Theta functions [CI SKIP]

Add a test data generator program for the Jacobi theta functions.
This program will produce data for the tau parameterization, so that
precision isn't lost during the log-transformation. This distinguishes
it from the Wolfram Alpha data, which is parameterized by q.

A few of these new random-data tests are failing, but not by obscene
margins (< 100 EPS). These failures will be addressed when the test
tolerances are finalized.

* Add small-tau tests and simplify Jacobi Theta code [CI SKIP]

Add tests for small tau (i.e. large q). The tests are failing with mean
~ 200 EPS and max ~ 800 EPS. These look like worst-case input, and
should be the focus of future accuracy improvements.

This commit also simplifies the _IMAGINARY code by abstracting all of
the loops into a single svelte function.

* Add user documentation for Jacobi Theta functions [CI SKIP]

* Add function graphs to Jacobi Theta docs [CI SKIP]

* Define Jacobi Theta test tolerances [CI SKIP]

* Add implementation note on Jacobi theta functions [CI SKIP]

* Consolidate Jacobi Theta ULPs plotting programs [CI SKIP]

* Fix q domain checking of jacobi_theta4 [CI SKIP]

* Add ULPs plots to Jacobi Theta docs [CI SKIP]

Also add the built HTML files for easy evaluation. A full rebuild is
needed for the new docs to appear in the indexes.

* Add missing Jacobi Theta ULPs plots [CI SKIP]

* Add LaTeX source for Jacobi Theta equations [CI SKIP]

* Remove unused Jacobi Theta PNG equations [CI SKIP]

* Add Jacobi Theta performance script [CI SKIP]

Provided by @NAThompson.

* Remove vestigial eps*eps check from jacobi_theta3 [CI SKIP]

* Update Jacobi Theta docs per code review comments [CI SKIP]

* Enable arg promotion for Jacobi Theta functions [CI SKIP]

Add Jacobi theta functions to the instantiation tests and fix up
everything needed to make them pass. This changes the function
signatures to use promote_args.

* Fix Jacobi Theta plotting script [CI SKIP]

This script broke when the promote_args API was added.

* Change Jacobi Theta convergence criterion [CI SKIP]

Compare the non-oscillating part of the delta to the previous one.
This avoids some headaches comparing the delta to the partial sum,
because the partial sum can be a small number due to the oscillating
component alternating signs.

Because successive terms involve either q^n^2 or exp(-(pi*n)^2),
convergence should still happen pretty quickly. Graphs have been updated
and tests still passs with no noticeable difference.
2020-08-15 18:51:47 -04:00
jzmaddock
df91e5a1c0 Add erf ulp plots to Jamfile.v2
[CI SKIP]
2020-08-15 15:36:02 +01:00
jzmaddock
2b428c94e5 Add new erf/erfc plots to docs.
[CI SKIP]
2020-08-15 12:41:30 +01:00
Nick
1186f1a7ff rsqrt (#361)
* rsqrt

* Link docs into math.qbk. [CI SKIP]

* Demo performance with a compiler that generates good instructions [CI SKIP]
2020-05-30 22:34:56 -04:00
Nick
9a45e6a358 AGM 2020-05-29 21:50:25 -04:00
pabristow
0ab00c3f9d [CI SKIP] changes to get inspect program problem-free, but one test failure in recurrence.cpp 2019-08-23 09:25:22 +01:00
jzmaddock
c0fb40c69d Merge branch 'develop' of https://github.com/boostorg/math into develop
# Resolved Conflicts:
#	reporting/accuracy/doc/accuracy_tables.qbk
#	reporting/accuracy/html/index.html
2018-03-09 17:22:23 +00:00
jzmaddock
66a7c1a1b9 Big documentation update with new error rate tests.
[CI SKIP]
2018-03-09 17:19:26 +00:00
John Maddock
1d3fb4b1f3 Try again with updated accuracy results [CI SKIP] 2018-03-09 10:16:44 +00:00
jzmaddock
4b415a64d1 Reporting: Add missing file. 2018-03-09 09:15:03 +00:00
jzmaddock
29b99df508 reporting: change to use C++17 <cmath> rather than tr1.
[CI SKIP]
2018-03-08 20:03:53 +00:00
John Maddock
4dcdbc2a2a Update error rates in docs [CI SKIP] 2018-03-08 16:42:47 +00:00
jzmaddock
ce198cefe8 Fix some inspection report failures. 2015-09-08 12:04:27 +01:00
jzmaddock
e02447b3a6 First cut at TR1 tests. 2015-07-13 19:18:16 +01:00
jzmaddock
3ff3c48d27 Add cephes placeholder. 2015-07-06 18:51:21 +01:00
jzmaddock
9c6e55b2b5 Add in Cephes results. 2015-07-05 19:53:37 +01:00
jzmaddock
a49dab7006 Add Cephes support. 2015-07-05 17:20:48 +01:00
jzmaddock
598b06ca91 Add Oracle test results. 2015-07-04 10:22:22 +01:00
jzmaddock
f0760f5536 Change to old style Boost.Test usage:
Too many compilers can't cope with the new style, or at least it's not enabled in the preprocessor lib.
Add back Linux test results.
2015-07-03 19:23:49 +01:00
jzmaddock
6db20ce240 Add new tables to old docs. Tweak table formatting slightly. 2015-07-03 18:40:09 +01:00
jzmaddock
62d8b8f172 Port back to C++03. 2015-07-02 17:25:42 +01:00
jzmaddock
174833831e Add Linux test results. 2015-07-02 17:21:35 +01:00
jzmaddock
acfae1cb2a Add "all_tables" template. 2015-07-02 17:05:38 +01:00
jzmaddock
a5d38f7fa5 Add newline at end of truncated content. 2015-07-02 16:35:56 +01:00
jzmaddock
6e01ee60c7 Add missing #include. 2015-07-02 16:34:09 +01:00
jzmaddock
ba9ead1c63 Truncated excessive output. 2015-07-02 13:55:40 +01:00
jzmaddock
9e62682906 Add version numbers to other libraries tested. 2015-07-02 13:55:21 +01:00
jzmaddock
07dd9f3046 Add Rmath support. 2015-07-02 13:39:03 +01:00
jzmaddock
ba6d764e92 Fix TR1 function names. 2015-07-02 10:09:24 +01:00
jzmaddock
c91e92f012 Set overflow policy correctly. 2015-07-02 09:55:19 +01:00
jzmaddock
f6b60b701f Fix overflow handling. 2015-07-01 18:36:26 +01:00
jzmaddock
008ed4d9b7 Add non central distributions to accuracy reporting. 2015-06-30 19:37:15 +01:00
jzmaddock
bac9466df0 Add some more functions to the tests. 2015-06-29 19:24:38 +01:00
jzmaddock
7318fc2663 Always test double functions if we're testing another lib at double. 2015-06-29 17:22:09 +01:00
jzmaddock
7d013c0a47 Fix description of ibeta. 2015-06-29 11:56:22 +01:00
jzmaddock
8c00c32ec7 Fix up GSL bindings. 2015-06-28 19:12:59 +01:00
jzmaddock
4d5e744fee Remove old comparison code - it gets in the way. 2015-06-28 09:32:20 +01:00
jzmaddock
8fd537d11b Need to name GSL in config. 2015-06-27 19:40:24 +01:00
jzmaddock
d135802b34 Sigh... need another link lib as well to use gsl. 2015-06-27 19:38:12 +01:00
jzmaddock
113529dc61 Need to link against gsl. 2015-06-27 19:36:11 +01:00
jzmaddock
7134ef58b3 Use correct #includes for gsl. 2015-06-27 19:34:28 +01:00
jzmaddock
7b4ca69d69 Add missing file. 2015-06-27 19:32:30 +01:00