Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50316 - in sandbox/math_toolkit: boost/math boost/math/distributions boost/math/distributions/detail libs/math/test/compile_test
From: john_at_[hidden]
Date: 2008-12-18 08:38:57


Author: johnmaddock
Date: 2008-12-18 08:38:56 EST (Thu, 18 Dec 2008)
New Revision: 50316
URL: http://svn.boost.org/trac/boost/changeset/50316

Log:
Added hypergeometric to more tests and to the "include everything" headers.
Suppressed a few warnings.
Text files modified:
   sandbox/math_toolkit/boost/math/distributions.hpp | 1 +
   sandbox/math_toolkit/boost/math/distributions/detail/hypergeometric_pdf.hpp | 1 +
   sandbox/math_toolkit/boost/math/distributions/fwd.hpp | 4 ++++
   sandbox/math_toolkit/boost/math/distributions/hypergeometric.hpp | 13 ++++---------
   sandbox/math_toolkit/libs/math/test/compile_test/instantiate.hpp | 3 +++
   5 files changed, 13 insertions(+), 9 deletions(-)

Modified: sandbox/math_toolkit/boost/math/distributions.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions.hpp 2008-12-18 08:38:56 EST (Thu, 18 Dec 2008)
@@ -22,6 +22,7 @@
 #include <boost/math/distributions/extreme_value.hpp>
 #include <boost/math/distributions/fisher_f.hpp>
 #include <boost/math/distributions/gamma.hpp>
+#include <boost/math/distributions/hypergeometric.hpp>
 #include <boost/math/distributions/logistic.hpp>
 #include <boost/math/distributions/lognormal.hpp>
 #include <boost/math/distributions/negative_binomial.hpp>

Modified: sandbox/math_toolkit/boost/math/distributions/detail/hypergeometric_pdf.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/detail/hypergeometric_pdf.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/detail/hypergeometric_pdf.hpp 2008-12-18 08:38:56 EST (Thu, 18 Dec 2008)
@@ -132,6 +132,7 @@
 template <class T, class Policy>
 T hypergeometric_pdf_lanczos_imp(unsigned x, unsigned r, unsigned n, unsigned N, const boost::math::lanczos::undefined_lanczos&, const Policy& pol)
 {
+ BOOST_MATH_STD_USING
    return exp(
       boost::math::lgamma(T(n + 1), pol)
       + boost::math::lgamma(T(r + 1), pol)

Modified: sandbox/math_toolkit/boost/math/distributions/fwd.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/fwd.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/fwd.hpp 2008-12-18 08:38:56 EST (Thu, 18 Dec 2008)
@@ -39,6 +39,9 @@
 class gamma_distribution;
 
 template <class RealType, class Policy>
+class hypergeometric_distribution;
+
+template <class RealType, class Policy>
 class logistic_distribution;
 
 template <class RealType, class Policy>
@@ -110,5 +113,6 @@
    typedef boost::math::non_central_beta_distribution<Type, Policy> non_central_beta;\
    typedef boost::math::non_central_f_distribution<Type, Policy> non_central_f;\
    typedef boost::math::non_central_t_distribution<Type, Policy> non_central_t;\
+ typedef boost::math::hypergeometric_distribution<Type, Policy> hypergeometric;\
 
 #endif // BOOST_MATH_DISTRIBUTIONS_FWD_HPP

Modified: sandbox/math_toolkit/boost/math/distributions/hypergeometric.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/distributions/hypergeometric.hpp (original)
+++ sandbox/math_toolkit/boost/math/distributions/hypergeometric.hpp 2008-12-18 08:38:56 EST (Thu, 18 Dec 2008)
@@ -131,7 +131,7 @@
    inline RealType pdf(const hypergeometric_distribution<RealType, Policy>& dist, const U& x)
    {
       static const char* function = "boost::math::pdf(const hypergeometric_distribution<%1%>&, const %1%&)";
- RealType r = x;
+ RealType r = static_cast<RealType>(x);
       unsigned u = boost::math::itrunc(r);
       if(u != r)
       {
@@ -159,7 +159,7 @@
    inline RealType cdf(const hypergeometric_distribution<RealType, Policy>& dist, const U& x)
    {
       static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
- RealType r = x;
+ RealType r = static_cast<RealType>(x);
       unsigned u = boost::math::itrunc(r);
       if(u != r)
       {
@@ -187,7 +187,7 @@
    inline RealType cdf(const complemented2_type<hypergeometric_distribution<RealType, Policy>, U>& c)
    {
       static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
- RealType r = c.param;
+ RealType r = static_cast<RealType>(c.param);
       unsigned u = boost::math::itrunc(r);
       if(u != r)
       {
@@ -251,14 +251,9 @@
    }
 
    template <class RealType, class Policy>
- inline RealType median(const hypergeometric_distribution<RealType, Policy>& dist)
- {
- // TODO:
- return 0;
- }
- template <class RealType, class Policy>
    inline RealType skewness(const hypergeometric_distribution<RealType, Policy>& dist)
    {
+ BOOST_MATH_STD_USING
       RealType r = static_cast<RealType>(dist.sample_count());
       RealType n = static_cast<RealType>(dist.defective());
       RealType N = static_cast<RealType>(dist.total());

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-12-18 08:38:56 EST (Thu, 18 Dec 2008)
@@ -83,6 +83,7 @@
    function_requires<DistributionConcept<non_central_beta_distribution<RealType> > >();
    function_requires<DistributionConcept<non_central_f_distribution<RealType> > >();
    function_requires<DistributionConcept<non_central_t_distribution<RealType> > >();
+ function_requires<DistributionConcept<hypergeometric_distribution<RealType> > >();
 #ifndef BOOST_MATH_INSTANTIATE_MINIMUM
    function_requires<DistributionConcept<bernoulli_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<beta_distribution<RealType, test_policy> > >();
@@ -109,6 +110,7 @@
    function_requires<DistributionConcept<non_central_beta_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<non_central_f_distribution<RealType, test_policy> > >();
    function_requires<DistributionConcept<non_central_t_distribution<RealType, test_policy> > >();
+ function_requires<DistributionConcept<hypergeometric_distribution<RealType, test_policy> > >();
 
    function_requires<DistributionConcept<dist_test::bernoulli > >();
    function_requires<DistributionConcept<dist_test::beta > >();
@@ -134,6 +136,7 @@
    function_requires<DistributionConcept<dist_test::non_central_beta > >();
    function_requires<DistributionConcept<dist_test::non_central_f > >();
    function_requires<DistributionConcept<dist_test::non_central_t > >();
+ function_requires<DistributionConcept<dist_test::hypergeometric > >();
 #endif
    int i;
    RealType v1(0.5), v2(0.5), v3(0.5);


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