• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright John Maddock 2006.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/math/tools/test_data.hpp>
7 #include <boost/test/included/prg_exec_monitor.hpp>
8 #include <boost/math/special_functions/ellint_1.hpp>
9 #include <boost/math/special_functions/ellint_2.hpp>
10 #include <fstream>
11 #include <boost/math/tools/test_data.hpp>
12 #include "mp_t.hpp"
13 
14 using namespace boost::math::tools;
15 using namespace boost::math;
16 using namespace std;
17 
ellint_d(mp_t phi,mp_t k)18 mp_t ellint_d(mp_t phi, mp_t k)
19 {
20    return (boost::math::ellint_1(k, phi) - boost::math::ellint_2(k, phi)) / (k * k);
21 }
22 
cpp_main(int argc,char * argv[])23 int cpp_main(int argc, char*argv [])
24 {
25    using namespace boost::math::tools;
26 
27    parameter_info<mp_t> arg1, arg2;
28    test_data<mp_t> data;
29 
30    bool cont;
31    std::string line;
32 
33    if(argc < 1)
34       return 1;
35 
36    do{
37       if(0 == get_user_parameter_info(arg1, "phi"))
38          return 1;
39       if(0 == get_user_parameter_info(arg2, "k"))
40          return 1;
41 
42       mp_t(*fp)(mp_t, mp_t) = &ellint_d;
43       data.insert(fp, arg1, arg2);
44 
45       std::cout << "Any more data [y/n]?";
46       std::getline(std::cin, line);
47       boost::algorithm::trim(line);
48       cont = (line == "y");
49    }while(cont);
50 
51    std::cout << "Enter name of test data file [default=ellint_d2_data.ipp]";
52    std::getline(std::cin, line);
53    boost::algorithm::trim(line);
54    if(line == "")
55       line = "ellint_d2_data.ipp";
56    std::ofstream ofs(line.c_str());
57    line.erase(line.find('.'));
58    ofs << std::scientific << std::setprecision(40);
59    write_code(ofs, data, line.c_str());
60 
61    return 0;
62 }
63 
64 
65