]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/hyp_2f0_data.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / math / tools / hyp_2f0_data.cpp
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)
5
6 #include <boost/math/special_functions/hypergeometric_2f0.hpp>
7 #include <boost/math/constants/constants.hpp>
8 #include <boost/lexical_cast.hpp>
9 #include <fstream>
10 #include <map>
11 #include <boost/math/tools/test_data.hpp>
12 #include <boost/random.hpp>
13 #include "mp_t.hpp"
14
15 using namespace boost::math::tools;
16 using namespace boost::math;
17 using namespace std;
18
19 struct hypergeometric_2f0_gen
20 {
21 mp_t operator()(mp_t a1, mp_t a2, mp_t z)
22 {
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;
26 return result;
27 }
28 };
29
30 struct hypergeometric_2f0_gen_spec1
31 {
32 boost::math::tuple<mp_t, mp_t, mp_t, mp_t> operator()(mp_t a1, mp_t z)
33 {
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);
37 }
38 };
39
40 int main(int, char* [])
41 {
42 parameter_info<mp_t> arg1, arg2, arg3;
43 test_data<mp_t> data;
44
45 std::cout << "Welcome.\n"
46 "This program will generate spot tests for 2F0:\n";
47
48 std::string line;
49 bool cont;
50
51 #if 1
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);
57
58
59 #else
60
61 do {
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);
69 cont = (line == "y");
70 } while (cont);
71
72 #endif
73 std::cout << "Enter name of test data file [default=hypergeometric_2f0.ipp]";
74 std::getline(std::cin, line);
75 boost::algorithm::trim(line);
76 if(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());
81
82 return 0;
83 }
84
85