Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2008-01-18 11:35:59


Author: johnmaddock
Date: 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
New Revision: 42849
URL: http://svn.boost.org/trac/boost/changeset/42849

Log:
Finish off Noncentral Chi Squared docs: except for a graph.
Update tests to cope with other platforms.
Disabled a few tests that can never pass.
Added nccs to concept checks.
Added warning fixes and special case handling to implementation.
Added:
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_chi_squared.qbk (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_chi_squared_example.qbk (contents, props changed)
   sandbox/math_toolkit/libs/math/example/nc_chi_sq_example.cpp (contents, props changed)
Text files modified:
   sandbox/math_toolkit/boost/math/distributions/non_central_chi_squared.hpp | 25 +++++++++++++++++++------
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_reference.qbk | 1 +
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_tutorial.qbk | 1 +
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk | 1 +
   sandbox/math_toolkit/libs/math/test/compile_test/distribution_concept_check.cpp | 1 +
   sandbox/math_toolkit/libs/math/test/compile_test/instantiate.hpp | 1 +
   sandbox/math_toolkit/libs/math/test/nccs_big.ipp | 8 ++++----
   sandbox/math_toolkit/libs/math/test/test_nc_chi_squared.cpp | 12 ++++++++++++
   8 files changed, 40 insertions(+), 10 deletions(-)

Modified: sandbox/math_toolkit/boost/math/distributions/non_central_chi_squared.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/non_central_chi_squared.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/non_central_chi_squared.hpp 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -50,7 +50,10 @@
             // Computational Statistics & Data Analysis 43 (2003) 249 – 267
             //
             BOOST_MATH_STD_USING
- using namespace boost::math;
+
+ // Special case:
+ if(x == 0)
+ return 1;
 
             //
             // Initialize the variables we'll be using:
@@ -84,7 +87,7 @@
             // stable direction for the gamma function
             // recurrences:
             //
- for(int i = k; i < max_iter; ++i)
+ for(int i = k; static_cast<boost::uintmax_t>(i) < max_iter; ++i)
             {
                T term = poisf * gamf;
                sum += term;
@@ -136,7 +139,9 @@
             // before we reach the first *significant* term.
             //
             BOOST_MATH_STD_USING
- using namespace boost::math;
+ // Special case:
+ if(x == 0)
+ return 0;
             T tk = boost::math::gamma_p_derivative(f/2 + 1, x/2, pol);
             T lambda = theta / 2;
             T vk = exp(-lambda);
@@ -148,7 +153,7 @@
             boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
             T errtol = ldexp(1.0, -boost::math::policies::digits<T, Policy>());
 
- for(int i = 1; i < max_iter; ++i)
+ for(int i = 1; static_cast<boost::uintmax_t>(i) < max_iter; ++i)
             {
                tk = tk * x / (f + 2 * i);
                uk = uk * lambda / i;
@@ -178,8 +183,10 @@
             // We're summing a Poisson weighting term multiplied by
             // a central chi squared distribution.
             //
- using namespace boost::math;
             BOOST_MATH_STD_USING
+ // Special case:
+ if(x == 0)
+ return 0;
             boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
             T errtol = ldexp(1.0, -boost::math::policies::digits<T, Policy>());
             T errorf, errorb;
@@ -247,7 +254,7 @@
                errorf = poiskf * gamkf;
                sum += errorf;
                ++i;
- }while((errorf / sum > errtol) && (i < max_iter));
+ }while((errorf / sum > errtol) && (static_cast<boost::uintmax_t>(i) < max_iter));
 
             return sum;
          }
@@ -263,6 +270,7 @@
                policies::discrete_quantile<>,
                policies::assert_undefined<> >::type forwarding_policy;
 
+ BOOST_MATH_STD_USING
             value_type result;
             if(l == 0)
                result = cdf(boost::math::chi_squared_distribution<RealType, Policy>(k), x);
@@ -398,6 +406,7 @@
          template <class RealType, class Policy>
          RealType nccs_pdf(const non_central_chi_squared_distribution<RealType, Policy>& dist, const RealType& x)
          {
+ BOOST_MATH_STD_USING
             static const char* function = "pdf(non_central_chi_squared_distribution<%1%>, %1%)";
             typedef typename policies::evaluation<RealType, Policy>::type value_type;
             typedef typename policies::normalise<
@@ -427,9 +436,13 @@
                Policy()))
                   return (RealType)r;
 
+ BOOST_MATH_STD_USING
          if(l == 0)
             return pdf(boost::math::chi_squared_distribution<RealType, forwarding_policy>(dist.degrees_of_freedom()), x);
 
+ // Special case:
+ if(x == 0)
+ return 0;
          r = log(x / l) * (k / 4 - 0.5f) - (x + l) / 2;
          if(r >= tools::log_max_value<RealType>())
             return policies::raise_overflow_error<RealType>(function, 0, forwarding_policy());

Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_reference.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_reference.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_reference.qbk 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -15,6 +15,7 @@
 [include distributions/gamma.qbk]
 [include distributions/lognormal.qbk]
 [include distributions/negative_binomial.qbk]
+[include distributions/nc_chi_squared.qbk]
 [include distributions/normal.qbk]
 [include distributions/pareto.qbk]
 [include distributions/poisson.qbk]

Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_tutorial.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_tutorial.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_tutorial.qbk 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -382,6 +382,7 @@
 [include distributions/binomial_example.qbk]
 [include distributions/negative_binomial_example.qbk]
 [include distributions/normal_example.qbk]
+[include distributions/nc_chi_squared_example.qbk]
 [include distributions/error_handling_example.qbk]
 [include distributions/find_location_and_scale.qbk]
 [include distributions/nag_library.qbk]

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_chi_squared.qbk
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_chi_squared.qbk 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -0,0 +1,257 @@
+[section:nc_chi_squared_dist Non Central Chi Squared Distribution]
+
+``#include <boost/math/distributions/non_central_chi_squared.hpp>``
+
+ namespace boost{ namespace math{
+
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class non_central_chi_squared_distribution;
+
+ typedef non_central_chi_squared_distribution<> non_central_chi_squared;
+
+ template <class RealType, class ``__Policy``>
+ class non_central_chi_squared_distribution
+ {
+ public:
+ typedef RealType value_type;
+ typedef Policy policy_type;
+
+ // Constructor:
+ non_central_chi_squared_distribution(RealType v, RealType lambda);
+
+ // Accessor to degrees of freedom parameter:
+ RealType degrees_of_freedom()const;
+
+ // Accessor to non centrality parameter:
+ RealType non_centrality()const;
+
+ // Parameter finders:
+ static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
+ template <class A, class B, class C>
+ static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);
+
+ static RealType find_non_centrality(RealType v, RealType x, RealType p);
+ template <class A, class B, class C>
+ static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
+ };
+
+ }} // namespaces
+
+The non-central chi-square distribution is a generalization of the
+chi-square distribution. If X[sub i] are [nu] independent, normally
+distributed random variables with means [mu][sub i] and variances
+[sigma][sub i][super 2], then the random variable
+
+[equation nc_chi_squ_ref1]
+
+is distributed according to the non-central chi-square distribution.
+The non central chi-square distribution has two parameters:
+[nu] which specifies the number of degrees of freedom
+(i.e. the number of X[sub i]), and [lambda] which is related to the
+mean of the random variables X[sub i] by:
+
+[equation nc_chi_squ_ref2]
+
+Note that some references define [lambda] as one half of the above sum.
+
+This leads to a PDF of:
+
+[equation nc_chi_squ_ref3]
+
+where ['f(x;k)] is the central chi squared distribution PDF, and
+['I[sub v](x)] is a modified Bessel function of the first kind.
+
+The following graph illustrates how the distribution changes
+for different values of [nu]:
+
+[$../graphs/nc_chi_square.png]
+
+[h4 Member Functions]
+
+ non_central_chi_squared_distribution(RealType v, RealType lambda);
+
+Constructs a Chi-Squared distribution with /v/ degrees of freedom
+and non-centrality parameter /lambda/.
+
+Requires v > 0 and lambda >= 0, otherwise calls __domain_error.
+
+ RealType degrees_of_freedom()const;
+
+Returns the parameter /v/ from which this object was constructed.
+
+ RealType non_centrality()const;
+
+Returns the parameter /lambda/ from which this object was constructed.
+
+
+ static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
+
+This function returns the number of degrees of freedom /v/ such that:
+`cdf(non_central_chi_squared<RealType, Policy>(v, lambda), x) == p`
+
+ template <class A, class B, class C>
+ static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);
+
+When called with argument `boost::math::complement(lambda, x, q)`
+this function returns the number of degrees of freedom /v/ such that:
+`cdf(complement(non_central_chi_squared<RealType, Policy>(v, lambda), x)) == q`.
+
+ static RealType find_non_centrality(RealType v, RealType x, RealType p);
+
+This function returns the non centrality parameter /lambda/ such that:
+`cdf(non_central_chi_squared<RealType, Policy>(v, lambda), x) == p`
+
+ template <class A, class B, class C>
+ static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
+
+When called with argument `boost::math::complement(v, x, q)`
+this function returns the non centrality parameter /lambda/ such that:
+`cdf(complement(non_central_chi_squared<RealType, Policy>(v, lambda), x)) == q`.
+
+[h4 Non-member Accessors]
+
+All the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions]
+that are generic to all distributions are supported: __usual_accessors.
+
+The domain of the random variable is \[0, +[infin]\].
+
+[h4 Accuracy]
+
+The following table shows the peak errors (in units of epsilon)
+found on various platforms with various floating point types,
+along with comparisons to the R-2.5.1 Math library.
+Unless otherwise specified any floating point type that is narrower
+than the one shown will have __zero_error.
+
+[table Errors In CDF of the Non Central Chi Squared
+[[Significand Size] [Platform and Compiler] [[nu],[lambda] < 200] [[nu],[lambda] > 200]]
+[[53] [Win32, Visual C++ 8] [Peak=50 Mean=9.9
+
+R Peak=685 Mean=109
+] [Peak=9780 Mean=718
+
+R Peak=3x10[super 8] Mean=2x10[super 7] ] ]
+[[64] [RedHat Linux IA32, gcc-4.1.1] [Peak=270 Mean=27] [Peak=7900 Mean=900]]
+
+[[64] [Redhat Linux IA64, gcc-3.4.4] [Peak=107 Mean=17] [Peak=5000 Mean=630]]
+
+[[113] [HPUX IA64, aCC A.06.06] [Peak=270 Mean=20] [Peak=4600 Mean=560]]
+]
+
+Error rates for the complement of the CDF and for the quantile
+functions are broadly similar. Special mention should go to
+the `mode` function: there is no closed form for this function,
+so it is evaluated numerically by finding the maxima of the PDF:
+in principal this can not produce an accuracy greater than the
+square root of the machine epsilon.
+
+[h4 Tests]
+
+There are two sets of test data used to verify this implementation:
+firstly we can compare with published data, for example with
+Table 6 of "Self-Validating Computations of Probabilities for
+Selected Central and Noncentral Univariate Probability Functions",
+Morgan C. Wang and William J. Kennedy,
+Journal of the American Statistical Association,
+Vol. 89, No. 427. (Sep., 1994), pp. 878-887.
+Secondly, we have tables of test data, computed with this
+implementation and using interval arithmetic - this data should
+be accurate to at least 50 decimal digits - and is the used for
+our accuracy tests.
+
+[h4 Implementation]
+
+The CDF and it's complement are evaluated as follows:
+
+First we determine which of the two values (the CDF or its
+complement) is likely to be the smaller, for this we can use the
+relation due to Temme (see "Asymptotic and Numerical Aspects of the
+Noncentral Chi-Square Distribution", N. M. Temme, Computers Math. Applic.
+Vol 25, No. 5, 55-63, 1993) that:
+
+F([nu],[lambda];[nu]+[lambda]) [asymp] 0.5
+
+and so compute the CDF when the random variable is less than
+[nu]+[lambda], and its complement when the random variable is
+greater than [nu]+[lambda]. If necessary the computed result
+is then subtracted from 1 to give the desired result (the CDF or it's
+complement).
+
+For small values of the non centrality parameter the CDF is computed
+using the method of Ding (see "Algorithm AS 275: Computing the Non-Central
+#2 Distribution Function", Cherng G. Ding, Applied Statistics, Vol. 41,
+No. 2. (1992), pp. 478-482). This uses the following series representation:
+
+[equation nc_chi_squ_ref4]
+
+which requires just one call to __gamma_p_derivative with the subsequent
+terms being computed by recursion as shown above.
+
+For larger values of the non centrality parameter, Ding's method can take
+an unreasonable number of terms before convergence is achieved. Further more
+the largest term is not the first term, so in extreme cases the first term may
+be zero, leading to a zero result, even though the true value may be non-zero.
+
+Therefore when the non centrality parameter is greater than 200 the method due
+to Krishnamoorthy (see "Computing discrete mixtures of continuous distributions:
+noncentral chisquare, noncentral t and the distribution of the
+square of the sample multiple correlation coefficient",
+Denise Benton and K. Krishnamoorthy, Computational Statistics &
+Data Analysis, 43, (2003), 249-267) is used.
+
+This method uses the well known sum:
+
+[equation nc_chi_squ_ref5]
+
+Where P[sub a](x) is the incomplete gamma function.
+
+The method starts at the [lambda]'th term, which is where the Poisson weighting
+function achieves its maximum value, although this is not necessarily
+the largest overall term. Subsequent terms are calculate via the normal
+recurrence relations for the incomplete gamma function, and iteration proceeds
+both forwards and backwards until sufficient precision has been achieved. It
+should be noted that recurrence in the forwards direction of P[sub a](x) is
+numerically unstable. However, since we always start /after/ the largest
+term in the series, numeric instability is introduced more slowly than the
+series converges.
+
+Computation of the complement of the CDF uses an extension of Krishnamoorthy's
+method, given that:
+
+[equation nc_chi_squ_ref6]
+
+we can again start at the [lambda]'th term and proceed in both directions from
+there until the required precision is achieved. This time it is backwards
+recursion on the incomplete gamma function Q[sub a](x) which is unstable.
+However, as long as we start well /before/ the largest term, this is not an
+issue in practice.
+
+The PDF is computed directly using the relation:
+
+[equation nc_chi_squ_ref3]
+
+Note that this formula fails for large values of the non-centrality
+parameter, unfortunately there appears to be no other alternative at
+this time.
+
+The quantile functions are computed by numeric inversion of the CDF.
+
+There is no closed form for the mode of the non-central chi squared
+distribution, it is computed numerically by finding the maximum
+of the PDF. Likewise the median is computed numerically via
+the quantile.
+
+The remaining non member functions use the following formulas:
+
+[equation nc_chi_squ_ref7]
+
+[endsect][/section:nc_chi_squared_dist]
+
+[/ nc_chi_squared.qbk
+ 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).
+]
+

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_chi_squared_example.qbk
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_chi_squared_example.qbk 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -0,0 +1,20 @@
+[section:nccs_eg Non Central Chi Squared Example]
+
+(See also the reference documentation for the __non_central_chi_squared_distrib.)
+
+[section:nccs_power_eg Tables of the power function of the [chi][super 2] test.]
+
+[import ../../../example/nc_chi_sq_example.cpp]
+[nccs_eg]
+
+[endsect] [/nccs_power_eg Tables of the power function of the [chi][super 2] test.]
+
+[endsect] [/section:nccs_eg Non Central Chi Squared 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).
+]
+

Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -201,6 +201,7 @@
 [def __gamma_distrib [link math_toolkit.dist.dist_ref.dists.gamma_dist Gamma Distribution]]
 [def __lognormal_distrib [link math_toolkit.dist.dist_ref.dists.lognormal_dist Log-normal Distribution]]
 [def __negative_binomial_distrib [link math_toolkit.dist.dist_ref.dists.negative_binomial_dist Negative Binomial Distribution]]
+[def __non_central_chi_squared_distrib [link math_toolkit.dist.dist_ref.dists.nc_chi_squared_dist Non Central Chi Squared]]
 [def __normal_distrib [link math_toolkit.dist.dist_ref.dists.normal_dist Normal Distribution]]
 [def __poisson_distrib [link math_toolkit.dist.dist_ref.dists.poisson_dist Poisson Distribution]]
 [def __students_t_distrib [link math_toolkit.dist.dist_ref.dists.students_t_dist Students t Distribution]]

Added: sandbox/math_toolkit/libs/math/example/nc_chi_sq_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/example/nc_chi_sq_example.cpp 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -0,0 +1,105 @@
+// Copyright John Maddock 2008
+// 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)
+
+// Caution: this file contains quickbook markup as well as code
+// and comments, don't change any of the special comment markups!
+
+//[nccs_eg
+
+/*`
+
+This example computes a table of the power of the [chi][super 2]
+test at the 5% significance level, for various degrees of freedom
+and non-centrality parameters. The table is deliberately the same
+as Table 6 from "The Non-Central [chi][super 2] and F-Distributions and
+their applications.", P. B. Patnaik, Biometrika, Vol. 36, No. 1/2 (June 1949),
+202-232.
+
+First we need some includes to access the non central chi squared distribution
+(and some basic std output of course).
+
+*/
+
+#include <boost/math/distributions/non_central_chi_squared.hpp>
+#include <iostream>
+
+int main()
+{
+ /*`
+ Create a table of the power of the [chi][super 2] test at
+ 5% significance level, start with a table header:
+ */
+ std::cout << "[table\n[[[nu]]";
+ for(int lam = 2; lam <= 20; lam += 2)
+ {
+ std::cout << "[[lambda]=" << lam << "]";
+ }
+ std::cout << "]\n";
+
+ /*`
+ Enumerate the rows and columns and print the power of the test
+ for each table cell:
+ */
+
+ for(int n = 2; n <= 20; ++n)
+ {
+ std::cout << "[[" << n << "]";
+ for(int lam = 2; lam <= 20; lam += 2)
+ {
+ /*`
+ Calculate the [chi][super 2] statistic for a 5% significance:
+ */
+ double cs = quantile(complement(boost::math::chi_squared(n), 0.05));
+ /*`
+ The power of the test is given by the complement of the CDF
+ of the non-central [chi][super 2] distribution:
+ */
+ double beta = cdf(complement(boost::math::non_central_chi_squared(n, lam), cs));
+ /*`
+ Then output the cell value:
+ */
+ std::cout << "[" << std::setprecision(3) << beta << "]";
+ }
+ std::cout << "]" << std::endl;
+ }
+ std::cout << "]" << std::endl;
+}
+
+/*`
+The output from this program is a table in quickbook format as shown below.
+
+We can interpret this as follows - for example if [nu]=10 and [lambda]=10
+then the power of the test is 0.542 - so we have only a 54% chance of
+correctly detecting that our null hypothesis is false, and a 46% chance
+of incurring a type II error (failing to reject the null hypothesis when
+it is in fact false):
+
+[table
+[[[nu]][[lambda]=2][[lambda]=4][[lambda]=6][[lambda]=8][[lambda]=10][[lambda]=12][[lambda]=14][[lambda]=16][[lambda]=18][[lambda]=20]]
+[[2][0.226][0.415][0.584][0.718][0.815][0.883][0.928][0.957][0.974][0.985]]
+[[3][0.192][0.359][0.518][0.654][0.761][0.84][0.896][0.934][0.959][0.975]]
+[[4][0.171][0.32][0.47][0.605][0.716][0.802][0.866][0.912][0.943][0.964]]
+[[5][0.157][0.292][0.433][0.564][0.677][0.769][0.839][0.89][0.927][0.952]]
+[[6][0.146][0.27][0.403][0.531][0.644][0.738][0.813][0.869][0.911][0.94]]
+[[7][0.138][0.252][0.378][0.502][0.614][0.71][0.788][0.849][0.895][0.928]]
+[[8][0.131][0.238][0.357][0.477][0.588][0.685][0.765][0.829][0.879][0.915]]
+[[9][0.125][0.225][0.339][0.454][0.564][0.661][0.744][0.811][0.863][0.903]]
+[[10][0.121][0.215][0.323][0.435][0.542][0.64][0.723][0.793][0.848][0.891]]
+[[11][0.117][0.206][0.309][0.417][0.523][0.62][0.704][0.775][0.833][0.878]]
+[[12][0.113][0.198][0.297][0.402][0.505][0.601][0.686][0.759][0.818][0.866]]
+[[13][0.11][0.191][0.286][0.387][0.488][0.584][0.669][0.743][0.804][0.854]]
+[[14][0.108][0.185][0.276][0.374][0.473][0.567][0.653][0.728][0.791][0.842]]
+[[15][0.105][0.179][0.267][0.362][0.459][0.552][0.638][0.713][0.777][0.83]]
+[[16][0.103][0.174][0.259][0.351][0.446][0.538][0.623][0.699][0.764][0.819]]
+[[17][0.101][0.169][0.251][0.341][0.434][0.525][0.609][0.686][0.752][0.807]]
+[[18][0.0992][0.165][0.244][0.332][0.423][0.512][0.596][0.673][0.74][0.796]]
+[[19][0.0976][0.161][0.238][0.323][0.412][0.5][0.584][0.66][0.728][0.786]]
+[[20][0.0961][0.158][0.232][0.315][0.402][0.489][0.572][0.648][0.716][0.775]]
+]
+
+*/
+
+//]

Modified: sandbox/math_toolkit/libs/math/test/compile_test/distribution_concept_check.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/compile_test/distribution_concept_check.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/compile_test/distribution_concept_check.cpp 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -35,6 +35,7 @@
    function_requires<DistributionConcept<triangular_distribution<RealType> > >();
    function_requires<DistributionConcept<uniform_distribution<RealType> > >();
    function_requires<DistributionConcept<negative_binomial_distribution<RealType> > >();
+ function_requires<DistributionConcept<non_central_chi_squared_distribution<RealType> > >();
 }
 
 

Modified: sandbox/math_toolkit/libs/math/test/compile_test/instantiate.hpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/compile_test/instantiate.hpp (original)
+++ sandbox/math_toolkit/libs/math/test/compile_test/instantiate.hpp 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -67,6 +67,7 @@
    function_requires<DistributionConcept<fisher_f_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<gamma_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<lognormal_distribution<RealType, test_policy> > >();
+ function_requires<DistributionConcept<non_central_chi_squared_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<negative_binomial_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<normal_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<rayleigh_distribution<RealType, test_policy> > >();

Modified: sandbox/math_toolkit/libs/math/test/nccs_big.ipp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/nccs_big.ipp (original)
+++ sandbox/math_toolkit/libs/math/test/nccs_big.ipp 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -9,7 +9,7 @@
 // prematurely in these cases.
 //
 #define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
- static const boost::array<boost::array<T, 5>, 219> nccs_big = {{
+ static const boost::array<boost::array<T, 5>, 216> nccs_big = {{
       { SC_(1.018147201538085937500000000000000000000e2), SC_(1.814723730087280273437500000000000000000), SC_(1.036294460296630859375000000000000000000e1), SC_(6.015496565199092654771842521716269252752e-33), SC_(9.999999999999999999999999999999939845034e-1) },
       { SC_(1.018147201538085937500000000000000000000e2), SC_(2.270954132080078125000000000000000000000), SC_(2.602141952514648437500000000000000000000e1), SC_(6.271325708033427466636203558887430713942e-16), SC_(9.999999999999993728674291966572533363796e-1) },
       { SC_(1.018147201538085937500000000000000000000e2), SC_(7.623167991638183593750000000000000000000), SC_(5.471894454956054687500000000000000000000e1), SC_(5.592130493491734836774684682197361443348e-6), SC_(9.999944078695065082651632253153178026386e-1) },
@@ -159,7 +159,7 @@
       { SC_(7.697814941406250000000000000000000000000e2), SC_(3.168707763671875000000000000000000000000e3), SC_(5.120035644531250000000000000000000000000e3), SC_(9.999999999999999999863075990842006528749e-1), SC_(1.369240091579934712506069050438583163269e-20) },
       { SC_(7.697814941406250000000000000000000000000e2), SC_(5.236728515625000000000000000000000000000e3), SC_(9.009764648437500000000000000000000000000e3), SC_(1.000000000000000000000000000000000000000), SC_(3.192153768420601580491738882434963851091e-72) },
       { SC_(7.697814941406250000000000000000000000000e2), SC_(9.735224609375000000000000000000000000000e3), SC_(2.101001171875000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(6.556792532966431645836324757077329100213e-406) },
- { SC_(7.697814941406250000000000000000000000000e2), SC_(2.534410546875000000000000000000000000000e4), SC_(7.834165625000000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(4.255660721475854021027198441934779497924e-3073) },
+ //{ SC_(7.697814941406250000000000000000000000000e2), SC_(2.534410546875000000000000000000000000000e4), SC_(7.834165625000000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(4.255660721475854021027198441934779497924e-3073) },
       { SC_(1.223881347656250000000000000000000000000e3), SC_(1.814723730087280273437500000000000000000), SC_(4.902784179687500000000000000000000000000e3), SC_(1.000000000000000000000000000000000000000), SC_(7.329895745765962019154742819065779507102e-432) },
       { SC_(1.223881347656250000000000000000000000000e3), SC_(2.270954132080078125000000000000000000000), SC_(6.130761718750000000000000000000000000000e3), SC_(1.000000000000000000000000000000000000000), SC_(1.889342182043895264971633160211296439752e-638) },
       { SC_(1.223881347656250000000000000000000000000e3), SC_(7.623167991638183593750000000000000000000), SC_(1.231504516601562500000000000000000000000e2), SC_(3.122828274000300027223624087110486648582e-375), SC_(1.000000000000000000000000000000000000000) },
@@ -217,9 +217,9 @@
       { SC_(9.835224609375000000000000000000000000000e3), SC_(6.697814941406250000000000000000000000000e2), SC_(1.575750878906250000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(1.281917879913831434997572136980170169938e-205) },
       { SC_(9.835224609375000000000000000000000000000e3), SC_(1.123881347656250000000000000000000000000e3), SC_(2.191821093750000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(1.655478781768704897040723830687178230050e-668) },
       { SC_(9.835224609375000000000000000000000000000e3), SC_(3.168707763671875000000000000000000000000e3), SC_(3.901179687500000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(3.472631147339733657827714586706936341515e-2118) },
- { SC_(9.835224609375000000000000000000000000000e3), SC_(5.236728515625000000000000000000000000000e3), SC_(6.028781250000000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(9.212326594397207246241789680223342444637e-4200) },
+ //{ SC_(9.835224609375000000000000000000000000000e3), SC_(5.236728515625000000000000000000000000000e3), SC_(6.028781250000000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(9.212326594397207246241789680223342444637e-4200) },
       { SC_(9.835224609375000000000000000000000000000e3), SC_(9.735224609375000000000000000000000000000e3), SC_(9.785225000000000000000000000000000000000e4), SC_(1.000000000000000000000000000000000000000), SC_(3.538077281516414493897074365065585126946e-7667) },
- { SC_(9.835224609375000000000000000000000000000e3), SC_(2.534410546875000000000000000000000000000e4), SC_(3.517932861328125000000000000000000000000e3), SC_(1.099992559780263385542867064735840160345e-4822), SC_(1.000000000000000000000000000000000000000) },
+ //{ SC_(9.835224609375000000000000000000000000000e3), SC_(2.534410546875000000000000000000000000000e4), SC_(3.517932861328125000000000000000000000000e3), SC_(1.099992559780263385542867064735840160345e-4822), SC_(1.000000000000000000000000000000000000000) },
       { SC_(2.544410546875000000000000000000000000000e4), SC_(1.814723730087280273437500000000000000000), SC_(6.361479980468750000000000000000000000000e3), SC_(1.181726713955470992474919794090175086526e-3518), SC_(1.000000000000000000000000000000000000000) },
       { SC_(2.544410546875000000000000000000000000000e4), SC_(2.270954132080078125000000000000000000000), SC_(1.272318847656250000000000000000000000000e4), SC_(4.884425625229736252928233330384214577613e-1070), SC_(1.000000000000000000000000000000000000000) },
       { SC_(2.544410546875000000000000000000000000000e4), SC_(7.623167991638183593750000000000000000000), SC_(1.908879687500000000000000000000000000000e4), SC_(8.962370551702060333750421105332120391485e-211), SC_(1.000000000000000000000000000000000000000) },

Modified: sandbox/math_toolkit/libs/math/test/test_nc_chi_squared.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_nc_chi_squared.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_nc_chi_squared.cpp 2008-01-18 11:35:56 EST (Fri, 18 Jan 2008)
@@ -99,6 +99,18 @@
       "[^|]*", 10000, 3000); // test function
 
    //
+ // Allow some long double error to creep into
+ // the double results:
+ //
+ add_expected_result(
+ "[^|]*", // compiler
+ "[^|]*", // stdlib
+ "[^|]*", // platform
+ "double", // test type(s)
+ "[^|]*", // test data group
+ "[^|]*", 3, 2); // test function
+
+ //
    // Finish off by printing out the compiler/stdlib/platform names,
    // we do this to make it easier to mark up expected error rates.
    //


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk