]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/hermite_data.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / tools / hermite_data.cpp
1 // (C) Copyright John Maddock 2007.
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/tools/test_data.hpp>
7 #include <boost/math/special_functions/hermite.hpp>
8 #include <fstream>
9 #include "mp_t.hpp"
10
11 using namespace boost::math::tools;
12 using namespace boost::math;
13 using namespace std;
14
15
16 template<class T>
17 boost::math::tuple<T, T, T> hermite_data(T n, T x)
18 {
19 n = floor(n);
20 T r1 = hermite(boost::math::tools::real_cast<unsigned>(n), x);
21 return boost::math::make_tuple(n, x, r1);
22 }
23
24 int main(int argc, char*argv [])
25 {
26 using namespace boost::math::tools;
27
28 parameter_info<mp_t> arg1, arg2, arg3;
29 test_data<mp_t> data;
30
31 std::cout << boost::math::hermite(10, static_cast<mp_t>(1e300)) << std::endl;
32
33 bool cont;
34 std::string line;
35
36 if(argc < 1)
37 return 1;
38
39 do{
40 if(0 == get_user_parameter_info(arg1, "n"))
41 return 1;
42 if(0 == get_user_parameter_info(arg2, "x"))
43 return 1;
44 arg1.type |= dummy_param;
45 arg2.type |= dummy_param;
46
47 data.insert(&hermite_data<mp_t>, arg1, arg2);
48
49 std::cout << "Any more data [y/n]?";
50 std::getline(std::cin, line);
51 boost::algorithm::trim(line);
52 cont = (line == "y");
53 }while(cont);
54
55 std::cout << "Enter name of test data file [default=hermite.ipp]";
56 std::getline(std::cin, line);
57 boost::algorithm::trim(line);
58 if(line == "")
59 line = "hermite.ipp";
60 std::ofstream ofs(line.c_str());
61 line.erase(line.find('.'));
62 ofs << std::scientific << std::setprecision(40);
63 write_code(ofs, data, line.c_str());
64
65 return 0;
66 }
67