From e0737c56c1e384e05064a0c6e1ac46979371041b Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 19 Dec 2018 22:58:32 +0100 Subject: New upstream version 2.0.0+repack --- boost/libs/math/tools/ibeta_derivative_data.cpp | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 boost/libs/math/tools/ibeta_derivative_data.cpp (limited to 'boost/libs/math/tools/ibeta_derivative_data.cpp') diff --git a/boost/libs/math/tools/ibeta_derivative_data.cpp b/boost/libs/math/tools/ibeta_derivative_data.cpp new file mode 100644 index 00000000..80e01907 --- /dev/null +++ b/boost/libs/math/tools/ibeta_derivative_data.cpp @@ -0,0 +1,68 @@ +// (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; +} + + -- cgit v1.2.3