Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-17 08:29:22

0001 // Copyright Nick Thompson, 2017
0002 // Copyright Matt Borland, 2024
0003 // Use, modification and distribution are subject to the
0004 // Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE_1_0.txt
0006 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 /*
0009  * This class performs sinh-sinh quadrature over the entire real line.
0010  *
0011  * References:
0012  *
0013  * 1) Tanaka, Ken'ichiro, et al. "Function classes for double exponential integration formulas." Numerische Mathematik 111.4 (2009): 631-655.
0014  */
0015 
0016 #ifndef BOOST_MATH_QUADRATURE_SINH_SINH_HPP
0017 #define BOOST_MATH_QUADRATURE_SINH_SINH_HPP
0018 
0019 #include <boost/math/tools/config.hpp>
0020 #include <boost/math/tools/precision.hpp>
0021 #include <boost/math/tools/cstdint.hpp>
0022 #include <boost/math/quadrature/detail/sinh_sinh_detail.hpp>
0023 #include <boost/math/policies/error_handling.hpp>
0024 
0025 #ifndef BOOST_MATH_HAS_NVRTC
0026 
0027 #include <cmath>
0028 #include <limits>
0029 #include <memory>
0030 
0031 namespace boost{ namespace math{ namespace quadrature {
0032 
0033 template<class Real, class Policy = boost::math::policies::policy<> >
0034 class sinh_sinh
0035 {
0036 public:
0037     sinh_sinh(size_t max_refinements = 9)
0038         : m_imp(std::make_shared<detail::sinh_sinh_detail<Real, Policy> >(max_refinements)) {}
0039 
0040     template<class F>
0041     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>()))
0042     {
0043         return m_imp->integrate(f, tol, error, L1, levels);
0044     }
0045 
0046 private:
0047     std::shared_ptr<detail::sinh_sinh_detail<Real, Policy>> m_imp;
0048 };
0049 
0050 }}}
0051 
0052 #endif // BOOST_MATH_HAS_NVRTC
0053 
0054 #ifdef BOOST_MATH_ENABLE_CUDA
0055 
0056 namespace boost {
0057 namespace math {
0058 namespace quadrature {
0059 
0060 template <class F, class Real, class Policy = boost::math::policies::policy<> >
0061 __device__ auto sinh_sinh_integrate(const F& f, Real tol = boost::math::tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, boost::math::size_t* levels = nullptr)
0062 {
0063     return detail::sinh_sinh_integrate_impl(f, tol, error, L1, levels);
0064 }
0065 
0066 } // namespace quadrature
0067 } // namespace math
0068 } // namespace boost
0069 
0070 #endif // BOOST_MATH_ENABLE_CUDA
0071 
0072 #endif // BOOST_MATH_QUADRATURE_SINH_SINH_HPP