2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-24 06:02:08 +00:00

197 Commits

Author SHA1 Message Date
ryanelandt
2c74b149b0 has_denorm_now (#1029)
* initial commit

* remove == std::denorm_present

* remove extra ) in ccmath/next
2023-10-30 09:37:29 +01:00
Nick
7887d43f83 Numerical evaluation of Fourier transform of Daubechies scaling funct… (#921)
* Numerical evaluation of Fourier transform of Daubechies scaling functions.

* Update example/calculate_fourier_transform_daubechies_constants.cpp

Co-authored-by: Matt Borland <matt@mattborland.com>

* Update example/fourier_transform_daubechies_ulp_plot.cpp

Co-authored-by: Matt Borland <matt@mattborland.com>

* Update include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp

Co-authored-by: Matt Borland <matt@mattborland.com>

* Update include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp

Co-authored-by: Matt Borland <matt@mattborland.com>

* Rename include file to reflect it implements both the scaling and wavelet.

* Add performance to docs.

* Update test/math_unit_test.hpp

Co-authored-by: Matt Borland <matt@mattborland.com>

* Add boost-no-inspect to files with non-ASCII characters.

---------

Co-authored-by: Matt Borland <matt@mattborland.com>
2023-06-13 08:05:00 -07:00
jzmaddock
aad4f85955 Improve powm1 error handling.
Makes 0^-n an overflow error (which matches std::pow which returns +INF rather than a NaN).
Fixes https://github.com/boostorg/math/issues/781.
2022-11-24 18:43:32 +00:00
jzmaddock
10bd7be0f1 ellint_1/2 performance tweaks.
Add Google bench to probe changes more easily.
Update graphs and docs.
2022-08-17 19:21:03 +01:00
Matt Borland
1cbf7e2c3d constexpr signbit (#793)
Implements constexpr signbit with annotated caveats during compile time.
2022-07-02 11:47:03 -07:00
Matt Borland
ae0fe3d751 Constexpr next (#789)
Implements constexpr: nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, and nexttowardl as described in P0533R9
2022-06-29 08:44:54 -07:00
Matt Borland
3107abaa8a Constexpr fma (#734)
* constexpr fma

* Improve use of intrinsics for calculation

* Changes to intrinsics and address sonarlint comments
2022-05-30 13:35:54 -07:00
jzmaddock
b5589965e6 Update history and regenerate docs.
Also fix some missing documentation links.
[CI SKIP]
2022-03-08 15:56:22 +00:00
Matt Borland
e8c40e309c Implement logaddexp (#763)
* Implement logaddexp

* Disable test for ASAN

* Implement logsumexp

* Add performance file and include results in the docs

* Address review comments

* Simplify overflow test and comply with min/max guidelines

* Minor cleanup

* FIxes to comments and docs [ci skip]

* Return status code.

Co-authored-by: Nick Thompson <nathompson7@protonmail.com>
2022-02-24 07:55:25 -08:00
Matt Borland
50008bb6ba constexpr isunordered (#745) 2022-01-21 08:07:07 -08:00
Matt Borland
18a0874056 Constexpr comparison functions (#736) 2022-01-09 09:28:13 -08:00
Matt Borland
9e369be7a4 Constexpr fmin and fmax (#732) 2022-01-06 11:02:41 -08:00
Matt Borland
3ce09d5739 Constexpr fdim (#730) 2022-01-05 07:01:22 -08:00
Matt Borland
181831c0ab Constexpr hypot (#721) 2021-11-27 16:33:11 -07:00
Matt Borland
7339acd01a constexpr copysign (#701)
* constexpr copysign

* Fix for mingw test failure
2021-10-10 10:38:26 -07:00
Matt Borland
8e8f6ec4be constexpr remainder (#700) 2021-10-06 10:42:02 -07:00
Matt Borland
6d5aeb08ea constexpr fmod (#699)
* constexpr fmod

* Fix for old clang versions
2021-10-02 08:07:14 -07:00
Matt Borland
392a1c016d constexpr round (#697) 2021-09-27 09:01:47 -07:00
Matt Borland
3e89a0dabd constexpr modf (#696) 2021-09-24 11:09:25 -07:00
Matt Borland
5d6236fb08 Implement, test, and document trunc (#695) 2021-09-21 09:20:43 -07:00
Matt Borland
991fcff33d constexpr floor and ceil (#694) 2021-09-20 09:51:59 -07:00
Matt Borland
4ad861217d constexpr scalbn and scalbln (#693) 2021-09-18 10:12:47 -07:00
Matt Borland
c0383edcea Constexpr logb and ilogb 2021-09-17 21:05:07 +03:00
Matt Borland
3b75b350a4 constexpr div (#691) 2021-09-15 11:51:06 -07:00
Matt Borland
c0e7a1fa56 Fix docs 2021-09-06 21:47:29 +03:00
Matt Borland
0a69c93a31 Initial commit 2021-09-06 21:39:35 +03:00
Matt Borland
0bbea8d8f9 constexpr frexp (#686) 2021-09-06 11:27:27 -07:00
Matt Borland
d8fe127b82 constexpr fpclassify (#679)
* Implement fpclassify and tests
2021-08-25 13:43:43 -07:00
Matt Borland
a4d5ae7177 Constexpr isfinite and isnormal (#674) 2021-08-23 21:47:41 -07:00
Matt Borland
564967785f Constexpr abs/fabs (#672)
* Initial commit

* Move error handling to impl

* Validate tests for float

* Test other types

* Add tests for types that are convertible to int

* Add include test

* Update docs

* Add fabs overloads

* Add fabs to docs

* Add missing header to tests

* Fix for old versions of clang and cleanup naming conventions

* Update jamfile

* Add glibcxx constexpr cmath tests and fix docs

* Use equality in testing instead of tolerance
2021-08-16 22:08:12 -07:00
Matt Borland
98b0cf1f11 Doc fixes and convert to C++17 format [ci skip] 2021-07-23 22:03:31 +03:00
Matt Borland
30b4d23f20 Add documentation 2021-07-20 21:06:32 +03:00
jzmaddock
d4de174bbb Prep for 1.77:
Rework hypergeometric distro equations.
Fix up Fibonacci docs.
Fix Fibonacci constexpr and noexcept usage and add to testing.
Regenerate docs.
2021-06-27 19:38:05 +01:00
pabristow
4382d2a7c6 More changes to hypergeometric distribution documentation. 2021-06-16 11:42:37 +01:00
jzmaddock
f69c712d79 Fix broken link to lambert_w graph.
Remove CircleCI asan tests.
2021-03-30 18:50:40 +01:00
Matt Borland
9c243dbb49 Replace <boost/config> w <boost/math/tools/config> 2021-03-23 21:38:13 +03:00
Matt Borland
26711525ca Remove uses of boost/cstdint without header called 2021-03-21 16:13:10 +03:00
Matt Borland
0339733a79 Replace BOOST_STATIC_ASSERT with static_assert
and add useful error messages
2021-03-14 22:06:15 +03:00
Matt Borland
fbadd8d653 remove boost.static_assert 2021-03-14 12:49:38 +03: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
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
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
b682c76f96 Update daubechies.qbk 2020-05-14 10:44:12 -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
Nick
58561d7f92 Add 2 Daubechies graphs to documentation. 2020-03-26 05:39:10 -04:00
NAThompson
8c621d8be4 Sketch out Daubechies wavelet class [CI SKIP] 2020-03-10 07:15:52 -04:00
Nick Thompson
0661b37716 Remove typos from docs. 2020-03-08 11:37:08 -04:00