mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Remove unused typedef. Fix dangling reference to policy in airy. Pipe unused variables in compile test to /dev/null to suppress compiler warnings. Remove comment within comment.
This commit is contained in:
@@ -246,7 +246,7 @@ Probability of selling his quota of 5 bars
|
||||
on or before the 30th house is 0.99849
|
||||
]
|
||||
|
||||
/*`So the risk of failing even after visiting all the houses is 1 - this probability,
|
||||
`So the risk of failing even after visiting all the houses is 1 - this probability,
|
||||
``1 - cdf(nb, all_houses - sales_quota``
|
||||
But using this expression may cause serious inaccuracy,
|
||||
so it would be much better to use the complement of the cdf:
|
||||
@@ -511,9 +511,3 @@ House for 5th (last) sale. Probability (%)
|
||||
30 0.99849
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
class function_object_ai_and_ai_prime
|
||||
{
|
||||
public:
|
||||
function_object_ai_and_ai_prime(const Policy pol) : my_pol(pol) { }
|
||||
function_object_ai_and_ai_prime(const Policy& pol) : my_pol(pol) { }
|
||||
|
||||
boost::math::tuple<T, T> operator()(const T& x) const
|
||||
{
|
||||
@@ -137,7 +137,7 @@
|
||||
class function_object_bi_and_bi_prime
|
||||
{
|
||||
public:
|
||||
function_object_bi_and_bi_prime(const Policy pol) : my_pol(pol) { }
|
||||
function_object_bi_and_bi_prime(const Policy& pol) : my_pol(pol) { }
|
||||
|
||||
boost::math::tuple<T, T> operator()(const T& x) const
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
# define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
|
||||
#endif
|
||||
|
||||
#include <ostream>
|
||||
#include <boost/math/distributions.hpp>
|
||||
|
||||
#include <boost/math/special_functions.hpp>
|
||||
@@ -54,6 +55,7 @@ void instantiate(RealType)
|
||||
using namespace boost;
|
||||
using namespace boost::math;
|
||||
using namespace boost::math::concepts;
|
||||
std::ostream cnull(0);
|
||||
#ifdef TEST_GROUP_1
|
||||
function_requires<DistributionConcept<arcsine_distribution<RealType> > >();
|
||||
function_requires<DistributionConcept<bernoulli_distribution<RealType> > >();
|
||||
@@ -159,7 +161,9 @@ void instantiate(RealType)
|
||||
function_requires<DistributionConcept<dist_test::hypergeometric > >();
|
||||
#endif
|
||||
#endif
|
||||
int i;
|
||||
int i = 1;
|
||||
// Deal with unused variable warnings:
|
||||
cnull << i;
|
||||
RealType v1(0.5), v2(0.5), v3(0.5);
|
||||
boost::detail::dummy_constructor dc;
|
||||
boost::output_iterator_archetype<RealType> oi(dc);
|
||||
@@ -918,16 +922,24 @@ void instantiate_mixed(RealType)
|
||||
{
|
||||
using namespace boost;
|
||||
using namespace boost::math;
|
||||
std::ostream cnull(0);
|
||||
#ifndef BOOST_MATH_INSTANTIATE_MINIMUM
|
||||
int i = 1;
|
||||
cnull << i;
|
||||
long l = 1;
|
||||
cnull << l;
|
||||
short s = 1;
|
||||
cnull << s;
|
||||
float fr = 0.5F;
|
||||
cnull << fr;
|
||||
double dr = 0.5;
|
||||
cnull << dr;
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
long double lr = 0.5L;
|
||||
cnull << lr;
|
||||
#else
|
||||
double lr = 0.5L;
|
||||
cnull << lr;
|
||||
#endif
|
||||
#ifdef TEST_GROUP_7
|
||||
boost::math::tgamma(i);
|
||||
@@ -1376,4 +1388,3 @@ void instantiate_mixed(RealType)
|
||||
|
||||
|
||||
#endif // BOOST_LIBS_MATH_TEST_INSTANTIATE_HPP
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void test_ignore_policy(RealType)
|
||||
// NaN constructors.
|
||||
BOOST_CHECK((boost::math::isnan)(mean(ignore_error_arcsine(2, nan))));
|
||||
BOOST_CHECK((boost::math::isnan)(mean(ignore_error_arcsine(nan, nan))));
|
||||
BOOST_CHECK((boost::math::isnan)(mean(ignore_error_arcsine(nan, 2))));
|
||||
BOOST_CHECK((boost::math::isnan)(mean(ignore_error_arcsine(nan, 2))));
|
||||
|
||||
// Variance
|
||||
BOOST_CHECK((boost::math::isnan)(variance(ignore_error_arcsine(nan, 0))));
|
||||
@@ -138,7 +138,7 @@ void test_ignore_policy(RealType)
|
||||
BOOST_CHECK((boost::math::isnan)(skewness(ignore_error_arcsine(2, 0))));
|
||||
BOOST_CHECK((boost::math::isnan)(skewness(ignore_error_arcsine(3, 0))));
|
||||
|
||||
// Kurtosis
|
||||
// Kurtosis
|
||||
BOOST_CHECK((boost::math::isnan)(kurtosis(ignore_error_arcsine(nan, 0))));
|
||||
BOOST_CHECK((boost::math::isnan)(kurtosis(ignore_error_arcsine(-1, nan))));
|
||||
BOOST_CHECK((boost::math::isnan)(kurtosis(ignore_error_arcsine(0, 0))));
|
||||
@@ -159,7 +159,7 @@ void test_ignore_policy(RealType)
|
||||
BOOST_CHECK((boost::math::isnan)(kurtosis_excess(ignore_error_arcsine(4, 0))));
|
||||
} // has_quiet_NaN
|
||||
|
||||
//
|
||||
//
|
||||
BOOST_CHECK(boost::math::isfinite(mean(ignore_error_arcsine(0, std::numeric_limits<RealType>::epsilon()))));
|
||||
|
||||
check_support<arcsine_distribution<RealType> >(arcsine_distribution<RealType>(0, 1));
|
||||
@@ -233,8 +233,8 @@ void test_spots(RealType)
|
||||
(boost::math::tools::epsilon<RealType>(),
|
||||
static_cast<RealType>(std::numeric_limits<double>::epsilon())); // 0 if real_concept.
|
||||
|
||||
RealType max_value = boost::math::tools::max_value<RealType>();
|
||||
RealType epsilon = boost::math::tools::epsilon<RealType>();
|
||||
//RealType max_value = boost::math::tools::max_value<RealType>();
|
||||
//RealType epsilon = boost::math::tools::epsilon<RealType>();
|
||||
|
||||
//cout << "Boost::math::tools::epsilon = " << boost::math::tools::epsilon<RealType>() << endl;
|
||||
//cout << "std::numeric_limits::epsilon = " << std::numeric_limits<RealType>::epsilon() << endl;
|
||||
@@ -273,7 +273,7 @@ void test_spots(RealType)
|
||||
|
||||
// PDF
|
||||
// pdf of x = 1/4 is same as reflected value at x = 3/4.
|
||||
// N[PDF[arcsinedistribution[0, 1], 0.25], 50]
|
||||
// N[PDF[arcsinedistribution[0, 1], 0.25], 50]
|
||||
// N[PDF[arcsinedistribution[0, 1], 0.75], 50]
|
||||
// 0.73510519389572273268176866441729258852984864048885
|
||||
|
||||
@@ -323,7 +323,7 @@ void test_spots(RealType)
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(arcsine_01, static_cast<RealType>(0.25L)), static_cast<RealType>(0.14644660940672624L), tolerance);
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(arcsine_01, static_cast<RealType>(0.5L)), 0.5, 2 * tolerance); // probability = 0.5, x = 0.5
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(arcsine_01, static_cast<RealType>(0.75L)), static_cast<RealType>(0.85355339059327373L), tolerance);
|
||||
|
||||
|
||||
// N[CDF[arcsinedistribution[0, 1], 0.05], 50] == 0.14356629312870627075094188477505571882161519989741
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(arcsine_01, static_cast<RealType>(0.14356629312870627075094188477505571882161519989741L)), 0.05, tolerance);
|
||||
|
||||
@@ -543,7 +543,7 @@ void test_spots(RealType)
|
||||
|
||||
arcsine as; // Using typedef for default standard arcsine.
|
||||
|
||||
//
|
||||
//
|
||||
BOOST_CHECK_EQUAL(as.x_min(), 0); //
|
||||
BOOST_CHECK_EQUAL(as.x_max(), 1);
|
||||
BOOST_CHECK_EQUAL(mean(as), 0.5); // 1 / (1 + 1) = 1/2 exactly.
|
||||
@@ -577,7 +577,7 @@ Version 12.0.30110.00 Update 1
|
||||
1> Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Debug\test_arcsine.exe"
|
||||
1> Running 1 test case...
|
||||
1> Platform: Win32
|
||||
1> Compiler: Microsoft Visual C++ version 12.0 ???? MSVC says 2013
|
||||
1> Compiler: Microsoft Visual C++ version 12.0 ???? MSVC says 2013
|
||||
1> STL : Dinkumware standard library version 610
|
||||
1> Boost : 1.56.0
|
||||
|
||||
@@ -609,6 +609,3 @@ Version 12.0.30110.00 Update 1
|
||||
RUN SUCCESSFUL (total time: 141ms)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -642,12 +642,6 @@ void test_spots(RealType T)
|
||||
for(unsigned i = 0; i < binomial_quantile_data.size(); ++i)
|
||||
{
|
||||
using namespace boost::math::policies;
|
||||
typedef policy<discrete_quantile<boost::math::policies::real> > P1;
|
||||
typedef policy<discrete_quantile<integer_round_down> > P2;
|
||||
typedef policy<discrete_quantile<integer_round_up> > P3;
|
||||
typedef policy<discrete_quantile<integer_round_outwards> > P4;
|
||||
typedef policy<discrete_quantile<integer_round_inwards> > P5;
|
||||
typedef policy<discrete_quantile<integer_round_nearest> > P6;
|
||||
RealType tol = boost::math::tools::epsilon<RealType>() * 500;
|
||||
if(!boost::is_floating_point<RealType>::value)
|
||||
tol *= 10; // no lanczos approximation implies less accuracy
|
||||
@@ -656,6 +650,7 @@ void test_spots(RealType T)
|
||||
//
|
||||
// Check full real value first:
|
||||
//
|
||||
typedef policy<discrete_quantile<boost::math::policies::real> > P1;
|
||||
binomial_distribution<RealType, P1> p1(binomial_quantile_data[i][0], binomial_quantile_data[i][1]);
|
||||
x = quantile(p1, binomial_quantile_data[i][2]);
|
||||
BOOST_CHECK_CLOSE_FRACTION(x, (RealType)binomial_quantile_data[i][3], tol);
|
||||
@@ -666,6 +661,7 @@ void test_spots(RealType T)
|
||||
//
|
||||
// Now with round down to integer:
|
||||
//
|
||||
typedef policy<discrete_quantile<integer_round_down> > P2;
|
||||
binomial_distribution<RealType, P2> p2(binomial_quantile_data[i][0], binomial_quantile_data[i][1]);
|
||||
x = quantile(p2, binomial_quantile_data[i][2]);
|
||||
BOOST_CHECK_EQUAL(x, (RealType)floor(binomial_quantile_data[i][3]));
|
||||
@@ -676,6 +672,7 @@ void test_spots(RealType T)
|
||||
//
|
||||
// Now with round up to integer:
|
||||
//
|
||||
typedef policy<discrete_quantile<integer_round_up> > P3;
|
||||
binomial_distribution<RealType, P3> p3(binomial_quantile_data[i][0], binomial_quantile_data[i][1]);
|
||||
x = quantile(p3, binomial_quantile_data[i][2]);
|
||||
BOOST_CHECK_EQUAL(x, (RealType)ceil(binomial_quantile_data[i][3]));
|
||||
@@ -686,6 +683,7 @@ void test_spots(RealType T)
|
||||
//
|
||||
// Now with round to integer "outside":
|
||||
//
|
||||
typedef policy<discrete_quantile<integer_round_outwards> > P4;
|
||||
binomial_distribution<RealType, P4> p4(binomial_quantile_data[i][0], binomial_quantile_data[i][1]);
|
||||
x = quantile(p4, binomial_quantile_data[i][2]);
|
||||
BOOST_CHECK_EQUAL(x, (RealType)(binomial_quantile_data[i][2] < 0.5f ? floor(binomial_quantile_data[i][3]) : ceil(binomial_quantile_data[i][3])));
|
||||
@@ -696,6 +694,7 @@ void test_spots(RealType T)
|
||||
//
|
||||
// Now with round to integer "inside":
|
||||
//
|
||||
typedef policy<discrete_quantile<integer_round_inwards> > P5;
|
||||
binomial_distribution<RealType, P5> p5(binomial_quantile_data[i][0], binomial_quantile_data[i][1]);
|
||||
x = quantile(p5, binomial_quantile_data[i][2]);
|
||||
BOOST_CHECK_EQUAL(x, (RealType)(binomial_quantile_data[i][2] < 0.5f ? ceil(binomial_quantile_data[i][3]) : floor(binomial_quantile_data[i][3])));
|
||||
@@ -706,6 +705,7 @@ void test_spots(RealType T)
|
||||
//
|
||||
// Now with round to nearest integer:
|
||||
//
|
||||
typedef policy<discrete_quantile<integer_round_nearest> > P6;
|
||||
binomial_distribution<RealType, P6> p6(binomial_quantile_data[i][0], binomial_quantile_data[i][1]);
|
||||
x = quantile(p6, binomial_quantile_data[i][2]);
|
||||
BOOST_CHECK_EQUAL(x, (RealType)(floor(binomial_quantile_data[i][3] + 0.5f)));
|
||||
@@ -765,7 +765,7 @@ Output is:
|
||||
Tolerance for type double is 2.22045e-011 %
|
||||
Tolerance for type long double is 2.22045e-011 %
|
||||
Tolerance for type class boost::math::concepts::real_concept is 2.22045e-011 %
|
||||
|
||||
|
||||
*** No errors detected
|
||||
|
||||
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
// This file tests the inverse hyperbolic functions. There are two sets of tests:
|
||||
// 1) Sanity checks: comparison to test values created with the
|
||||
// online calculator at functions.wolfram.com
|
||||
// 2) Accuracy tests use values generated with NTL::RR at
|
||||
// 2) Accuracy tests use values generated with NTL::RR at
|
||||
// 1000-bit precision and our generic versions of these functions.
|
||||
//
|
||||
// Note that when this file is first run on a new platform many of
|
||||
// these tests will fail: the default accuracy is 1 epsilon which
|
||||
// is too tight for most platforms. In this situation you will
|
||||
// is too tight for most platforms. In this situation you will
|
||||
// need to cast a human eye over the error rates reported and make
|
||||
// a judgement as to whether they are acceptable. Either way please
|
||||
// report the results to the Boost mailing list. Acceptable rates of
|
||||
@@ -88,7 +88,7 @@ void expected_results()
|
||||
".*", // test data group
|
||||
".*", 4, 1); // test function
|
||||
|
||||
std::cout << "Tests run with " << BOOST_COMPILER << ", "
|
||||
std::cout << "Tests run with " << BOOST_COMPILER << ", "
|
||||
<< BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ void do_test_asinh(const T& data, const char* type_name, const char* test_name)
|
||||
// test asinh(T) against data:
|
||||
//
|
||||
using namespace std;
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
std::cout << test_name << " with type " << type_name << std::endl;
|
||||
@@ -130,7 +129,6 @@ void do_test_acosh(const T& data, const char* type_name, const char* test_name)
|
||||
// test acosh(T) against data:
|
||||
//
|
||||
using namespace std;
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
std::cout << test_name << " with type " << type_name << std::endl;
|
||||
@@ -161,7 +159,6 @@ void do_test_atanh(const T& data, const char* type_name, const char* test_name)
|
||||
// test atanh(T) against data:
|
||||
//
|
||||
using namespace std;
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
std::cout << test_name << " with type " << type_name << std::endl;
|
||||
@@ -229,7 +226,7 @@ void test_spots(T, const char* t)
|
||||
{
|
||||
std::cout << "Testing basic sanity checks for type " << t << std::endl;
|
||||
//
|
||||
// Basic sanity checks, tolerance is either 5 or 10 epsilon
|
||||
// Basic sanity checks, tolerance is either 5 or 10 epsilon
|
||||
// expressed as a percentage:
|
||||
//
|
||||
T tolerance = boost::math::tools::epsilon<T>() * 100 *
|
||||
@@ -285,8 +282,5 @@ BOOST_AUTO_TEST_CASE( test_main )
|
||||
"not available at all, or because they are too inaccurate for these tests "
|
||||
"to pass.</note>" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define BOOST_TEST_MAIN
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
#include <boost/math/distributions/non_central_chi_squared.hpp>
|
||||
#include <boost/math/distributions/non_central_chi_squared.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "functor.hpp"
|
||||
@@ -48,7 +48,7 @@
|
||||
template <class RealType>
|
||||
RealType naive_pdf(RealType v, RealType lam, RealType x)
|
||||
{
|
||||
// Formula direct from
|
||||
// Formula direct from
|
||||
// http://mathworld.wolfram.com/NoncentralChi-SquaredDistribution.html
|
||||
// with no simplification:
|
||||
RealType sum, term, prefix(1);
|
||||
@@ -117,7 +117,7 @@ void test_spots(RealType)
|
||||
boost::math::tools::epsilon<RealType>(),
|
||||
(RealType)boost::math::tools::epsilon<double>() * 5) * 150;
|
||||
//
|
||||
// At float precision we need to up the tolerance, since
|
||||
// At float precision we need to up the tolerance, since
|
||||
// the input values are rounded off to inexact quantities
|
||||
// the results get thrown off by a noticeable amount.
|
||||
//
|
||||
@@ -135,10 +135,10 @@ void test_spots(RealType)
|
||||
//
|
||||
// Test against the data from Table 6 of:
|
||||
//
|
||||
// "Self-Validating Computations of Probabilities for Selected
|
||||
// "Self-Validating Computations of Probabilities for Selected
|
||||
// Central and Noncentral Univariate Probability Functions."
|
||||
// Morgan C. Wang; William J. Kennedy
|
||||
// Journal of the American Statistical Association,
|
||||
// Journal of the American Statistical Association,
|
||||
// Vol. 89, No. 427. (Sep., 1994), pp. 878-887.
|
||||
//
|
||||
test_spot(
|
||||
@@ -289,7 +289,6 @@ T nccs_ccdf(T df, T nc, T x)
|
||||
template <typename Real, typename T>
|
||||
void do_test_nc_chi_squared(T& data, const char* type_name, const char* test)
|
||||
{
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
std::cout << "Testing: " << test << std::endl;
|
||||
@@ -330,7 +329,6 @@ template <typename Real, typename T>
|
||||
void quantile_sanity_check(T& data, const char* type_name, const char* test)
|
||||
{
|
||||
#ifndef ERROR_REPORTING_MODE
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
//
|
||||
@@ -397,7 +395,7 @@ void quantile_sanity_check(T& data, const char* type_name, const char* test)
|
||||
//
|
||||
// Sanity check degrees-of-freedom finder, don't bother at float
|
||||
// precision though as there's not enough data in the probability
|
||||
// values to get back to the correct degrees of freedom or
|
||||
// values to get back to the correct degrees of freedom or
|
||||
// non-cenrality parameter:
|
||||
//
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
@@ -444,4 +442,3 @@ void test_accuracy(T, const char* type_name)
|
||||
do_test_nc_chi_squared<T>(nccs_big, type_name, "Non Central Chi Squared, large parameters");
|
||||
quantile_sanity_check<T>(nccs_big, type_name, "Non Central Chi Squared, large parameters");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define BOOST_TEST_MAIN
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
#include <boost/math/distributions/non_central_t.hpp>
|
||||
#include <boost/math/distributions/non_central_t.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "functor.hpp"
|
||||
@@ -187,7 +187,7 @@ void test_spots(RealType)
|
||||
boost::math::tools::epsilon<RealType>(),
|
||||
(RealType)5e-12f) * 100;
|
||||
//
|
||||
// At float precision we need to up the tolerance, since
|
||||
// At float precision we need to up the tolerance, since
|
||||
// the input values are rounded off to inexact quantities
|
||||
// the results get thrown off by a noticeable amount.
|
||||
//
|
||||
@@ -319,7 +319,6 @@ T nct_ccdf(T df, T nc, T x)
|
||||
template <typename Real, typename T>
|
||||
void do_test_nc_t(T& data, const char* type_name, const char* test)
|
||||
{
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
std::cout << "Testing: " << test << std::endl;
|
||||
@@ -361,7 +360,6 @@ template <typename Real, typename T>
|
||||
void quantile_sanity_check(T& data, const char* type_name, const char* test)
|
||||
{
|
||||
#ifndef ERROR_REPORTING_MODE
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
//
|
||||
@@ -430,7 +428,7 @@ void quantile_sanity_check(T& data, const char* type_name, const char* test)
|
||||
//
|
||||
// Sanity check degrees-of-freedom finder, don't bother at float
|
||||
// precision though as there's not enough data in the probability
|
||||
// values to get back to the correct degrees of freedom or
|
||||
// values to get back to the correct degrees of freedom or
|
||||
// non-centrality parameter:
|
||||
//
|
||||
try{
|
||||
@@ -494,7 +492,7 @@ void test_big_df(RealType)
|
||||
{ // Ordinary floats only.
|
||||
// Could also test if (std::numeric_limits<RealType>::is_specialized);
|
||||
|
||||
RealType tolerance = 10 * boost::math::tools::epsilon<RealType>(); // static_cast<RealType>(1e-14); //
|
||||
RealType tolerance = 10 * boost::math::tools::epsilon<RealType>(); // static_cast<RealType>(1e-14); //
|
||||
std::cout.precision(17); // Note: need to reset after calling BOOST_CHECK_s
|
||||
// due to buglet in Boost.test that fails to restore precision corrrectly.
|
||||
|
||||
@@ -549,11 +547,11 @@ void test_big_df(RealType)
|
||||
BOOST_CHECK_EQUAL(mean(infdf10), 10);
|
||||
BOOST_CHECK_CLOSE_FRACTION(mean(maxdf10), static_cast<RealType>(10), tolerance);
|
||||
|
||||
BOOST_CHECK_CLOSE_FRACTION(pdf(infdf10, 11), pdf(maxdf10, 11), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(pdf(infdf10, 11), pdf(maxdf10, 11), tolerance); //
|
||||
|
||||
BOOST_CHECK_CLOSE_FRACTION(cdf(complement(infdf10, 11)), 1 - cdf(infdf10, 11), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(cdf(complement(maxdf10, 11)), 1 - cdf(maxdf10, 11), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(cdf(complement(infdf10, 11)), 1 - cdf(maxdf10, 11), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(cdf(complement(infdf10, 11)), 1 - cdf(infdf10, 11), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(cdf(complement(maxdf10, 11)), 1 - cdf(maxdf10, 11), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(cdf(complement(infdf10, 11)), 1 - cdf(maxdf10, 11), tolerance); //
|
||||
std::cout.precision(17);
|
||||
//std::cout << "cdf(maxdf10, 11) = " << cdf(maxdf10, 11) << ' ' << cdf(complement(maxdf10, 11)) << endl;
|
||||
//std::cout << "cdf(infdf10, 11) = " << cdf(infdf10, 11) << ' ' << cdf(complement(infdf10, 11)) << endl;
|
||||
@@ -608,18 +606,18 @@ void test_big_df(RealType)
|
||||
//RealType cmaxc = quantile(complement(maxdf10, 0.75));
|
||||
//std::cout << cmaxc << ' ' << cdf(maxdf10, cmaxc) << std::endl; // 9.32551 0.25
|
||||
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.5), quantile(maxdf10, 0.5), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.2), quantile(maxdf10, 0.2), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.8), quantile(maxdf10, 0.8), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.5), quantile(maxdf10, 0.5), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.2), quantile(maxdf10, 0.2), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.8), quantile(maxdf10, 0.8), tolerance); //
|
||||
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.25), quantile(complement(infdf10, 0.75)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(complement(infdf10, 0.5)), quantile(complement(maxdf10, 0.5)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.25), quantile(complement(infdf10, 0.75)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(complement(infdf10, 0.5)), quantile(complement(maxdf10, 0.5)), tolerance); //
|
||||
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(maxdf10, 0.25), quantile(complement(maxdf10, 0.75)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(maxdf10, 0.25), quantile(complement(maxdf10, 0.75)), tolerance); //
|
||||
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.99), quantile(complement(infdf10, 0.01)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.4), quantile(complement(infdf10, 0.6)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.01), quantile(complement(infdf10, 1 - 0.01)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.99), quantile(complement(infdf10, 0.01)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.4), quantile(complement(infdf10, 0.6)), tolerance); //
|
||||
BOOST_CHECK_CLOSE_FRACTION(quantile(infdf10, 0.01), quantile(complement(infdf10, 1 - 0.01)), tolerance); //
|
||||
}
|
||||
} // void test_big_df(RealType)
|
||||
|
||||
@@ -699,7 +697,7 @@ void test_ignore_policy(RealType)
|
||||
BOOST_CHECK((boost::math::isnan)(skewness(ignore_error_non_central_t(2, 0))));
|
||||
BOOST_CHECK((boost::math::isnan)(skewness(ignore_error_non_central_t(3, 0))));
|
||||
|
||||
// Kurtosis
|
||||
// Kurtosis
|
||||
BOOST_CHECK((boost::math::isnan)(kurtosis(ignore_error_non_central_t(std::numeric_limits<RealType>::quiet_NaN(), 0))));
|
||||
BOOST_CHECK((boost::math::isnan)(kurtosis(ignore_error_non_central_t(-1, 0))));
|
||||
BOOST_CHECK((boost::math::isnan)(kurtosis(ignore_error_non_central_t(0, 0))));
|
||||
@@ -731,4 +729,3 @@ void test_ignore_policy(RealType)
|
||||
check_support<non_central_t_distribution<RealType> >(non_central_t_distribution<RealType>(1, 0));
|
||||
} // ordinary floats.
|
||||
} // template <class RealType> void test_ignore_policy(RealType)
|
||||
|
||||
|
||||
@@ -145,15 +145,15 @@ void test_values(const T& val, const char* name)
|
||||
}
|
||||
#endif
|
||||
static const int primes[] = {
|
||||
11, 13, 17, 19, 23, 29,
|
||||
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
|
||||
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
|
||||
127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
|
||||
179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
|
||||
233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
|
||||
283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
|
||||
353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
|
||||
419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
|
||||
11, 13, 17, 19, 23, 29,
|
||||
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
|
||||
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
|
||||
127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
|
||||
179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
|
||||
233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
|
||||
283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
|
||||
353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
|
||||
419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
|
||||
};
|
||||
|
||||
for(unsigned i = 0; i < sizeof(primes)/sizeof(primes[0]); ++i)
|
||||
@@ -199,13 +199,6 @@ BOOST_AUTO_TEST_CASE( test_main )
|
||||
#endif
|
||||
#if defined(TEST_SSE2)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma message("Compiling SSE2 test code")
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
# pragma message "Compiling SSE2 test code"
|
||||
#endif
|
||||
|
||||
int mmx_flags = _mm_getcsr(); // We'll restore these later.
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -227,7 +220,5 @@ BOOST_AUTO_TEST_CASE( test_main )
|
||||
// Restore the MMX flags:
|
||||
_mm_setcsr(mmx_flags);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ void test_spots(RealType)
|
||||
|
||||
// BOOST_CHECK_CLOSE_FRACTION(owens_t(static_cast<RealType>(L), static_cast<RealType>(L)), static_cast<RealType>(L), tolerance);
|
||||
|
||||
// Spots values using Mathematica
|
||||
// Spots values using Mathematica
|
||||
BOOST_CHECK_CLOSE_FRACTION(owens_t(static_cast<RealType>(6.5L), static_cast<RealType>(0.4375L)), static_cast<RealType>(2.00057730485083154100907167684918851101649922551817956120806662022118024594547E-11L), tolerance);
|
||||
BOOST_CHECK_CLOSE_FRACTION(owens_t(static_cast<RealType>(0.4375L), static_cast<RealType>(6.5L)), static_cast<RealType>(0.16540130125449396247498691826626273249659241838438244251206819782787761751256L), tolerance);
|
||||
BOOST_CHECK_CLOSE_FRACTION(owens_t(static_cast<RealType>(7.L), static_cast<RealType>(0.96875L)), static_cast<RealType>(6.39906271938986853083219914428916013764797190941459233223182225724846022843930e-13L), tolerance);
|
||||
@@ -117,7 +117,6 @@ template <class Real, class T>
|
||||
void do_test_owens_t(const T& data, const char* type_name, const char* test_name)
|
||||
{
|
||||
#if !(defined(ERROR_REPORTING_MODE) && !defined(OWENS_T_FUNCTION_TO_TEST))
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
typedef value_type(*pg)(value_type, value_type);
|
||||
@@ -155,7 +154,7 @@ void test_owens_t(T, const char* name)
|
||||
//
|
||||
// The contents are as follows, each row of data contains
|
||||
// three items, input value a, input value b and erf(a, b):
|
||||
//
|
||||
//
|
||||
# include "owens_t.ipp"
|
||||
|
||||
do_test_owens_t<T>(owens_t, name, "Owens T (medium small values)");
|
||||
|
||||
@@ -245,7 +245,6 @@ template <class Real, class T>
|
||||
void test_inverses(const T& data)
|
||||
{
|
||||
using namespace std;
|
||||
typedef typename T::value_type row_type;
|
||||
typedef Real value_type;
|
||||
|
||||
value_type precision = static_cast<value_type>(ldexp(1.0, 1-boost::math::policies::digits<value_type, boost::math::policies::policy<> >()/2)) * 150;
|
||||
@@ -267,8 +266,8 @@ void test_inverses(const T& data)
|
||||
BOOST_CHECK_EQUAL(inverse_ibeta_newton(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(0));
|
||||
BOOST_CHECK_EQUAL(inverse_ibeta_bisect(Real(data[i][0]), Real(data[i][1]), Real(data[i][5])), value_type(0));
|
||||
}
|
||||
else if((1 - data[i][5] > 0.001)
|
||||
&& (fabs(data[i][5]) > 2 * boost::math::tools::min_value<value_type>())
|
||||
else if((1 - data[i][5] > 0.001)
|
||||
&& (fabs(data[i][5]) > 2 * boost::math::tools::min_value<value_type>())
|
||||
&& (fabs(data[i][5]) > 2 * boost::math::tools::min_value<double>()))
|
||||
{
|
||||
value_type inv = inverse_ibeta_halley(Real(data[i][0]), Real(data[i][1]), Real(data[i][5]));
|
||||
@@ -320,8 +319,5 @@ void test_beta(T, const char* /* name */)
|
||||
BOOST_AUTO_TEST_CASE( test_main )
|
||||
{
|
||||
test_beta(0.1, "double");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user