• 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 k)18 mp_t ellint_d(mp_t k)
19 {
20    return (boost::math::ellint_1(k) - boost::math::ellint_2(k)) / (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;
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, "k"))
38          return 1;
39 
40       mp_t(*fp)(mp_t) = &ellint_d;
41       data.insert(fp, arg1);
42 
43       std::cout << "Any more data [y/n]?";
44       std::getline(std::cin, line);
45       boost::algorithm::trim(line);
46       cont = (line == "y");
47    }while(cont);
48 
49    std::cout << "Enter name of test data file [default=ellint_d_data.ipp]";
50    std::getline(std::cin, line);
51    boost::algorithm::trim(line);
52    if(line == "")
53       line = "ellint_d_data.ipp";
54    std::ofstream ofs(line.c_str());
55    line.erase(line.find('.'));
56    ofs << std::scientific << std::setprecision(40);
57    write_code(ofs, data, line.c_str());
58 
59    return 0;
60 }
61 
62 
63