// (C) Copyright John Maddock 2006. // 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) #include #include #include #include #include #include #include #include #include "mp_t.hpp" using namespace boost::math::tools; using namespace boost::math; using namespace std; #include #define T double #define SC_(x) static_cast(x) #include int main(int, char* []) { std::cout << "Enter name of test data file [default=ibeta_derivative_data.ipp]"; std::string line; std::getline(std::cin, line); boost::algorithm::trim(line); if(line == "") line = "ibeta_derivative_data.ipp"; std::ofstream ofs(line.c_str()); ofs << std::scientific << std::setprecision(40); ofs << "// (C) Copyright John Maddock 2006.\n" "// Use, modification and distribution are subject to the\n" "// Boost Software License, Version 1.0. (See accompanying file\n" "// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" "\n\n" "static const boost::array::type, 4>, " << ibeta_int_data.size() << "> ibeta_derivative_small_data = { {\n"; for(unsigned i = 0; i < ibeta_int_data.size(); ++i) { mp_t a(ibeta_int_data[i][0]); mp_t b(ibeta_int_data[i][1]); mp_t x(ibeta_int_data[i][2]); std::cout << a << std::endl; std::cout << b << std::endl; std::cout << x << std::endl; mp_t bet = exp(boost::math::lgamma(a) + boost::math::lgamma(b) - boost::math::lgamma(a + b)); mp_t d = pow(1 - x, b - 1) * pow(x, a - 1) / bet; ofs << "{{ SC_(" << a << "), SC_(" << b << "), SC_(" << x << "), SC_(" << d << ") }}\n"; } ofs << "}};\n\n"; return 0; }