2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

1755 Commits

Author SHA1 Message Date
jzmaddock
c7cf622d56 Minor doc fix to put pow<> in the index.
Fixes https://github.com/boostorg/math/issues/393.
2021-01-24 14:39:20 +00:00
Matt Borland
1eb3c71f8a Implement Policies in Statistics (#434)
* Initial Commit [WIP][CI SKIP]
Policies for mean implemented and forced vectorization

* First cut at integer variance [CI SKIP]

* Functional variance impl [WIP][CI SKIP]

* Work on variance [CI SKIP]
Details are now moved into detail files.
Recursively decomposes sufficient range size until max threads achieved.
Single failing test for integral, not implemented for Reals.

* Parallel integer variance complete [CI SKIP]

* All variance policies complete [CI SKIP]

* Update mean_and_sample_variance [CI SKIP]

* Median complete for all types [CI SKIP]

* Median absolute deviation complete for all types
[CI SKIP]

* Refactored sequential first four moments impls
[CI SKIP]

* Setup test cases for first four moments [WIP]
[CI SKIP]

* Sequential impl pass [CI SKIP]

* Parallel interface impl. Fails some tests
[CI SKIP]

* Interquartile range passes for all existing test
[CI SKIP]

* Gini coefficient generally implemented
Does not support long double or cpp_bin_float_50s
[CI SKIP]

* Sample gini coef implemented w/same constraints
[CI SKIP]

* Add benchmarks [CI SKIP]

* First four moments complete for most types
[CI SKIP]

* Skewness restructured. Currently INOP for non-seq
[CI SKIP]

* Fix floating point skewness [CI SKIP]

* Skewness complete [CI SKIP]

* Kurtosis complete [CI SKIP]

* Gini coefficient complete [CI SKIP]

Removes atomics which expands number of compatible types.

* Mode complete [CI SKIP]

Additionally mode now supports floating types by using an unordered_map to store frequency

* Garbage cleanup [CI SKIP]

* Doc updates [CI SKIP]

* Mean cleanup [CI SKIP]

* Cleanup variance [CI SKIP]

Remove duplicate impls that vary only be return type

* Variance Cleanup [CI SKIP]

Remove duplicate impls

* Skewness cleanup [CI SKIP]

* Update performance [CI SKIP]

* Add swap file to gitignore [CI SKIP]

* Add missing comma [CI SKIP]

* Improve par mode performance regression [CI SKIP]
[WIP] Parallel mode still ~2 orders of magnitude slower

* mode performance improvement [CI SKIP]

* Improved data handling - mode [CI SKIP]

* Additional overloads to match STL proposal
[CI SKIP]

* Updates to mode and documentation

* Remove dependency and fix todo [CI SKIP]

* Minor fixes [CI SKIP]

* Fix multiprecision issues [CI SKIP]

* Remove dependency. Minor change to thread counting
[CI SKIP]

* Standardize seq mean impl [CI SKIP]

* Fix doc brackets [CI SKIP]

* Remove duplicated sort on gini coef [CI SKIP]

* C++11 all that is required for sequential methods
[CI SKIP]

* Fixes for CI failure

* More CI fixes

* Fixes for MSVC issues
Fix gitignore merge conflict
Adjust test tol to match others

* Fix MSVC lang macro

* More small fixes for vinatge compilers

* Minor fix for MSVC 14.2 c++17 [CI SKIP]

* Cleanup docs, test file, and remove cruft
[CI SKIP]

* Delete par_unseq tests [CI SKIP]

* Change link to accumulators [CI SKIP]

* Add bigobj flag to failing build

* Remove redundant impl [WIP][CI SKIP]

* Initial cut at linear decomposition [WIP][CI SKIP]

* Passes tests [CI SKIP]

* Various CI fixes

* More CI fixes

* Delete extra impl and add linker flags

* Try CI without TBB

* Restrict compiler support

* Restrict c++ version
2021-01-22 09:42:16 -05:00
Matt Borland
bf3038bfcb Add Z-test (#494)
* Initial Commit

* Add tests

* Add docs

* Fix svg file dimensions [CI SKIP]

* Minor fixes [CI SKIP]

* Fixes to docs and tests [CI SKIP]

* More test fixes and cycle CI

* Cycle CI

* Update docs

* Fix for MSVC-14.2 C++17 misc failure [CI SKIP]
2021-01-17 09:53:49 -05:00
Matt Borland
f7e3fc17a6 Additional t-tests (#487)
* Add integer support to t_test

* Add paired samples t test

* Add two sample t test

* Add welch's t test

* Update docs

* Cleanup

* Add CHECK_ULP_CLOSE tests to test battery. Fix svg

* Remove all instances of ex [CI SKIP]

* Remove std::distance and note in docs [CI SKIP]

* Re-write test battery
2021-01-12 15:48:53 -05:00
Matt Borland
d78be60933 Update library authors [CI SKIP] (#481) 2021-01-06 16:30:26 -05:00
jzmaddock
8df142b651 Remove PDF file - no need to distribute this, we can add a link.
See https://github.com/boostorg/math/issues/457.
2020-12-17 17:56:05 +00:00
jzmaddock
64154c2d4b Update history, regenerate docs.
Add some missing files.
[CI SKIP]
2020-10-19 18:19:34 +01:00
pabristow
f304c83794 Add display:inline-block; for all colors, and comments. 2020-09-29 12:45:43 +01:00
Suyash Patil
c2843663dc fixed CSS property in doc/math.css (#437) 2020-09-26 17:38:15 -04: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
2b428c94e5 Add new erf/erfc plots to docs.
[CI SKIP]
2020-08-15 12:41:30 +01:00
jzmaddock
6d1d46720f Improve ulps plot: (#417)
* Improve ulps plot:

- Use numeric_limits for precision comparison, plot out of bounds points at the clip boundary so we can still see that they're there.
-Add options for colored marks when clipping and NaN.
2020-08-11 11:44:32 -04:00
Nick
cbd2af2890 Cohen acceleration (#415)
* Cohen acceleration

Accelerates convergence of an alternating series by a method designed by Cohen, Villegas, and Zagier.
2020-08-09 09:55:56 -04:00
Nick
fa23c83bb1 Laplace limit. (#409) 2020-07-27 21:26:24 -04:00
Nick
326faa4c28 Reciprocal Fibonacci constant and Dottie number. (#407) 2020-07-25 09:26:38 -04:00
Nick
8792935679 Engel expansions (#404) 2020-07-20 09:51:17 -04:00
Nick
ee2cd5d5e5 Luroth expansions (#401) 2020-07-18 09:28:39 -04:00
NAThompson
758288bc7b Typos in docs [CI SKIP] 2020-07-12 14:05:25 -04:00
NAThompson
696145aed2 Do not add newline to ostream operator of simple_continued_fraction; let the user. Also, remove some typos from the docs. 2020-07-12 13:51:13 -04:00
Matt Borland
699d326f64 Implemented mode and associated tests (#390)
* Implemented mode and associated tests

* Clarity and complexity changes

* Added google benchmark

* Small changes to mode. More tests.

* Seperated into sorted and non-sorted functions

* Fixed data types and removed copying

* Fixed bounds checking

* Additional tests and cleanup.

* Added tests for std::list and std::forward_list

* Small testing changes and documentation

* Added modes memory allocation and faster insertion

* Changed return type, and modified tests

* Removed copied iterator and edge cases.

* Documentation fixes
2020-07-09 13:28:29 -04:00
jzmaddock
b5d925de98 Minor update for pow<N>():
Add a few more constexpr tests for the corner cases.
Document the constexpr-ness.
See https://github.com/boostorg/math/issues/354.
2020-07-06 19:29:28 +01:00
Nick
fbb62f01c5 Centered continued fractions (#379)
* Centered continued fraction [CI SKIP]

* Document centered cfrac. [CI SKIP]

* Unit tests for centered continued fraction [CI SKIP]

* Kick off build.

* Fix syntax error in docs [CI SKIP]

* Fix ADL.
2020-06-28 14:20:52 -04:00
Nick
1ac89b2b02 Simple continued fraction (#377)
* Simple continued fraction [CI SKIP]

* Comments on error analysis [CI SKIP]

* Simple continued fraction [CI SKIP]

* Clarify comment and kick off build.
2020-06-26 14:50:04 -04:00
ambrish
3cc1ebef5e Update nc_chi_squared.qbk (#370)
* Update nc_chi_squared.qbk

* Update nc_chi_squared.qbk
2020-06-14 11:12:42 -04:00
NAThompson
a228b3337d Use consistent notation in nc_chi_squ [CI SKIP] 2020-06-11 15:21:23 -04:00
ambrish
6462f62a9e i tried removing non-essential "/ " symbols (#367)
* i tried removing  non-essential  "/ " symbols

* Update nc_chi_squared.qbk

* updated [nu]
2020-06-11 15:19:35 -04:00
Nick
4facb20ff9 Gauss's constant G:=1/agm(1,sqrt(2)) (#363) 2020-06-05 20:25:04 -04:00
Nick
4e0e8eb005 Add Feigenbaum constant. (#351)
* Add Feigenbaum constant.

* Add isnan to real_concept. Convert test_constants.cpp to math_unit_test.cpp.

* Reduce ULP tolerance to 2, which is the minimum that passes on my machine.

* Improvements to Feigenbaum.

* Ok this is pretty complicated . . . [CI SKIP]

* Take jzmaddock's suggestion to remove additions to real_concept.

* Remove test the demonstrates throw.

* Use BOOST_STATIC_ASSERT_MSG to retain C++03 compatibility.

* More precise conversion from binary to decimal.

* Plastic constant.

* Fix typos.

* New tests [CI SKIP]

* bugfix in test [CI SKIP]

* Update docs for new constants [CI SKIP]

* Fix outdated instructions [CI SKIP]

* Do C++11 check for new constants.

* Update constants.qbk [CI SKIP]

* Hopefully green up build

* Constants still *work* in C++03, but now they must be tested in C++11 mode.

* Remove boost::math::isnan.

* Test file requires C++17.
2020-06-04 21:57:38 -04:00
NAThompson
646005eaca Take care of overflow. [CI SKIP] 2020-05-31 11:35:46 -04: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
Nick
aa4b140b50 Update univariate_statistics.qbk
Document C++17 requirements.
2020-05-19 20:49:51 -04:00
Nick
b682c76f96 Update daubechies.qbk 2020-05-14 10:44:12 -04:00
Edward Diener
6d678efbf7 Change __BORLANDC__ to BOOST_BORLANDC and __CODEGEARC__ to BOOST_CODEGEARC, which is defined in Boost config for the Embarcadero non-clang-based compilers. (#345) 2020-05-06 11:46:51 -04:00
pabristow
82591fe56d [CI SKIP]Added missing include pow and regenerate rooting table with latest gcc 2020-04-28 17:25:43 +01:00
Nick
47e61a447c ULP plots (#341)
ULPs plots
2020-04-25 09:03:49 -04:00
Nick
c59659f4ed Reinch's modification to Clenshaw recurrence (#339)
* Reinch's modification to Clenshaw recurrence. [CI SKIP]

* Convert Chebyshev tests to math_unit_test.hpp

* Performance of translated Chebyshev Clenshaw recurrence. [CI SKIP]

* Prepare to use modified Clenshaw recurrence in Chebyshev transform.

* Remove unused headers from Chebyshev transform test [CI SKIP]

* Update Chebyshev transform tests to use math_unit_test.hpp
2020-04-25 09:01:05 -04:00
jzmaddock
cb98c2959d Integrate linux performance results,
Regenerate docs.
2020-04-04 09:27:17 +01:00
jzmaddock
08ce839e82 Update performance results on Win64. 2020-04-03 13:37:39 +01:00
Nick
58561d7f92 Add 2 Daubechies graphs to documentation. 2020-03-26 05:39:10 -04:00
Nick Thompson
73be25461d Merge branch 'develop' of https://github.com/boostorg/math into develop [CI SKIP] 2020-03-24 14:48:26 -04:00
Nick Thompson
0612173b9c Update roadmap [CI SKIP] 2020-03-24 14:48:17 -04:00
Nick
6038719753 Merge pull request #267 from boostorg/daubechies_attempt_2
Continuous Daubechies wavelets
2020-03-24 14:39:14 -04:00
jzmaddock
9af885b5fb Update history, regenerate docs.
[CI SKIP]
2020-03-24 13:06:05 +00:00
Nick
9ba1ce6f00 Improve docs and loosen tolerances for Windows. 2020-03-23 07:39:57 -04:00
Nick
2c85c98982 Document wavelet transform. Submit (mildly) failing unit test for transforms. [CI SKIP] 2020-03-22 20:15:10 -04:00
Nick
2af33f2725 Fix quintic hermite interpolation [CI SKIP] 2020-03-22 12:07:05 -04:00
Nick
5cbfdb554a Fix invalid read in cubic Hermite. [CI SKIP] 2020-03-22 11:22:36 -04:00