]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/tools/laguerre_data.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / math / tools / laguerre_data.cpp
CommitLineData
7c673cae
FG
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
20effc67 6#include "mp_t.hpp"
7c673cae
FG
7#include <boost/math/tools/test_data.hpp>
8#include <boost/math/special_functions/laguerre.hpp>
9#include <boost/math/special_functions/gamma.hpp>
10#include <fstream>
11#include <boost/math/tools/test_data.hpp>
7c673cae
FG
12
13using namespace boost::math::tools;
14using namespace boost::math;
15using namespace std;
16
17
18template<class T>
19boost::math::tuple<T, T, T> laguerre2_data(T n, T x)
20{
21 n = floor(n);
22 T r1 = laguerre(boost::math::tools::real_cast<unsigned>(n), x);
23 return boost::math::make_tuple(n, x, r1);
24}
25
26template<class T>
27boost::math::tuple<T, T, T, T> laguerre3_data(T n, T m, T x)
28{
29 n = floor(n);
30 m = floor(m);
31 T r1 = laguerre(real_cast<unsigned>(n), real_cast<unsigned>(m), x);
32 return boost::math::make_tuple(n, m, x, r1);
33}
34
35int main(int argc, char*argv [])
36{
37 using namespace boost::math::tools;
38
39 parameter_info<mp_t> arg1, arg2, arg3;
40 test_data<mp_t> data;
41
42 bool cont;
43 std::string line;
44
45 if(argc < 2)
46 return 1;
47
48 if(strcmp(argv[1], "--laguerre2") == 0)
49 {
50 do{
51 if(0 == get_user_parameter_info(arg1, "n"))
52 return 1;
53 if(0 == get_user_parameter_info(arg2, "x"))
54 return 1;
55 arg1.type |= dummy_param;
56 arg2.type |= dummy_param;
57
58 data.insert(&laguerre2_data<mp_t>, arg1, arg2);
59
60 std::cout << "Any more data [y/n]?";
61 std::getline(std::cin, line);
62 boost::algorithm::trim(line);
63 cont = (line == "y");
64 }while(cont);
65 }
66 else if(strcmp(argv[1], "--laguerre3") == 0)
67 {
68 do{
69 if(0 == get_user_parameter_info(arg1, "n"))
70 return 1;
71 if(0 == get_user_parameter_info(arg2, "m"))
72 return 1;
73 if(0 == get_user_parameter_info(arg3, "x"))
74 return 1;
75 arg1.type |= dummy_param;
76 arg2.type |= dummy_param;
77 arg3.type |= dummy_param;
78
79 data.insert(&laguerre3_data<mp_t>, arg1, arg2, arg3);
80
81 std::cout << "Any more data [y/n]?";
82 std::getline(std::cin, line);
83 boost::algorithm::trim(line);
84 cont = (line == "y");
85 }while(cont);
86 }
87
88
89 std::cout << "Enter name of test data file [default=laguerre.ipp]";
90 std::getline(std::cin, line);
91 boost::algorithm::trim(line);
92 if(line == "")
93 line = "laguerre.ipp";
94 std::ofstream ofs(line.c_str());
95 line.erase(line.find('.'));
96 ofs << std::scientific << std::setprecision(40);
97 write_code(ofs, data, line.c_str());
98
99 return 0;
100}
101