From 4ba0027365a408b7e28a7487417f4ea7453dfb6e Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 16 Oct 2007 09:32:28 +0000 Subject: [PATCH] Fixed lots of "inspect" issues: bad hyperlinks, tabs in source and missing licenses. Tweaked some error levels again. [SVN r40079] --- doc/math.qbk | 7 +- doc/sf_and_dist/background.qbk | 6 + doc/sf_and_dist/bessel_ik.qbk | 6 + doc/sf_and_dist/bessel_introduction.qbk | 6 + doc/sf_and_dist/bessel_jy.qbk | 10 +- doc/sf_and_dist/bessel_spherical.qbk | 6 + doc/sf_and_dist/concepts.qbk | 10 +- doc/sf_and_dist/contact_info.qbk | 8 + doc/sf_and_dist/distributions/bernoulli.qbk | 7 + .../distributions/binomial_example.qbk | 8 + .../distributions/chi_squared_examples.qbk | 12 +- .../distribution_construction.qbk | 8 + .../distributions/f_dist_example.qbk | 10 +- .../distributions/find_location_and_scale.qbk | 7 + doc/sf_and_dist/distributions/gamma.qbk | 7 + doc/sf_and_dist/distributions/lognormal.qbk | 7 + doc/sf_and_dist/distributions/nag_library.qbk | 7 + .../negative_binomial_example.qbk | 8 + .../distributions/normal_example.qbk | 7 + doc/sf_and_dist/distributions/pareto.qbk | 7 + doc/sf_and_dist/distributions/rayleigh.qbk | 7 + .../distributions/students_t_examples.qbk | 7 + doc/sf_and_dist/distributions/triangular.qbk | 8 +- doc/sf_and_dist/distributions/uniform.qbk | 7 + doc/sf_and_dist/distributions/weibull.qbk | 6 + doc/sf_and_dist/ellint_legendre.qbk | 4 +- doc/sf_and_dist/error_handling.qbk | 4 +- doc/sf_and_dist/implementation.qbk | 2 +- doc/sf_and_dist/overview.qbk | 7 + doc/sf_and_dist/performance.qbk | 15 +- doc/sf_and_dist/references.qbk | 2 +- doc/sf_and_dist/remez.qbk | 6 + doc/sf_and_dist/result_type_calc.qbk | 6 + doc/sf_and_dist/thread_safety.qbk | 7 + example/c_error_policy_example.cpp | 4 +- example/error_handling_example.cpp | 8 +- example/error_policies_example.cpp | 8 +- example/error_policy_example.cpp | 10 +- example/neg_binomial_sample_sizes.cpp | 12 +- example/negative_binomial_example1.cpp | 2 +- example/normal_misc_examples.cpp | 2 +- example/students_t_example1.cpp | 46 ++-- example/students_t_example2.cpp | 62 +++--- example/students_t_example3.cpp | 66 +++--- include/boost/math/bindings/rr.hpp | 10 +- include/boost/math/distributions/binomial.hpp | 14 +- include/boost/math/distributions/cauchy.hpp | 8 +- .../boost/math/distributions/chi_squared.hpp | 6 +- .../boost/math/distributions/exponential.hpp | 10 +- .../math/distributions/extreme_value.hpp | 10 +- include/boost/math/distributions/fisher_f.hpp | 10 +- include/boost/math/distributions/gamma.hpp | 10 +- .../boost/math/distributions/lognormal.hpp | 10 +- .../math/distributions/negative_binomial.hpp | 12 +- include/boost/math/distributions/normal.hpp | 10 +- include/boost/math/distributions/poisson.hpp | 24 +- include/boost/math/distributions/rayleigh.hpp | 10 +- .../boost/math/distributions/students_t.hpp | 12 +- include/boost/math/distributions/uniform.hpp | 10 +- include/boost/math/distributions/weibull.hpp | 10 +- .../boost/math/policies/error_handling.hpp | 8 +- include/boost/math/special_functions/cbrt.hpp | 24 +- .../boost/math/special_functions/math_fwd.hpp | 6 +- include/boost/math/special_functions/sign.hpp | 4 +- include/boost/math/tools/config.hpp | 42 ++-- include/boost/math/tools/fraction.hpp | 80 +++---- test/assoc_legendre_p.ipp | 5 + test/binomial_data.ipp | 5 + test/binomial_large_data.ipp | 5 + test/binomial_quantile.ipp | 5 + test/cbrt_data.ipp | 5 + test/digamma_data.ipp | 5 + test/digamma_neg_data.ipp | 5 + test/digamma_root_data.ipp | 5 + test/digamma_small_data.ipp | 5 + test/ellint_k_data.ipp | 5 + test/erf_data.ipp | 5 + test/erf_inv_data.ipp | 5 + test/erf_large_data.ipp | 5 + test/erfc_inv_big_data.ipp | 5 + test/erfc_inv_data.ipp | 5 + test/functor.hpp | 5 + test/gamma_inv_big_data.ipp | 5 + test/gamma_inv_data.ipp | 5 + test/gamma_inv_small_data.ipp | 5 + test/handle_test_result.hpp | 5 +- test/hermite.ipp | 5 + test/ibeta_int_data.ipp | 5 + test/ibeta_inv_data.ipp | 5 + test/ibeta_inva_data.ipp | 5 + test/igamma_int_data.ipp | 5 + test/igamma_inva_data.ipp | 5 + test/laguerre2.ipp | 5 + test/laguerre3.ipp | 5 + test/legendre_p.ipp | 5 + test/legendre_p_large.ipp | 5 + test/log1p_expm1_data.ipp | 5 + test/negative_binomial_quantile.ipp | 5 + test/poisson_quantile.ipp | 5 + test/spherical_harmonic.ipp | 5 + test/test_bernoulli.cpp | 6 +- test/test_bessel_y.cpp | 2 +- test/test_beta_dist.cpp | 2 +- test/test_binomial.cpp | 50 ++--- test/test_cauchy.cpp | 210 +++++++++--------- test/test_chi_squared.cpp | 4 +- test/test_constants.cpp | 6 +- test/test_dist_overloads.cpp | 14 +- test/test_error_handling.cpp | 12 +- test/test_exponential_dist.cpp | 48 ++-- test/test_extreme_value.cpp | 46 ++-- test/test_find_location.cpp | 2 +- test/test_find_scale.cpp | 2 +- test/test_fisher_f.cpp | 54 ++--- test/test_gamma_dist.cpp | 28 +-- test/test_ibeta.cpp | 8 + test/test_ibeta_inv.cpp | 8 + test/test_ibeta_inv_ab.cpp | 2 - test/test_igamma_inv.cpp | 8 + test/test_lognormal.cpp | 36 +-- test/test_negative_binomial.cpp | 4 +- test/test_normal.cpp | 38 ++-- test/test_pareto.cpp | 30 +-- test/test_poisson.cpp | 120 +++++----- test/test_policy.cpp | 2 +- .../test_rational_instances/test_rational.hpp | 5 + .../test_rational_double1.cpp | 5 + .../test_rational_double2.cpp | 5 + .../test_rational_double3.cpp | 5 + .../test_rational_double4.cpp | 4 + .../test_rational_double5.cpp | 5 + .../test_rational_float1.cpp | 5 + .../test_rational_float2.cpp | 5 + .../test_rational_float3.cpp | 5 + .../test_rational_float4.cpp | 5 + .../test_rational_ldouble1.cpp | 5 + .../test_rational_ldouble2.cpp | 5 + .../test_rational_ldouble3.cpp | 5 + .../test_rational_ldouble4.cpp | 5 + .../test_rational_ldouble5.cpp | 5 + .../test_rational_real_concept1.cpp | 5 + .../test_rational_real_concept2.cpp | 5 + .../test_rational_real_concept3.cpp | 5 + .../test_rational_real_concept4.cpp | 5 + .../test_rational_real_concept5.cpp | 5 + test/test_rayleigh.cpp | 70 +++--- test/test_students_t.cpp | 92 ++++---- test/test_tgamma_ratio.cpp | 18 +- test/test_uniform.cpp | 30 +-- test/test_weibull.cpp | 28 +-- test/tgamma_delta_ratio_data.ipp | 5 + test/tgamma_delta_ratio_int.ipp | 5 + test/tgamma_delta_ratio_int2.ipp | 5 + test/tgamma_ratio_data.ipp | 5 + tools/ellint_e_data.cpp | 5 + tools/ellint_f_data.cpp | 5 + tools/ellint_k_data.cpp | 5 + tools/factorial_tables.cpp | 4 + tools/generate_rational_test.cpp | 4 + tools/hermite_data.cpp | 4 + tools/laguerre_data.cpp | 4 + tools/legendre_data.cpp | 4 + tools/rational_tests.cpp | 4 + tools/spherical_harmonic_data.cpp | 4 + 164 files changed, 1333 insertions(+), 781 deletions(-) diff --git a/doc/math.qbk b/doc/math.qbk index f60071c98..7ac058993 100644 --- a/doc/math.qbk +++ b/doc/math.qbk @@ -1,5 +1,6 @@ [article Boost.Math [quickbook 1.4] + [copyright 2007 Paul A. Bristow, Hubert Holin, John Maddock, Daryle Walker and Xiaogang Zhang] [license Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -66,7 +67,7 @@ programming problems. [[[@../octonion/html/index.html Octonions]] [ -Octonions, like [@../../quaternions/html/index.html quaternions], are a relative of complex numbers. +Octonions, like [@../quaternions/html/index.html quaternions], are a relative of complex numbers. Octonions see some use in theoretical physics. @@ -160,8 +161,8 @@ quaternions ['[^x]] and ['[^y]] such that __not_equal). A good mnemotechnical wa things is by using the formula ['[^i*i = j*j = k*k = -1]]. Quaternions (and their kin) are described in far more details in this -other [@../../../quaternion/TQE.pdf document] -(with [@../../../quaternion/TQE_EA.pdf errata and addenda]). +other [@../../quaternion/TQE.pdf document] +(with [@../../quaternion/TQE_EA.pdf errata and addenda]). Some traditional constructs, such as the exponential, carry over without too much change into the realms of quaternions, but other, such as taking diff --git a/doc/sf_and_dist/background.qbk b/doc/sf_and_dist/background.qbk index 7853d985e..34a0bfeb0 100644 --- a/doc/sf_and_dist/background.qbk +++ b/doc/sf_and_dist/background.qbk @@ -75,5 +75,11 @@ for these distributions. [endsect] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/bessel_ik.qbk b/doc/sf_and_dist/bessel_ik.qbk index ac27d2ab7..9c246323c 100644 --- a/doc/sf_and_dist/bessel_ik.qbk +++ b/doc/sf_and_dist/bessel_ik.qbk @@ -189,3 +189,9 @@ f[sub [nu]], the Wronskian yields I[sub [nu]](x) directly. [endsect] +[/ + Copyright 2006 John Maddock, Paul A. Bristow and Xiaogang Zhang. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/bessel_introduction.qbk b/doc/sf_and_dist/bessel_introduction.qbk index 4830dc58d..4cdfe629d 100644 --- a/doc/sf_and_dist/bessel_introduction.qbk +++ b/doc/sf_and_dist/bessel_introduction.qbk @@ -116,3 +116,9 @@ __sph_neumann. [endsect] +[/ + Copyright 2006 John Maddock, Paul A. Bristow and Xiaogang Zhang. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/bessel_jy.qbk b/doc/sf_and_dist/bessel_jy.qbk index a864d8330..04a6a5115 100644 --- a/doc/sf_and_dist/bessel_jy.qbk +++ b/doc/sf_and_dist/bessel_jy.qbk @@ -54,7 +54,7 @@ cyclic for large /x/, but tends to -[infin][space] for small /x/: [h4 Testing] There are two sets of test values: spot values calculated using -[@http//:functions.wolfram.com functions.wolfram.com], +[@http://functions.wolfram.com functions.wolfram.com], and a much larger set of tests computed using a simplified version of this implementation (with all the special case handling removed). @@ -129,7 +129,7 @@ perform much better when the arguments become large, __cephes in particular prod some remarkably inaccurate results with some of the test data (no significant figures correct), and even GSL performs badly with some inputs to J[sub v]. Note that by way of double-checking these results, the worst performing __cephes and GSL cases -were recomputed using [@http//:functions.wolfram.com functions.wolfram.com], +were recomputed using [@http://functions.wolfram.com functions.wolfram.com], and the result checked against our test data: no errors in the test data were found. [h4 Implementation] @@ -253,3 +253,9 @@ without backward recurrence. [endsect] +[/ + Copyright 2006 John Maddock, Paul A. Bristow and Xiaogang Zhang. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/bessel_spherical.qbk b/doc/sf_and_dist/bessel_spherical.qbk index 47e5b7e31..7be51d8a2 100644 --- a/doc/sf_and_dist/bessel_spherical.qbk +++ b/doc/sf_and_dist/bessel_spherical.qbk @@ -79,3 +79,9 @@ main definition as x [rarr] 0. [endsect] +[/ + Copyright 2006 John Maddock, Paul A. Bristow and Xiaogang Zhang. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/concepts.qbk b/doc/sf_and_dist/concepts.qbk index 4d3890244..ec64c6893 100644 --- a/doc/sf_and_dist/concepts.qbk +++ b/doc/sf_and_dist/concepts.qbk @@ -16,7 +16,7 @@ in NTL. Finally there is a high precision __lanczos suitable for use with `boost::math::ntl::RR`, used at 1000-bit precision in -[@../tools/ntl_rr_lanczos.hpp libs/math/tools/ntl_rr_lanczos.hpp]. +[@../../../tools/ntl_rr_lanczos.hpp libs/math/tools/ntl_rr_lanczos.hpp]. The approximation has a theoretical precision of > 90 decimal digits, and an experimental precision of > 100 decimal digits. To use that approximation, just include that header before any of the special @@ -116,7 +116,7 @@ synthesised from the others, and so no explicit specialisation is required. # The function `epsilon` can be synthesised from the others, so no explicit specialisation is required provided the precision of RealType does not vary at runtime (see the header -[@../../../../../boost/math/tools/ntl.hpp boost/math/tools/ntl.hpp] +[@../../../../../boost/math/bindings/rr.hpp boost/math/bindings/rr.hpp] for an example where the precision does vary at runtime). # The functions `digits`, `max_value` and `min_value`, all get synthesised automatically from `std::numeric_limits`. However, if `numeric_limits` @@ -185,7 +185,7 @@ In addition, for efficient and accurate results, a __lanczos is highly desirable You may be able to adapt an existing approximation from [@../../../../../boost/math/special_functions/lanczos.hpp boost/math/special_functions/lanczos.hpp] or -[@../tools/ntl_rr_lanczos.hpp libs/math/tools/ntl_rr_lanczos.hpp]: +[@../../../tools/ntl_rr_lanczos.hpp libs/math/tools/ntl_rr_lanczos.hpp]: you will need change static_cast's to lexical_cast's, and the constants to /strings/ (in order to ensure the coefficients aren't truncated to long double) @@ -280,7 +280,7 @@ compile if the all the standard library functions used have been brought into the current scope with a using declaration. There is a test program -[@../../../teststd_real_concept_check.cpp libs/math/test/std_real_concept_check.cpp] +[@../../../test/std_real_concept_check.cpp libs/math/test/std_real_concept_check.cpp] that instantiates every template in this library with type `std_real_concept` to verify it's usage of standard library functions. @@ -335,7 +335,7 @@ The class template `DistributionConcept` is a for distribution types. The test program -[@../../../test/distribution_concept_check.cpp distribution_concept_check.cpp] +[@../../../test/compile_test/distribution_concept_check.cpp distribution_concept_check.cpp] is responsible for using `DistributionConcept` to verify that all the distributions in this library conform to the [link math_toolkit.using_udt.dist_concept Distribution concept]. diff --git a/doc/sf_and_dist/contact_info.qbk b/doc/sf_and_dist/contact_info.qbk index 50750b3b6..ba8c40e18 100644 --- a/doc/sf_and_dist/contact_info.qbk +++ b/doc/sf_and_dist/contact_info.qbk @@ -15,3 +15,11 @@ You can also find JM at john - at - johnmaddock.co.uk and PAB at pbristow - at - hetp.u-net.com. [endsect] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/bernoulli.qbk b/doc/sf_and_dist/distributions/bernoulli.qbk index a9eb7e488..17200fb41 100644 --- a/doc/sf_and_dist/distributions/bernoulli.qbk +++ b/doc/sf_and_dist/distributions/bernoulli.qbk @@ -109,3 +109,10 @@ the binomial distribution with a single trial should be used, for example: [endsect][/section:bernoulli_dist bernoulli] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/binomial_example.qbk b/doc/sf_and_dist/distributions/binomial_example.qbk index bc07ff1c4..41a462ab1 100644 --- a/doc/sf_and_dist/distributions/binomial_example.qbk +++ b/doc/sf_and_dist/distributions/binomial_example.qbk @@ -322,3 +322,11 @@ less than 1 in 1000 chance of observing a component failure [endsect] [/section:binom_size_eg Estimating Sample Sizes for a Binomial Distribution.] [endsect][/section:binom_eg Binomial Distribution] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/chi_squared_examples.qbk b/doc/sf_and_dist/distributions/chi_squared_examples.qbk index 74cc62a03..cf071c264 100644 --- a/doc/sf_and_dist/distributions/chi_squared_examples.qbk +++ b/doc/sf_and_dist/distributions/chi_squared_examples.qbk @@ -178,7 +178,7 @@ situations where we wish to compare the standard deviation of a new process to an established one. The code for this example is contained in -[@../../../chi_square_std_dev_test.cpp chi_square_std_dev_test.cpp], and +[@../../../example/chi_square_std_dev_test.cpp chi_square_std_dev_test.cpp], and we'll begin by defining the procedure that will print out the test statistics: @@ -372,7 +372,7 @@ some acceptable risk of type I failure /alpha/, type II failure note that the method used works on variance, and not standard deviation as is usual for the Chi Squared Test. -The code for this example is located in [@../../../chi_square_std_dev_test.cpp +The code for this example is located in [@../../../example/chi_square_std_dev_test.cpp chi_square_std_dev_test.cpp]. We begin by defining a procedure to print out the sample sizes required @@ -490,3 +490,11 @@ risk of failing to reject the null-hypothesis is also 0.05 [endsect][/section:chi_sq_size Estimating the Required Sample Sizes for a Chi-Square Test for the Standard Deviation] [endsect][/section:cs_eg Chi Squared Distribution] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/distribution_construction.qbk b/doc/sf_and_dist/distributions/distribution_construction.qbk index a6d1bf08f..5aab16543 100644 --- a/doc/sf_and_dist/distributions/distribution_construction.qbk +++ b/doc/sf_and_dist/distributions/distribution_construction.qbk @@ -7,3 +7,11 @@ See [@../../../example/distribution_construction.cpp distribution_construction.c [distribution_construction2] [endsect] [/section:dist_construct_eg Distribution Construction Example] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/f_dist_example.qbk b/doc/sf_and_dist/distributions/f_dist_example.qbk index a1062bd5b..4d48cca47 100644 --- a/doc/sf_and_dist/distributions/f_dist_example.qbk +++ b/doc/sf_and_dist/distributions/f_dist_example.qbk @@ -13,7 +13,7 @@ The data for this case study were collected by Said Jahanmir of the NIST Ceramics Division in 1996 in connection with a NIST/industry ceramics consortium for strength optimization of ceramic strength. -The example program is [@../example/f_test.cpp f_test.cpp], +The example program is [@../../../example/f_test.cpp f_test.cpp], program output has been deliberately made as similar as possible to the DATAPLOT output in the corresponding [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda359.htm @@ -210,3 +210,11 @@ hypothesis must be rejected. We therefore conclude that there is a change for the better in our standard deviation. [endsect][/section:f_eg F Distribution] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/find_location_and_scale.qbk b/doc/sf_and_dist/distributions/find_location_and_scale.qbk index 8ac5b5c5f..c9d87a9e4 100644 --- a/doc/sf_and_dist/distributions/find_location_and_scale.qbk +++ b/doc/sf_and_dist/distributions/find_location_and_scale.qbk @@ -30,3 +30,10 @@ for full source code & appended program output. +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/gamma.qbk b/doc/sf_and_dist/distributions/gamma.qbk index 64be70905..1bc233351 100644 --- a/doc/sf_and_dist/distributions/gamma.qbk +++ b/doc/sf_and_dist/distributions/gamma.qbk @@ -129,3 +129,10 @@ and /q = 1-p/. [endsect][/section:normal_dist Normal] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/lognormal.qbk b/doc/sf_and_dist/distributions/lognormal.qbk index 96b0fe155..33ac076d6 100644 --- a/doc/sf_and_dist/distributions/lognormal.qbk +++ b/doc/sf_and_dist/distributions/lognormal.qbk @@ -110,3 +110,10 @@ and /q = 1-p/. [endsect][/section:normal_dist Normal] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/nag_library.qbk b/doc/sf_and_dist/distributions/nag_library.qbk index 7e2c28753..b0377871b 100644 --- a/doc/sf_and_dist/distributions/nag_library.qbk +++ b/doc/sf_and_dist/distributions/nag_library.qbk @@ -51,3 +51,10 @@ See [@../../../example/binomial_example_nag.cpp binomial_example_nag.cpp] for de [endsect] [/section:nag_library Comparison with C, R, FORTRAN-style Free Functions] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/negative_binomial_example.qbk b/doc/sf_and_dist/distributions/negative_binomial_example.qbk index 629843480..c51817b88 100644 --- a/doc/sf_and_dist/distributions/negative_binomial_example.qbk +++ b/doc/sf_and_dist/distributions/negative_binomial_example.qbk @@ -182,3 +182,11 @@ Example program showing output of a table of values of cdf and pdf for various k [endsect] [/section:negative_binomial_example1 Negative Binomial example 2.] [endsect] [/section:neg_binom_eg Negative Binomial Distribution Examples] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/normal_example.qbk b/doc/sf_and_dist/distributions/normal_example.qbk index 31b60df63..d5cafca11 100644 --- a/doc/sf_and_dist/distributions/normal_example.qbk +++ b/doc/sf_and_dist/distributions/normal_example.qbk @@ -27,3 +27,10 @@ normal_misc_examples.cpp] illustrates their use. [endsect] [/section:normal_misc Some Miscellaneous Examples of the Normal Distribution] [endsect] [/section:normal_example Normal Distribution Examples] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/pareto.qbk b/doc/sf_and_dist/distributions/pareto.qbk index 5e7db0c3b..040b3c622 100644 --- a/doc/sf_and_dist/distributions/pareto.qbk +++ b/doc/sf_and_dist/distributions/pareto.qbk @@ -105,3 +105,10 @@ and its complement /q = 1-p/. [endsect][/section:pareto pareto] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/rayleigh.qbk b/doc/sf_and_dist/distributions/rayleigh.qbk index e426dcdb7..8fa768406 100644 --- a/doc/sf_and_dist/distributions/rayleigh.qbk +++ b/doc/sf_and_dist/distributions/rayleigh.qbk @@ -110,3 +110,10 @@ In the following table [sigma][space] is the sigma parameter of the distribution [endsect][/section:Rayleigh Rayleigh] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/students_t_examples.qbk b/doc/sf_and_dist/distributions/students_t_examples.qbk index f7e63eb46..bc4c35dea 100644 --- a/doc/sf_and_dist/distributions/students_t_examples.qbk +++ b/doc/sf_and_dist/distributions/students_t_examples.qbk @@ -773,3 +773,10 @@ in order to obtain a significant result]. [endsect][/section:st_eg Student's t] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/triangular.qbk b/doc/sf_and_dist/distributions/triangular.qbk index be052d90d..eb04ee5a3 100644 --- a/doc/sf_and_dist/distributions/triangular.qbk +++ b/doc/sf_and_dist/distributions/triangular.qbk @@ -154,9 +154,15 @@ Some 'known good' test values were obtained from * Evans, M.; Hastings, N.; and Peacock, B. "Triangular Distribution." Ch. 40 in Statistical Distributions, 3rd ed. New York: Wiley, pp. 187-188, 2000, ISBN - 0471371246] * [@http://www.brighton-webs.co.uk/distributions/triangular.asp Brighton Webs Ltd. BW D-Calc 1.0 Distribution Calculator] * [@http://www.worldscibooks.com/mathematics/etextbook/5720/5720_chap1.pdf The Triangular Distribution including its history.] -* [@www.measurement.sk/2002/S1/Wimmer2.pdf Gejza Wimmer, Viktor Witkovsky and Tomas Duby, +* [@http://www.measurement.sk/2002/S1/Wimmer2.pdf Gejza Wimmer, Viktor Witkovsky and Tomas Duby, Measurement Science Review, Volume 2, Section 1, 2002, Proper Rounding Of The Measurement Results Under The Assumption Of Triangular Distribution.] [endsect][/section:triangular_dist triangular] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/distributions/uniform.qbk b/doc/sf_and_dist/distributions/uniform.qbk index c9700a06a..098a8d150 100644 --- a/doc/sf_and_dist/distributions/uniform.qbk +++ b/doc/sf_and_dist/distributions/uniform.qbk @@ -125,3 +125,10 @@ b is the /upper/ parameter, [endsect][/section:uniform_dist Uniform] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/doc/sf_and_dist/distributions/weibull.qbk b/doc/sf_and_dist/distributions/weibull.qbk index 44270aaa5..140f13792 100644 --- a/doc/sf_and_dist/distributions/weibull.qbk +++ b/doc/sf_and_dist/distributions/weibull.qbk @@ -119,3 +119,9 @@ and /q = 1-p/. [endsect][/section:weibull Weibull] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/ellint_legendre.qbk b/doc/sf_and_dist/ellint_legendre.qbk index d7a0ec7d9..d461d8b8e 100644 --- a/doc/sf_and_dist/ellint_legendre.qbk +++ b/doc/sf_and_dist/ellint_legendre.qbk @@ -188,7 +188,7 @@ are relative errors in units of epsilon. [heading Testing] The tests use a mixture of spot test values calculated using the online -calculator at [@functions.wolfram.com +calculator at [http://@functions.wolfram.com functions.wolfram.com], and random test data generated using NTL::RR at 1000-bit precision and this implementation. @@ -296,7 +296,7 @@ are relative errors in units of epsilon. [heading Testing] The tests use a mixture of spot test values calculated using the online -calculator at [@functions.wolfram.com +calculator at [@http://functions.wolfram.com functions.wolfram.com], and random test data generated using NTL::RR at 1000-bit precision and this implementation. diff --git a/doc/sf_and_dist/error_handling.qbk b/doc/sf_and_dist/error_handling.qbk index 3ccd21fbb..eca907b6b 100644 --- a/doc/sf_and_dist/error_handling.qbk +++ b/doc/sf_and_dist/error_handling.qbk @@ -1,6 +1,6 @@ [section:error_handling Error Handling] -[def __format [@../../../libs/format/index.html Boost.Format]] +[def __format [@../../../../format/index.html Boost.Format]] [heading Quick Reference] @@ -159,7 +159,7 @@ the error, or set global ::errno, then a NaN will be returned. This behaviour is chosen to assist compatibility with the behaviour of ['ISO/IEC 9899:1999 Programming languages - C] and with the -[@www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf Draft Technical Report on C++ Library Extensions, 2005-06-24, section 5.2.1, paragraph 6]: +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf Draft Technical Report on C++ Library Extensions, 2005-06-24, section 5.2.1, paragraph 6]: [:['"Each of the functions declared above shall return a NaN (Not a Number) if any argument value is a NaN, but it shall not report a domain error. diff --git a/doc/sf_and_dist/implementation.qbk b/doc/sf_and_dist/implementation.qbk index 35375d1c9..528086e49 100644 --- a/doc/sf_and_dist/implementation.qbk +++ b/doc/sf_and_dist/implementation.qbk @@ -124,7 +124,7 @@ for which the mathematical function obtains a non-real value.] This implementation is believed to follow these proposals and to assist compatibility with ['ISO/IEC 9899:1999 Programming languages - C] and with the -[@www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf Draft Technical Report on C++ Library Extensions, 2005-06-24, section 5.2.1, paragraph 5]. +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf Draft Technical Report on C++ Library Extensions, 2005-06-24, section 5.2.1, paragraph 5]. [link math_toolkit.main_overview.error_handling See also domain_error]. See __policy_ref for details of the error handling policies that should allow diff --git a/doc/sf_and_dist/overview.qbk b/doc/sf_and_dist/overview.qbk index b70a7f249..69982aeb4 100644 --- a/doc/sf_and_dist/overview.qbk +++ b/doc/sf_and_dist/overview.qbk @@ -81,3 +81,10 @@ rapid generation of test data] and/or data for output to an external graphing application. [endsect] [/section:intro Introduction] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/performance.qbk b/doc/sf_and_dist/performance.qbk index 81646644a..469b1b263 100644 --- a/doc/sf_and_dist/performance.qbk +++ b/doc/sf_and_dist/performance.qbk @@ -361,12 +361,9 @@ __policy_section you want to test set as the default. [endsect] - - - - - - - - - +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/references.qbk b/doc/sf_and_dist/references.qbk index 8d9da7b0d..af16d0d7e 100644 --- a/doc/sf_and_dist/references.qbk +++ b/doc/sf_and_dist/references.qbk @@ -34,7 +34,7 @@ by N.A.J. Hastings, Brian Peacock, Merran Evans, ISBN: 0471371246, Wiley 2000. [@http://bh0.physics.ubc.ca/People/matt/Doc/ThesesOthers/Phd/pugh.pdf pugh.pdf (application/pdf Object)] Pugh Msc Thesis on the Lanczzos approximation to the gamma function. -[@www.open-std.org/jtc1/sc22/wg21/docs/papers/2003 N1514, 03-0097, A Proposal to Add Mathematical Special Functions to the C++ Standard Library (version 2), Walter E. Brown] +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003 N1514, 03-0097, A Proposal to Add Mathematical Special Functions to the C++ Standard Library (version 2), Walter E. Brown] [h4 Calculators* that we found (and used to cross-check - as far as their widely-varying accuracy allowed).] diff --git a/doc/sf_and_dist/remez.qbk b/doc/sf_and_dist/remez.qbk index d032ce316..46d62e2f7 100644 --- a/doc/sf_and_dist/remez.qbk +++ b/doc/sf_and_dist/remez.qbk @@ -368,4 +368,10 @@ Russian Journal of Mathematical Physics, vol.1, No. 3, 1994. [endsect][/section:remez The Remez Method] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/result_type_calc.qbk b/doc/sf_and_dist/result_type_calc.qbk index 629129531..dd128106e 100644 --- a/doc/sf_and_dist/result_type_calc.qbk +++ b/doc/sf_and_dist/result_type_calc.qbk @@ -77,3 +77,9 @@ and with the [endsect] +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/doc/sf_and_dist/thread_safety.qbk b/doc/sf_and_dist/thread_safety.qbk index 1143cb8b3..ef825854d 100644 --- a/doc/sf_and_dist/thread_safety.qbk +++ b/doc/sf_and_dist/thread_safety.qbk @@ -21,3 +21,10 @@ race conditions. This limitation may be addressed in a future release. [endsect] [/section:threads Thread Safety] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/example/c_error_policy_example.cpp b/example/c_error_policy_example.cpp index 3561e6c2e..f05c9ddef 100644 --- a/example/c_error_policy_example.cpp +++ b/example/c_error_policy_example.cpp @@ -39,8 +39,8 @@ typedef policy< // std #include - using std::cout; - using std::endl; + using std::cout; + using std::endl; int main() { diff --git a/example/error_handling_example.cpp b/example/error_handling_example.cpp index 8fb4af365..5b06a407e 100644 --- a/example/error_handling_example.cpp +++ b/example/error_handling_example.cpp @@ -48,15 +48,15 @@ We'll begin our sample program with the needed includes: // Boost #include - using boost::math::students_t; // Probability of students_t(df, t). + using boost::math::students_t; // Probability of students_t(df, t). // std #include - using std::cout; - using std::endl; + using std::cout; + using std::endl; #include - using std::exception; + using std::exception; /*` diff --git a/example/error_policies_example.cpp b/example/error_policies_example.cpp index bb08a2833..c726b5417 100644 --- a/example/error_policies_example.cpp +++ b/example/error_policies_example.cpp @@ -12,8 +12,8 @@ using boost::math::normal_distribution; #include - using boost::math::students_t; // Probability of students_t(df, t). - using boost::math::students_t_distribution; + using boost::math::students_t; // Probability of students_t(df, t). + using boost::math::students_t_distribution; // using namespace boost::math; //.\error_policy_normal.cpp(30) : error C2872: 'policy' : ambiguous symbol @@ -26,8 +26,8 @@ // std #include - using std::cout; - using std::endl; + using std::cout; + using std::endl; using boost::math::policies::policy; // Possible errors diff --git a/example/error_policy_example.cpp b/example/error_policy_example.cpp index bd3760566..cbe875481 100644 --- a/example/error_policy_example.cpp +++ b/example/error_policy_example.cpp @@ -23,11 +23,11 @@ using boost::math::students_t; // Probability of students_t(df, t) convenience // std #include - using std::cout; - using std::endl; + using std::cout; + using std::endl; #include - using std::exception; + using std::exception; using boost::math::policies::policy; using boost::math::policies::domain_error; @@ -43,7 +43,7 @@ typedef students_t_distribution my_students_t; int main() { // Example of error handling of bad argument(s) to a distribution. - cout << "Example error handling using Student's t function. " << endl; + cout << "Example error handling using Student's t function. " << endl; double degrees_of_freedom = -1; double t = -1.; // Two 'bad' arguments! @@ -71,7 +71,7 @@ int main() "\n""Message from thrown exception was:\n " << e.what() << std::endl; } - return 0; + return 0; } // int main() /* diff --git a/example/neg_binomial_sample_sizes.cpp b/example/neg_binomial_sample_sizes.cpp index ce4724292..def7b1553 100644 --- a/example/neg_binomial_sample_sizes.cpp +++ b/example/neg_binomial_sample_sizes.cpp @@ -90,12 +90,12 @@ void find_number_of_trials(double failures, double p) int main() { - find_number_of_trials(5, 0.5); - find_number_of_trials(50, 0.5); - find_number_of_trials(500, 0.5); - find_number_of_trials(50, 0.1); - find_number_of_trials(500, 0.1); - find_number_of_trials(5, 0.9); + find_number_of_trials(5, 0.5); + find_number_of_trials(50, 0.5); + find_number_of_trials(500, 0.5); + find_number_of_trials(50, 0.1); + find_number_of_trials(500, 0.1); + find_number_of_trials(5, 0.9); return 0; } // int main() diff --git a/example/negative_binomial_example1.cpp b/example/negative_binomial_example1.cpp index fa428fc08..ce5c50999 100644 --- a/example/negative_binomial_example1.cpp +++ b/example/negative_binomial_example1.cpp @@ -426,7 +426,7 @@ Message from thrown exception was: */ //] [/ negative_binomial_eg1_2] } - return 0; + return 0; } // int main() diff --git a/example/normal_misc_examples.cpp b/example/normal_misc_examples.cpp index 289f8ea1e..04be5b08c 100644 --- a/example/normal_misc_examples.cpp +++ b/example/normal_misc_examples.cpp @@ -74,7 +74,7 @@ int main() /*`And all this you can do with a nanoscopic amount of work compared to the team of *human computers* toiling with Milton Abramovitz and Irene Stegen -at the US National Bureau of Standards (now [@www.nist.gov NIST]). +at the US National Bureau of Standards (now [@http://www.nist.gov NIST]). Starting in 1938, their "Handbook of Mathematical Functions with Formulas, Graphs and Mathematical Tables", was eventually published in 1964, and has been reprinted numerous times since. (A major replacement is planned at [@http://dlmf.nist.gov Digital Library of Mathematical Functions]). diff --git a/example/students_t_example1.cpp b/example/students_t_example1.cpp index cb6cf4542..c86b89d5d 100644 --- a/example/students_t_example1.cpp +++ b/example/students_t_example1.cpp @@ -43,46 +43,46 @@ double value[values] = {38.9, 37.4, 37.1}; // The Students't distribution function is described at // http://en.wikipedia.org/wiki/Student%27s_t_distribution #include - using boost::math::students_t; // Probability of students_t(df, t). + using boost::math::students_t; // Probability of students_t(df, t). #include - using std::cout; using std::endl; + using std::cout; using std::endl; #include - using std::setprecision; + using std::setprecision; #include - using std::sqrt; + using std::sqrt; int main() { - cout << "Example 1 using Student's t function. " << endl; + cout << "Example 1 using Student's t function. " << endl; - // Example/test using tabulated value + // Example/test using tabulated value // (deliberately coded as naively as possible). - // Null hypothesis is that there is no difference (greater or less) + // Null hypothesis is that there is no difference (greater or less) // between measured and standard. - double degrees_of_freedom = values-1; // 3-1 = 2 + double degrees_of_freedom = values-1; // 3-1 = 2 cout << "Measurement 1 = " << value[0] << ", measurement 2 = " << value[1] << ", measurement 3 = " << value[2] << endl; - double mean = (value[0] + value[1] + value[2]) / static_cast(values); + double mean = (value[0] + value[1] + value[2]) / static_cast(values); cout << "Standard = " << standard << ", mean = " << mean << ", (mean - standard) = " << mean - standard << endl; - double sd = sqrt(((value[0] - mean) * (value[0] - mean) + (value[1] - mean) * (value[1] - mean) + (value[2] - mean) * (value[2] - mean))/ static_cast(values-1)); - cout << "Standard deviation = " << sd << endl; - if (sd == 0.) - { - cout << "Measured mean is identical to SRM value," << endl; - cout << "so probability of no difference between measured and standard (the 'null hypothesis') is unity." << endl; - return 0; - } + double sd = sqrt(((value[0] - mean) * (value[0] - mean) + (value[1] - mean) * (value[1] - mean) + (value[2] - mean) * (value[2] - mean))/ static_cast(values-1)); + cout << "Standard deviation = " << sd << endl; + if (sd == 0.) + { + cout << "Measured mean is identical to SRM value," << endl; + cout << "so probability of no difference between measured and standard (the 'null hypothesis') is unity." << endl; + return 0; + } - double t = (mean - standard) * std::sqrt(static_cast(values)) / sd; - cout << "Student's t = " << t << endl; - cout.precision(2); // Useful accuracy is only a few decimal digits. - cout << "Probability of Student's t is " << cdf(students_t(degrees_of_freedom), std::abs(t)) << endl; + double t = (mean - standard) * std::sqrt(static_cast(values)) / sd; + cout << "Student's t = " << t << endl; + cout.precision(2); // Useful accuracy is only a few decimal digits. + cout << "Probability of Student's t is " << cdf(students_t(degrees_of_freedom), std::abs(t)) << endl; // 0.91, is 1 tailed. - // So there is insufficient evidence of a difference to meet a 95% (1 in 20) criterion. + // So there is insufficient evidence of a difference to meet a 95% (1 in 20) criterion. - return 0; + return 0; } // int main() /* diff --git a/example/students_t_example2.cpp b/example/students_t_example2.cpp index 6f5d7d8e9..4ae727a4e 100644 --- a/example/students_t_example2.cpp +++ b/example/students_t_example2.cpp @@ -30,16 +30,16 @@ // http://en.wikipedia.org/wiki/Student%27s_t_distribution #include - using boost::math::students_t; // Probability of students_t(df, t). + using boost::math::students_t; // Probability of students_t(df, t). #include - using std::cout; - using std::endl; + using std::cout; + using std::endl; #include - using std::setprecision; - using std::setw; + using std::setprecision; + using std::setw; #include - using std::sqrt; + using std::sqrt; // This example of a one-sided test is from: // @@ -58,39 +58,39 @@ double data [values] = {25.06, 25.18, 24.87, 25.51, 25.34, 25.41}; int main() { - cout << "Example2 using Student's t function. "; + cout << "Example2 using Student's t function. "; #if defined(__FILE__) && defined(__TIMESTAMP__) - cout << " " << __FILE__ << ' ' << __TIMESTAMP__ << ' '<< _MSC_FULL_VER; + cout << " " << __FILE__ << ' ' << __TIMESTAMP__ << ' '<< _MSC_FULL_VER; #endif - cout << endl; + cout << endl; - double sum = 0.; - for (int value = 0; value < values; value++) - { // Echo data and calculate mean. - sum += data[value]; - cout << setw(4) << value << ' ' << setw(14) << data[value] << endl; - } - double mean = sum /static_cast(values); - cout << "Mean = " << mean << endl; // 25.2283 + double sum = 0.; + for (int value = 0; value < values; value++) + { // Echo data and calculate mean. + sum += data[value]; + cout << setw(4) << value << ' ' << setw(14) << data[value] << endl; + } + double mean = sum /static_cast(values); + cout << "Mean = " << mean << endl; // 25.2283 - double sd = 0.; - for (int value = 0; value < values; value++) - { // Calculate standard deviation. - sd +=(data[value] - mean) * (data[value] - mean); - } - int degrees_of_freedom = values - 1; // Use the n-1 formula. - sd /= degrees_of_freedom; // == variance. + double sd = 0.; + for (int value = 0; value < values; value++) + { // Calculate standard deviation. + sd +=(data[value] - mean) * (data[value] - mean); + } + int degrees_of_freedom = values - 1; // Use the n-1 formula. + sd /= degrees_of_freedom; // == variance. sd= sqrt(sd); - cout << "Standard deviation = " << sd<< endl; // = 0.238279 + cout << "Standard deviation = " << sd<< endl; // = 0.238279 - double t = (mean - reference) * sqrt(static_cast(values))/ sd; // - cout << "Student's t = " << t << ", with " << degrees_of_freedom << " degrees of freedom." << endl; // = 2.34725 + double t = (mean - reference) * sqrt(static_cast(values))/ sd; // + cout << "Student's t = " << t << ", with " << degrees_of_freedom << " degrees of freedom." << endl; // = 2.34725 - cout << "Probability of positive bias is " << cdf(students_t(degrees_of_freedom), t) << "."<< endl; // = 0.967108. - // A 1-sided test because only testing for a positive bias. - // If > 0.95 then greater than 1 in 20 conventional (arbitrary) requirement. + cout << "Probability of positive bias is " << cdf(students_t(degrees_of_freedom), t) << "."<< endl; // = 0.967108. + // A 1-sided test because only testing for a positive bias. + // If > 0.95 then greater than 1 in 20 conventional (arbitrary) requirement. - return 0; + return 0; } // int main() /* diff --git a/example/students_t_example3.cpp b/example/students_t_example3.cpp index d42daf1ab..289daec09 100644 --- a/example/students_t_example3.cpp +++ b/example/students_t_example3.cpp @@ -30,14 +30,14 @@ // http://en.wikipedia.org/wiki/Student%27s_t_distribution #include - using boost::math::students_t; // Probability of students_t(df, t). + using boost::math::students_t; // Probability of students_t(df, t). #include - using std::cout; using std::endl; + using std::cout; using std::endl; #include - using std::setprecision; using std::setw; + using std::setprecision; using std::setw; #include - using std::sqrt; + using std::sqrt; // This example of a two-sided test is from: // B. M. Smith & M. B. Griffiths, Analyst, 1982, 107, 253, @@ -64,38 +64,38 @@ float diffs[portions]; int main() { - cout << "Example3 using Student's t function. " << endl; - float mean_diff = 0.f; - cout << "\n""Portion wet_oxidation Direct_extraction difference" << endl; - for (int portion = 0; portion < portions; portion++) - { // Echo data and differences. - diffs[portion] = data[portion][0] - data[portion][1]; - mean_diff += diffs[portion]; - cout << setw(4) << portion << ' ' << setw(14) << data[portion][0] << ' ' << setw(18)<< data[portion][1] << ' ' << setw(9) << diffs[portion] << endl; - } - mean_diff /= portions; - cout << "Mean difference = " << mean_diff << endl; // -1.75 + cout << "Example3 using Student's t function. " << endl; + float mean_diff = 0.f; + cout << "\n""Portion wet_oxidation Direct_extraction difference" << endl; + for (int portion = 0; portion < portions; portion++) + { // Echo data and differences. + diffs[portion] = data[portion][0] - data[portion][1]; + mean_diff += diffs[portion]; + cout << setw(4) << portion << ' ' << setw(14) << data[portion][0] << ' ' << setw(18)<< data[portion][1] << ' ' << setw(9) << diffs[portion] << endl; + } + mean_diff /= portions; + cout << "Mean difference = " << mean_diff << endl; // -1.75 - float sd_diffs = 0.f; - for (int portion = 0; portion < portions; portion++) - { // Calculate standard deviation of differences. - sd_diffs +=(diffs[portion] - mean_diff) * (diffs[portion] - mean_diff); - } - int degrees_of_freedom = portions-1; // Use the n-1 formula. - sd_diffs /= degrees_of_freedom; - sd_diffs = sqrt(sd_diffs); - cout << "Standard deviation of differences = " << sd_diffs << endl; // 4.99166 - // Standard deviation of differences = 4.99166 - double t = mean_diff * sqrt(static_cast(portions))/ sd_diffs; // -0.70117 - cout << "Student's t = " << t << ", if " << degrees_of_freedom << " degrees of freedom." << endl; - // Student's t = -0.70117, if 3 degrees of freedom. - cout << "Probability of the means being different is " + float sd_diffs = 0.f; + for (int portion = 0; portion < portions; portion++) + { // Calculate standard deviation of differences. + sd_diffs +=(diffs[portion] - mean_diff) * (diffs[portion] - mean_diff); + } + int degrees_of_freedom = portions-1; // Use the n-1 formula. + sd_diffs /= degrees_of_freedom; + sd_diffs = sqrt(sd_diffs); + cout << "Standard deviation of differences = " << sd_diffs << endl; // 4.99166 + // Standard deviation of differences = 4.99166 + double t = mean_diff * sqrt(static_cast(portions))/ sd_diffs; // -0.70117 + cout << "Student's t = " << t << ", if " << degrees_of_freedom << " degrees of freedom." << endl; + // Student's t = -0.70117, if 3 degrees of freedom. + cout << "Probability of the means being different is " << 2.F * cdf(students_t(degrees_of_freedom), t) << "."<< endl; // 0.266846 * 2 = 0.533692 - // Double the probability because using a 'two-sided test' because - // mean for 'Wet oxidation' could be either - // greater OR LESS THAN for 'Direct extraction'. + // Double the probability because using a 'two-sided test' because + // mean for 'Wet oxidation' could be either + // greater OR LESS THAN for 'Direct extraction'. - return 0; + return 0; } // int main() /* diff --git a/include/boost/math/bindings/rr.hpp b/include/boost/math/bindings/rr.hpp index cbeae9556..2bbf25f31 100644 --- a/include/boost/math/bindings/rr.hpp +++ b/include/boost/math/bindings/rr.hpp @@ -566,15 +566,15 @@ namespace constants{ template<> inline boost::math::ntl::RR pi(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR)) { - NTL::RR result; - ComputePi(result); - return result; + NTL::RR result; + ComputePi(result); + return result; } template<> inline boost::math::ntl::RR e(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR)) { - NTL::RR result; + NTL::RR result; result = 1; - return exp(result); + return exp(result); } } // namespace constants diff --git a/include/boost/math/distributions/binomial.hpp b/include/boost/math/distributions/binomial.hpp index b829e7b9b..36000adb2 100644 --- a/include/boost/math/distributions/binomial.hpp +++ b/include/boost/math/distributions/binomial.hpp @@ -231,8 +231,8 @@ namespace boost } if (p <= pow(1 - success_fraction, trials)) { // p <= pdf(dist, 0) == cdf(dist, 0) - return 0; // So the only reasonable result is zero. - } // And root finder would fail otherwise. + return 0; // So the only reasonable result is zero. + } // And root finder would fail otherwise. // Solve for quantile numerically: // @@ -406,9 +406,9 @@ namespace boost }; // template class binomial_distribution typedef binomial_distribution<> binomial; - // typedef binomial_distribution binomial; - // IS now included since no longer a name clash with function binomial. - //typedef binomial_distribution binomial; // Reserved name of type double. + // typedef binomial_distribution binomial; + // IS now included since no longer a name clash with function binomial. + //typedef binomial_distribution binomial; // Reserved name of type double. template const std::pair range(const binomial_distribution& dist) @@ -676,8 +676,8 @@ namespace boost // 1993, vol. 40, no3-4, pp. 185-189 (4 ref.) // Bounds for median and 50 percetage point of binomial and negative binomial distribution - // Metrika, ISSN 0026-1335 (Print) 1435-926X (Online) - // Volume 41, Number 1 / December, 1994, DOI 10.1007/BF01895303 + // Metrika, ISSN 0026-1335 (Print) 1435-926X (Online) + // Volume 41, Number 1 / December, 1994, DOI 10.1007/BF01895303 BOOST_MATH_STD_USING // ADL of std functions. RealType p = dist.success_fraction(); RealType n = dist.trials(); diff --git a/include/boost/math/distributions/cauchy.hpp b/include/boost/math/distributions/cauchy.hpp index ca6a06020..ca0b0a3bc 100644 --- a/include/boost/math/distributions/cauchy.hpp +++ b/include/boost/math/distributions/cauchy.hpp @@ -85,7 +85,7 @@ RealType cdf_imp(const cauchy_distribution& dist, const RealTy return 0.5; } result = -atan(1 / mx) / constants::pi(); - return (((x > location) != complement) ? 1 - result : result); + return (((x > location) != complement) ? 1 - result : result); } // cdf template @@ -180,14 +180,14 @@ typedef cauchy_distribution cauchy; template inline const std::pair range(const cauchy_distribution&) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); // - to + infinity. + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); // - to + infinity. } template inline const std::pair support(const cauchy_distribution& ) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return std::pair(-tools::max_value(), tools::max_value()); // - to + infinity. } diff --git a/include/boost/math/distributions/chi_squared.hpp b/include/boost/math/distributions/chi_squared.hpp index 9f6da17d9..cbed73d24 100644 --- a/include/boost/math/distributions/chi_squared.hpp +++ b/include/boost/math/distributions/chi_squared.hpp @@ -58,14 +58,14 @@ typedef chi_squared_distribution chi_squared; template inline const std::pair range(const chi_squared_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(0, max_value()); // 0 to + infinity. + using boost::math::tools::max_value; + return std::pair(0, max_value()); // 0 to + infinity. } template inline const std::pair support(const chi_squared_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. return std::pair(0, tools::max_value()); // 0 to + infinity. } diff --git a/include/boost/math/distributions/exponential.hpp b/include/boost/math/distributions/exponential.hpp index 3f767d216..669636c37 100644 --- a/include/boost/math/distributions/exponential.hpp +++ b/include/boost/math/distributions/exponential.hpp @@ -80,16 +80,16 @@ typedef exponential_distribution exponential; template inline const std::pair range(const exponential_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(static_cast(0), max_value()); + using boost::math::tools::max_value; + return std::pair(static_cast(0), max_value()); } template inline const std::pair support(const exponential_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template diff --git a/include/boost/math/distributions/extreme_value.hpp b/include/boost/math/distributions/extreme_value.hpp index c9911d1d2..038307181 100644 --- a/include/boost/math/distributions/extreme_value.hpp +++ b/include/boost/math/distributions/extreme_value.hpp @@ -75,16 +75,16 @@ typedef extreme_value_distribution extreme_value; template inline const std::pair range(const extreme_value_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); } template inline const std::pair support(const extreme_value_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); } template diff --git a/include/boost/math/distributions/fisher_f.hpp b/include/boost/math/distributions/fisher_f.hpp index dd103bce3..8e020b7d0 100644 --- a/include/boost/math/distributions/fisher_f.hpp +++ b/include/boost/math/distributions/fisher_f.hpp @@ -57,16 +57,16 @@ typedef fisher_f_distribution fisher_f; template inline const std::pair range(const fisher_f_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template inline const std::pair support(const fisher_f_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template diff --git a/include/boost/math/distributions/gamma.hpp b/include/boost/math/distributions/gamma.hpp index 26645539c..5ac4bb370 100644 --- a/include/boost/math/distributions/gamma.hpp +++ b/include/boost/math/distributions/gamma.hpp @@ -102,16 +102,16 @@ private: template inline const std::pair range(const gamma_distribution& /* dist */) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template inline const std::pair support(const gamma_distribution& /* dist */) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template diff --git a/include/boost/math/distributions/lognormal.hpp b/include/boost/math/distributions/lognormal.hpp index f2ee911f8..a496e4a14 100644 --- a/include/boost/math/distributions/lognormal.hpp +++ b/include/boost/math/distributions/lognormal.hpp @@ -77,16 +77,16 @@ typedef lognormal_distribution lognormal; template inline const std::pair range(const lognormal_distribution& /*dist*/) { // Range of permissible values for random variable x is >0 to +infinity. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template inline const std::pair support(const lognormal_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template diff --git a/include/boost/math/distributions/negative_binomial.hpp b/include/boost/math/distributions/negative_binomial.hpp index 0eff143de..ccc8127b1 100644 --- a/include/boost/math/distributions/negative_binomial.hpp +++ b/include/boost/math/distributions/negative_binomial.hpp @@ -259,16 +259,16 @@ namespace boost template inline const std::pair range(const negative_binomial_distribution& /* dist */) { // Range of permissible values for random variable k. - using boost::math::tools::max_value; - return std::pair(0, max_value()); // max_integer? + using boost::math::tools::max_value; + return std::pair(0, max_value()); // max_integer? } template inline const std::pair support(const negative_binomial_distribution& /* dist */) { // Range of supported values for random variable k. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(0, max_value()); // max_integer? + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(0, max_value()); // max_integer? } template @@ -458,7 +458,7 @@ namespace boost } if (P <= pow(dist.success_fraction(), dist.successes())) { // p <= pdf(dist, 0) == cdf(dist, 0) - return 0; + return 0; } /* // Calculate quantile of negative_binomial using the inverse incomplete beta function. diff --git a/include/boost/math/distributions/normal.hpp b/include/boost/math/distributions/normal.hpp index 464e0dbda..f3776bc5f 100644 --- a/include/boost/math/distributions/normal.hpp +++ b/include/boost/math/distributions/normal.hpp @@ -74,17 +74,17 @@ typedef normal_distribution normal; template inline const std::pair range(const normal_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); // - to + max value. + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); // - to + max value. } template inline const std::pair support(const normal_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); // - to + max value. + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); // - to + max value. } template diff --git a/include/boost/math/distributions/poisson.hpp b/include/boost/math/distributions/poisson.hpp index 43861a5c1..9bb6e8b1c 100644 --- a/include/boost/math/distributions/poisson.hpp +++ b/include/boost/math/distributions/poisson.hpp @@ -233,16 +233,16 @@ namespace boost template inline const std::pair range(const poisson_distribution& /* dist */) { // Range of permissible values for random variable k. - using boost::math::tools::max_value; - return std::pair(0, max_value()); // Max integer? + using boost::math::tools::max_value; + return std::pair(0, max_value()); // Max integer? } template inline const std::pair support(const poisson_distribution& /* dist */) { // Range of supported values for random variable k. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template @@ -480,10 +480,10 @@ namespace boost BOOST_MATH_STD_USING // ADL of std functions. // if(p == 0) NOT necessarily zero! // Not necessarily any special value of k because is unlimited. - if (p <= exp(-dist.mean())) - { // if p <= cdf for 0 events (== pdf for 0 events), then quantile must be zero. - return 0; - } + if (p <= exp(-dist.mean())) + { // if p <= cdf for 0 events (== pdf for 0 events), then quantile must be zero. + return 0; + } return gamma_q_inva(dist.mean(), p, Policy()) - 1; */ typedef typename Policy::discrete_quantile_type discrete_type; @@ -549,9 +549,9 @@ namespace boost } /* if (-q <= boost::math::expm1(-dist.mean())) - { // if q <= cdf(complement for 0 events, then quantile must be zero. - return 0; - } + { // if q <= cdf(complement for 0 events, then quantile must be zero. + return 0; + } return gamma_p_inva(dist.mean(), q, Policy()) -1; */ typedef typename Policy::discrete_quantile_type discrete_type; diff --git a/include/boost/math/distributions/rayleigh.hpp b/include/boost/math/distributions/rayleigh.hpp index ebc85ee30..2a97b4194 100644 --- a/include/boost/math/distributions/rayleigh.hpp +++ b/include/boost/math/distributions/rayleigh.hpp @@ -80,16 +80,16 @@ typedef rayleigh_distribution rayleigh; template inline const std::pair range(const rayleigh_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(static_cast(1), max_value()); + using boost::math::tools::max_value; + return std::pair(static_cast(1), max_value()); } template inline const std::pair support(const rayleigh_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair((1), max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair((1), max_value()); } template diff --git a/include/boost/math/distributions/students_t.hpp b/include/boost/math/distributions/students_t.hpp index c0f536193..14bdf9cfe 100644 --- a/include/boost/math/distributions/students_t.hpp +++ b/include/boost/math/distributions/students_t.hpp @@ -63,16 +63,16 @@ typedef students_t_distribution students_t; template inline const std::pair range(const students_t_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); } template inline const std::pair support(const students_t_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); } template @@ -146,7 +146,7 @@ inline RealType cdf(const students_t_distribution& dist, const RealType z = degrees_of_freedom / (degrees_of_freedom + t2); probability = ibeta(degrees_of_freedom / 2, static_cast(0.5), z, Policy()) / 2; } - return (t > 0 ? 1 - probability : probability); + return (t > 0 ? 1 - probability : probability); } // cdf template diff --git a/include/boost/math/distributions/uniform.hpp b/include/boost/math/distributions/uniform.hpp index dd51437ae..5efb5dd0e 100644 --- a/include/boost/math/distributions/uniform.hpp +++ b/include/boost/math/distributions/uniform.hpp @@ -140,16 +140,16 @@ namespace boost{ namespace math template inline const std::pair range(const uniform_distribution& /* dist */) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(-max_value(), max_value()); // - to + infinity + using boost::math::tools::max_value; + return std::pair(-max_value(), max_value()); // - to + infinity } template inline const std::pair support(const uniform_distribution& dist) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(dist.lower(), dist.upper()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(dist.lower(), dist.upper()); } template diff --git a/include/boost/math/distributions/weibull.hpp b/include/boost/math/distributions/weibull.hpp index 43b14c5d9..c41704ba9 100644 --- a/include/boost/math/distributions/weibull.hpp +++ b/include/boost/math/distributions/weibull.hpp @@ -102,16 +102,16 @@ typedef weibull_distribution weibull; template inline const std::pair range(const weibull_distribution& /*dist*/) { // Range of permissible values for random variable x. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template inline const std::pair support(const weibull_distribution& /*dist*/) { // Range of supported values for random variable x. - // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - using boost::math::tools::max_value; - return std::pair(0, max_value()); + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + return std::pair(0, max_value()); } template diff --git a/include/boost/math/policies/error_handling.hpp b/include/boost/math/policies/error_handling.hpp index bf9cdbbb3..33335be9b 100644 --- a/include/boost/math/policies/error_handling.hpp +++ b/include/boost/math/policies/error_handling.hpp @@ -62,9 +62,9 @@ template void raise_error(const char* function, const char* message) { if(function == 0) - function = "Unknown function"; + function = "Unknown function"; if(message == 0) - message = "Cause unknown"; + message = "Cause unknown"; std::string msg("Error in function "); msg += (boost::format(function) % typeid(T).name()).str(); @@ -79,9 +79,9 @@ template void raise_error(const char* function, const char* message, const T& val) { if(function == 0) - function = "Unknown function"; + function = "Unknown function"; if(message == 0) - message = "Cause unknown"; + message = "Cause unknown"; std::string msg("Error in function "); msg += (boost::format(function) % typeid(T).name()).str(); diff --git a/include/boost/math/special_functions/cbrt.hpp b/include/boost/math/special_functions/cbrt.hpp index 4e3c54184..d8c9ad4e6 100644 --- a/include/boost/math/special_functions/cbrt.hpp +++ b/include/boost/math/special_functions/cbrt.hpp @@ -14,18 +14,18 @@ namespace boost{ namespace math{ namespace detail { - template - struct cbrt_functor - { - cbrt_functor(T const& target) : a(target){} - std::tr1::tuple operator()(T const& z) - { - T sqr = z * z; - return std::tr1::make_tuple(sqr * z - a, 3 * sqr, 6 * z); - } - private: - T a; - }; + template + struct cbrt_functor + { + cbrt_functor(T const& target) : a(target){} + std::tr1::tuple operator()(T const& z) + { + T sqr = z * z; + return std::tr1::make_tuple(sqr * z - a, 3 * sqr, 6 * z); + } + private: + T a; + }; template T cbrt_imp(T z, const Policy&) diff --git a/include/boost/math/special_functions/math_fwd.hpp b/include/boost/math/special_functions/math_fwd.hpp index 8f32099ad..f4d607f53 100644 --- a/include/boost/math/special_functions/math_fwd.hpp +++ b/include/boost/math/special_functions/math_fwd.hpp @@ -28,8 +28,8 @@ namespace boost { - namespace math - { // Math functions (in roughly alphabetic order). + namespace math + { // Math functions (in roughly alphabetic order). // Beta functions. template @@ -621,7 +621,7 @@ namespace boost template bool isnormal BOOST_NO_MACRO_EXPAND(T t); - } // namespace math + } // namespace math } // namespace boost #define BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(Policy)\ diff --git a/include/boost/math/special_functions/sign.hpp b/include/boost/math/special_functions/sign.hpp index db6c943e0..b22913d5d 100644 --- a/include/boost/math/special_functions/sign.hpp +++ b/include/boost/math/special_functions/sign.hpp @@ -6,8 +6,7 @@ #ifndef BOOST_MATH_TOOLS_SIGN_HPP #define BOOST_MATH_TOOLS_SIGN_HPP -#include -#include +#include namespace boost{ namespace math{ @@ -26,6 +25,7 @@ inline int signbit(const T& z) template inline T copysign(const T& x, const T& y) { + BOOST_MATH_STD_USING return fabs(x) * boost::math::sign(y); } diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 66fa93670..d82ffc1c4 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -176,30 +176,30 @@ inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d) #ifdef __linux__ - #include + #include - namespace boost{ namespace math{ - namespace detail - { - struct fpu_guard - { - fpu_guard() - { - fegetexceptflag(&m_flags, FE_ALL_EXCEPT); - feclearexcept(FE_ALL_EXCEPT); - } - ~fpu_guard() - { - fesetexceptflag(&m_flags, FE_ALL_EXCEPT); - } - private: - fexcept_t m_flags; - }; + namespace boost{ namespace math{ + namespace detail + { + struct fpu_guard + { + fpu_guard() + { + fegetexceptflag(&m_flags, FE_ALL_EXCEPT); + feclearexcept(FE_ALL_EXCEPT); + } + ~fpu_guard() + { + fesetexceptflag(&m_flags, FE_ALL_EXCEPT); + } + private: + fexcept_t m_flags; + }; - } // namespace detail - }} // namespaces + } // namespace detail + }} // namespaces - #define BOOST_FPU_EXCEPTION_GUARD boost::math::detail::fpu_guard local_guard_object; + #define BOOST_FPU_EXCEPTION_GUARD boost::math::detail::fpu_guard local_guard_object; #else // All other platforms. #define BOOST_FPU_EXCEPTION_GUARD #endif diff --git a/include/boost/math/tools/fraction.hpp b/include/boost/math/tools/fraction.hpp index cd125b7c8..f5b3df5a4 100644 --- a/include/boost/math/tools/fraction.hpp +++ b/include/boost/math/tools/fraction.hpp @@ -17,52 +17,52 @@ namespace boost{ namespace math{ namespace tools{ namespace detail { - template - struct is_pair : public boost::false_type{}; + template + struct is_pair : public boost::false_type{}; - template - struct is_pair > : public boost::true_type{}; + template + struct is_pair > : public boost::true_type{}; - template - struct fraction_traits_simple - { - typedef typename Gen::result_type result_type; - typedef typename Gen::result_type value_type; + template + struct fraction_traits_simple + { + typedef typename Gen::result_type result_type; + typedef typename Gen::result_type value_type; - static result_type a(const value_type& v) - { - return 1; - } - static result_type b(const value_type& v) - { - return v; - } - }; + static result_type a(const value_type& v) + { + return 1; + } + static result_type b(const value_type& v) + { + return v; + } + }; - template - struct fraction_traits_pair - { - typedef typename Gen::result_type value_type; - typedef typename value_type::first_type result_type; + template + struct fraction_traits_pair + { + typedef typename Gen::result_type value_type; + typedef typename value_type::first_type result_type; - static result_type a(const value_type& v) - { - return v.first; - } - static result_type b(const value_type& v) - { - return v.second; - } - }; + static result_type a(const value_type& v) + { + return v.first; + } + static result_type b(const value_type& v) + { + return v.second; + } + }; - template - struct fraction_traits - : public boost::mpl::if_c< - is_pair::value, - fraction_traits_pair, - fraction_traits_simple >::type - { - }; + template + struct fraction_traits + : public boost::mpl::if_c< + is_pair::value, + fraction_traits_pair, + fraction_traits_simple >::type + { + }; } // namespace detail diff --git a/test/assoc_legendre_p.ipp b/test/assoc_legendre_p.ipp index fbbcda2e9..456ba6d49 100644 --- a/test/assoc_legendre_p.ipp +++ b/test/assoc_legendre_p.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 400> assoc_legendre_p = { SC_(3.755727291107177734375), SC_(-3), SC_(0.264718532562255859375), SC_(0.018682285998021253444483874168352748715136623066073), diff --git a/test/binomial_data.ipp b/test/binomial_data.ipp index 763caa363..2ad131388 100644 --- a/test/binomial_data.ipp +++ b/test/binomial_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 159> binomial_data = { { { SC_(0.15e2), SC_(0.15e2), SC_(0.1e1) }, diff --git a/test/binomial_large_data.ipp b/test/binomial_large_data.ipp index a87733011..7441d393d 100644 --- a/test/binomial_large_data.ipp +++ b/test/binomial_large_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 230> binomial_large_data = { { { SC_(0.174e3), SC_(0.4e1), SC_(0.36890001e8) }, diff --git a/test/binomial_quantile.ipp b/test/binomial_quantile.ipp index 871e46e28..b2a1c55ab 100644 --- a/test/binomial_quantile.ipp +++ b/test/binomial_quantile.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 4032> binomial_quantile_data = {{ { SC_(2), SC_(0.12698681652545928955078125), SC_(0.12698681652545928955078125), SC_(0), SC_(0.28467385230321224203411154382440248724380832183117) }, diff --git a/test/cbrt_data.ipp b/test/cbrt_data.ipp index 8eefcc56e..12d5f5def 100644 --- a/test/cbrt_data.ipp +++ b/test/cbrt_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 85> cbrt_data = { { { SC_(0.266297021326439287136622624529991298914e-12), SC_(0.1888421455001568264216782004847867296461e-37) }, diff --git a/test/digamma_data.ipp b/test/digamma_data.ipp index e118a2346..b5ab09aca 100644 --- a/test/digamma_data.ipp +++ b/test/digamma_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 500> digamma_data = { { { SC_(2.818432331085205078125), SC_(0.8484115700906551606307984398000472347785) }, diff --git a/test/digamma_neg_data.ipp b/test/digamma_neg_data.ipp index 0addba672..d77f8215e 100644 --- a/test/digamma_neg_data.ipp +++ b/test/digamma_neg_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 200> digamma_neg_data = { { { SC_(-99.7181549072265625), SC_(2.03892909952497242038694056382195623059) }, diff --git a/test/digamma_root_data.ipp b/test/digamma_root_data.ipp index 36c9643e6..b0a3aa838 100644 --- a/test/digamma_root_data.ipp +++ b/test/digamma_root_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 200> digamma_root_data = { { { SC_(1.39999997615814208984375), SC_(-0.06138456903152256550686860248931989075643) }, diff --git a/test/digamma_small_data.ipp b/test/digamma_small_data.ipp index 4d582c689..7377548db 100644 --- a/test/digamma_small_data.ipp +++ b/test/digamma_small_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 33> digamma_small_data = { { { SC_(0.1690093176520690576580818742513656616211e-8), SC_(-591683355.0172646248558707395909205014789) }, diff --git a/test/ellint_k_data.ipp b/test/ellint_k_data.ipp index 54b21f551..0b8ea2255 100644 --- a/test/ellint_k_data.ipp +++ b/test/ellint_k_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 100> ellint_k_data = { SC_(-0.99042308330535888671875e0), SC_(0.3377711175347896212115917173531827081735908096628e1), diff --git a/test/erf_data.ipp b/test/erf_data.ipp index ee44c32dc..d13707ad5 100644 --- a/test/erf_data.ipp +++ b/test/erf_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 500> erf_data = { { { SC_(-7.954905033111572265625), SC_(-0.9999999999999999999999999999768236114552), SC_(1.999999999999999999999999999976823611455) }, diff --git a/test/erf_inv_data.ipp b/test/erf_inv_data.ipp index 710bd05b9..b3ee380cc 100644 --- a/test/erf_inv_data.ipp +++ b/test/erf_inv_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 100> erf_inv_data = { { { SC_(-0.990433037281036376953125), SC_(-1.832184533179510927322805923563700329767) }, diff --git a/test/erf_large_data.ipp b/test/erf_large_data.ipp index 1f48763a1..ef4ea8b3a 100644 --- a/test/erf_large_data.ipp +++ b/test/erf_large_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 300> erf_large_data = { { { SC_(8.2311115264892578125), SC_(0.9999999999999999999999999999997436415644), SC_(0.2563584356432915693836191701249115171878e-30) }, diff --git a/test/erfc_inv_big_data.ipp b/test/erfc_inv_big_data.ipp index f8035d3f5..60725380c 100644 --- a/test/erfc_inv_big_data.ipp +++ b/test/erfc_inv_big_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 200> erfc_inv_big_data = { { { SC_(0.5460825444184401149953083908674803067585e-4312), SC_(99.62016927389407649911084501709563799849) }, diff --git a/test/erfc_inv_data.ipp b/test/erfc_inv_data.ipp index e80acd0b5..13ae441bd 100644 --- a/test/erfc_inv_data.ipp +++ b/test/erfc_inv_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 100> erfc_inv_data = { { { SC_(0.00956696830689907073974609375), SC_(1.832184391051582711731256541599359331735) }, diff --git a/test/functor.hpp b/test/functor.hpp index 829a440f9..cde300100 100644 --- a/test/functor.hpp +++ b/test/functor.hpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #ifndef BOOST_MATH_TEST_FUNCTOR_HPP #define BOOST_MATH_TEST_FUNCTOR_HPP diff --git a/test/gamma_inv_big_data.ipp b/test/gamma_inv_big_data.ipp index 36cccd316..89975a2a8 100644 --- a/test/gamma_inv_big_data.ipp +++ b/test/gamma_inv_big_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 130> gamma_inv_big_data = { { { SC_(464.56927490234375), SC_(0.12698681652545928955078125), SC_(440.0905015614498663381793089656310373835539712118699915057655756381750702144551901256933419148259778), SC_(489.2489328115381710888005650788332818303123263238882523231037266766796974176786885492715539575179927) }, diff --git a/test/gamma_inv_data.ipp b/test/gamma_inv_data.ipp index 623d82e07..e397a4619 100644 --- a/test/gamma_inv_data.ipp +++ b/test/gamma_inv_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 200> gamma_inv_data = { { { SC_(9.754039764404296875), SC_(0.12698681652545928955078125), SC_(6.349849983781954486964960115093039567468747967664820851534065876063014180392060424555352423162443804), SC_(13.35954665556050630769710564071384909890705633863167415813992116806093647564994418684947673739937248) }, diff --git a/test/gamma_inv_small_data.ipp b/test/gamma_inv_small_data.ipp index dcca00391..bedd4ad51 100644 --- a/test/gamma_inv_small_data.ipp +++ b/test/gamma_inv_small_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 229> gamma_inv_small_data = { { { SC_(0.1730655412757187150418758392333984375e-5), SC_(0.12698681652545928955078125), SC_(0.2239623606222809074122747811596115646210220735131141509259977248899758059576948436798908594057794725e-517862), SC_(0.4348301951174619607003912855228982264838968134589390827069898370149065135278987288014463439625604227e-34079) }, diff --git a/test/handle_test_result.hpp b/test/handle_test_result.hpp index 227471823..8317eb5cd 100644 --- a/test/handle_test_result.hpp +++ b/test/handle_test_result.hpp @@ -1,4 +1,7 @@ - +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_HANDLE_TEST_RESULT #define BOOST_MATH_HANDLE_TEST_RESULT diff --git a/test/hermite.ipp b/test/hermite.ipp index 3cefaaaee..a42413232 100644 --- a/test/hermite.ipp +++ b/test/hermite.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 420> hermite = { SC_(0.8e1), SC_(-0.804919189453125e3), SC_(0.45107507538695517471998224862706929168983312035236e26), diff --git a/test/ibeta_int_data.ipp b/test/ibeta_int_data.ipp index 0d06ba2b4..73266d83c 100644 --- a/test/ibeta_int_data.ipp +++ b/test/ibeta_int_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 1000> ibeta_int_data = { { { SC_(1), SC_(1), SC_(0.12707412242889404296875), SC_(0.12707412242889404296875), SC_(0.87292587757110595703125), SC_(0.12707412242889404296875), SC_(0.87292587757110595703125) }, diff --git a/test/ibeta_inv_data.ipp b/test/ibeta_inv_data.ipp index c7ddb65f3..fbed1c49d 100644 --- a/test/ibeta_inv_data.ipp +++ b/test/ibeta_inv_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 1210> ibeta_inv_data = { { { SC_(0.104760829344741068780422210693359375e-4), SC_(39078.1875), SC_(0.913384497165679931640625), SC_(0.2135769916611873809373928693612157637794870746322109915739746618652569766882593624385400901395922558e-3760), SC_(0.6169146818683135737866366973021696361959736535710675458813428774517757535576031054239811928697394346e-101417) }, diff --git a/test/ibeta_inva_data.ipp b/test/ibeta_inva_data.ipp index 34e8fefc5..05a6bd211 100644 --- a/test/ibeta_inva_data.ipp +++ b/test/ibeta_inva_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 1100> ibeta_inva_data = { { { SC_(0.101913392427377402782440185546875e-4), SC_(0.3082362115383148193359375), SC_(0.1355634629726409912109375), SC_(0.6498233713152427462579302903941895526823485861809005407005756658138299437345439685916818979079350952e-4), SC_(0.1598220360006443400909761969445329244603859759388130816641624923434214075962489978723834186220509792e-5), SC_(0.1598250823507423266003361933591577902014719110010440833489018043541995851576985396009647692344594598e-5), SC_(0.6499023539055942142435327607856798948132754954188633069136984730655318067141056849740949064680308213e-4) }, diff --git a/test/igamma_int_data.ipp b/test/igamma_int_data.ipp index 0cab53119..77e20f289 100644 --- a/test/igamma_int_data.ipp +++ b/test/igamma_int_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 140> igamma_int_data = { { { SC_(0.5), SC_(0.004999999888241291046142578125), SC_(1.631267845368323485191815380032984903074365412587098308286220239190324188420710121791871591309590004), SC_(0.9203443263332001265162236927545643793578786527087679769237787431564844748135321134774112708209554194), SC_(0.1411860055371925421063521033081602797231840435352888199275875506625870961703220596656577919527041757), SC_(0.07965567366679987348377630724543562064212134729123202307622125684351552518646788652258872917904458057) }, diff --git a/test/igamma_inva_data.ipp b/test/igamma_inva_data.ipp index bf45d3459..573821934 100644 --- a/test/igamma_inva_data.ipp +++ b/test/igamma_inva_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 435> igamma_inva_data = { { { SC_(0.11342023313045501708984375), SC_(0.097540400922298431396484375), SC_(1.035869900800721563193351335409353423054156223778352824799732510014114331303190861923913851617789576), SC_(0.05862165929221091309602935851268320728966552926925608108837955463403857541085640683871851098187935567) }, diff --git a/test/laguerre2.ipp b/test/laguerre2.ipp index 7fb1d0b9d..ccbb26fe5 100644 --- a/test/laguerre2.ipp +++ b/test/laguerre2.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 280> laguerre2 = { SC_(0.5e1), SC_(0.9754039764404296875e2), SC_(-0.56218428868911115998451316426215010600803852349048e8), diff --git a/test/laguerre3.ipp b/test/laguerre3.ipp index abcf7acae..3567163f7 100644 --- a/test/laguerre3.ipp +++ b/test/laguerre3.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 2240> laguerre3 = { SC_(0.6e1), SC_(0.4e1), SC_(0.9754039764404296875e2), SC_(0.61248773400035441372705568899743424188675775638604e9), diff --git a/test/legendre_p.ipp b/test/legendre_p.ipp index 4462ea6ca..0a21b9279 100644 --- a/test/legendre_p.ipp +++ b/test/legendre_p.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 140> legendre_p = { SC_(3), SC_(-0.804919183254241943359375), SC_(-0.09637879251279735399302410605920296560178428535437), SC_(-0.84585603807674271376114723023136351467791030262194), diff --git a/test/legendre_p_large.ipp b/test/legendre_p_large.ipp index badc3ba3c..a1f7d1ac8 100644 --- a/test/legendre_p_large.ipp +++ b/test/legendre_p_large.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 160> legendre_p_large = { SC_(29), SC_(-0.74602639675140380859375), SC_(0.050915219643735786802064817454102557266509665552523), SC_(-0.27118035040452065163236941090242943684321195237749), diff --git a/test/log1p_expm1_data.ipp b/test/log1p_expm1_data.ipp index f1c1ac1d7..a4cd8da04 100644 --- a/test/log1p_expm1_data.ipp +++ b/test/log1p_expm1_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 80> log1p_expm1_data = { { { SC_(-0.69330310821533203125e0), SC_(-0.1181895342296499380302723361817935835636e1), SC_(-0.5000779577496508480606742934033661111325e0) }, diff --git a/test/negative_binomial_quantile.ipp b/test/negative_binomial_quantile.ipp index 8ced2a6da..e20981f94 100644 --- a/test/negative_binomial_quantile.ipp +++ b/test/negative_binomial_quantile.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 792> negative_binomial_quantile_data = {{ { SC_(4.285762786865234375), SC_(0.12698681652545928955078125), SC_(0.097540400922298431396484375), SC_(11.568381290037563253305975817351444024377036234904), SC_(49.67581419477884086070549390307050513757197652133) }, diff --git a/test/poisson_quantile.ipp b/test/poisson_quantile.ipp index 393b62147..4ed508817 100644 --- a/test/poisson_quantile.ipp +++ b/test/poisson_quantile.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 619> poisson_quantile_data = {{ { SC_(2.539736270904541015625), SC_(0.097540400922298431396484375), SC_(0.1236392659323415267286721455855935332272165776019), SC_(4.1794244675777288954971650240102219690023733491107) }, diff --git a/test/spherical_harmonic.ipp b/test/spherical_harmonic.ipp index 85245c525..0115a0edc 100644 --- a/test/spherical_harmonic.ipp +++ b/test/spherical_harmonic.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 1000> spherical_harmonic = { SC_(0.2e1), SC_(0), SC_(-0.6223074436187744140625e1), SC_(-0.983176708221435546875e0), SC_(0.62736841735769885881246893757736785347239567286304e0), SC_(0), diff --git a/test/test_bernoulli.cpp b/test/test_bernoulli.cpp index d65e6ff0d..e86389b27 100644 --- a/test/test_bernoulli.cpp +++ b/test/test_bernoulli.cpp @@ -210,9 +210,9 @@ void test_spots(RealType) int test_main(int, char* []) { BOOST_MATH_CONTROL_FP; - // Check that can generate bernoulli distribution using both convenience methods: - bernoulli_distribution bn1(0.5); // Using default RealType double. - boost::math::bernoulli bn2(0.5); // Using typedef. + // Check that can generate bernoulli distribution using both convenience methods: + bernoulli_distribution bn1(0.5); // Using default RealType double. + boost::math::bernoulli bn2(0.5); // Using typedef. BOOST_CHECK_EQUAL(bn1.success_fraction(), 0.5); BOOST_CHECK_EQUAL(bn2.success_fraction(), 0.5); diff --git a/test/test_bessel_y.cpp b/test/test_bessel_y.cpp index 06a4f83ec..b72fc048e 100644 --- a/test/test_bessel_y.cpp +++ b/test/test_bessel_y.cpp @@ -151,7 +151,7 @@ void expected_results() ".*", // stdlib "Sun.*", // platform largest_type, // test type(s) - "Y[0N] Mathworld.*", // test data group + "Y[0N].*Mathworld.*", // test data group ".*", 2000, 2000); // test function #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_beta_dist.cpp b/test/test_beta_dist.cpp index a83c5a094..5256e4a31 100644 --- a/test/test_beta_dist.cpp +++ b/test/test_beta_dist.cpp @@ -21,7 +21,7 @@ // provided 40 decimal digits accuracy incomplete beta aka beta regularized == cdf // http://www.ausvet.com.au/pprev/content.php?page=PPscript -// mode 0.75 5/95% 0.9 alpha 7.39 beta 3.13 +// mode 0.75 5/95% 0.9 alpha 7.39 beta 3.13 // http://www.epi.ucdavis.edu/diagnostictests/betabuster.html // Beta Buster also calculates alpha and beta from mode & percentile estimates. // This is NOT (yet) implemented. diff --git a/test/test_binomial.cpp b/test/test_binomial.cpp index b81d09c74..cfe9e5f1b 100644 --- a/test/test_binomial.cpp +++ b/test/test_binomial.cpp @@ -354,27 +354,27 @@ void test_spots(RealType) // so useful for testing 64-bit double accuracy. // P = 0.25, n = 20, k = 0 to 20 - //0 C(20,0) * 0.25^0 * 0.75^20 0.00317121193893399322405457496643 - //1 C(20,1) * 0.25^1 * 0.75^19 0.02114141292622662149369716644287 - //2 C(20,2) * 0.25^2 * 0.75^18 0.06694780759971763473004102706909 - //3 C(20,3) * 0.25^3 * 0.75^17 0.13389561519943526946008205413818 - //4 C(20,4) * 0.25^4 * 0.75^16 0.18968545486586663173511624336242 - //5 C(20,5) * 0.25^5 * 0.75^15 0.20233115185692440718412399291992 - //6 C(20,6) * 0.25^6 * 0.75^14 0.16860929321410367265343666076660 - //7 C(20,7) * 0.25^7 * 0.75^13 0.11240619547606911510229110717773 - //8 C(20,8) * 0.25^8 * 0.75^12 0.06088668921620410401374101638793 - //9 C(20,9) * 0.25^9 * 0.75^11 0.02706075076275737956166267395019 - //10 C(20,10) * 0.25^10 * 0.75^10 0.00992227527967770583927631378173 - //11 C(20,11) * 0.25^11 * 0.75^9 0.00300675008475081995129585266113 - //12 C(20,12) * 0.25^12 * 0.75^8 0.00075168752118770498782396316528 - //13 C(20,13) * 0.25^13 * 0.75^7 0.00015419231203850358724594116210 - //14 C(20,14) * 0.25^14 * 0.75^6 0.00002569871867308393120765686035 - //15 C(20,15) * 0.25^15 * 0.75^5 0.00000342649582307785749435424804 - //16 C(20,16) * 0.25^16 * 0.75^4 0.00000035692664823727682232856750 - //17 C(20,17) * 0.25^17 * 0.75^3 0.00000002799424692057073116302490 - //18 C(20,18) * 0.25^18 * 0.75^2 0.00000000155523594003170728683471 - //19 C(20,19) * 0.25^19 * 0.75^1 0.00000000005456968210637569427490 - //20 C(20,20) * 0.25^20 * 0.75^0 0.00000000000090949470177292823791 + //0 C(20,0) * 0.25^0 * 0.75^20 0.00317121193893399322405457496643 + //1 C(20,1) * 0.25^1 * 0.75^19 0.02114141292622662149369716644287 + //2 C(20,2) * 0.25^2 * 0.75^18 0.06694780759971763473004102706909 + //3 C(20,3) * 0.25^3 * 0.75^17 0.13389561519943526946008205413818 + //4 C(20,4) * 0.25^4 * 0.75^16 0.18968545486586663173511624336242 + //5 C(20,5) * 0.25^5 * 0.75^15 0.20233115185692440718412399291992 + //6 C(20,6) * 0.25^6 * 0.75^14 0.16860929321410367265343666076660 + //7 C(20,7) * 0.25^7 * 0.75^13 0.11240619547606911510229110717773 + //8 C(20,8) * 0.25^8 * 0.75^12 0.06088668921620410401374101638793 + //9 C(20,9) * 0.25^9 * 0.75^11 0.02706075076275737956166267395019 + //10 C(20,10) * 0.25^10 * 0.75^10 0.00992227527967770583927631378173 + //11 C(20,11) * 0.25^11 * 0.75^9 0.00300675008475081995129585266113 + //12 C(20,12) * 0.25^12 * 0.75^8 0.00075168752118770498782396316528 + //13 C(20,13) * 0.25^13 * 0.75^7 0.00015419231203850358724594116210 + //14 C(20,14) * 0.25^14 * 0.75^6 0.00002569871867308393120765686035 + //15 C(20,15) * 0.25^15 * 0.75^5 0.00000342649582307785749435424804 + //16 C(20,16) * 0.25^16 * 0.75^4 0.00000035692664823727682232856750 + //17 C(20,17) * 0.25^17 * 0.75^3 0.00000002799424692057073116302490 + //18 C(20,18) * 0.25^18 * 0.75^2 0.00000000155523594003170728683471 + //19 C(20,19) * 0.25^19 * 0.75^1 0.00000000005456968210637569427490 + //20 C(20,20) * 0.25^20 * 0.75^0 0.00000000000090949470177292823791 BOOST_CHECK_CLOSE( @@ -483,7 +483,7 @@ void test_spots(RealType) kurtosis_excess(dist) , static_cast(-0.08333333333333333333333333333333333333L), tol2); // Check kurtosis_excess == kurtosis -3; - BOOST_CHECK_EQUAL(kurtosis(dist), static_cast(3) + kurtosis_excess(dist)); + BOOST_CHECK_EQUAL(kurtosis(dist), static_cast(3) + kurtosis_excess(dist)); // special cases for PDF: BOOST_CHECK_EQUAL( @@ -693,10 +693,10 @@ void test_spots(RealType) int test_main(int, char* []) { BOOST_MATH_CONTROL_FP; - // Check that can generate binomial distribution using one convenience methods: - binomial_distribution<> mybn2(1., 0.5); // Using default RealType double. + // Check that can generate binomial distribution using one convenience methods: + binomial_distribution<> mybn2(1., 0.5); // Using default RealType double. // but that - // boost::math::binomial mybn1(1., 0.5); // Using typedef fails + // boost::math::binomial mybn1(1., 0.5); // Using typedef fails // error C2039: 'binomial' : is not a member of 'boost::math' // Basic sanity-check spot values. diff --git a/test/test_cauchy.cpp b/test/test_cauchy.cpp index 6f29dc37f..14e6cea71 100644 --- a/test/test_cauchy.cpp +++ b/test/test_cauchy.cpp @@ -21,21 +21,21 @@ #include // for real_concept #include - using boost::math::cauchy_distribution; + using boost::math::cauchy_distribution; #include // Boost.Test #include #include - using std::cout; - using std::endl; + using std::cout; + using std::endl; template void test_spots(RealType T) { // Check some bad parameters to the distribution, - BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(0, 0), std::domain_error); // zero sd - BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(0, -1), std::domain_error); // negative scale (shape) + BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(0, 0), std::domain_error); // zero sd + BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(0, -1), std::domain_error); // negative scale (shape) cauchy_distribution C01; BOOST_CHECK_EQUAL(C01.location(), 0); // Check standard values. @@ -51,8 +51,8 @@ void test_spots(RealType T) BOOST_CHECK_EQUAL(cdf(complement(C01, +std::numeric_limits::infinity())), 0); // x = + infinity, cdf = 0 BOOST_CHECK_EQUAL(cdf(complement(C01, -std::numeric_limits::infinity())), 1); // x = - infinity, cdf = 1 BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(std::numeric_limits::infinity(), static_cast(1)), std::domain_error); // +infinite mean - BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(-std::numeric_limits::infinity(), static_cast(1)), std::domain_error); // -infinite mean - BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(static_cast(0), std::numeric_limits::infinity()), std::domain_error); // infinite sd + BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(-std::numeric_limits::infinity(), static_cast(1)), std::domain_error); // -infinite mean + BOOST_CHECK_THROW(boost::math::cauchy_distribution nbad1(static_cast(0), std::numeric_limits::infinity()), std::domain_error); // infinite sd } if (std::numeric_limits::has_quiet_NaN) @@ -85,61 +85,61 @@ void test_spots(RealType T) cauchy_distribution(), static_cast(0.125)), // x static_cast(0.53958342416056554201085167134004L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(-0.125)), // x static_cast(0.46041657583943445798914832865996L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(0.5)), // x static_cast(0.64758361765043327417540107622474L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(-0.5)), // x static_cast(0.35241638234956672582459892377526L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(1.0)), // x static_cast(0.75), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(-1.0)), // x static_cast(0.25), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(2.0)), // x static_cast(0.85241638234956672582459892377526L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(-2.0)), // x static_cast(0.14758361765043327417540107622474L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(10.0)), // x static_cast(0.9682744825694464304850228813987L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(), static_cast(-10.0)), // x static_cast(0.031725517430553569514977118601302L), // probability. - tolerance); // % + tolerance); // % // // Complements: @@ -149,61 +149,61 @@ void test_spots(RealType T) complement(cauchy_distribution(), static_cast(0.125))), // x static_cast(0.46041657583943445798914832865996L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(-0.125))), // x static_cast(0.53958342416056554201085167134004L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(0.5))), // x static_cast(0.35241638234956672582459892377526L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(-0.5))), // x static_cast(0.64758361765043327417540107622474L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(1.0))), // x static_cast(0.25), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(-1.0))), // x static_cast(0.75), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(2.0))), // x static_cast(0.14758361765043327417540107622474L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(-2.0))), // x static_cast(0.85241638234956672582459892377526L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(10.0))), // x static_cast(0.031725517430553569514977118601302L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(), static_cast(-10.0))), // x static_cast(0.9682744825694464304850228813987L), // probability. - tolerance); // % + tolerance); // % // // Quantiles: @@ -213,61 +213,61 @@ void test_spots(RealType T) cauchy_distribution(), static_cast(0.53958342416056554201085167134004L)), static_cast(0.125), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.46041657583943445798914832865996L)), static_cast(-0.125), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.64758361765043327417540107622474L)), static_cast(0.5), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.35241638234956672582459892377526)), static_cast(-0.5), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.75)), static_cast(1.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.25)), static_cast(-1.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.85241638234956672582459892377526L)), static_cast(2.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.14758361765043327417540107622474L)), static_cast(-2.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.9682744825694464304850228813987L)), static_cast(10.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(), static_cast(0.031725517430553569514977118601302L)), static_cast(-10.0), - tolerance); // % + tolerance); // % // // Quantile from complement: @@ -277,61 +277,61 @@ void test_spots(RealType T) complement(cauchy_distribution(), static_cast(0.46041657583943445798914832865996L))), static_cast(0.125), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.53958342416056554201085167134004L))), static_cast(-0.125), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.35241638234956672582459892377526L))), static_cast(0.5), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.64758361765043327417540107622474L))), static_cast(-0.5), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.25))), static_cast(1.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.75))), static_cast(-1.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.14758361765043327417540107622474L))), static_cast(2.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.85241638234956672582459892377526L))), static_cast(-2.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.031725517430553569514977118601302L))), static_cast(10.0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(), static_cast(0.9682744825694464304850228813987L))), static_cast(-10.0), - tolerance); // % + tolerance); // % // // PDF @@ -341,73 +341,73 @@ void test_spots(RealType T) cauchy_distribution(), static_cast(0.125)), // x static_cast(0.31341281101173235351410956479511L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(-0.125)), // x static_cast(0.31341281101173235351410956479511L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(0.5)), // x static_cast(0.25464790894703253723021402139602L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(-0.5)), // x static_cast(0.25464790894703253723021402139602L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(1.0)), // x static_cast(0.15915494309189533576888376337251L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(-1.0)), // x static_cast(0.15915494309189533576888376337251L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(2.0)), // x static_cast(0.063661977236758134307553505349006L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(-2.0)), // x static_cast(0.063661977236758134307553505349006L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(10.0)), // x static_cast(0.0031515830315226799162155200667825L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(), static_cast(-10.0)), // x static_cast(0.0031515830315226799162155200667825L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(2, 5), static_cast(1)), // x static_cast(0.061213439650728975295724524374044L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( cauchy_distribution(-2, 0.25), static_cast(1)), // x static_cast(0.0087809623774838805941453110826215L), // probability. - tolerance); // % + tolerance); // % // // The following test values were calculated using MathCad, @@ -419,250 +419,250 @@ void test_spots(RealType T) cauchy_distribution(1, 1), static_cast(0.125)), // x static_cast(0.271189304634946L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(1, 1), static_cast(0.125))), // x static_cast(1 - 0.271189304634946L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(1, 1), static_cast(0.271189304634946L)), // x static_cast(0.125), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(1, 1), static_cast(1 - 0.271189304634946L))), // x static_cast(0.125), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(0.125)), // x static_cast(0.539583424160566L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(0.5)), // x static_cast(0.647583617650433L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(1)), // x static_cast(0.750000000000000), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(2)), // x static_cast(0.852416382349567), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(10)), // x static_cast(0.968274482569447), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(100)), // x static_cast(0.996817007235092), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(-0.125)), // x static_cast(0.460416575839434), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(-0.5)), // x static_cast(0.352416382349567), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(-1)), // x static_cast(0.2500000000000000), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(-2)), // x static_cast(0.147583617650433), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(-10)), // x static_cast(0.031725517430554), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(0, 1), static_cast(-100)), // x static_cast(3.18299276490824E-3), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(1, 5), static_cast(1.25)), // x static_cast(0.515902251256176), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(2, 2), static_cast(1.25)), // x static_cast(0.385799748780092), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(4, 0.125), static_cast(3)), // x static_cast(0.039583424160566), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(-2, static_cast(0.0001)), static_cast(-3)), // x static_cast(3.1830988512275777e-5), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(4, 50), static_cast(-3)), // x static_cast(0.455724386698215), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(-4, 50), static_cast(-3)), // x static_cast(0.506365349100973), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(1, 5), static_cast(1.25))), // x static_cast(1-0.515902251256176), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(2, 2), static_cast(1.25))), // x static_cast(1-0.385799748780092), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(4, 0.125), static_cast(3))), // x static_cast(1-0.039583424160566), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( cauchy_distribution(-2, static_cast(0.001)), static_cast(-3)), // x static_cast(0.000318309780080539), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(4, 50), static_cast(-3))), // x static_cast(1-0.455724386698215), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(cauchy_distribution(-4, 50), static_cast(-3))), // x static_cast(1-0.506365349100973), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(1, 5), static_cast(0.515902251256176)), // x static_cast(1.25), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(2, 2), static_cast(0.385799748780092)), // x static_cast(1.25), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(4, 0.125), static_cast(0.039583424160566)), // x static_cast(3), // probability. - tolerance); // % + tolerance); // % /* BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(-2, 0.0001), static_cast(-3)), // x static_cast(0.000015915494296), // probability. - tolerance); // % + tolerance); // % */ BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(4, 50), static_cast(0.455724386698215)), // x static_cast(-3), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(-4, 50), static_cast(0.506365349100973)), // x static_cast(-3), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(1, 5), static_cast(1-0.515902251256176))), // x static_cast(1.25), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(2, 2), static_cast(1-0.385799748780092))), // x static_cast(1.25), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(4, 0.125), static_cast(1-0.039583424160566))), // x static_cast(3), // probability. - tolerance); // % + tolerance); // % /* BOOST_CHECK_CLOSE( ::boost::math::quantile( cauchy_distribution(-2, 0.0001), static_cast(-3)), // x static_cast(0.000015915494296), // probability. - tolerance); // % + tolerance); // % */ BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(4, 50), static_cast(1-0.455724386698215))), // x static_cast(-3), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::quantile( complement(cauchy_distribution(-4, 50), static_cast(1-0.506365349100973))), // x static_cast(-3), // probability. - tolerance); // % + tolerance); // % cauchy_distribution dist; // default (0, 1) BOOST_CHECK_EQUAL( @@ -715,15 +715,15 @@ void test_spots(RealType T) int test_main(int, char* []) { BOOST_MATH_CONTROL_FP; - // Check that can generate cauchy distribution using the two convenience methods: - boost::math::cauchy mycd1(1.); // Using typedef - cauchy_distribution<> mycd2(1.); // Using default RealType double. - cauchy_distribution<> C01; // Using default RealType double for Standard Cauchy. + // Check that can generate cauchy distribution using the two convenience methods: + boost::math::cauchy mycd1(1.); // Using typedef + cauchy_distribution<> mycd2(1.); // Using default RealType double. + cauchy_distribution<> C01; // Using default RealType double for Standard Cauchy. BOOST_CHECK_EQUAL(C01.location(), 0); // Check standard values. BOOST_CHECK_EQUAL(C01.scale(), 1); - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_chi_squared.cpp b/test/test_chi_squared.cpp index 360c31ce0..49a788e16 100644 --- a/test/test_chi_squared.cpp +++ b/test/test_chi_squared.cpp @@ -523,8 +523,8 @@ void test_spots(RealType) int test_main(int, char* []) { - BOOST_MATH_CONTROL_FP; - // Check that can generate chi_squared distribution using the two convenience methods: + BOOST_MATH_CONTROL_FP; + // Check that can generate chi_squared distribution using the two convenience methods: chi_squared_distribution<> mychisqr(8); chi_squared mychisqr2(8); diff --git a/test/test_constants.cpp b/test/test_constants.cpp index f3c887a26..aad457dad 100644 --- a/test/test_constants.cpp +++ b/test/test_constants.cpp @@ -20,10 +20,10 @@ void test_spots(RealType) { // Basic sanity checks for constants. - RealType tolerance = static_cast(2e-15); // double - //cout << "Tolerance for type " << typeid(T).name() << " is " << tolerance << "." << endl; + RealType tolerance = static_cast(2e-15); // double + //cout << "Tolerance for type " << typeid(T).name() << " is " << tolerance << "." << endl; - using namespace boost::math::constants; + using namespace boost::math::constants; using namespace std; // Help ADL of std exp, log... using std::exp; diff --git a/test/test_dist_overloads.cpp b/test/test_dist_overloads.cpp index 9ca6504a3..ef1008df0 100644 --- a/test/test_dist_overloads.cpp +++ b/test/test_dist_overloads.cpp @@ -10,15 +10,15 @@ #include // for real_concept #include - using boost::math::normal_distribution; + using boost::math::normal_distribution; #include // Boost.Test #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; template void test_spots(RealType) @@ -27,7 +27,7 @@ void test_spots(RealType) // 2 eps as a percentage: RealType tolerance = boost::math::tools::epsilon() * 2 * 100; - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; for(int i = -4; i <= 4; ++i) { @@ -67,8 +67,8 @@ void test_spots(RealType) int test_main(int, char* []) { - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_error_handling.cpp b/test/test_error_handling.cpp index b939cf5b7..04d31a314 100644 --- a/test/test_error_handling.cpp +++ b/test/test_error_handling.cpp @@ -126,13 +126,13 @@ void test_error(T) int test_main(int, char* []) { - // Test error handling. - // (Parameter value, arbitrarily zero, only communicates the floating point type FPT). - test_error(0.0F); // Test float. - test_error(0.0); // Test double. - test_error(0.0L); // Test long double. + // Test error handling. + // (Parameter value, arbitrarily zero, only communicates the floating point type FPT). + test_error(0.0F); // Test float. + test_error(0.0); // Test double. + test_error(0.0L); // Test long double. test_error(boost::math::concepts::real_concept(0.0L)); // Test concepts. - return 0; + return 0; } // int test_main(int, char* []) /* diff --git a/test/test_exponential_dist.cpp b/test/test_exponential_dist.cpp index 138fa1d55..3a2a7b5fa 100644 --- a/test/test_exponential_dist.cpp +++ b/test/test_exponential_dist.cpp @@ -10,15 +10,15 @@ #include // for real_concept #include - using boost::math::exponential_distribution; + using boost::math::exponential_distribution; #include // Boost.Test #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; template void test_spot(RealType l, RealType x, RealType p, RealType q, RealType tolerance) @@ -28,13 +28,13 @@ void test_spot(RealType l, RealType x, RealType p, RealType q, RealType toleranc exponential_distribution(l), x), p, - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(exponential_distribution(l), x)), q, - tolerance); // % + tolerance); // % if(p < 0.999) { BOOST_CHECK_CLOSE( @@ -42,7 +42,7 @@ void test_spot(RealType l, RealType x, RealType p, RealType q, RealType toleranc exponential_distribution(l), p), x, - tolerance); // % + tolerance); // % } if(q < 0.999) { @@ -51,7 +51,7 @@ void test_spot(RealType l, RealType x, RealType p, RealType q, RealType toleranc complement(exponential_distribution(l), q)), x, - tolerance); // % + tolerance); // % } } @@ -72,7 +72,7 @@ void test_spots(RealType T) { cout << "Expect parameter T == 0!" << endl; } - cout << "Tolerance for type " << typeid(T).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(T).name() << " is " << tolerance << " %" << endl; test_spot( static_cast(0.5), // lambda @@ -166,63 +166,63 @@ void test_spots(RealType T) exponential_distribution(0.5), static_cast(0.125)), // x static_cast(0.46970653140673789305985541231115L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( exponential_distribution(0.5), static_cast(5)), // x static_cast(0.04104249931194939758476433723358L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( exponential_distribution(2), static_cast(0.125)), // x static_cast(1.5576015661428097364903405339566L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( exponential_distribution(2), static_cast(5)), // x static_cast(9.0799859524969703071183031121101e-5L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::mean( exponential_distribution(2)), static_cast(0.5), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::standard_deviation( exponential_distribution(2)), static_cast(0.5), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::mode( exponential_distribution(2)), static_cast(0), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::median( exponential_distribution(4)), static_cast(0.693147180559945309417232121458176568075500134360255254) / 4, - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::skewness( exponential_distribution(2)), static_cast(2), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::kurtosis( exponential_distribution(2)), static_cast(9), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::kurtosis_excess( exponential_distribution(2)), static_cast(6), - tolerance); // % + tolerance); // % // // Things that are errors: @@ -255,11 +255,11 @@ void test_spots(RealType T) int test_main(int, char* []) { // Check that can generate exponential distribution using the two convenience methods: - boost::math::exponential mycexp1(1.); // Using typedef - exponential_distribution<> myexp2(1.); // Using default RealType double. + boost::math::exponential mycexp1(1.); // Using typedef + exponential_distribution<> myexp2(1.); // Using default RealType double. - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_extreme_value.cpp b/test/test_extreme_value.cpp index 576b63646..a1575cdcf 100644 --- a/test/test_extreme_value.cpp +++ b/test/test_extreme_value.cpp @@ -9,15 +9,15 @@ #include // for real_concept #include - using boost::math::extreme_value_distribution; + using boost::math::extreme_value_distribution; #include // Boost.Test #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; template void test_spot(RealType a, RealType b, RealType x, RealType p, RealType q, RealType tolerance) @@ -27,13 +27,13 @@ void test_spot(RealType a, RealType b, RealType x, RealType p, RealType q, RealT extreme_value_distribution(a, b), x), p, - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(extreme_value_distribution(a, b), x)), q, - tolerance); // % + tolerance); // % if((p < 0.999) && (p > 0)) { BOOST_CHECK_CLOSE( @@ -41,7 +41,7 @@ void test_spot(RealType a, RealType b, RealType x, RealType p, RealType q, RealT extreme_value_distribution(a, b), p), x, - tolerance); // % + tolerance); // % } if((q < 0.999) && (q > 0)) { @@ -50,7 +50,7 @@ void test_spot(RealType a, RealType b, RealType x, RealType p, RealType q, RealT complement(extreme_value_distribution(a, b), q)), x, - tolerance); // % + tolerance); // % } } @@ -65,7 +65,7 @@ void test_spots(RealType) boost::math::tools::epsilon()); tolerance *= 50 * 100; - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; // Results calculated by punching numbers into a calculator, // and using the formula at http://mathworld.wolfram.com/ExtremeValueDistribution.html @@ -103,56 +103,56 @@ void test_spots(RealType) extreme_value_distribution(0.5, 2), static_cast(0.125)), // x static_cast(0.18052654830890205978204427757846L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( extreme_value_distribution(1, 3), static_cast(5)), // x static_cast(0.0675057324099851209129017326286L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( extreme_value_distribution(1, 3), static_cast(0)), // x static_cast(0.11522236828583456431277265757312L), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::mean( extreme_value_distribution(2, 3)), static_cast(3.731646994704598581819536270246L), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::standard_deviation( extreme_value_distribution(-1, 0.5)), static_cast(0.6412749150809320477720181798355L), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::mode( extreme_value_distribution(2, 3)), static_cast(2), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::median( extreme_value_distribution(0, 1)), static_cast(+0.36651292058166432701243915823266946945426344783710526305367771367056), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::skewness( extreme_value_distribution(2, 3)), static_cast(1.1395470994046486574927930193898461120875997958366L), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::kurtosis( extreme_value_distribution(2, 3)), static_cast(5.4), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::kurtosis_excess( extreme_value_distribution(2, 3)), static_cast(2.4), - tolerance); // % + tolerance); // % // // Things that are errors: @@ -185,11 +185,11 @@ int test_main(int, char* []) { // Check that can generate extreme_value distribution using the two convenience methods: - boost::math::extreme_value mycev1(1.); // Using typedef - extreme_value_distribution<> myev2(1.); // Using default RealType double. + boost::math::extreme_value mycev1(1.); // Using typedef + extreme_value_distribution<> myev2(1.); // Using default RealType double. - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_find_location.cpp b/test/test_find_location.cpp index 6bc070ee5..7f1a8b61f 100644 --- a/test/test_find_location.cpp +++ b/test/test_find_location.cpp @@ -64,7 +64,7 @@ void test_spots(RealType) BOOST_CHECK_EQUAL(n.location(), 0); // aka mean. BOOST_CHECK_EQUAL(n.scale(), 1); // aka standard_deviation. - // Check for 'bad' arguments. + // Check for 'bad' arguments. BOOST_CHECK_THROW(find_location(0., -1., 0.), std::domain_error); // p below 0 to 1. BOOST_CHECK_THROW(find_location(0., 2., 0.), std::domain_error); // p above 0 to 1. BOOST_CHECK_THROW(find_location(numeric_limits::infinity(), 0.5, 0.), diff --git a/test/test_find_scale.cpp b/test/test_find_scale.cpp index 32309b6ed..4312253a4 100644 --- a/test/test_find_scale.cpp +++ b/test/test_find_scale.cpp @@ -64,7 +64,7 @@ void test_spots(RealType) BOOST_CHECK_EQUAL(n.location(), 0); // aka mean. BOOST_CHECK_EQUAL(n.scale(), 1); // aka standard_deviation. - // Check for 'bad' arguments. + // Check for 'bad' arguments. BOOST_CHECK_THROW(find_scale(0., -1., 0.), std::domain_error); // p below 0 to 1. BOOST_CHECK_THROW(find_scale(0., 2., 0.), std::domain_error); // p above 0 to 1. BOOST_CHECK_THROW(find_scale(numeric_limits::infinity(), 0.5, 0.), diff --git a/test/test_fisher_f.cpp b/test/test_fisher_f.cpp index 444c7b4ae..978b08efd 100644 --- a/test/test_fisher_f.cpp +++ b/test/test_fisher_f.cpp @@ -215,18 +215,18 @@ void test_spots(RealType) } } - // http://www.vias.org/simulations/simusoft_distcalc.html - // Distcalc version 1.2 Copyright 2002 H Lohninger, TU Wein - // H.Lohninger: Teach/Me Data Analysis, Springer-Verlag, Berlin-New York-Tokyo, 1999. ISBN 3-540-14743-8 - // The Windows calculator is available zipped distcalc.exe for download at: - // http://www.vias.org/simulations/simu_stat.html + // http://www.vias.org/simulations/simusoft_distcalc.html + // Distcalc version 1.2 Copyright 2002 H Lohninger, TU Wein + // H.Lohninger: Teach/Me Data Analysis, Springer-Verlag, Berlin-New York-Tokyo, 1999. ISBN 3-540-14743-8 + // The Windows calculator is available zipped distcalc.exe for download at: + // http://www.vias.org/simulations/simu_stat.html - // This interactive Windows program was used to find some combination for which the - // result appears to be exact. No doubt this can be done analytically too, - // by mathematicians! + // This interactive Windows program was used to find some combination for which the + // result appears to be exact. No doubt this can be done analytically too, + // by mathematicians! - // Some combinations for which the result is 'exact', or at least is to 40 decimal digits. - // 40 decimal digits includes 128-bit significand User Defined Floating-Point types. + // Some combinations for which the result is 'exact', or at least is to 40 decimal digits. + // 40 decimal digits includes 128-bit significand User Defined Floating-Point types. // These all pass tests at near epsilon accuracy for the floating-point type. tolerance = boost::math::tools::epsilon() * 5 * 100; cout << "Tolerance = " << tolerance << "%." << endl; @@ -236,7 +236,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(2.)/static_cast(3.) ), // F static_cast(0.5), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -244,7 +244,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(1.6L))), // F static_cast(0.333333333333333333333333333333333333L), // probability. - tolerance * 100); // needs higher tolerance at 128-bit precision - value not exact? + tolerance * 100); // needs higher tolerance at 128-bit precision - value not exact? BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -252,7 +252,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(6.5333333333333333333333333333333333L))), // F static_cast(0.125L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -260,7 +260,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(1.))), // F static_cast(0.5L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -268,7 +268,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(3.))), // F static_cast(0.25L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -276,7 +276,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(3.))), // F static_cast(0.25L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -284,7 +284,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(7.))), // F static_cast(0.125L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -292,7 +292,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(9.))), // F static_cast(0.1L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -300,7 +300,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(19.))), // F static_cast(0.05L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -308,7 +308,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(29.))), // F static_cast(0.03333333333333333333333333333333333333333L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -316,7 +316,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(99.))), // F static_cast(0.01L), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -324,7 +324,7 @@ void test_spots(RealType) static_cast(4.)), // df2 static_cast(9.))), // F static_cast(0.028L), // probability. - tolerance*10); // not quite exact??? + tolerance*10); // not quite exact??? BOOST_CHECK_CLOSE( cdf(complement(fisher_f_distribution( @@ -332,7 +332,7 @@ void test_spots(RealType) static_cast(8.)), // df2 static_cast(1.))), // F static_cast(0.5L), // probability. - tolerance); + tolerance); // Inverse tests @@ -342,7 +342,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(0.03333333333333333333333333333333333333333L))), // probability static_cast(29.), // F expected. - tolerance*10); + tolerance*10); BOOST_CHECK_CLOSE( quantile(fisher_f_distribution( @@ -350,7 +350,7 @@ void test_spots(RealType) static_cast(2.)), // df2 static_cast(1.0L - 0.03333333333333333333333333333333333333333L)), // probability static_cast(29.), // F expected. - tolerance*10); + tolerance*10); // Also note limit cases for F(1, infinity) == normal distribution @@ -505,8 +505,8 @@ int test_main(int, char* []) { // Check that can generate fisher distribution using the two convenience methods: - boost::math::fisher_f myf1(1., 2); // Using typedef - fisher_f_distribution<> myf2(1., 2); // Using default RealType double. + boost::math::fisher_f myf1(1., 2); // Using typedef + fisher_f_distribution<> myf2(1., 2); // Using default RealType double. // Basic sanity-check spot values. diff --git a/test/test_gamma_dist.cpp b/test/test_gamma_dist.cpp index c23f896ba..0023de948 100644 --- a/test/test_gamma_dist.cpp +++ b/test/test_gamma_dist.cpp @@ -20,13 +20,13 @@ #include #include - using boost::math::gamma_distribution; + using boost::math::gamma_distribution; #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; #include using std::numeric_limits; @@ -49,14 +49,14 @@ void check_gamma(RealType shape, RealType scale, RealType x, RealType p, RealTyp gamma_distribution(shape, scale), // distribution. x), // random variable. p, // probability. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::cdf( complement( gamma_distribution(shape, scale), // distribution. x)), // random variable. q, // probability complement. - tol); // %tolerance. + tol); // %tolerance. if(p < 0.999) { BOOST_CHECK_CLOSE( @@ -64,7 +64,7 @@ void check_gamma(RealType shape, RealType scale, RealType x, RealType p, RealTyp gamma_distribution(shape, scale), // distribution. p), // probability. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. } if(q < 0.999) { @@ -74,7 +74,7 @@ void check_gamma(RealType shape, RealType scale, RealType x, RealType p, RealTyp gamma_distribution(shape, scale), // distribution. q)), // probability complement. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. } // PDF: BOOST_CHECK_CLOSE( @@ -82,7 +82,7 @@ void check_gamma(RealType shape, RealType scale, RealType x, RealType p, RealTyp gamma_distribution(shape, scale), // distribution. x), // random variable. NaivePDF(shape, scale, x), // PDF - tol); // %tolerance. + tol); // %tolerance. } template @@ -90,12 +90,12 @@ void test_spots(RealType) { // Basic sanity checks // - // 15 decimal places expressed as a persentage. + // 15 decimal places expressed as a persentage. // The first tests use values generated by MathCAD, // and should be accurate to around double precision. // RealType tolerance = (std::max)(5e-14f, boost::math::tools::real_cast(std::numeric_limits::epsilon() * 20)) * 100; - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; check_gamma( static_cast(0.5), @@ -128,8 +128,8 @@ void test_spots(RealType) // (it doesn't agree with MathCAD or this implementation). // To be fair the incomplete gamma is tricky to get right in this area... // - tolerance = 1e-5f * 100; // 5 decimal places as a persentage - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + tolerance = 1e-5f * 100; // 5 decimal places as a persentage + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; check_gamma( static_cast(2), @@ -216,7 +216,7 @@ void test_spots(RealType) int test_main(int, char* []) { // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_ibeta.cpp b/test/test_ibeta.cpp index 8f564685d..41ce4a2d1 100644 --- a/test/test_ibeta.cpp +++ b/test/test_ibeta.cpp @@ -507,14 +507,22 @@ int test_main(int, char* []) #ifdef TEST_GSL gsl_set_error_handler_off(); #endif +#ifdef TEST_FLOAT test_spots(0.0F); +#endif +#ifdef TEST_DOUBLE test_spots(0.0); +#endif #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#ifdef TEST_LDOUBLE test_spots(0.0L); +#endif #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +#ifdef TEST_REAL_CONCEPT test_spots(boost::math::concepts::real_concept(0.1)); #endif #endif +#endif #ifdef TEST_FLOAT test_beta(0.1F, "float"); diff --git a/test/test_ibeta_inv.cpp b/test/test_ibeta_inv.cpp index 0c8638e9e..a53d9a7e4 100644 --- a/test/test_ibeta_inv.cpp +++ b/test/test_ibeta_inv.cpp @@ -307,12 +307,20 @@ int test_main(int, char* []) #ifdef TEST_GSL gsl_set_error_handler_off(); #endif +#ifdef TEST_FLOAT test_spots(0.0F); +#endif +#ifdef TEST_DOUBLE test_spots(0.0); +#endif #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#ifdef TEST_LDOUBLE test_spots(0.0L); +#endif +#ifdef TEST_REAL_CONCEPT test_spots(boost::math::concepts::real_concept(0.1)); #endif +#endif #ifdef TEST_FLOAT test_beta(0.1F, "float"); diff --git a/test/test_ibeta_inv_ab.cpp b/test/test_ibeta_inv_ab.cpp index a23daab7b..04292450d 100644 --- a/test/test_ibeta_inv_ab.cpp +++ b/test/test_ibeta_inv_ab.cpp @@ -263,8 +263,6 @@ void test_beta(T, const char* name) int test_main(int, char* []) { expected_results(); - boost::math::ibetac_invb(15.3268413543701171875f, 0.3082362115383148193359375f, 0.913384497165679931640625f); - boost::math::ibetac(15.3268413543701171875f, 21.432123240471673235001418f, 0.3082362115383148193359375f); #ifdef TEST_GSL gsl_set_error_handler_off(); #endif diff --git a/test/test_igamma_inv.cpp b/test/test_igamma_inv.cpp index a91e692de..cc19dcf3f 100644 --- a/test/test_igamma_inv.cpp +++ b/test/test_igamma_inv.cpp @@ -367,15 +367,23 @@ int test_main(int, char* []) BOOST_MATH_CONTROL_FP; #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS +#ifdef TEST_FLOAT test_spots(0.0F, "float"); #endif +#endif +#ifdef TEST_DOUBLE test_spots(0.0, "double"); +#endif #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#ifdef TEST_LDOUBLE test_spots(0.0L, "long double"); +#endif #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +#ifdef TEST_REAL_CONCEPT test_spots(boost::math::concepts::real_concept(0.1), "real_concept"); #endif #endif +#endif #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS #ifdef TEST_FLOAT diff --git a/test/test_lognormal.cpp b/test/test_lognormal.cpp index 0116983e2..b964b9c0c 100644 --- a/test/test_lognormal.cpp +++ b/test/test_lognormal.cpp @@ -13,13 +13,13 @@ #include #include - using boost::math::lognormal_distribution; + using boost::math::lognormal_distribution; #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; #include using std::numeric_limits; #include @@ -32,27 +32,27 @@ void check_lognormal(RealType loc, RealType scale, RealType x, RealType p, RealT lognormal_distribution(loc, scale), // distribution. x), // random variable. p, // probability. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::cdf( complement( lognormal_distribution(loc, scale), // distribution. x)), // random variable. q, // probability complement. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::quantile( lognormal_distribution(loc, scale), // distribution. p), // probability. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::quantile( complement( lognormal_distribution(loc, scale), // distribution. q)), // probability complement. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. } template @@ -60,12 +60,12 @@ void test_spots(RealType) { // Basic sanity checks. - RealType tolerance = 5e-3 * 100; - // Some tests only pass at 1e-4 because values generated by + RealType tolerance = 5e-3 * 100; + // Some tests only pass at 1e-4 because values generated by // http://faculty.vassar.edu/lowry/VassarStats.html // give only 5 or 6 *fixed* places, so small values have fewer digits. - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; using std::exp; @@ -144,7 +144,7 @@ void test_spots(RealType) // Tests for PDF // tolerance = boost::math::tools::epsilon() * 5 * 100; // 5 eps as a percentage - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; BOOST_CHECK_CLOSE( pdf(lognormal_distribution(), static_cast(1)), static_cast(0.3989422804014326779399460599343818684759L), // 1/sqrt(2*pi) @@ -176,7 +176,7 @@ void test_spots(RealType) tolerance = (std::max)( boost::math::tools::epsilon(), static_cast(boost::math::tools::epsilon())) * 5 * 100; // 5 eps as a percentage - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; lognormal_distribution dist(8, 3); RealType x = static_cast(0.125); using namespace std; // ADL of std names. @@ -258,9 +258,9 @@ void test_spots(RealType) int test_main(int, char* []) { - // Check that can generate lognormal distribution using the two convenience methods: - boost::math::lognormal myf1(1., 2); // Using typedef - lognormal_distribution<> myf2(1., 2); // Using default RealType double. + // Check that can generate lognormal distribution using the two convenience methods: + boost::math::lognormal myf1(1., 2); // Using typedef + lognormal_distribution<> myf2(1., 2); // Using default RealType double. // Test range and support using double only, // because it supports numeric_limits max for a pseudo-infinity. @@ -269,8 +269,8 @@ int test_main(int, char* []) BOOST_CHECK_EQUAL(support(myf2).first, 0); // support 0 to + infinity. BOOST_CHECK_EQUAL(support(myf2).second, (std::numeric_limits::max)()); - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_negative_binomial.cpp b/test/test_negative_binomial.cpp index 7dd277ab8..64417d28c 100644 --- a/test/test_negative_binomial.cpp +++ b/test/test_negative_binomial.cpp @@ -793,8 +793,8 @@ int test_main(int, char* []) { // Check that can generate negative_binomial distribution using the two convenience methods: using namespace boost::math; - negative_binomial mynb1(2., 0.5); // Using typedef - default type is double. - negative_binomial_distribution<> myf2(2., 0.5); // Using default RealType double. + negative_binomial mynb1(2., 0.5); // Using typedef - default type is double. + negative_binomial_distribution<> myf2(2., 0.5); // Using default RealType double. // Basic sanity-check spot values. diff --git a/test/test_normal.cpp b/test/test_normal.cpp index b3b13bc3e..c03090439 100644 --- a/test/test_normal.cpp +++ b/test/test_normal.cpp @@ -26,13 +26,13 @@ #include #include - using boost::math::normal_distribution; + using boost::math::normal_distribution; #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; #include using std::numeric_limits; @@ -54,41 +54,41 @@ void check_normal(RealType mean, RealType sd, RealType x, RealType p, RealType q normal_distribution(mean, sd), // distribution. x), // random variable. p, // probability. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::cdf( complement( normal_distribution(mean, sd), // distribution. x)), // random variable. q, // probability complement. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::quantile( normal_distribution(mean, sd), // distribution. p), // probability. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::quantile( complement( normal_distribution(mean, sd), // distribution. q)), // probability complement. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. } template void test_spots(RealType) { // Basic sanity checks - RealType tolerance = static_cast(std::pow(10., -(4-2))); // 1e-4 (as %) - // Some tests only pass at 1e-4 because values generated by + RealType tolerance = static_cast(std::pow(10., -(4-2))); // 1e-4 (as %) + // Some tests only pass at 1e-4 because values generated by // http://faculty.vassar.edu/lowry/VassarStats.html // give only 5 or 6 *fixed* places, so small values have fewer digits. // Check some bad parameters to the distribution, - BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(0, 0), std::domain_error); // zero sd - BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(0, -1), std::domain_error); // negative sd + BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(0, 0), std::domain_error); // zero sd + BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(0, -1), std::domain_error); // negative sd // Tests on extreme values of random variate x, if has numeric_limit infinity etc. normal_distribution N01; @@ -101,8 +101,8 @@ void test_spots(RealType) BOOST_CHECK_EQUAL(cdf(complement(N01, +std::numeric_limits::infinity())), 0); // x = + infinity, c cdf = 0 BOOST_CHECK_EQUAL(cdf(complement(N01, -std::numeric_limits::infinity())), 1); // x = - infinity, c cdf = 1 BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(std::numeric_limits::infinity(), static_cast(1)), std::domain_error); // +infinite mean - BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(-std::numeric_limits::infinity(), static_cast(1)), std::domain_error); // -infinite mean - BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(static_cast(0), std::numeric_limits::infinity()), std::domain_error); // infinite sd + BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(-std::numeric_limits::infinity(), static_cast(1)), std::domain_error); // -infinite mean + BOOST_CHECK_THROW(boost::math::normal_distribution nbad1(static_cast(0), std::numeric_limits::infinity()), std::domain_error); // infinite sd } if (std::numeric_limits::has_quiet_NaN) @@ -115,7 +115,7 @@ void test_spots(RealType) BOOST_CHECK_THROW(quantile(complement(N01, +std::numeric_limits::quiet_NaN())), std::domain_error); // p = + infinity } - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; check_normal( static_cast(5), @@ -284,8 +284,8 @@ void test_spots(RealType) int test_main(int, char* []) { // Check that can generate normal distribution using the two convenience methods: - boost::math::normal myf1(1., 2); // Using typedef - normal_distribution<> myf2(1., 2); // Using default RealType double. + boost::math::normal myf1(1., 2); // Using typedef + normal_distribution<> myf2(1., 2); // Using default RealType double. boost::math::normal myn01; // Use default values. // Note NOT myn01() as the compiler will interpret as a function! @@ -293,8 +293,8 @@ int test_main(int, char* []) BOOST_CHECK_EQUAL(myn01.mean(), myn01.location()); BOOST_CHECK_EQUAL(myn01.standard_deviation(), myn01.scale()); - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_pareto.cpp b/test/test_pareto.cpp index 80e95b2b2..7c80d6cef 100644 --- a/test/test_pareto.cpp +++ b/test/test_pareto.cpp @@ -24,13 +24,13 @@ #include #include - using boost::math::pareto_distribution; + using boost::math::pareto_distribution; #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; #include using std::numeric_limits; @@ -233,11 +233,11 @@ void test_spots(RealType) int test_main(int, char* []) { // Check that can generate pareto distribution using the two convenience methods: - boost::math::pareto myp1(1., 1); // Using typedef - pareto_distribution<> myp2(1., 1); // Using default RealType double. + boost::math::pareto myp1(1., 1); // Using typedef + pareto_distribution<> myp2(1., 1); // Using default RealType double. boost::math::pareto pareto11; // Use default values (location = 1, shape = 1). // Note NOT pareto11() as the compiler will interpret as a function! - // Basic sanity-check spot values. + // Basic sanity-check spot values. BOOST_CHECK_EQUAL(pareto11.location(), 1); // Check defaults again. BOOST_CHECK_EQUAL(pareto11.shape(), 1); @@ -254,10 +254,10 @@ int test_main(int, char* []) BOOST_CHECK_EQUAL(support(myp2).second, (numeric_limits::max)()); // Check some bad parameters to the distribution. - BOOST_CHECK_THROW(boost::math::pareto mypm1(-1, 1), std::domain_error); // Using typedef - BOOST_CHECK_THROW(boost::math::pareto myp0(0, 1), std::domain_error); // Using typedef - BOOST_CHECK_THROW(boost::math::pareto myp1m1(1, -1), std::domain_error); // Using typedef - BOOST_CHECK_THROW(boost::math::pareto myp10(1, 0), std::domain_error); // Using typedef + BOOST_CHECK_THROW(boost::math::pareto mypm1(-1, 1), std::domain_error); // Using typedef + BOOST_CHECK_THROW(boost::math::pareto myp0(0, 1), std::domain_error); // Using typedef + BOOST_CHECK_THROW(boost::math::pareto myp1m1(1, -1), std::domain_error); // Using typedef + BOOST_CHECK_THROW(boost::math::pareto myp10(1, 0), std::domain_error); // Using typedef // Check some moments that should fail because shape not big enough. BOOST_CHECK_THROW(variance(myp2), std::domain_error); @@ -268,9 +268,9 @@ int test_main(int, char* []) // Test on extreme values of distribution parameters, // using just double because it has numeric_limit infinity etc. - BOOST_CHECK_THROW(boost::math::pareto mypinf1(+std::numeric_limits::infinity(), 1), std::domain_error); // Using typedef - BOOST_CHECK_THROW(boost::math::pareto myp1inf(1, +std::numeric_limits::infinity()), std::domain_error); // Using typedef - BOOST_CHECK_THROW(boost::math::pareto mypinf1(+std::numeric_limits::infinity(), +std::numeric_limits::infinity()), std::domain_error); // Using typedef + BOOST_CHECK_THROW(boost::math::pareto mypinf1(+std::numeric_limits::infinity(), 1), std::domain_error); // Using typedef + BOOST_CHECK_THROW(boost::math::pareto myp1inf(1, +std::numeric_limits::infinity()), std::domain_error); // Using typedef + BOOST_CHECK_THROW(boost::math::pareto mypinf1(+std::numeric_limits::infinity(), +std::numeric_limits::infinity()), std::domain_error); // Using typedef // Test on extreme values of random variate x, using just double because it has numeric_limit infinity etc.. // No longer allow x to be + or - infinity, then these tests should throw. @@ -296,7 +296,7 @@ int test_main(int, char* []) BOOST_CHECK_THROW(cdf(pareto11, -(std::numeric_limits::min)()), std::domain_error); // x = - min, BOOST_CHECK_THROW(cdf(pareto11, -(std::numeric_limits::max)()), std::domain_error); // x = - max, - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tol5eps = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tol5eps = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_poisson.cpp b/test/test_poisson.cpp index acbc6c4d1..7773d4a19 100644 --- a/test/test_poisson.cpp +++ b/test/test_poisson.cpp @@ -27,7 +27,7 @@ #include #include - using boost::math::poisson_distribution; + using boost::math::poisson_distribution; #include // for real_concept #include // for real_concept @@ -35,11 +35,11 @@ // using boost::math::qamma_Q; #include - using std::cout; - using std::endl; - using std::setprecision; - using std::showpoint; - using std::ios; + using std::cout; + using std::endl; + using std::setprecision; + using std::showpoint; + using std::ios; #include using std::numeric_limits; @@ -47,10 +47,10 @@ template // Any floating-point type RealType. void test_spots(RealType) { // Basic sanity checks, tolerance is about numeric_limits::digits10 decimal places, - // guaranteed for type RealType, eg 6 for float, 15 for double, - // expressed as a percentage (so -2) for BOOST_CHECK_CLOSE, + // guaranteed for type RealType, eg 6 for float, 15 for double, + // expressed as a percentage (so -2) for BOOST_CHECK_CLOSE, - int decdigits = numeric_limits::digits10; + int decdigits = numeric_limits::digits10; // May eb >15 for 80 and 128-bit FP typtes. if (decdigits <= 0) { // decdigits is not defined, for example real concept, @@ -62,21 +62,21 @@ void test_spots(RealType) decdigits = 15; // numeric_limits::digits10; } - decdigits -= 1; // Perhaps allow some decimal digit(s) margin of numerical error. - RealType tolerance = static_cast(std::pow(10., -(decdigits-2))); // 1e-6 (-2 so as %) - tolerance *= 2; // Allow some bit(s) small margin (2 means + or - 1 bit) of numerical error. - // Typically 2e-13% = 2e-15 as fraction for double. + decdigits -= 1; // Perhaps allow some decimal digit(s) margin of numerical error. + RealType tolerance = static_cast(std::pow(10., -(decdigits-2))); // 1e-6 (-2 so as %) + tolerance *= 2; // Allow some bit(s) small margin (2 means + or - 1 bit) of numerical error. + // Typically 2e-13% = 2e-15 as fraction for double. - // Sources of spot test values: + // Sources of spot test values: // Many be some combinations for which the result is 'exact', // or at least is good to 40 decimal digits. - // 40 decimal digits includes 128-bit significand User Defined Floating-Point types, - - // Best source of accurate values is: - // Mathworld online calculator (40 decimal digits precision, suitable for up to 128-bit significands) - // http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=GammaRegularized - // GammaRegularized is same as gamma incomplete, gamma or gamma_q(a, x) or Q(a, z). + // 40 decimal digits includes 128-bit significand User Defined Floating-Point types, + + // Best source of accurate values is: + // Mathworld online calculator (40 decimal digits precision, suitable for up to 128-bit significands) + // http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=GammaRegularized + // GammaRegularized is same as gamma incomplete, gamma or gamma_q(a, x) or Q(a, z). // http://documents.wolfram.com/calculationcenter/v2/Functions/ListsMatrices/Statistics/PoissonDistribution.html @@ -148,177 +148,177 @@ void test_spots(RealType) BOOST_CHECK_CLOSE( // mode mode(poisson_distribution(static_cast(4))), // mode = mean = 4. static_cast(4), // mode. - tolerance); + tolerance); //BOOST_CHECK_CLOSE( // mode // median(poisson_distribution(static_cast(4))), // mode = mean = 4. // static_cast(4), // mode. - // tolerance); + // tolerance); poisson_distribution dist4(static_cast(40)); BOOST_CHECK_CLOSE( // median median(dist4), // mode = mean = 4. median = 40.328333333333333 quantile(dist4, static_cast(0.5)), // 39.332839138842637 - tolerance); + tolerance); // PDF BOOST_CHECK_CLOSE( pdf(poisson_distribution(static_cast(4)), // mean 4. static_cast(0)), static_cast(1.831563888873410E-002), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( pdf(poisson_distribution(static_cast(4)), // mean 4. static_cast(2)), static_cast(1.465251111098740E-001), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( pdf(poisson_distribution(static_cast(20)), // mean big. static_cast(1)), // k small static_cast(4.122307244877130E-008), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( pdf(poisson_distribution(static_cast(4)), // mean 4. static_cast(20)), // K>> mean static_cast(8.277463646553730E-009), // probability. - tolerance); + tolerance); // CDF BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(0)), // zero k events. static_cast(3.678794411714420E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(1)), // one k event. static_cast(7.357588823428830E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(2)), // two k events. static_cast(9.196986029286060E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(10)), // two k events. static_cast(9.999999899522340E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(15)), // two k events. static_cast(9.999999999999810E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(16)), // two k events. static_cast(9.999999999999990E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(17)), // two k events. static_cast(1.), // probability unity for double. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(33)), // k events at limit for float unchecked_factorial table. static_cast(1.), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(100)), // mean 100. static_cast(33)), // k events at limit for float unchecked_factorial table. static_cast(6.328271240363390E-15), // probability is tiny. - tolerance * static_cast(2e11)); // 6.3495253382825722e-015 MathCAD + tolerance * static_cast(2e11)); // 6.3495253382825722e-015 MathCAD // Note that there two tiny probability are much more different. BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(100)), // mean 100. static_cast(34)), // k events at limit for float unchecked_factorial table. static_cast(1.898481372109020E-14), // probability is tiny. - tolerance*static_cast(2e11)); // 1.8984813721090199e-014 MathCAD + tolerance*static_cast(2e11)); // 1.8984813721090199e-014 MathCAD BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(33)), // mean = k static_cast(33)), // k events above limit for float unchecked_factorial table. static_cast(5.461191812386560E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(33)), // mean = k-1 static_cast(34)), // k events above limit for float unchecked_factorial table. static_cast(6.133535681502950E-1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1)), // mean unity. static_cast(34)), // k events above limit for float unchecked_factorial table. static_cast(1.), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(5.)), // mean static_cast(5)), // k events. static_cast(0.615960654833065), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(5.)), // mean static_cast(1)), // k events. static_cast(0.040427681994512805), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(5.)), // mean static_cast(0)), // k events (uses special case formula, not gamma). static_cast(0.006737946999085467), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(1.)), // mean static_cast(0)), // k events (uses special case formula, not gamma). static_cast(0.36787944117144233), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(10.)), // mean static_cast(10)), // k events. static_cast(0.5830397501929856), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( cdf(poisson_distribution(static_cast(4.)), // mean static_cast(5)), // k events. static_cast(0.785130387030406), // probability. - tolerance); + tolerance); // complement CDF BOOST_CHECK_CLOSE( // Complement CDF cdf(complement(poisson_distribution(static_cast(4.)), // mean static_cast(5))), // k events. static_cast(1 - 0.785130387030406), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( // Complement CDF cdf(complement(poisson_distribution(static_cast(4.)), // mean static_cast(0))), // Zero k events (uses special case formula, not gamma). static_cast(0.98168436111126578), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( // Complement CDF cdf(complement(poisson_distribution(static_cast(1.)), // mean static_cast(0))), // Zero k events (uses special case formula, not gamma). static_cast(0.63212055882855767), // probability. - tolerance); + tolerance); // Example where k is bigger than max_factorial (>34 for float) // (therefore using log gamma so perhaps less accurate). @@ -326,7 +326,7 @@ void test_spots(RealType) cdf(poisson_distribution(static_cast(40.)), // mean static_cast(40)), // k events. static_cast(0.5419181783625430), // probability. - tolerance); + tolerance); // Quantile & complement. BOOST_CHECK_CLOSE( @@ -353,7 +353,7 @@ void test_spots(RealType) cdf(poisson_distribution(static_cast(10.)), // mean static_cast(10)), // k events. static_cast(0.5830397501929856), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE(boost::math::quantile( // inverse of cdf above. poisson_distribution(10.), // mean. @@ -366,7 +366,7 @@ void test_spots(RealType) cdf(poisson_distribution(static_cast(4.)), // mean static_cast(5)), // k events. static_cast(0.785130387030406), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE(boost::math::quantile( // inverse of cdf above. poisson_distribution(4.), // mean. @@ -494,9 +494,9 @@ int test_main(int, char* []) // Check that can construct normal distribution using the two convenience methods: using namespace boost::math; poisson myp1(2); // Using typedef - poisson_distribution<> myp2(2); // Using default RealType double. + poisson_distribution<> myp2(2); // Using default RealType double. - // Basic sanity-check spot values. + // Basic sanity-check spot values. // Some plain double examples & tests: cout.precision(17); // double max_digits10 @@ -523,12 +523,12 @@ int test_main(int, char* []) BOOST_CHECK_CLOSE( pdf(mypoisson, 2.), // k events = 2. 1.465251111098740E-001, // probability. - 5e-13); + 5e-13); BOOST_CHECK_CLOSE( cdf(mypoisson, 2.), // k events = 2. 0.238103305553545, // probability. - 5e-13); + 5e-13); #if 0 @@ -562,7 +562,7 @@ int test_main(int, char* []) BOOST_CHECK_CLOSE( cdf(mypoisson, static_cast(i)), sum, // of pdfs. - 4e-14); // Fails at 2e-14 + 4e-14); // Fails at 2e-14 // This call puts the precision etc back to default 6 !!! cout << setprecision(17) << showpoint; @@ -584,7 +584,7 @@ int test_main(int, char* []) } #endif - // (Parameter value, arbitrarily zero, only communicates the floating-point type). + // (Parameter value, arbitrarily zero, only communicates the floating-point type). #ifdef TEST_POISSON test_spots(0.0F); // Test float. #endif @@ -595,7 +595,7 @@ int test_main(int, char* []) if (numeric_limits::digits10 > numeric_limits::digits10) { // long double is better than double (so not MSVC where they are same). #ifdef TEST_LDOUBLE - test_spots(0.0L); // Test long double. + test_spots(0.0L); // Test long double. #endif } @@ -605,7 +605,7 @@ int test_main(int, char* []) #endif #endif #endif - return 0; + return 0; } // int test_main(int, char* []) /* diff --git a/test/test_policy.cpp b/test/test_policy.cpp index 241fe26d6..dcc92592f 100644 --- a/test/test_policy.cpp +++ b/test/test_policy.cpp @@ -35,7 +35,7 @@ int test_main(int, char* []) BOOST_CHECK((is_same::domain_error_type, domain_error >::value)); BOOST_CHECK((is_same::evaluation_error_type, evaluation_error >::value)); - + BOOST_CHECK((is_same >::domain_error_type, domain_error >::value)); BOOST_CHECK((is_same >::pole_error_type, pole_error >::value)); BOOST_CHECK((is_same >::overflow_error_type, overflow_error >::value)); diff --git a/test/test_rational_instances/test_rational.hpp b/test/test_rational_instances/test_rational.hpp index a1c31d16a..30820e726 100644 --- a/test/test_rational_instances/test_rational.hpp +++ b/test/test_rational_instances/test_rational.hpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #ifndef BOOST_MATH_TEST_RATIONAL_HPP #define BOOST_MATH_TEST_RATIONAL_HPP diff --git a/test/test_rational_instances/test_rational_double1.cpp b/test/test_rational_instances/test_rational_double1.cpp index 508f90d40..4cc42ec0f 100644 --- a/test/test_rational_instances/test_rational_double1.cpp +++ b/test/test_rational_instances/test_rational_double1.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_double2.cpp b/test/test_rational_instances/test_rational_double2.cpp index b13b6606e..254bbcd90 100644 --- a/test/test_rational_instances/test_rational_double2.cpp +++ b/test/test_rational_instances/test_rational_double2.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_double3.cpp b/test/test_rational_instances/test_rational_double3.cpp index f4aeaf22b..d371b988b 100644 --- a/test/test_rational_instances/test_rational_double3.cpp +++ b/test/test_rational_instances/test_rational_double3.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_double4.cpp b/test/test_rational_instances/test_rational_double4.cpp index 8f3c9d9ae..64e31eccd 100644 --- a/test/test_rational_instances/test_rational_double4.cpp +++ b/test/test_rational_instances/test_rational_double4.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_double5.cpp b/test/test_rational_instances/test_rational_double5.cpp index 60ef17953..f5ed5c863 100644 --- a/test/test_rational_instances/test_rational_double5.cpp +++ b/test/test_rational_instances/test_rational_double5.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_float1.cpp b/test/test_rational_instances/test_rational_float1.cpp index 6e88570fa..227c48267 100644 --- a/test/test_rational_instances/test_rational_float1.cpp +++ b/test/test_rational_instances/test_rational_float1.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_float2.cpp b/test/test_rational_instances/test_rational_float2.cpp index f3d629322..81b843d83 100644 --- a/test/test_rational_instances/test_rational_float2.cpp +++ b/test/test_rational_instances/test_rational_float2.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_float3.cpp b/test/test_rational_instances/test_rational_float3.cpp index 2afd81a1c..aa7a1ae7d 100644 --- a/test/test_rational_instances/test_rational_float3.cpp +++ b/test/test_rational_instances/test_rational_float3.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_float4.cpp b/test/test_rational_instances/test_rational_float4.cpp index b89ccb7f9..49f792016 100644 --- a/test/test_rational_instances/test_rational_float4.cpp +++ b/test/test_rational_instances/test_rational_float4.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_ldouble1.cpp b/test/test_rational_instances/test_rational_ldouble1.cpp index d40fae02c..5b69bbafb 100644 --- a/test/test_rational_instances/test_rational_ldouble1.cpp +++ b/test/test_rational_instances/test_rational_ldouble1.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_ldouble2.cpp b/test/test_rational_instances/test_rational_ldouble2.cpp index 65cf69117..593c33f33 100644 --- a/test/test_rational_instances/test_rational_ldouble2.cpp +++ b/test/test_rational_instances/test_rational_ldouble2.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_ldouble3.cpp b/test/test_rational_instances/test_rational_ldouble3.cpp index ff7c65ec9..82281c381 100644 --- a/test/test_rational_instances/test_rational_ldouble3.cpp +++ b/test/test_rational_instances/test_rational_ldouble3.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_ldouble4.cpp b/test/test_rational_instances/test_rational_ldouble4.cpp index bfdf3e773..9b945b186 100644 --- a/test/test_rational_instances/test_rational_ldouble4.cpp +++ b/test/test_rational_instances/test_rational_ldouble4.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_ldouble5.cpp b/test/test_rational_instances/test_rational_ldouble5.cpp index 6f93955cd..cccd06926 100644 --- a/test/test_rational_instances/test_rational_ldouble5.cpp +++ b/test/test_rational_instances/test_rational_ldouble5.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include "test_rational.hpp" diff --git a/test/test_rational_instances/test_rational_real_concept1.cpp b/test/test_rational_instances/test_rational_real_concept1.cpp index 8df517527..144cc33df 100644 --- a/test/test_rational_instances/test_rational_real_concept1.cpp +++ b/test/test_rational_instances/test_rational_real_concept1.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) diff --git a/test/test_rational_instances/test_rational_real_concept2.cpp b/test/test_rational_instances/test_rational_real_concept2.cpp index 8c5be1eb4..2c04fc62e 100644 --- a/test/test_rational_instances/test_rational_real_concept2.cpp +++ b/test/test_rational_instances/test_rational_real_concept2.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) diff --git a/test/test_rational_instances/test_rational_real_concept3.cpp b/test/test_rational_instances/test_rational_real_concept3.cpp index ae9f4b8a8..e238dcc3e 100644 --- a/test/test_rational_instances/test_rational_real_concept3.cpp +++ b/test/test_rational_instances/test_rational_real_concept3.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) diff --git a/test/test_rational_instances/test_rational_real_concept4.cpp b/test/test_rational_instances/test_rational_real_concept4.cpp index 8d2db7095..e74537f75 100644 --- a/test/test_rational_instances/test_rational_real_concept4.cpp +++ b/test/test_rational_instances/test_rational_real_concept4.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) diff --git a/test/test_rational_instances/test_rational_real_concept5.cpp b/test/test_rational_instances/test_rational_real_concept5.cpp index f65c211b1..1bd217c37 100644 --- a/test/test_rational_instances/test_rational_real_concept5.cpp +++ b/test/test_rational_instances/test_rational_real_concept5.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) diff --git a/test/test_rayleigh.cpp b/test/test_rayleigh.cpp index b00ae0495..be876ad24 100644 --- a/test/test_rayleigh.cpp +++ b/test/test_rayleigh.cpp @@ -14,15 +14,15 @@ #include // for real_concept #include - using boost::math::rayleigh_distribution; + using boost::math::rayleigh_distribution; #include // Boost.Test #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; template void test_spot(RealType s, RealType x, RealType p, RealType q, RealType tolerance) @@ -32,13 +32,13 @@ void test_spot(RealType s, RealType x, RealType p, RealType q, RealType toleranc rayleigh_distribution(s), x), p, - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( complement(rayleigh_distribution(s), x)), q, - tolerance); // % + tolerance); // % // Special extra tests for p and q near to unity. if(p < 0.999) { @@ -47,7 +47,7 @@ void test_spot(RealType s, RealType x, RealType p, RealType q, RealType toleranc rayleigh_distribution(s), p), x, - tolerance); // % + tolerance); // % } if(q < 0.999) { @@ -56,7 +56,7 @@ void test_spot(RealType s, RealType x, RealType p, RealType q, RealType toleranc complement(rayleigh_distribution(s), q)), x, - tolerance); // % + tolerance); // % } } // void test_spot @@ -72,7 +72,7 @@ void test_spots(RealType T) static_cast(boost::math::tools::epsilon()), boost::math::tools::epsilon()); tolerance *= 10 * 100; // 10 eps as a percent - cout << "Tolerance for type " << typeid(T).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(T).name() << " is " << tolerance << " %" << endl; using namespace boost::math::constants; @@ -134,72 +134,72 @@ void test_spots(RealType T) rayleigh_distribution(1.L), static_cast(1.L)), // x static_cast(exp_minus_half()), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( rayleigh_distribution(0.5L), static_cast(0.5L)), // x static_cast(2 * exp_minus_half()), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::pdf( rayleigh_distribution(2.L), static_cast(2.L)), // x static_cast(exp_minus_half() /2), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::mean( rayleigh_distribution(1.L)), static_cast(root_half_pi()), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::variance( rayleigh_distribution(root_two())), static_cast(four_minus_pi()), - tolerance * 100); // % + tolerance * 100); // % BOOST_CHECK_CLOSE( ::boost::math::mode( rayleigh_distribution(1.L)), static_cast(1.L), - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::median( rayleigh_distribution(1.L)), static_cast(sqrt(log(4.L))), // sigma * sqrt(log_four) - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::skewness( rayleigh_distribution(1.L)), static_cast(2.L * root_pi()) * (pi() - 3) / (pow((4 - pi()), static_cast(1.5L))), - tolerance * 100); // % + tolerance * 100); // % BOOST_CHECK_CLOSE( ::boost::math::skewness( rayleigh_distribution(1.L)), static_cast(0.63111065781893713819189935154422777984404221106391L), - tolerance * 100); // % + tolerance * 100); // % BOOST_CHECK_CLOSE( ::boost::math::kurtosis_excess( rayleigh_distribution(1.L)), static_cast(0.2450893006876380628486604106197544154170667057995L), - tolerance * 1000); // % + tolerance * 1000); // % BOOST_CHECK_CLOSE( ::boost::math::kurtosis( rayleigh_distribution(1.L)), static_cast(3.2450893006876380628486604106197544154170667057995L), - tolerance * 100); // % + tolerance * 100); // % BOOST_CHECK_CLOSE( ::boost::math::kurtosis_excess(rayleigh_distribution(2)), ::boost::math::kurtosis(rayleigh_distribution(2)) -3, - tolerance* 100); // % + tolerance* 100); // % return; } // template void test_spots(RealType) @@ -207,11 +207,11 @@ void test_spots(RealType T) int test_main(int, char* []) { // Check that can generate rayleigh distribution using the two convenience methods: - boost::math::rayleigh ray1(1.); // Using typedef - rayleigh_distribution<> ray2(1.); // Using default RealType double. + boost::math::rayleigh ray1(1.); // Using typedef + rayleigh_distribution<> ray2(1.); // Using default RealType double. using namespace boost::math::constants; - // Basic sanity-check spot values. + // Basic sanity-check spot values. // Double only tests. BOOST_CHECK_CLOSE_FRACTION( @@ -219,72 +219,72 @@ int test_main(int, char* []) rayleigh_distribution(1.), static_cast(1)), // x static_cast(exp_minus_half()), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::pdf( rayleigh_distribution(0.5), static_cast(0.5)), // x static_cast(2 * exp_minus_half()), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::pdf( rayleigh_distribution(2.), static_cast(2)), // x static_cast(exp_minus_half() /2 ), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::cdf( rayleigh_distribution(1.), static_cast(1)), // x static_cast(1- exp_minus_half()), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::cdf( rayleigh_distribution(2.), static_cast(2)), // x static_cast(1- exp_minus_half()), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::cdf( rayleigh_distribution(3.), static_cast(3)), // x static_cast(1- exp_minus_half()), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::cdf( rayleigh_distribution(4.), static_cast(4)), // x static_cast(1- exp_minus_half()), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::cdf(complement( rayleigh_distribution(4.), static_cast(4))), // x static_cast(exp_minus_half()), // q = 1 - p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::quantile( rayleigh_distribution(4.), static_cast(1- exp_minus_half())), // x static_cast(4), // p - 1e-15); // % + 1e-15); // % BOOST_CHECK_CLOSE_FRACTION( ::boost::math::quantile(complement( rayleigh_distribution(4.), static_cast(exp_minus_half()))), // x static_cast(4), // p - 1e-15); // % + 1e-15); // % - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_students_t.cpp b/test/test_students_t.cpp index e96d5c593..9d2af265e 100644 --- a/test/test_students_t.cpp +++ b/test/test_students_t.cpp @@ -18,14 +18,14 @@ #include #include - using boost::math::students_t_distribution; + using boost::math::students_t_distribution; #include // for real_concept #include // for real_concept #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; #include using std::numeric_limits; @@ -54,29 +54,29 @@ template void test_spots(RealType) { // Basic sanity checks - RealType tolerance = static_cast(std::pow(10., -(6-2))); // 1e-6 (as %) - // Some tests only pass at 1e-5 because probability value is less accurate, - // a digit in 6th decimal place, although calculated using - // a t-distribution generator (claimed 6 decimal digits) at + RealType tolerance = static_cast(std::pow(10., -(6-2))); // 1e-6 (as %) + // Some tests only pass at 1e-5 because probability value is less accurate, + // a digit in 6th decimal place, although calculated using + // a t-distribution generator (claimed 6 decimal digits) at // http://faculty.vassar.edu/lowry/VassarStats.html - // http://faculty.vassar.edu/lowry/tsamp.html - // df = 5, +/-t = 2.0, 1-tailed = 0.050970, 2-tailed = 0.101939 + // http://faculty.vassar.edu/lowry/tsamp.html + // df = 5, +/-t = 2.0, 1-tailed = 0.050970, 2-tailed = 0.101939 - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; - // http://en.wikipedia.org/wiki/Student%27s_t_distribution#Table_of_selected_values + // http://en.wikipedia.org/wiki/Student%27s_t_distribution#Table_of_selected_values // Using tabulated value of t = 3.182 for 0.975, 3 df, one-sided. - // http://www.mth.kcl.ac.uk/~shaww/web_page/papers/Tdistribution06.pdf refers to: + // http://www.mth.kcl.ac.uk/~shaww/web_page/papers/Tdistribution06.pdf refers to: - // A lookup table of quantiles of the RealType distribution + // A lookup table of quantiles of the RealType distribution // for 1 to 25 in steps of 0.1 is provided in CSV form at: // www.mth.kcl.ac.uk/~shaww/web_page/papers/Tsupp/tquantiles.csv - // gives accurate t of -3.1824463052837 and 3 degrees of freedom. - // Values below are from this source, saved as tquantiles.xls. - // DF are across the columns, probabilities down the rows - // and the t- values (quantiles) are shown. - // These values are probably accurate to nearly 64-bit double + // gives accurate t of -3.1824463052837 and 3 degrees of freedom. + // Values below are from this source, saved as tquantiles.xls. + // DF are across the columns, probabilities down the rows + // and the t- values (quantiles) are shown. + // These values are probably accurate to nearly 64-bit double // (perhaps 14 decimal digits). BOOST_CHECK_CLOSE( @@ -84,63 +84,63 @@ void test_spots(RealType) students_t_distribution(2), // degrees_of_freedom static_cast(-6.96455673428326)), // t static_cast(0.01), // probability. - tolerance); // % + tolerance); // % BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(5), // degrees_of_freedom static_cast(-3.36492999890721)), // t static_cast(0.01), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(1), // degrees_of_freedom static_cast(-31830.988607907)), // t static_cast(0.00001), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(25.), // degrees_of_freedom static_cast(-5.2410429995425)), // t static_cast(0.00001), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(1), // degrees_of_freedom static_cast(-63661.97723)), // t static_cast(0.000005), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(5.), // degrees_of_freedom static_cast(-17.89686614)), // t static_cast(0.000005), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(25.), // degrees_of_freedom static_cast(-5.510848412)), // t static_cast(0.000005), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(10.), // degrees_of_freedom static_cast(-1.812461123)), // t static_cast(0.05), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(10), // degrees_of_freedom static_cast(1.812461123)), // t static_cast(0.95), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( @@ -148,24 +148,24 @@ void test_spots(RealType) students_t_distribution(10), // degrees_of_freedom static_cast(1.812461123))), // t static_cast(0.05), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(10), // degrees_of_freedom static_cast(9.751995491)), // t static_cast(0.999999), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(10.), // degrees_of_freedom - for ALL degrees_of_freedom! static_cast(0.)), // t static_cast(0.5), // probability. - tolerance); + tolerance); - // Student's t Inverse function tests. + // Student's t Inverse function tests. // Special cases BOOST_CHECK_THROW(boost::math::quantile( @@ -191,20 +191,20 @@ void test_spots(RealType) students_t_distribution(1.), // degrees_of_freedom (ignored). static_cast(0.5)), // probability == half - special case. static_cast(0), // t == zero. - tolerance); + tolerance); BOOST_CHECK_CLOSE( // Tests of p middling. ::boost::math::cdf( students_t_distribution(5.), // degrees_of_freedom static_cast(-0.559429644)), // t static_cast(0.3), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::quantile( students_t_distribution(5.), // degrees_of_freedom static_cast(0.3)), // probability. static_cast(-0.559429644), // t - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::quantile( @@ -212,47 +212,47 @@ void test_spots(RealType) students_t_distribution(5.), // degrees_of_freedom static_cast(0.7))), // probability. static_cast(-0.559429644), // t - tolerance); + tolerance); BOOST_CHECK_CLOSE( // Tests of p high. ::boost::math::cdf( students_t_distribution(5.), // degrees_of_freedom static_cast(1.475884049)), // t static_cast(0.9), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::quantile( students_t_distribution(5.), // degrees_of_freedom static_cast(0.9)), // probability. static_cast(1.475884049), // t - tolerance); + tolerance); BOOST_CHECK_CLOSE( // Tests of p low. ::boost::math::cdf( students_t_distribution(5.), // degrees_of_freedom static_cast(-1.475884049)), // t static_cast(0.1), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::quantile( students_t_distribution(5.), // degrees_of_freedom static_cast(0.1)), // probability. static_cast(-1.475884049), // t - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::cdf( students_t_distribution(2.), // degrees_of_freedom static_cast(-6.96455673428326)), // t static_cast(0.01), // probability. - tolerance); + tolerance); BOOST_CHECK_CLOSE( ::boost::math::quantile( students_t_distribution(2.), // degrees_of_freedom static_cast(0.01)), // probability. static_cast(-6.96455673428326), // t - tolerance); + tolerance); // Student's t pdf tests. @@ -379,11 +379,11 @@ int test_main(int, char* []) // Check that can construct students_t distribution using the two convenience methods: using namespace boost::math; students_t myst1(2); // Using typedef - students_t_distribution<> myst2(2); // Using default RealType double. - //students_t_distribution myst3(2); // Using explicit RealType double. + students_t_distribution<> myst2(2); // Using default RealType double. + //students_t_distribution myst3(2); // Using explicit RealType double. - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_tgamma_ratio.cpp b/test/test_tgamma_ratio.cpp index 61108f58c..d863fd930 100644 --- a/test/test_tgamma_ratio.cpp +++ b/test/test_tgamma_ratio.cpp @@ -70,7 +70,23 @@ void expected_results() "float", // test type(s) "[^|]*", // test data group "boost::math::tgamma_ratio[^|]*", 35, 8); // test function - + // + // Linux AMD x86em64 has slightly higher rates: + // + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "linux.*", // platform + largest_type, // test type(s) + "[^|]*", // test data group + "boost::math::tgamma_ratio[^|]*", 300, 100); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "linux.*", // platform + "real_concept", // test type(s) + "[^|]*", // test data group + "boost::math::tgamma_ratio[^|]*", 300, 100); // test function // // Catch all cases come last: // diff --git a/test/test_uniform.cpp b/test/test_uniform.cpp index 53381e424..274f55d3d 100644 --- a/test/test_uniform.cpp +++ b/test/test_uniform.cpp @@ -18,13 +18,13 @@ #include #include - using boost::math::uniform_distribution; + using boost::math::uniform_distribution; #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; #include using std::numeric_limits; @@ -36,27 +36,27 @@ void check_uniform(RealType lower, RealType upper, RealType x, RealType p, RealT uniform_distribution(lower, upper), // distribution. x), // random variable. p, // probability. - tol); // tolerance. + tol); // tolerance. BOOST_CHECK_CLOSE_FRACTION( ::boost::math::cdf( complement( uniform_distribution(lower, upper), // distribution. x)), // random variable. q, // probability complement. - tol); // tolerance. + tol); // tolerance. BOOST_CHECK_CLOSE_FRACTION( ::boost::math::quantile( uniform_distribution(lower, upper), // distribution. p), // probability. x, // random variable. - tol); // tolerance. + tol); // tolerance. BOOST_CHECK_CLOSE_FRACTION( ::boost::math::quantile( complement( uniform_distribution(lower, upper), // distribution. q)), // probability complement. x, // random variable. - tol); // tolerance. + tol); // tolerance. } // void check_uniform template @@ -70,8 +70,8 @@ void test_spots(RealType) // // Tolerance is just over 5 decimal digits expressed as a fraction: // that's the limit of the test data. - RealType tolerance = 2e-5f; - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << "." << endl; + RealType tolerance = 2e-5f; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << "." << endl; using std::exp; @@ -283,7 +283,7 @@ void test_spots(RealType) tolerance = (std::max)( boost::math::tools::epsilon(), static_cast(boost::math::tools::epsilon())) * 5; // 5 eps as a fraction. - cout << "Tolerance (as fraction) for type " << typeid(RealType).name() << " is " << tolerance << "." << endl; + cout << "Tolerance (as fraction) for type " << typeid(RealType).name() << " is " << tolerance << "." << endl; uniform_distribution distu01(0, 1); RealType x = static_cast(0.5); using namespace std; // ADL of std names. @@ -375,7 +375,7 @@ int test_main(int, char* []) // == uniform_distribution unistd; BOOST_CHECK_EQUAL(unistd.lower(), 0); // Check defaults. BOOST_CHECK_EQUAL(unistd.upper(), 1); - uniform_distribution<> myu01(0, 1); // Using default RealType double. + uniform_distribution<> myu01(0, 1); // Using default RealType double. BOOST_CHECK_EQUAL(myu01.lower(), 0); // Check defaults again. BOOST_CHECK_EQUAL(myu01.upper(), 1); @@ -393,7 +393,7 @@ int test_main(int, char* []) BOOST_CHECK_THROW(uniform_distribution<> zinf(0, +std::numeric_limits::infinity()), std::domain_error); // zero to infinity using default RealType double. - uniform_distribution<> zmax(0, +(std::numeric_limits::max)()); // zero to max using default RealType double. + uniform_distribution<> zmax(0, +(std::numeric_limits::max)()); // zero to max using default RealType double. BOOST_CHECK_EQUAL(zmax.lower(), 0); // Check defaults again. BOOST_CHECK_EQUAL(zmax.upper(), +(std::numeric_limits::max)()); @@ -409,8 +409,8 @@ int test_main(int, char* []) BOOST_CHECK_THROW(uniform_distribution<> zNaN(0, std::numeric_limits::quiet_NaN()), std::domain_error); BOOST_CHECK_THROW(pdf(unistd, std::numeric_limits::quiet_NaN()), std::domain_error); - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/test_weibull.cpp b/test/test_weibull.cpp index e6fa7d162..32c049219 100644 --- a/test/test_weibull.cpp +++ b/test/test_weibull.cpp @@ -13,13 +13,13 @@ #include #include - using boost::math::weibull_distribution; + using boost::math::weibull_distribution; #include #include - using std::cout; - using std::endl; - using std::setprecision; + using std::cout; + using std::endl; + using std::setprecision; #include using std::numeric_limits; @@ -31,27 +31,27 @@ void check_weibull(RealType shape, RealType scale, RealType x, RealType p, RealT weibull_distribution(shape, scale), // distribution. x), // random variable. p, // probability. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::cdf( complement( weibull_distribution(shape, scale), // distribution. x)), // random variable. q, // probability complement. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::quantile( weibull_distribution(shape, scale), // distribution. p), // probability. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. BOOST_CHECK_CLOSE( ::boost::math::quantile( complement( weibull_distribution(shape, scale), // distribution. q)), // probability complement. x, // random variable. - tol); // %tolerance. + tol); // %tolerance. } template @@ -65,8 +65,8 @@ void test_spots(RealType) // // Tolerance is just over 5 decimal digits expressed as a persentage: // that's the limit of the test data. - RealType tolerance = 2e-5f * 100; - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + RealType tolerance = 2e-5f * 100; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; using std::exp; @@ -251,7 +251,7 @@ void test_spots(RealType) tolerance = (std::max)( boost::math::tools::epsilon(), static_cast(boost::math::tools::epsilon())) * 5 * 100; // 5 eps as a percentage - cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; + cout << "Tolerance for type " << typeid(RealType).name() << " is " << tolerance << " %" << endl; weibull_distribution dist(2, 3); RealType x = static_cast(0.125); using namespace std; // ADL of std names. @@ -334,10 +334,10 @@ int test_main(int, char* []) // Check that can construct weibull distribution using the two convenience methods: using namespace boost::math; weibull myw1(2); // Using typedef - weibull_distribution<> myw2(2); // Using default RealType double. + weibull_distribution<> myw2(2); // Using default RealType double. - // Basic sanity-check spot values. - // (Parameter value, arbitrarily zero, only communicates the floating point type). + // Basic sanity-check spot values. + // (Parameter value, arbitrarily zero, only communicates the floating point type). test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 % test_spots(0.0); // Test double. OK at decdigits 7, tolerance = 1e07 % #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS diff --git a/test/tgamma_delta_ratio_data.ipp b/test/tgamma_delta_ratio_data.ipp index 181a716c9..3a2969b84 100644 --- a/test/tgamma_delta_ratio_data.ipp +++ b/test/tgamma_delta_ratio_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 560> tgamma_delta_ratio_data = { { { SC_(0.2585242462158203125e2), SC_(0.5408298164866209845058619976043701171875e-7), SC_(0.9999998251530248995276873521622051469349e0), SC_(0.1000000174847005556584935896873247717521e1) }, diff --git a/test/tgamma_delta_ratio_int.ipp b/test/tgamma_delta_ratio_int.ipp index e36860348..ef7baaeee 100644 --- a/test/tgamma_delta_ratio_int.ipp +++ b/test/tgamma_delta_ratio_int.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 344> tgamma_delta_ratio_int = { { { SC_(0.24302618503570556640625e1), SC_(0.1e1), SC_(0.4114782939349022594054088894256271572472e0), SC_(0.14302618503570556640625e1) }, diff --git a/test/tgamma_delta_ratio_int2.ipp b/test/tgamma_delta_ratio_int2.ipp index 7e151e065..eae1564e2 100644 --- a/test/tgamma_delta_ratio_int2.ipp +++ b/test/tgamma_delta_ratio_int2.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 190> tgamma_delta_ratio_int2 = { { { SC_(0.11e2), SC_(0.1e2), SC_(0.1491552059147518383844493235618106619139e-11), SC_(0.36288e7) }, diff --git a/test/tgamma_ratio_data.ipp b/test/tgamma_ratio_data.ipp index 258bdc029..a5f86c315 100644 --- a/test/tgamma_ratio_data.ipp +++ b/test/tgamma_ratio_data.ipp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2006-7. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 400> tgamma_ratio_data = { { { SC_(6.68193912506103515625), SC_(6.68193912506103515625), SC_(1) }, diff --git a/tools/ellint_e_data.cpp b/tools/ellint_e_data.cpp index 9fe10654e..f2b83c555 100644 --- a/tools/ellint_e_data.cpp +++ b/tools/ellint_e_data.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #include #include diff --git a/tools/ellint_f_data.cpp b/tools/ellint_f_data.cpp index 7764db281..eb909e308 100644 --- a/tools/ellint_f_data.cpp +++ b/tools/ellint_f_data.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #include #include diff --git a/tools/ellint_k_data.cpp b/tools/ellint_k_data.cpp index 063073c9c..e239b650c 100644 --- a/tools/ellint_k_data.cpp +++ b/tools/ellint_k_data.cpp @@ -1,3 +1,8 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #include #include #include diff --git a/tools/factorial_tables.cpp b/tools/factorial_tables.cpp index ca13581fa..67234eed1 100644 --- a/tools/factorial_tables.cpp +++ b/tools/factorial_tables.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include diff --git a/tools/generate_rational_test.cpp b/tools/generate_rational_test.cpp index dba84b7d3..d3719faed 100644 --- a/tools/generate_rational_test.cpp +++ b/tools/generate_rational_test.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #define BOOST_MATH_POLY_METHOD 0 #define BOOST_MATH_RATIONAL_METHOD 0 diff --git a/tools/hermite_data.cpp b/tools/hermite_data.cpp index d3d48ab0d..1df52aa1b 100644 --- a/tools/hermite_data.cpp +++ b/tools/hermite_data.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include diff --git a/tools/laguerre_data.cpp b/tools/laguerre_data.cpp index b733cbcec..bacc1aae3 100644 --- a/tools/laguerre_data.cpp +++ b/tools/laguerre_data.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include diff --git a/tools/legendre_data.cpp b/tools/legendre_data.cpp index 5ff5f2a99..0bc2b08d3 100644 --- a/tools/legendre_data.cpp +++ b/tools/legendre_data.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include diff --git a/tools/rational_tests.cpp b/tools/rational_tests.cpp index 9c1c39b7d..ebb1bdb78 100644 --- a/tools/rational_tests.cpp +++ b/tools/rational_tests.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include diff --git a/tools/spherical_harmonic_data.cpp b/tools/spherical_harmonic_data.cpp index 0f4ff38a9..e66fc228e 100644 --- a/tools/spherical_harmonic_data.cpp +++ b/tools/spherical_harmonic_data.cpp @@ -1,3 +1,7 @@ +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include