test_1F1_log.hpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright John Maddock 2006.
  2. // Copyright Paul A. Bristow 2007, 2009
  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. #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
  7. #include <boost/math/concepts/real_concept.hpp>
  8. #include <boost/math/special_functions/math_fwd.hpp>
  9. #define BOOST_TEST_MAIN
  10. #include <boost/test/unit_test.hpp>
  11. #include <boost/test/tools/floating_point_comparison.hpp>
  12. #include <boost/math/tools/stats.hpp>
  13. #include <boost/math/tools/test.hpp>
  14. #include <boost/math/tools/big_constant.hpp>
  15. #include <boost/math/constants/constants.hpp>
  16. #include <boost/type_traits/is_floating_point.hpp>
  17. #include <boost/array.hpp>
  18. #include "functor.hpp"
  19. #include "handle_test_result.hpp"
  20. #include "table_type.hpp"
  21. #include <boost/math/special_functions/hypergeometric_1F1.hpp>
  22. #include <boost/math/quadrature/exp_sinh.hpp>
  23. #ifdef BOOST_MSVC
  24. #pragma warning(disable:4127)
  25. #endif
  26. template <class Real, class T>
  27. void do_test_1F1(const T& data, const char* type_name, const char* test_name)
  28. {
  29. typedef Real value_type;
  30. typedef value_type(*pg)(value_type, value_type, value_type);
  31. #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
  32. pg funcp = boost::math::log_hypergeometric_1F1<value_type, value_type>;
  33. #else
  34. pg funcp = boost::math::log_hypergeometric_1F1;
  35. #endif
  36. boost::math::tools::test_result<value_type> result;
  37. std::cout << "Testing " << test_name << " with type " << type_name
  38. << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
  39. //
  40. // test hypergeometric_2F0 against data:
  41. //
  42. result = boost::math::tools::test_hetero<Real>(
  43. data,
  44. bind_func<Real>(funcp, 0, 1, 2),
  45. extract_result<Real>(3));
  46. handle_test_result(result, data[result.worst()], result.worst(), type_name, "log_hypergeometric_1F1", test_name);
  47. std::cout << std::endl;
  48. }
  49. #ifndef SC_
  50. #define SC_(x) BOOST_MATH_BIG_CONSTANT(T, 1000000, x)
  51. #endif
  52. template <class T>
  53. void test_spots1(T, const char* type_name)
  54. {
  55. #include "hypergeometric_1f1_log_large.ipp"
  56. do_test_1F1<T>(hypergeometric_1f1_log_large, type_name, "Large random values - log");
  57. }
  58. template <class T>
  59. void test_spots2(T, const char* type_name)
  60. {
  61. #include "hypergeometric_1f1_log_large_unsolved.ipp"
  62. do_test_1F1<T>(hypergeometric_1f1_log_large_unsolved, type_name, "Large random values - log - unsolved");
  63. }
  64. template <class T>
  65. void test_spots(T z, const char* type_name)
  66. {
  67. test_spots1(z, type_name);
  68. #ifdef TEST_UNSOLVED
  69. test_spots2(z, type_name);
  70. #endif
  71. }