sinh_sinh.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright Nick Thompson, 2017
  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. /*
  7. * This class performs sinh-sinh quadrature over the entire real line.
  8. *
  9. * References:
  10. *
  11. * 1) Tanaka, Ken'ichiro, et al. "Function classes for double exponential integration formulas." Numerische Mathematik 111.4 (2009): 631-655.
  12. */
  13. #ifndef BOOST_MATH_QUADRATURE_SINH_SINH_HPP
  14. #define BOOST_MATH_QUADRATURE_SINH_SINH_HPP
  15. #include <cmath>
  16. #include <limits>
  17. #include <memory>
  18. #include <boost/math/quadrature/detail/sinh_sinh_detail.hpp>
  19. namespace boost{ namespace math{ namespace quadrature {
  20. template<class Real, class Policy = boost::math::policies::policy<> >
  21. class sinh_sinh
  22. {
  23. public:
  24. sinh_sinh(size_t max_refinements = 9)
  25. : m_imp(std::make_shared<detail::sinh_sinh_detail<Real, Policy> >(max_refinements)) {}
  26. template<class F>
  27. auto integrate(const F f, Real tol = boost::math::tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) const ->decltype(std::declval<F>()(std::declval<Real>()))
  28. {
  29. return m_imp->integrate(f, tol, error, L1, levels);
  30. }
  31. private:
  32. std::shared_ptr<detail::sinh_sinh_detail<Real, Policy>> m_imp;
  33. };
  34. }}}
  35. #endif