1 // test_real_concept.cpp
3 // Copyright Paul A. Bristow 2010.
4 // Copyright John Maddock 2010.
6 // Use, modification and distribution are subject to the
7 // Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt
9 // or copy at http://www.boost.org/LICENSE_1_0.txt)
11 // Tests real_concept for Negative Binomial and Geometric Distribution.
12 // find_upper_bound ...
14 #include <boost/math/concepts/real_concept.hpp> // for real_concept
15 using ::boost::math::concepts::real_concept
;
17 #include <boost/math/distributions/geometric.hpp> // for geometric_distribution
18 using boost::math::geometric_distribution
;
19 using boost::math::geometric
; // using typedef for geometric_distribution<double>
21 #include <boost/math/distributions/negative_binomial.hpp> // for some comparisons.
26 using std::setprecision
;
29 using std::numeric_limits
;
31 template <class RealType
>
32 void test_spot(RealType
)
34 using boost::math::negative_binomial_distribution
;
36 // NOT boost::math::negative_binomial or boost::math::geometric
37 // - because then you get the default negative_binomial_distribution<double>!!!
39 RealType k
= static_cast<RealType
>(2.L
);
40 RealType alpha
= static_cast<RealType
>(0.05L);
41 RealType p
= static_cast<RealType
>(0.5L);
43 result
= negative_binomial_distribution
<RealType
>::find_lower_bound_on_p(static_cast<RealType
>(k
), static_cast<RealType
>(1), static_cast<RealType
>(alpha
));
44 result
= negative_binomial_distribution
<RealType
>::find_lower_bound_on_p(k
, 1, alpha
);
45 result
= geometric_distribution
<RealType
>::find_lower_bound_on_p(k
, alpha
);
50 test_spot(boost::math::concepts::real_concept(0.)); // Test real concept.