1 // (C) Copyright John Maddock 2006.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/math/special_functions/gamma.hpp>
7 #include <boost/math/constants/constants.hpp>
8 #include <boost/math/tools/test_data.hpp>
12 using namespace boost::math::tools;
14 struct beta_data_generator
16 mp_t operator()(mp_t a, mp_t b)
19 throw std::domain_error("");
20 // very naively calculate spots:
23 g1 = boost::math::lgamma(a, &s1);
24 g2 = boost::math::lgamma(b, &s2);
25 g3 = boost::math::lgamma(a+b, &s3);
36 parameter_info<mp_t> arg1, arg2;
39 std::cout << "Welcome.\n"
40 "This program will generate spot tests for the beta function:\n"
47 get_user_parameter_info(arg1, "a");
48 get_user_parameter_info(arg2, "b");
49 data.insert(beta_data_generator(), arg1, arg2);
51 std::cout << "Any more data [y/n]?";
52 std::getline(std::cin, line);
53 boost::algorithm::trim(line);
57 std::cout << "Enter name of test data file [default=beta_data.ipp]";
58 std::getline(std::cin, line);
59 boost::algorithm::trim(line);
61 line = "beta_data.ipp";
62 std::ofstream ofs(line.c_str());
63 ofs << std::scientific << std::setprecision(40);
64 write_code(ofs, data, "beta_data");