]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/jacobi_theta_data.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / tools / jacobi_theta_data.cpp
1 /*
2 * Copyright Evan Miller, 2020
3 * Use, modification and distribution are subject to the
4 * Boost Software License, Version 1.0. (See accompanying file
5 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 */
7
8 #include "mp_t.hpp"
9 #include <boost/math/tools/test_data.hpp>
10 #include <boost/test/included/prg_exec_monitor.hpp>
11 #include <boost/math/special_functions/jacobi_theta.hpp>
12 #include <fstream>
13 #include <boost/math/tools/test_data.hpp>
14
15 using namespace boost::math::tools;
16 using namespace boost::math;
17 using namespace std;
18
19 struct jacobi_theta_data_generator
20 {
21 boost::math::tuple<mp_t, mp_t, mp_t, mp_t> operator()(mp_t z, mp_t tau)
22 {
23 return boost::math::make_tuple(
24 jacobi_theta1tau(z, tau),
25 jacobi_theta2tau(z, tau),
26 jacobi_theta3tau(z, tau),
27 jacobi_theta4tau(z, tau));
28 }
29 };
30
31 int cpp_main(int argc, char*argv [])
32 {
33 parameter_info<mp_t> arg1, arg2;
34 test_data<mp_t> data;
35
36 bool cont;
37 std::string line;
38
39 if(argc < 1)
40 return 1;
41
42 std::cout << "Welcome.\n"
43 "This program will generate spot tests for the Jacobi Theta functions.\n"
44 ;
45
46 do{
47 if(0 == get_user_parameter_info(arg1, "z"))
48 return 1;
49 if(0 == get_user_parameter_info(arg2, "tau"))
50 return 1;
51
52 data.insert(jacobi_theta_data_generator(), arg1, arg2);
53
54 std::cout << "Any more data [y/n]?";
55 std::getline(std::cin, line);
56 boost::algorithm::trim(line);
57 cont = (line == "y");
58 } while(cont);
59
60 std::cout << "Generating " << data.size() << " test points.";
61
62 std::cout << "Enter name of test data file [default=jacobi_theta.ipp]";
63 std::getline(std::cin, line);
64 boost::algorithm::trim(line);
65 if(line == "")
66 line = "jacobi_theta.ipp";
67 std::ofstream ofs(line.c_str());
68 ofs << std::scientific << std::setprecision(40);
69 write_code(ofs, data, "jacobi_theta_data");
70
71 return 0;
72 }