Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / math / tools / hypergeometric_dist_data.cpp
index 3ed87dd..55352f0 100644 (file)
@@ -5,32 +5,29 @@
 
 //#define BOOST_MATH_INSTRUMENT
 
-#include <boost/math/bindings/rr.hpp>
-#include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/distributions/hypergeometric.hpp>
 #include <boost/math/special_functions/trunc.hpp>
 #include <boost/math/constants/constants.hpp>
-#include <boost/math/tools/test.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/random/uniform_int.hpp>
 #include <fstream>
-
 #include <boost/math/tools/test_data.hpp>
+#include "mp_t.hpp"
 
 using namespace boost::math::tools;
 
-std::tr1::mt19937 rnd;
+std::mt19937 rnd;
 
 struct hypergeometric_generator
 {
    boost::math::tuple<
-      boost::math::ntl::RR
-      boost::math::ntl::RR
-      boost::math::ntl::RR
-      boost::math::ntl::RR
-      boost::math::ntl::RR,
-      boost::math::ntl::RR,
-      boost::math::ntl::RR> operator()(boost::math::ntl::RR rN, boost::math::ntl::RR rr, boost::math::ntl::RR rn)
+      mp_t
+      mp_t
+      mp_t
+      mp_t
+      mp_t,
+      mp_t,
+      mp_t> operator()(mp_t rN, mp_t rr, mp_t rn)
    {
       using namespace std;
       using namespace boost;
@@ -46,16 +43,16 @@ struct hypergeometric_generator
          boost::uniform_int<> ui((std::max)(0, n + r - N), (std::min)(n, r));
          int k = ui(rnd);
 
-         hypergeometric_distribution<ntl::RR> d(r, n, N);
+         hypergeometric_distribution<mp_t> d(r, n, N);
 
-         ntl::RR p = pdf(d, k);
+         mp_t p = pdf(d, k);
          if((p == 1) || (p == 0))
          {
             // trivial case, don't clutter up our table with it:
             throw std::domain_error("");
          }
-         ntl::RR c = cdf(d, k);
-         ntl::RR cc = cdf(complement(d, k));
+         mp_t c = cdf(d, k);
+         mp_t cc = cdf(complement(d, k));
 
          std::cout << "N = " << N << " r = " << r << " n = " << n << " PDF = " << p << " CDF = " << c << " CCDF = " << cc << std::endl;
 
@@ -69,21 +66,18 @@ struct hypergeometric_generator
    }
 };
 
-int test_main(int argc, char*argv [])
+int main(int argc, char*argv [])
 {
-   boost::math::ntl::RR::SetPrecision(1000);
-   boost::math::ntl::RR::SetOutputPrecision(100);
-
    std::string line;
-   parameter_info<boost::math::ntl::RR> arg1, arg2, arg3;
-   test_data<boost::math::ntl::RR> data;
+   parameter_info<mp_t> arg1, arg2, arg3;
+   test_data<mp_t> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests hypergeoemtric distribution:\n";
 
-   arg1 = make_power_param(boost::math::ntl::RR(0), 1, 21);
-   arg2 = make_power_param(boost::math::ntl::RR(0), 1, 21);
-   arg3 = make_power_param(boost::math::ntl::RR(0), 1, 21);
+   arg1 = make_power_param(mp_t(0), 1, 21);
+   arg2 = make_power_param(mp_t(0), 1, 21);
+   arg3 = make_power_param(mp_t(0), 1, 21);
 
    arg1.type |= dummy_param;
    arg2.type |= dummy_param;
@@ -93,6 +87,7 @@ int test_main(int argc, char*argv [])
 
    line = "hypergeometric_dist_data2.ipp";
    std::ofstream ofs(line.c_str());
+   ofs << std::scientific << std::setprecision(40);
    write_code(ofs, data, "hypergeometric_dist_data2");
    
    return 0;