]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_real_concept_neg_bin.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / test / test_real_concept_neg_bin.cpp
1 // test_real_concept.cpp
2
3 // Copyright Paul A. Bristow 2010.
4 // Copyright John Maddock 2010.
5
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)
10
11 // Tests real_concept for Negative Binomial and Geometric Distribution.
12 // find_upper_bound ...
13
14 #include <boost/math/concepts/real_concept.hpp> // for real_concept
15 using ::boost::math::concepts::real_concept;
16
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>
20
21 #include <boost/math/distributions/negative_binomial.hpp> // for some comparisons.
22
23 #include <iostream>
24 using std::cout;
25 using std::endl;
26 using std::setprecision;
27 using std::showpoint;
28 #include <limits>
29 using std::numeric_limits;
30
31 template <class RealType>
32 void test_spot(RealType)
33 {
34 using boost::math::negative_binomial_distribution;
35
36 // NOT boost::math::negative_binomial or boost::math::geometric
37 // - because then you get the default negative_binomial_distribution<double>!!!
38
39 RealType k = static_cast<RealType>(2.L);
40 RealType alpha = static_cast<RealType>(0.05L);
41 RealType p = static_cast<RealType>(0.5L);
42 RealType result;
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);
46 }
47
48 int main()
49 {
50 test_spot(boost::math::concepts::real_concept(0.)); // Test real concept.
51 return 0;
52 }