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/hypergeometric_2f0.hpp>
7 #include <boost/math/constants/constants.hpp>
8 #include <boost/lexical_cast.hpp>
11 #include <boost/math/tools/test_data.hpp>
12 #include <boost/random.hpp>
15 using namespace boost::math::tools
;
16 using namespace boost::math
;
19 struct hypergeometric_2f0_gen
21 mp_t
operator()(mp_t a1
, mp_t a2
, mp_t z
)
23 std::cout
<< a1
<< " " << a2
<< " " << z
<< std::endl
;
24 mp_t result
= boost::math::detail::hypergeometric_2f0_generic_series(a1
, a2
, z
, boost::math::policies::policy
<>());
25 std::cout
<< a1
<< " " << a2
<< " " << z
<< " " << result
<< std::endl
;
30 struct hypergeometric_2f0_gen_spec1
32 boost::math::tuple
<mp_t
, mp_t
, mp_t
, mp_t
> operator()(mp_t a1
, mp_t z
)
34 mp_t result
= boost::math::detail::hypergeometric_2f0_generic_series(a1
, a1
+ 0.5, z
, boost::math::policies::policy
<>());
35 std::cout
<< a1
<< " " << a1
+ 0.5 << " " << z
<< " " << result
<< std::endl
;
36 return boost::math::make_tuple(a1
, a1
+ 0.5, z
, result
);
40 int main(int, char* [])
42 parameter_info
<mp_t
> arg1
, arg2
, arg3
;
45 std::cout
<< "Welcome.\n"
46 "This program will generate spot tests for 2F0:\n";
52 arg1
= make_periodic_param(mp_t(-20), mp_t(-1), 19);
53 arg2
= make_random_param(mp_t(-5), mp_t(5), 8);
54 arg1
.type
|= dummy_param
;
55 arg2
.type
|= dummy_param
;
56 data
.insert(hypergeometric_2f0_gen_spec1(), arg1
, arg2
);
62 get_user_parameter_info(arg1
, "a1");
63 get_user_parameter_info(arg2
, "a2");
64 get_user_parameter_info(arg3
, "z");
65 data
.insert(hypergeometric_2f0_gen(), arg1
, arg2
, arg3
);
66 std::cout
<< "Any more data [y/n]?";
67 std::getline(std::cin
, line
);
68 boost::algorithm::trim(line
);
73 std::cout
<< "Enter name of test data file [default=hypergeometric_2f0.ipp]";
74 std::getline(std::cin
, line
);
75 boost::algorithm::trim(line
);
77 line
= "hypergeometric_2f0.ipp";
78 std::ofstream
ofs(line
.c_str());
79 ofs
<< std::scientific
<< std::setprecision(40);
80 write_code(ofs
, data
, line
.c_str());