ellint_k_data.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #include <boost/math/tools/test_data.hpp>
  6. #include <boost/test/included/prg_exec_monitor.hpp>
  7. #include <boost/math/special_functions/ellint_1.hpp>
  8. #include <fstream>
  9. #include <boost/math/tools/test_data.hpp>
  10. #include "mp_t.hpp"
  11. using namespace boost::math::tools;
  12. using namespace boost::math;
  13. using namespace std;
  14. template<class T>
  15. T ellint_k_data(T k)
  16. {
  17. return ellint_1(k);
  18. }
  19. int cpp_main(int argc, char*argv [])
  20. {
  21. using namespace boost::math::tools;
  22. parameter_info<mp_t> arg1;
  23. test_data<mp_t> data;
  24. bool cont;
  25. std::string line;
  26. if(argc < 1)
  27. return 1;
  28. do{
  29. if(0 == get_user_parameter_info(arg1, "phi"))
  30. return 1;
  31. data.insert(&ellint_k_data<mp_t>, arg1);
  32. std::cout << "Any more data [y/n]?";
  33. std::getline(std::cin, line);
  34. boost::algorithm::trim(line);
  35. cont = (line == "y");
  36. }while(cont);
  37. std::cout << "Enter name of test data file [default=ellint_k_data.ipp]";
  38. std::getline(std::cin, line);
  39. boost::algorithm::trim(line);
  40. if(line == "")
  41. line = "ellint_k_data.ipp";
  42. std::ofstream ofs(line.c_str());
  43. line.erase(line.find('.'));
  44. ofs << std::scientific << std::setprecision(40);
  45. write_code(ofs, data, line.c_str());
  46. return 0;
  47. }