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