Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2008-01-31 05:57:31


Author: johnmaddock
Date: 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
New Revision: 43032
URL: http://svn.boost.org/trac/boost/changeset/43032

Log:
Added non central beta docs.
Added script to auto-generate images from the .mml files.
Updated nc-beta tests for correct error rates and hooks to test R library.
Added:
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_beta.qbk (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/generate.sh (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref1.mml (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref1.png (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref1.svg (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref2.mml (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref2.png (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref2.svg (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref3.mml (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref3.png (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref3.svg (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref4.mml (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref4.png (contents, props changed)
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref4.svg (contents, props changed)
   sandbox/math_toolkit/libs/math/test/test_ncbeta_hooks.hpp (contents, props changed)
Text files modified:
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/dist_reference.qbk | 1 +
   sandbox/math_toolkit/libs/math/doc/sf_and_dist/graphs/sf_graphs.cpp | 2 +-
   sandbox/math_toolkit/libs/math/test/test_nc_beta.cpp | 28 ++++++++++++++++++++++++++--
   3 files changed, 28 insertions(+), 3 deletions(-)

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-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -15,6 +15,7 @@
 [include distributions/gamma.qbk]
 [include distributions/lognormal.qbk]
 [include distributions/negative_binomial.qbk]
+[include distributions/nc_beta.qbk]
 [include distributions/nc_chi_squared.qbk]
 [include distributions/normal.qbk]
 [include distributions/pareto.qbk]

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_beta.qbk
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/nc_beta.qbk 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -0,0 +1,208 @@
+[section:nc_beta_dist Non Central Beta Distribution]
+
+``#include <boost/math/distributions/non_central_beta.hpp>``
+
+ namespace boost{ namespace math{
+
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class non_central_beta_distribution;
+
+ typedef non_central_beta_distribution<> non_central_beta;
+
+ template <class RealType, class ``__Policy``>
+ class non_central_beta_distribution
+ {
+ public:
+ typedef RealType value_type;
+ typedef Policy policy_type;
+
+ // Constructor:
+ non_central_beta_distribution(RealType alpha, RealType beta, RealType lambda);
+
+ // Accessor to parameters:
+ RealType alpha()const;
+ RealType beta()const;
+
+ // Accessor to non centrality parameter:
+ RealType non_centrality()const;
+ };
+
+ }} // namespaces
+
+The non-central beta distribution is a generalization of the
+beta distribution. It is defined as the ratio
+X = [chi][sub m][super 2]([lambda]) \/ ([chi][sub m][super 2]([lambda])
++ [chi][sub n][super 2])
+where [chi][sub m][super 2]([lambda]) is a non-central [chi][super 2]
+random variable with /m/ degrees of freedom, and [chi][sub n][super 2]
+is a central [chi][super 2] random variable with /n/ degrees of freedom.
+
+This gives a PDF that can be expressed as a Poisson mixture
+of beta distribution PDF's:
+
+[equation nc_beta_ref1]
+
+where P(i;[lambda]\/2) is the discrete poisson probablity at /i/, with mean
+[lambda]\/2, and I[sub x][super ']([alpha], [beta]) is the derivative of
+the incomplete beta function. This leads to the usual form of the CDF
+as:
+
+[equation nc_beta_ref2]
+
+The following graph illustrates how the distribution changes
+for different values of [lambda]:
+
+[$../graphs/nc_beta_pdf.png]
+
+[h4 Member Functions]
+
+ non_central_beta_distribution(RealType a, RealType b, RealType lambda);
+
+Constructs a non-central beta distribution with parameters /a/ and /b/
+and non-centrality parameter /lambda/.
+
+Requires a > 0, b > 0 and lambda >= 0, otherwise calls __domain_error.
+
+ RealType alpha()const;
+
+Returns the parameter /a/ from which this object was constructed.
+
+ RealType beta()const;
+
+Returns the parameter /b/ from which this object was constructed.
+
+ RealType non_centrality()const;
+
+Returns the parameter /lambda/ from which this object was constructed.
+
+[h4 Non-member Accessors]
+
+Most of the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions]
+are supported: __cdf, __pdf, __quantile,
+__hazard, __chf, __range and __support.
+
+However, the following are not currently implemented:
+__mean, __median, __mode, __variance, __sd, __skewness,
+ __kurtosis and __kurtosis_excess.
+
+The domain of the random variable is \[0, 1\].
+
+[h4 Accuracy]
+
+The following table shows the peak errors (in units of epsilon)
+found on various platforms with various floating point types.
+No comparison to the R-2.5.1 Math library, or to the FORTRAN
+implementations of AS226 or AS310 are given since these appear
+to only guarentee absolute error: this would causes our test harness
+to assign an /"infinite"/ error to these libraries for some of our
+test values when measuring /relative error/.
+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 Beta
+[[Significand Size] [Platform and Compiler] [[alpha], [beta],[lambda] < 200] [[alpha],[beta],[lambda] > 200]]
+[[53] [Win32, Visual C++ 8] [Peak=620 Mean=22] [Peak=8670 Mean=1040]]
+[[64] [RedHat Linux IA32, gcc-4.1.1] [Peak=825 Mean=50] [Peak=2.5x10[super 4] Mean=4000]]
+
+[[64] [Redhat Linux IA64, gcc-3.4.4] [Peak=825 Mean=30] [Peak=1.7x10[super 4] Mean=2500]]
+
+[[113] [HPUX IA64, aCC A.06.06] [Peak=420 Mean=50] [Peak=9200 Mean=1200]]
+]
+
+Error rates for the PDF, the complement of the CDF and for the quantile
+functions are broadly similar.
+
+[h4 Tests]
+
+There are two sets of test data used to verify this implementation:
+firstly we can compare with a few sample values generated by the R library.
+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, the crossover point
+is taken to be the mean of the distribution, for which we use the
+approximation due to: R. Chattamvelli and R. Shanmugam,
+"Algorithm AS 310: Computing the Non-Central Beta Distribution Function",
+Applied Statistics, Vol. 46, No. 1. (1997), pp. 146-156.
+
+[equation nc_beta_ref3]
+
+Then either the CDF or it's complement is computed using the
+relations:
+
+[equation nc_beta_ref4]
+
+The summation is performed by starting at i = [lambda]/2, and then recursing
+in both directions, using the usual recurrence relations for the poisson
+PDF and incomplete beta functions. This is the "Method 2" described
+by:
+
+Denise Benton and K. Krishnamoorthy,
+"Computing discrete mixtures of continuous
+distributions: noncentral chisquare, noncentral t
+and the distribution of the square of the sample
+multiple correlation coefficient",
+Computational Statistics & Data Analysis 43 (2003) 249-267.
+
+Specific applications of the above formulae to the non-central
+beta distribution can be found in:
+
+Russell V. Lenth,
+"Algorithm AS 226: Computing Noncentral Beta Probabilities",
+Applied Statistics, Vol. 36, No. 2. (1987), pp. 241-244.
+
+H. Frick,
+"Algorithm AS R84: A Remark on Algorithm AS 226: Computing Non-Central Beta
+Probabilities", Applied Statistics, Vol. 39, No. 2. (1990), pp. 311-312.
+
+Ming Long Lam,
+"Remark AS R95: A Remark on Algorithm AS 226: Computing Non-Central Beta
+Probabilities", Applied Statistics, Vol. 44, No. 4. (1995), pp. 551-552.
+
+Harry O. Posten,
+"An Effective Algorithm for the Noncentral Beta Distribution Function",
+The American Statistician, Vol. 47, No. 2. (May, 1993), pp. 129-131.
+
+R. Chattamvelli,
+"A Note on the Noncentral Beta Distribution Function",
+The American Statistician, Vol. 49, No. 2. (May, 1995), pp. 231-234.
+
+Of these, the Posten reference provides the most complete overview,
+and includes the modification of starting iteration at [lambda]/2.
+
+The main difference between this implementation and the above
+references is the direct computation of the complement when most
+efficient to do so, and the accumulation of the sum to -1 rather
+than subtracting the result from 1 at the end: this can substantially
+reduce the number of iterations required when the result is near 1.
+
+The PDF is computed using the methodology of Benton and Krishnamoorthy
+and the relation:
+
+[equation nc_beta_ref1]
+
+Quantiles are computed using a specially modified version of
+[link math_toolkit.toolkit.internals1.roots2 bracket_and_solve_root]
+and starting the search for the root at the mean of the distribution
+(a Cornish-Fisher type expansion was also tried, but while this gets
+quite close to the root in many cases, when it's wrong it tends to
+introduce quite pathological behaviour: more investigation in this
+area is probably warrented).
+
+[endsect][/section:nc_beta_dist]
+
+[/ nc_beta.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/equations/generate.sh
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/generate.sh 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -0,0 +1,26 @@
+#
+# Generates SVG and PNG files from the MML masters.
+#
+# Paths to tools come first, change these to match your system:
+#
+math2svg='C:\download\open\SVGMath-0.3.1\math2svg.py'
+python=/cygdrive/c/Python25/python.exe
+inkscape=/cygdrive/c/progra~1/Inkscape/inkscape
+# Image DPI:
+dpi=120
+
+for mmlfile in $*; do
+ svgfile=$(basename $mmlfile .mml).svg
+ pngfile=$(basename $svgfile .svg).png
+ tempfile=temp.mml
+ # strip html wrappers put in by MathCast:
+ cat $svgfile | tr -d "\r\n" | sed -e 's/.*\(<math[^>]*>.*<\/math>\).*/\1/' > $tempfile
+
+ echo Generating $svgfile
+ $python $math2svg $tempfile > $svgfile
+ echo Generating $pngfile
+ $inkscape -d $dpi -e $(cygpath -a -w $pngfile) $(cygpath -a -w $svgfile)
+ rm $tempfile
+done
+
+

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref1.mml
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref1.mml 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -0,0 +1,56 @@
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mi>f</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>;</mo>
+ <mi>&#x03B1;</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ <mo>;</mo>
+ <mi>&#x03BB;</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <munderover>
+ <mo>&#x2211;</mo>
+ <mrow>
+ <mi>i</mi>
+ <mo>=</mo>
+ <mn>0</mn>
+ </mrow>
+ <mi>&#x221E;</mi>
+ </munderover>
+ <mi>P</mi>
+ <mfenced>
+ <mrow>
+ <mi>i</mi>
+ <mo>;</mo>
+ <mfrac>
+ <mi>&#x03BB;</mi>
+ <mn>2</mn>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ <msubsup>
+ <mi>I</mi>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ <mo>&#x2032;</mo>
+ </msubsup>
+ <mfenced>
+ <mrow>
+ <mi>&#x03B1;</mi>
+ <mo>+</mo>
+ <mi>i</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+</math>
+

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref1.png
==============================================================================
Binary file. No diff available.

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref1.svg
==============================================================================
Binary file. No diff available.

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref2.mml
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref2.mml 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -0,0 +1,53 @@
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mi>F</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>;</mo>
+ <mi>&#x03B1;</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ <mo>;</mo>
+ <mi>&#x03BB;</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <munderover>
+ <mo>&#x2211;</mo>
+ <mrow>
+ <mi>i</mi>
+ <mo>=</mo>
+ <mn>0</mn>
+ </mrow>
+ <mi>&#x221E;</mi>
+ </munderover>
+ <mi>P</mi>
+ <mfenced>
+ <mrow>
+ <mi>i</mi>
+ <mo>;</mo>
+ <mfrac>
+ <mi>&#x03BB;</mi>
+ <mn>2</mn>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ <msub>
+ <mi>I</mi>
+ <mi>x</mi>
+ </msub>
+ <mfenced>
+ <mrow>
+ <mi>&#x03B1;</mi>
+ <mo>+</mo>
+ <mi>i</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+</math>
+

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref2.png
==============================================================================
Binary file. No diff available.

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref2.svg
==============================================================================
Binary file. No diff available.

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref3.mml
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref3.mml 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -0,0 +1,53 @@
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mi>E</mi>
+ <mfenced>
+ <mrow>
+ <mi>X</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>&#x2243;</mo>
+ <mspace width="1em"/>
+ <mn>1</mn>
+ <mo>&#x2212;</mo>
+ <mfenced>
+ <mrow>
+ <mfrac>
+ <mi>&#x03B2;</mi>
+ <mi>C</mi>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ <mfenced>
+ <mrow>
+ <mn>1</mn>
+ <mo>+</mo>
+ <mfrac>
+ <mi>&#x03BB;</mi>
+ <mrow>
+ <mn>2</mn>
+ <msup>
+ <mi>C</mi>
+ <mn>2</mn>
+ </msup>
+ </mrow>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>;</mo>
+ <mspace width="1em"/>
+ <mi>C</mi>
+ <mo>=</mo>
+ <mi>&#x03B1;</mi>
+ <mo>+</mo>
+ <mi>&#x03B2;</mi>
+ <mo>+</mo>
+ <mfrac>
+ <mi>&#x03BB;</mi>
+ <mn>2</mn>
+ </mfrac>
+ </mrow>
+</math>
+

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref3.png
==============================================================================
Binary file. No diff available.

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref3.svg
==============================================================================
Binary file. No diff available.

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref4.mml
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref4.mml 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -0,0 +1,119 @@
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+ <mrow>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mi>F</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>;</mo>
+ <mi>&#x03B1;</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ <mo>;</mo>
+ <mi>&#x03BB;</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <munderover>
+ <mo>&#x2211;</mo>
+ <mrow>
+ <mi>i</mi>
+ <mo>=</mo>
+ <mn>0</mn>
+ </mrow>
+ <mi>&#x221E;</mi>
+ </munderover>
+ <mi>P</mi>
+ <mfenced>
+ <mrow>
+ <mi>i</mi>
+ <mo>;</mo>
+ <mfrac>
+ <mi>&#x03BB;</mi>
+ <mn>2</mn>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ <msub>
+ <mi>I</mi>
+ <mi>x</mi>
+ </msub>
+ <mfenced>
+ <mrow>
+ <mi>&#x03B1;</mi>
+ <mo>+</mo>
+ <mi>i</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ </mrow>
+ </mfenced>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mn>1</mn>
+ <mo>&#x2212;</mo>
+ <mi>F</mi>
+ <mfenced>
+ <mrow>
+ <mi>x</mi>
+ <mo>;</mo>
+ <mi>&#x03B1;</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ <mo>;</mo>
+ <mi>&#x03BB;</mi>
+ </mrow>
+ </mfenced>
+ <mspace width="1em"/>
+ <mo>=</mo>
+ <mspace width="1em"/>
+ <munderover>
+ <mo>&#x2211;</mo>
+ <mrow>
+ <mi>i</mi>
+ <mo>=</mo>
+ <mn>0</mn>
+ </mrow>
+ <mi>&#x221E;</mi>
+ </munderover>
+ <mi>P</mi>
+ <mfenced>
+ <mrow>
+ <mi>i</mi>
+ <mo>;</mo>
+ <mfrac>
+ <mi>&#x03BB;</mi>
+ <mn>2</mn>
+ </mfrac>
+ </mrow>
+ </mfenced>
+ <mfenced>
+ <mrow>
+ <mn>1</mn>
+ <mo>&#x2212;</mo>
+ <msub>
+ <mi>I</mi>
+ <mi>x</mi>
+ </msub>
+ <mfenced>
+ <mrow>
+ <mi>&#x03B1;</mi>
+ <mo>+</mo>
+ <mi>i</mi>
+ <mo>,</mo>
+ <mi>&#x03B2;</mi>
+ </mrow>
+ </mfenced>
+ </mrow>
+ </mfenced>
+ </mtd>
+ </mtr>
+ </mtable>
+ </mrow>
+</math>
+

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref4.png
==============================================================================
Binary file. No diff available.

Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/equations/nc_beta_ref4.svg
==============================================================================
Binary file. No diff available.

Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/graphs/sf_graphs.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/graphs/sf_graphs.cpp (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/graphs/sf_graphs.cpp 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -110,7 +110,7 @@
       plot.image_size(600, 400);
       plot.copyright_holder("John Maddock").copyright_date("2008").boost_license_on(true);
       plot.coord_precision(4); // Ciould be 3 for smaller plots.
- plot.title(title).legend_title_font_size(15).title_on(true);
+ plot.title(title).title_font_size(20).title_on(true);
       plot.legend_on(m_has_legend);
 
       double x_delta = (m_max_x - m_min_x) / 50;

Modified: sandbox/math_toolkit/libs/math/test/test_nc_beta.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_nc_beta.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_nc_beta.cpp 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -26,6 +26,7 @@
 
 #include "functor.hpp"
 #include "handle_test_result.hpp"
+#include "test_ncbeta_hooks.hpp"
 
 #include <iostream>
 using std::cout;
@@ -93,6 +94,20 @@
          "[^|]*", 5, 5); // test function
    }
 
+ add_expected_result(
+ "[^|]*", // compiler
+ "[^|]*", // stdlib
+ "[^|]*linux[^|]*", // platform
+ largest_type, // test type(s)
+ "[^|]*medium[^|]*", // test data group
+ "[^|]*", 900, 500); // test function
+ add_expected_result(
+ "[^|]*", // compiler
+ "[^|]*", // stdlib
+ "[^|]*linux[^|]*", // platform
+ largest_type, // test type(s)
+ "[^|]*large[^|]*", // test data group
+ "[^|]*", 40000, 5500); // test function
    //
    // Catch all cases come last:
    //
@@ -109,14 +124,14 @@
       "[^|]*", // platform
       "real_concept", // test type(s)
       "[^|]*large[^|]*", // test data group
- "[^|]*", 20000, 4000); // test function
+ "[^|]*", 30000, 4000); // test function
    add_expected_result(
       "[^|]*", // compiler
       "[^|]*", // stdlib
       "[^|]*", // platform
       largest_type, // test type(s)
       "[^|]*large[^|]*", // test data group
- "[^|]*", 9000, 2000); // test function
+ "[^|]*", 10000, 2000); // 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.
@@ -276,6 +291,15 @@
    handle_test_result(result, data[result.worst()], result.worst(),
       type_name, "CCDF", test);
 
+#ifdef TEST_OTHER
+ fp1 = other::ncbeta_cdf;
+ result = boost::math::tools::test(
+ data,
+ bind_func(fp1, 0, 1, 2, 3),
+ extract_result(4));
+ handle_test_result(result, data[result.worst()], result.worst(),
+ type_name, "Other::CDF", test);
+#endif
    std::cout << std::endl;
 
 }

Added: sandbox/math_toolkit/libs/math/test/test_ncbeta_hooks.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/test/test_ncbeta_hooks.hpp 2008-01-31 05:57:30 EST (Thu, 31 Jan 2008)
@@ -0,0 +1,39 @@
+// (C) 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)
+
+#ifndef BOOST_MATH_TEST_NCBETA_OTHER_HOOKS_HPP
+#define BOOST_MATH_TEST_NCBETA_OTHER_HOOKS_HPP
+
+
+#ifdef TEST_R
+#define MATHLIB_STANDALONE
+#include <rmath.h>
+namespace other{
+inline float ncbeta_cdf(float a, float b, float nc, float x)
+{
+ return (float)pnbeta(x, a, b, nc, 1, 0);
+}
+inline double ncbeta_cdf(double a, double b, double nc, double x)
+{
+ return pnbeta(x, a, b, nc, 1, 0);
+}
+inline long double ncbeta_cdf(long double a, long double b, long double nc, long double x)
+{
+ return pnbeta((double)x, (double)a, (double)b, (double)nc, 1, 0);
+}
+}
+#define TEST_OTHER
+#endif
+
+#ifdef TEST_OTHER
+namespace other{
+ boost::math::concepts::real_concept ncbeta_cdf(boost::math::concepts::real_concept, boost::math::concepts::real_concept, boost::math::concepts::real_concept){ return 0; }
+}
+#endif
+
+
+#endif
+
+


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