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

Merge pull request #863 from AtariDreams/Unused

Junk removal
This commit is contained in:
jzmaddock
2022-11-10 18:45:07 +00:00
committed by GitHub
58 changed files with 95 additions and 103 deletions

View File

@@ -142,7 +142,7 @@ The N+2 extrema can then be found using standard function minimisation technique
We now have a choice: multi-point exchange, or single point exchange.
In single point exchange, we move the control point nearest to the largest extrema to
the absissa value of the extrema.
the abscissa value of the extrema.
In multi-point exchange we swap all the current control points, for the locations
of the extrema.
@@ -317,7 +317,7 @@ retaining the last set of control points at each stage.
* Try using a smaller interval. It may also be possible to optimise over
one (small) interval, rescale the control points over a larger interval,
and then re-minimise.
* Keep absissa values small: use a change of variable to keep the abscissa
* Keep abscissa values small: use a change of variable to keep the abscissa
over, say \[0, b\], for some smallish value /b/.
[h4 References]

View File

@@ -285,9 +285,9 @@ of type `const RealType`, and /ca/ is an object of type `const arithmetic-type`
[table
[[Expression][Result Type][Notes]]
[[`RealType(cr)`][RealType]
[RealType is copy constructible.]]
[RealType is copy constructable.]]
[[`RealType(ca)`][RealType]
[RealType is copy constructible from the arithmetic types.]]
[RealType is copy constructable from the arithmetic types.]]
[[`r = cr`][RealType&][Assignment operator.]]
[[`r = ca`][RealType&][Assignment operator from the arithmetic types.]]
[[`r += cr`][RealType&][Adds cr to r.]]
@@ -468,7 +468,7 @@ object of a type convertible to `RealType`.
[[DistributionType::policy_type][RealType]
[The __Policy to use when evaluating functions that depend on this distribution.]]
[[d = cd][Distribution&][Distribution types are assignable.]]
[[Distribution(cd)][Distribution][Distribution types are copy constructible.]]
[[Distribution(cd)][Distribution][Distribution types are copy constructable.]]
[[pdf(cd, cr)][RealType][Returns the PDF of the distribution.]]
[[cdf(cd, cr)][RealType][Returns the CDF of the distribution.]]
[[cdf(complement(cd, cr))][RealType]

View File

@@ -610,7 +610,7 @@ accurate to at least 100 decimal digits (in practice that means at least 102 dig
Again for consistency use scientific format with a signed exponent.
For types with precision greater than a long double,
then if T is constructible `T `is constructible from a `const char*`
then if T is constructable `T `is constructable from a `const char*`
then it's directly constructed from the string,
otherwise we fall back on lexical_cast to convert to type `T`.
(Using a string is necessary because you can't use a numeric constant

View File

@@ -238,7 +238,7 @@
<span class="identifier">r</span><span class="special">[</span><span class="number">3.56</span><span class="special">]</span> <span class="special">=</span> <span class="number">2.0002</span><span class="special">;</span>
<span class="identifier">r</span><span class="special">[</span><span class="number">3.72</span><span class="special">]</span> <span class="special">=</span> <span class="number">2.0001</span><span class="special">;</span>
<span class="comment">// Let's discover the absissa that will generate a potential of exactly 3.0,</span>
<span class="comment">// Let's discover the abscissa that will generate a potential of exactly 3.0,</span>
<span class="comment">// start by creating 2 ranges for the x and y values:</span>
<span class="keyword">auto</span> <span class="identifier">x_range</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">adaptors</span><span class="special">::</span><span class="identifier">keys</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span>
<span class="keyword">auto</span> <span class="identifier">y_range</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">adaptors</span><span class="special">::</span><span class="identifier">values</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span>

View File

@@ -211,10 +211,10 @@
<span class="comment">// Now we can evaluate the spline wherever we please.</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">mt19937</span> <span class="identifier">gen</span><span class="special">;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">::</span><span class="identifier">uniform_real_distribution</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">absissa</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">()*</span><span class="identifier">step</span><span class="special">);</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">::</span><span class="identifier">uniform_real_distribution</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">abscissa</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">()*</span><span class="identifier">step</span><span class="special">);</span>
<span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">absissa</span><span class="special">(</span><span class="identifier">gen</span><span class="special">);</span>
<span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">abscissa</span><span class="special">(</span><span class="identifier">gen</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sin("</span> <span class="special">&lt;&lt;</span> <span class="identifier">x</span> <span class="special">&lt;&lt;</span> <span class="string">") = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sin</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">", spline interpolation gives "</span> <span class="special">&lt;&lt;</span> <span class="identifier">spline</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"cos("</span> <span class="special">&lt;&lt;</span> <span class="identifier">x</span> <span class="special">&lt;&lt;</span> <span class="string">") = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">cos</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">", spline derivative interpolation gives "</span> <span class="special">&lt;&lt;</span> <span class="identifier">spline</span><span class="special">.</span><span class="identifier">prime</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="special">}</span>

View File

@@ -226,8 +226,8 @@
digits). Again for consistency use scientific format with a signed exponent.
</p>
<p>
For types with precision greater than a long double, then if T is constructible
<code class="computeroutput"><span class="identifier">T</span> </code>is constructible from a
For types with precision greater than a long double, then if T is constructable
<code class="computeroutput"><span class="identifier">T</span> </code>is constructable from a
<code class="computeroutput"><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span></code> then it's directly constructed from the string,
otherwise we fall back on lexical_cast to convert to type <code class="computeroutput"><span class="identifier">T</span></code>.
(Using a string is necessary because you can't use a numeric constant since

View File

@@ -131,7 +131,7 @@
</td>
<td>
<p>
Distribution types are copy constructible.
Distribution types are copy constructable.
</p>
</td>
</tr>

View File

@@ -103,7 +103,7 @@
</td>
<td>
<p>
RealType is copy constructible.
RealType is copy constructable.
</p>
</td>
</tr>
@@ -120,7 +120,7 @@
</td>
<td>
<p>
RealType is copy constructible from the arithmetic types.
RealType is copy constructable from the arithmetic types.
</p>
</td>
</tr>

View File

@@ -230,7 +230,7 @@
</p>
<p>
In single point exchange, we move the control point nearest to the largest
extrema to the absissa value of the extrema.
extrema to the abscissa value of the extrema.
</p>
<p>
In multi-point exchange we swap all the current control points, for the locations
@@ -468,7 +468,7 @@
and then re-minimise.
</li>
<li class="listitem">
Keep absissa values small: use a change of variable to keep the abscissa
Keep abscissa values small: use a change of variable to keep the abscissa
over, say [0, b], for some smallish value <span class="emphasis"><em>b</em></span>.
</li>
</ul></div>

View File

@@ -65,7 +65,7 @@
</li>
<li class="listitem">
If any of the arguments is a user-defined class type, then the result type
is the first such class type that is constructible from all of the other
is the first such class type that is constructable from all of the other
argument types.
</li>
<li class="listitem">

View File

@@ -26,7 +26,7 @@ further analysis.
then it is treated as if it were of type `double` for the purposes of
further analysis.
# If any of the arguments is a user-defined class type, then the result type
is the first such class type that is constructible from all of the other
is the first such class type that is constructable from all of the other
argument types.
# If any of the arguments is of type `long double`, then the result is of type
`long double`.

View File

@@ -72,7 +72,7 @@ int main()
r[3.56] = 2.0002;
r[3.72] = 2.0001;
// Let's discover the absissa that will generate a potential of exactly 3.0,
// Let's discover the abscissa that will generate a potential of exactly 3.0,
// start by creating 2 ranges for the x and y values:
auto x_range = boost::adaptors::keys(r);
auto y_range = boost::adaptors::values(r);

View File

@@ -20,7 +20,7 @@
// Weisstein, Eric W. "Bessel Function Zeros." From MathWorld--A Wolfram Web Resource.
// http://mathworld.wolfram.com/BesselFunctionZeros.html
// Test values can be calculated using [@wolframalpha.com WolframAplha]
// Test values can be calculated using [@wolframalpha.com WolframAlpha]
// See also http://dlmf.nist.gov/10.21
//[bessel_errors_example_1

View File

@@ -20,7 +20,7 @@
// Weisstein, Eric W. "Bessel Function Zeros." From MathWorld--A Wolfram Web Resource.
// http://mathworld.wolfram.com/BesselFunctionZeros.html
// Test values can be calculated using [@wolframalpha.com WolframAplha]
// Test values can be calculated using [@wolframalpha.com WolframAlpha]
// See also http://dlmf.nist.gov/10.21
//[bessel_zero_example_1

View File

@@ -21,7 +21,7 @@
// Weisstein, Eric W. "Bessel Function Zeros." From MathWorld--A Wolfram Web Resource.
// http://mathworld.wolfram.com/BesselFunctionZeros.html
// Test values can be calculated using [@wolframalpha.com WolframAplha]
// Test values can be calculated using [@wolframalpha.com WolframAlpha]
// See also http://dlmf.nist.gov/10.21
//[bessel_zeros_example_1

View File

@@ -41,10 +41,10 @@ int main()
// Now we can evaluate the spline wherever we please.
std::mt19937 gen;
boost::random::uniform_real_distribution<double> absissa(0, v.size()*step);
boost::random::uniform_real_distribution<double> abscissa(0, v.size()*step);
for (size_t i = 0; i < 10; ++i)
{
double x = absissa(gen);
double x = abscissa(gen);
std::cout << "sin(" << x << ") = " << sin(x) << ", spline interpolation gives " << spline(x) << std::endl;
std::cout << "cos(" << x << ") = " << cos(x) << ", spline derivative interpolation gives " << spline.prime(x) << std::endl;
}

View File

@@ -580,7 +580,7 @@ int main(int argc, char** argv)
if (debug)
{
for (int64_t i = image_width / 2; i < image_width; ++i)
points[image_width * (image_height - 1) + i] = i & 1 ? 1 : 0;
points[image_width * (image_height - 1) + i] = i & 1;
}
//

View File

@@ -64,7 +64,7 @@ inline constexpr T abs(T x) noexcept
}
else
{
static_assert(sizeof(T) == 0, "Taking the absolute value of an unsigned value not covertible to int is UB.");
static_assert(sizeof(T) == 0, "Taking the absolute value of an unsigned value not convertible to int is UB.");
return T(0); // Unreachable, but suppresses warnings
}
}

View File

@@ -28,7 +28,7 @@ template <typename ReturnType, typename Z>
inline constexpr ReturnType div_impl(const Z x, const Z y) noexcept
{
// std::div_t/ldiv_t/lldiv_t/imaxdiv_t can be defined as either { Z quot; Z rem; }; or { Z rem; Z quot; };
// so don't use braced initialziation to guarantee compatibility
// so don't use braced initialization to guarantee compatibility
ReturnType ans {0, 0};
ans.quot = x / y;

View File

@@ -16,7 +16,6 @@
#include <limits>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/constants/constants.hpp>
namespace boost{ namespace math{ namespace detail{

View File

@@ -42,14 +42,14 @@ class distribution_archetype
public:
typedef RealType value_type;
distribution_archetype(const distribution_archetype&); // Copy constructible.
distribution_archetype(const distribution_archetype&); // Copy constructable.
distribution_archetype& operator=(const distribution_archetype&); // Assignable.
// There is no default constructor,
// but we need a way to instantiate the archetype:
static distribution_archetype& get_object()
{
// will never get caled:
// will never get called:
return *reinterpret_cast<distribution_archetype*>(nullptr);
}
}; // template <class RealType>class distribution_archetype

View File

@@ -136,14 +136,14 @@ class fvar {
// Initialize a variable or constant.
fvar(root_type const&, bool const is_variable);
// RealType(cr) | RealType | RealType is copy constructible.
// RealType(cr) | RealType | RealType is copy constructable.
fvar(fvar const&) = default;
// Be aware of implicit casting from one fvar<> type to another by this copy constructor.
template <typename RealType2, size_t Order2>
fvar(fvar<RealType2, Order2> const&);
// RealType(ca) | RealType | RealType is copy constructible from the arithmetic types.
// RealType(ca) | RealType | RealType is copy constructable from the arithmetic types.
explicit fvar(root_type const&); // Initialize a constant. (No epsilon terms.)
template <typename RealType2>

View File

@@ -151,7 +151,7 @@ namespace boost
return dist.success_fraction();
} // mean
// Rely on dereived_accessors quantile(half)
// Rely on derived_accessors quantile(half)
//template <class RealType>
//inline RealType median(const bernoulli_distribution<RealType, Policy>& dist)
//{ // Median of bernoulli distribution is not defined.

View File

@@ -554,7 +554,6 @@ namespace boost
// for this distribution have been defined, in order to
// keep compilers that support two-phase lookup happy.
#include <boost/math/distributions/detail/derived_accessors.hpp>
#include <boost/math/distributions/detail/inv_discrete_quantile.hpp>
#endif // BOOST_MATH_SPECIAL_POISSON_HPP

View File

@@ -362,7 +362,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::kurtosis_execess(const uniform_distribution<%1%>&)", lower, upper, &result, Policy()))
if(false == detail::check_uniform("boost::math::kurtosis_excess(const uniform_distribution<%1%>&)", lower, upper, &result, Policy()))
{
return result;
}

View File

@@ -112,7 +112,7 @@ public:
using std::fma;
// control_points_.size() == n + 1
RandomAccessContainer c(control_points_.size() + 1);
// This is the constant of integration, chosen arbitarily to be zero:
// This is the constant of integration, chosen arbitrarily to be zero:
for (Z j = 0; j < control_points_[0].size(); ++j) {
c[0][j] = Real(0);
}

View File

@@ -192,7 +192,7 @@ cardinal_cubic_b_spline_imp<Real>::cardinal_cubic_b_spline_imp(BidiIterator f, B
// There are, in fact 5 diagonals, but they only differ from zero on the first and last row,
// so we can patch up the tridiagonal row reduction algorithm to deal with two special rows.
// See Kress, equations 8.41
// The the "tridiagonal" matrix is:
// The "tridiagonal" matrix is:
// 1 0 -1
// 1 4 1
// 1 4 1

View File

@@ -50,7 +50,7 @@ public:
auto integrate(const F f, Real tolerance, Real* error, Real* L1, std::size_t* levels)->decltype(std::declval<F>()(std::declval<Real>())) const;
private:
private:
const std::vector<Real>& get_abscissa_row(std::size_t n)const
{
#if !defined(BOOST_MATH_NO_ATOMIC_INT) && defined(BOOST_HAS_THREADS)

View File

@@ -1439,7 +1439,7 @@ T ibeta_derivative_imp(T a, T b, T x, const Policy& pol)
return f1;
}
//
// Some forwarding functions that dis-ambiguate the third argument type:
// Some forwarding functions that disambiguate the third argument type:
//
template <class RT1, class RT2, class Policy>
inline typename tools::promote_args<RT1, RT2>::type

View File

@@ -155,7 +155,7 @@ inline bool asymptotic_bessel_large_x_limit(const T& v, const T& x)
}
template <class T, class Policy>
void temme_asyptotic_y_small_x(T v, T x, T* Y, T* Y1, const Policy& pol)
void temme_asymptotic_y_small_x(T v, T x, T* Y, T* Y1, const Policy& pol)
{
T c = 1;
T p = (v / boost::math::sin_pi(v, pol)) * pow(x / 2, -v) / boost::math::tgamma(1 - v, pol);

View File

@@ -213,4 +213,4 @@ inline T bessel_y_derivative_small_z_series(T v, T x, const Policy& pol)
}}} // namespaces
#endif // BOOST_MATH_BESSEL_JY_DERIVATVIES_SERIES_HPP
#endif // BOOST_MATH_BESSEL_JY_DERIVATIVES_SERIES_HPP

View File

@@ -247,7 +247,7 @@
if (have_no_correct_bits)
{
// We have no correct bits in the result... just give up!
result = boost::math::policies::raise_evaluation_error("boost::math::hypergeometric_pFq<%1%>", "Cancellation is so severe that no bits in the reuslt are correct, last result was %1%", Real(result * exp(Real(log_scale))), pol);
result = boost::math::policies::raise_evaluation_error("boost::math::hypergeometric_pFq<%1%>", "Cancellation is so severe that no bits in the result are correct, last result was %1%", Real(result * exp(Real(log_scale))), pol);
return std::make_pair(result, result);
}
else

View File

@@ -1263,7 +1263,3 @@ inline typename tools::promote_args<T>::type erfc(T z)
#include <boost/math/special_functions/detail/erf_inv.hpp>
#endif // BOOST_MATH_SPECIAL_ERF_HPP

View File

@@ -1275,7 +1275,7 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert,
else if(x < 1.1)
{
//
// Changover here occurs when P ~ 0.75 or Q ~ 0.25:
// Changeover here occurs when P ~ 0.75 or Q ~ 0.25:
//
if(x * 0.75f < a)
{

View File

@@ -683,7 +683,7 @@ z * (2.154990206091088289321708745358647e6L // z^20 distance -5 without term 20
// N[InverseSeries[Series[z Exp[z],{z,0,34}]],50],
// and are suffixed by L as they are assumed of type long double.
// (This is NOT used for 128-bit quad boost::multiprecision::float128 type which required a suffix Q
// nor multiprecision type cpp_bin_float_quad that can only be initialised at full precision of the type
// nor multiprecision type cpp_bin_float_quad that can only be initialized at full precision of the type
// constructed with a decimal digit string like "2.6666666666666666666666666666666666666666666666667".)
template <typename T, typename Policy>

View File

@@ -223,7 +223,6 @@ namespace boost {
*it = fill;
}
private:
const int flags_;
};
@@ -573,7 +572,6 @@ namespace boost {
return !*s;
} // bool match_string
private:
const int flags_;
}; //

View File

@@ -170,7 +170,7 @@ inline typename tools::promote_args<T1, T2>::type
{
typedef typename tools::promote_args<T1, T2>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
return policies::checked_narrowing_cast<result_type, Policy>(detail::spherical_harmonic_r(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi), pol), "bost::math::spherical_harmonic_r<%1%>(unsigned, int, %1%, %1%)");
return policies::checked_narrowing_cast<result_type, Policy>(detail::spherical_harmonic_r(n, m, static_cast<value_type>(theta), static_cast<value_type>(phi), pol), "boost::math::spherical_harmonic_r<%1%>(unsigned, int, %1%, %1%)");
}
template <class T1, class T2>

View File

@@ -168,9 +168,6 @@
#include <cmath>
#include <climits>
#include <cfloat>
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
# include <math.h>
#endif
#include <boost/math/tools/user.hpp>

View File

@@ -29,7 +29,7 @@ namespace boost{ namespace math{ namespace tools{
#ifdef BOOST_MATH_NO_LEXICAL_CAST
// This function should not compile, we don't have the necessary functionality to support it:
static_assert(sizeof(Real) == 0, "boost.lexical_cast is not supported in standalone mode.");
(void)p; // Supresses -Wunused-parameter
(void)p; // Suppresses -Wunused-parameter
return Real(0);
#else
return boost::lexical_cast<Real>(p);

View File

@@ -221,7 +221,7 @@ subresultant_gcd(polynomial<T> u, polynomial<T> v)
* The multi-precision constraint is enforced via numeric_limits.
*
* Note that intermediate terms in the evaluation can grow arbitrarily large, hence the need for
* unbounded integers, otherwise numeric loverflow would break the algorithm.
* unbounded integers, otherwise numeric overflow would break the algorithm.
*
* @tparam T A multi-precision integral type.
*/

View File

@@ -182,8 +182,8 @@ struct log_limit_traits
std::integral_constant<int, (std::numeric_limits<T>::max_exponent > INT_MAX ? INT_MAX : static_cast<int>(std::numeric_limits<T>::max_exponent))>,
std::integral_constant<int, 0>
>::type tag_type;
static constexpr bool value = tag_type::value ? true : false;
static_assert(::std::numeric_limits<T>::is_specialized || (value == 0), "Type T must be specialized or equal to 0");
static constexpr bool value = (tag_type::value != 0);
static_assert(::std::numeric_limits<T>::is_specialized || !value, "Type T must be specialized or equal to 0");
};
template <class T, bool b> struct log_limit_noexcept_traits_imp : public log_limit_traits<T> {};

View File

@@ -68,7 +68,7 @@ inline T create_test_value(largest_float val, const char*, const std::true_type&
template <class T>
inline T create_test_value(largest_float, const char* str, const std::false_type&, const std::true_type&)
{ // Construct from decimal digit string const char* @c str (ignoring long double parameter).
// For example, extended precision or other User-Defined types which ARE constructible from a string
// For example, extended precision or other User-Defined types which ARE constructable from a string
// (but not from double, or long double without loss of precision).
// (This is case for MPL parameters = false_type and T2 == true_type).
#ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
@@ -80,8 +80,8 @@ inline T create_test_value(largest_float, const char* str, const std::false_type
template <class T>
inline T create_test_value(largest_float, const char* str, const std::false_type&, const std::false_type&)
{ // Create test value using from lexical cast of decimal digit string const char* str.
// For example, extended precision or other User-Defined types which are NOT constructible from a string
// (NOR constructible from a long double).
// For example, extended precision or other User-Defined types which are NOT constructable from a string
// (NOR constructable from a long double).
// (This is case T1 = false_type and T2 == false_type).
#ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
create_type = 3;

View File

@@ -10,6 +10,10 @@
#pragma once
#endif
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
# include <math.h>
#endif
#include <boost/math/tools/config.hpp>
namespace boost{ namespace math{ namespace tools{

View File

@@ -29,10 +29,10 @@
// basic_ellint_rational_performance<double> 1.6
//
// We can in fact get basic_ellint_rational_performance to much the same performance as log
// ONLY if we remove all error hangling for cases with m > 0.9. In particular the code appears
// ONLY if we remove all error handling for cases with m > 0.9. In particular the code appears
// to be ultra-sensitive to the presence of "if" statements which significantly hamper optimisation.
//
// Performance with gcc-cygwin appears to be broasly similar.
// Performance with gcc-cygwin appears to be broadly similar.
//
#include <vector>
#include <benchmark/benchmark.h>

View File

@@ -279,11 +279,11 @@ void test_trig_function()
boost::math::interpolators::cardinal_cubic_b_spline<Real> spline(v.data(), v.size(), x0, step);
boost::random::uniform_real_distribution<Real> absissa(x0, x0 + 499 * step);
boost::random::uniform_real_distribution<Real> abscissa(x0, x0 + 499 * step);
for (size_t i = 0; i < v.size(); ++i)
{
Real x = absissa(gen);
Real x = abscissa(gen);
Real y = spline(x);
BOOST_CHECK_CLOSE(y, sin(x), 1.0);
auto y_prime = spline.prime(x);

View File

@@ -29,7 +29,7 @@ void test()
{
static_assert(boost::math::ccmath::isnan(std::numeric_limits<T>::signaling_NaN()), "Signaling NAN failed");
}
static_assert(!boost::math::ccmath::isnan(std::numeric_limits<T>::infinity()), "Infininty failed");
static_assert(!boost::math::ccmath::isnan(std::numeric_limits<T>::infinity()), "Infinity failed");
static_assert(!boost::math::ccmath::isnan(T(0)), "Real 0 failed");
}

View File

@@ -166,7 +166,7 @@ void test_translated_clenshaw_recurrence()
// it shows they are doing roughly the same thing.
Real computed = chebyshev_clenshaw_recurrence(c.data(), c.size(), Real(-1), Real(1), x);
if (!CHECK_ULP_CLOSE(expected, computed, 1000)) {
std::cerr << " Problem occured at x = " << x << "\n";
std::cerr << " Problem occurred at x = " << x << "\n";
}
}
}

View File

@@ -21,9 +21,9 @@
// These next 2 should be solvable by A&S 13.3.6 (which does converge nicely for these inputs) but gives the wrong results:
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the reuslt are correct, last result was 3.0871891698197084e+73
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73
{ { SC_(-5.9981750131794866e-15), SC_(0.499999999999994), SC_(-240.42092034220695), SC_(1.00000000000004464930530925572237133417488137) }},
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the reuslt are correct, last result was 3.0871891698197084e+73
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73
{ { SC_(-5.9981750131794866e-15), SC_(-0.500000000000006), SC_(-240.42092034220695), SC_(1.00000000000003262784934420226963147689063665) }},
// This one is not too awful, we simply have no better method to improve the error rate:

View File

@@ -21,7 +21,7 @@ static RealType zs[450];
template <typename RealType>
static RealType ws[450];
// The values are defined using the macro BOOST_MATH_TEST_VALUE to ensure
// that both built-in and multiprecision types are correctly initialiased with full precision.
// that both built-in and multiprecision types are correctly initialized with full precision.
// built-in types like float, double require a floating-point literal like 3.14,
// but multiprecision types require a decimal digit string like "3.14".
// Numerical values are chosen to avoid exactly representable values.

View File

@@ -13,7 +13,7 @@
static const unsigned int noof_tests = 100;
// Declare arrays of arguments z and Lambert W(z)
// The values are defined using the macro BOOST_MATH_TEST_VALUE to ensure
// that both built-in and multiprecision types are correctly initialiased with full precision.
// that both built-in and multiprecision types are correctly initialized with full precision.
// built-in types like double require a floating-point literal like 3.14,
// but multiprecision types require a decimal digit string like "3.14".

View File

@@ -207,13 +207,13 @@ void test_spots6(T, const char* type_name)
{ { static_cast<double>(5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(-1.74381782591884817018404492963109914357365958e+193) }},
// Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -9.61305077326281580724540507004198316499661687e+268 Expected : 1.74381782591870724567837900957146707932623893e+193
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(1.74381782591870734495565763481520223752372107e+193) }},
//Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the reuslt are correct, last result was - 13497.312248525042
//Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was - 13497.312248525042
{ { static_cast<double>(-0.00023636552788275367), static_cast<double>(0.49976363447211725), static_cast<double>(-55.448519088327885), SC_(1.00141219419064760011631555641142295011268795) }},
// Unexpected exception: Error in function boost::math::hypergeometric_pFq<long double>: Cancellation is so severe that no bits in the reuslt are correct, last result was -13497.312248525042
// Unexpected exception: Error in function boost::math::hypergeometric_pFq<long double>: Cancellation is so severe that no bits in the result are correct, last result was -13497.312248525042
{{ static_cast<double>(-0.00023636552788275367), static_cast<double>(-0.50023636552788275), static_cast<double>(-55.448519088327885), SC_(1.00093463146763986302362749764017215184711625) }},
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the reuslt are correct, last result was - 1.3871133003351527e+47
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was - 1.3871133003351527e+47
{ { static_cast<double>(-1.6548533913638905e-10), static_cast<double>(0.49999999983451465), static_cast<double>(-169.20843148231506), SC_(1.00000000117356793527360151094991866549128017) }},
// Unexpected exception: Error in function boost::math::hypergeometric_pFq<long double>: Cancellation is so severe that no bits in the reuslt are correct, last result was -1.3871133003351527e+47
// Unexpected exception: Error in function boost::math::hypergeometric_pFq<long double>: Cancellation is so severe that no bits in the result are correct, last result was -1.3871133003351527e+47
{{ static_cast<double>(-1.6548533913638905e-10), static_cast<double>(-0.50000000016548529), static_cast<double>(-169.20843148231506), SC_(1.00000000084161045914716192484600809610013447) }},
// Unexpected high error : 17825.7893791562892147339880466461181640625 Found : -0.000253525216373273569459012577453904668800532818 Expected : -0.000253525216374277052779756536082800266740377992
{ { static_cast<double>(-2.0211181797563725e-14), static_cast<double>(-1.0000000000000202), static_cast<double>(-25.653068032115698), SC_(-0.000253525216374277055047768086884693917115210113) }},
@@ -225,9 +225,9 @@ void test_spots6(T, const char* type_name)
{ { static_cast<double>(5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(-1.74381782591884817018404492963109914357365958e+193) }},
// Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -9.61305077326281580724540507004198316499661687e+268 Expected : 1.74381782591870724567837900957146707932623893e+193
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(1.74381782591870734495565763481520223752372107e+193) }},
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the reuslt are correct, last result was 3.0871891698197084e+73
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(0.499999999999994), static_cast<double>(-240.42092034220695), SC_(1.00000000000004464930530925572237133417488137) }},
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the reuslt are correct, last result was 3.0871891698197084e+73
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(-0.500000000000006), static_cast<double>(-240.42092034220695), SC_(1.00000000000003262784934420226963147689063665) }},
// Unexpected high error : 18466.4373304979599197395145893096923828125 Found : 1.32865406167486480872551302123696359558380209e-08 Expected : 1.3286540616694168317751162703647255236560909e-08
{ { static_cast<double>(6.772927684190258e-10), static_cast<double>(-0.99999999932270722), static_cast<double>(-483.69576895236969), SC_(1.32865406166941679958876322759721528297325713e-08) }},

View File

@@ -33,7 +33,7 @@ void expected_results()
".*", // stdlib
".*", // platform
".*", // test type(s)
".*Wolfram Alpha.*", // test data group
".*WolframAlpha.*", // test data group
".*", 60, 15); // test function
// Catch all cases come last:

View File

@@ -286,10 +286,10 @@ void test_spots(T, const char* type_name)
// {{ SC_(0.0), SC_(0.9921875), SC_(0.0) }},
}};
do_test_jacobi_theta1<T>(data1, type_name, "Jacobi Theta 1: Wolfrom Alpha Data");
do_test_jacobi_theta2<T>(data2, type_name, "Jacobi Theta 2: Wolfram Alpha Data");
do_test_jacobi_theta3<T>(data3, type_name, "Jacobi Theta 3: Wolfram Alpha Data");
do_test_jacobi_theta4<T>(data4, type_name, "Jacobi Theta 4: Wolfram Alpha Data");
do_test_jacobi_theta1<T>(data1, type_name, "Jacobi Theta 1: WolframAlpha Data");
do_test_jacobi_theta2<T>(data2, type_name, "Jacobi Theta 2: WolframAlpha Data");
do_test_jacobi_theta3<T>(data3, type_name, "Jacobi Theta 3: WolframAlpha Data");
do_test_jacobi_theta4<T>(data4, type_name, "Jacobi Theta 4: WolframAlpha Data");
#include "jacobi_theta_data.ipp"

View File

@@ -66,7 +66,7 @@ inline T create_test_value(largest_float val, const char*, const std::true_type&
template <class T>
inline T create_test_value(largest_float, const char* str, const std::false_type&, const std::true_type&)
{ // Construct from decimal digit string const char* @c str (ignoring long double parameter).
// For example, extended precision or other User-Defined types which ARE constructible from a string
// For example, extended precision or other User-Defined types which ARE constructable from a string
// (but not from double, or long double without loss of precision).
// (This is case for MPL parameters = false_type and T2 == true_type).
#ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
@@ -78,8 +78,8 @@ inline T create_test_value(largest_float, const char* str, const std::false_type
template <class T>
inline T create_test_value(largest_float, const char* str, const std::false_type&, const std::false_type&)
{ // Create test value using from lexical cast of decimal digit string const char* str.
// For example, extended precision or other User-Defined types which are NOT constructible from a string
// (NOR constructible from a long double).
// For example, extended precision or other User-Defined types which are NOT constructable from a string
// (NOR constructable from a long double).
// (This is case T1 = false_type and T2 == false_type).
#ifdef BOOST_MATH_INSTRUMENT_CREATE_TEST_VALUE
create_type = 3;

View File

@@ -150,7 +150,6 @@ void calculate_terms(double sigma, double a, unsigned bits)
cout << "Print code [0|1]? ";
cin >> code;
int prec = 2 + (static_cast<double>(bits) * 3010LL)/10000;
std::cout << std::scientific << std::setprecision(40);
if(code)

View File

@@ -103,7 +103,7 @@ int main()
<< std::endl;
fout << "// The values are defined using the macro BOOST_MATH_TEST_VALUE to ensure\n"
"// that both built-in and multiprecision types are correctly initialiased with full precision.\n"
"// that both built-in and multiprecision types are correctly initialized with full precision.\n"
"// built-in types like float, double require a floating-point literal like 3.14,\n"
"// but multiprecision types require a decimal digit string like \"3.14\".\n"
"// Numerical values are chosen to avoid exactly representable values."

View File

@@ -163,7 +163,7 @@ int main()
fout << "// Declare arrays of arguments z and Lambert W(z)" << std::endl;
fout << "// The values are defined using the macro BOOST_MATH_TEST_VALUE to ensure\n"
"// that both built-in and multiprecision types are correctly initialiased with full precision.\n"
"// that both built-in and multiprecision types are correctly initialized with full precision.\n"
"// built-in types like double require a floating-point literal like 3.14,\n"
"// but multiprecision types require a decimal digit string like \"3.14\".\n"
<< std::endl;
@@ -224,7 +224,7 @@ int main()
/*
start and finish checks again Wolfram Alpha:
start and finish checks again WolframAlpha:
ws<RealType>[0] = BOOST_MATH_TEST_VALUE(RealType, -0.7166388164560738505881698000038650406110575701385055261614344530078353170171071547711151137001759321);
Wolfram N[productlog(-0.35), 100] -0.7166388164560738505881698000038650406110575701385055261614344530078353170171071547711151137001759321

View File

@@ -267,13 +267,13 @@ void do_test(T, const char* name)
// Do the tests at the zeros:
//
std::cout << "Starting tests at " << name << " precision...\n";
std::cout << "Absissa Error (Poly) Error (Cheb)\n";
std::cout << "Abscissa Error (Poly) Error (Cheb)\n";
for(unsigned i = 0; i < zeros.size(); ++i)
{
mp_type true_result = the_function(zeros[i]);
T absissa = boost::math::tools::real_cast<T>(zeros[i]);
mp_type test_result = convert_to_rr(n.evaluate(absissa) / d.evaluate(absissa));
mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, absissa) / boost::math::tools::evaluate_chebyshev(cd, absissa));
T abscissa = boost::math::tools::real_cast<T>(zeros[i]);
mp_type test_result = convert_to_rr(n.evaluate(abscissa) / d.evaluate(abscissa));
mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, abscissa) / boost::math::tools::evaluate_chebyshev(cd, abscissa));
mp_type err, cheb_err;
if(rel_error)
{
@@ -289,7 +289,7 @@ void do_test(T, const char* name)
max_error = err;
if(cheb_err > cheb_max_error)
cheb_max_error = cheb_err;
std::cout << std::setprecision(6) << std::setw(15) << std::left << absissa
std::cout << std::setprecision(6) << std::setw(15) << std::left << abscissa
<< std::setw(15) << std::left << boost::math::tools::real_cast<T>(err) << boost::math::tools::real_cast<T>(cheb_err) << std::endl;
}
//
@@ -298,9 +298,9 @@ void do_test(T, const char* name)
for(unsigned i = 0; i < cheb.size(); ++i)
{
mp_type true_result = the_function(cheb[i]);
T absissa = boost::math::tools::real_cast<T>(cheb[i]);
mp_type test_result = convert_to_rr(n.evaluate(absissa) / d.evaluate(absissa));
mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, absissa) / boost::math::tools::evaluate_chebyshev(cd, absissa));
T abscissa = boost::math::tools::real_cast<T>(cheb[i]);
mp_type test_result = convert_to_rr(n.evaluate(abscissa) / d.evaluate(abscissa));
mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, abscissa) / boost::math::tools::evaluate_chebyshev(cd, abscissa));
mp_type err, cheb_err;
if(rel_error)
{
@@ -314,7 +314,7 @@ void do_test(T, const char* name)
}
if(err > max_error)
max_error = err;
std::cout << std::setprecision(6) << std::setw(15) << std::left << absissa
std::cout << std::setprecision(6) << std::setw(15) << std::left << abscissa
<< std::setw(15) << std::left << boost::math::tools::real_cast<T>(err) <<
boost::math::tools::real_cast<T>(cheb_err) << std::endl;
}
@@ -401,15 +401,15 @@ void do_test_n(T, const char* name, unsigned count)
// Do the tests at the zeros:
//
std::cout << "Starting tests at " << name << " precision...\n";
std::cout << "Absissa Error (poly) Error (Cheb)\n";
std::cout << "Abscissa Error (poly) Error (Cheb)\n";
for(mp_type x = a; x <= b; x += step)
{
mp_type true_result = the_function(x);
//std::cout << true_result << std::endl;
T absissa = boost::math::tools::real_cast<T>(x);
mp_type test_result = convert_to_rr(n.evaluate(absissa) / d.evaluate(absissa));
T abscissa = boost::math::tools::real_cast<T>(x);
mp_type test_result = convert_to_rr(n.evaluate(abscissa) / d.evaluate(abscissa));
//std::cout << test_result << std::endl;
mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, absissa) / boost::math::tools::evaluate_chebyshev(cd, absissa));
mp_type cheb_result = convert_to_rr(boost::math::tools::evaluate_chebyshev(cn, abscissa) / boost::math::tools::evaluate_chebyshev(cd, abscissa));
//std::cout << cheb_result << std::endl;
mp_type err, cheb_err;
if(rel_error)
@@ -426,7 +426,7 @@ void do_test_n(T, const char* name, unsigned count)
max_error = err;
if(cheb_err > max_cheb_error)
max_cheb_error = cheb_err;
std::cout << std::setprecision(6) << std::setw(15) << std::left << boost::math::tools::real_cast<double>(absissa)
std::cout << std::setprecision(6) << std::setw(15) << std::left << boost::math::tools::real_cast<double>(abscissa)
<< (test_result < true_result ? "-" : "") << std::setw(20) << std::left
<< boost::math::tools::real_cast<double>(err)
<< boost::math::tools::real_cast<double>(cheb_err) << std::endl;