Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:58

0001 // Copyright Nick Thompson, 2019
0002 // Use, modification and distribution are subject to the
0003 // Boost Software License, Version 1.0.
0004 // (See accompanying file LICENSE_1_0.txt
0005 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 /*
0008  * References:
0009  * Ooura, Takuya, and Masatake Mori. "A robust double exponential formula for Fourier-type integrals." Journal of computational and applied mathematics 112.1-2 (1999): 229-241.
0010  * http://www.kurims.kyoto-u.ac.jp/~ooura/intde.html
0011  */
0012 #ifndef BOOST_MATH_QUADRATURE_OOURA_FOURIER_INTEGRALS_HPP
0013 #define BOOST_MATH_QUADRATURE_OOURA_FOURIER_INTEGRALS_HPP
0014 #include <memory>
0015 #include <boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp>
0016 
0017 namespace boost { namespace math { namespace quadrature {
0018 
0019 template<class Real>
0020 class ooura_fourier_sin {
0021 public:
0022     ooura_fourier_sin(const Real relative_error_tolerance = tools::root_epsilon<Real>(), size_t levels = sizeof(Real)) : impl_(std::make_shared<detail::ooura_fourier_sin_detail<Real>>(relative_error_tolerance, levels))
0023     {}
0024 
0025     template<class F>
0026     std::pair<Real, Real> integrate(F const & f, Real omega) {
0027         return impl_->integrate(f, omega);
0028     }
0029 
0030     // These are just for debugging/unit tests:
0031     std::vector<std::vector<Real>> const & big_nodes() const {
0032         return impl_->big_nodes();
0033     }
0034 
0035     std::vector<std::vector<Real>> const & weights_for_big_nodes() const {
0036         return impl_->weights_for_big_nodes();
0037     }
0038 
0039     std::vector<std::vector<Real>> const & little_nodes() const {
0040         return impl_->little_nodes();
0041     }
0042 
0043     std::vector<std::vector<Real>> const & weights_for_little_nodes() const {
0044         return impl_->weights_for_little_nodes();
0045     }
0046 
0047 private:
0048     std::shared_ptr<detail::ooura_fourier_sin_detail<Real>> impl_;
0049 };
0050 
0051 
0052 template<class Real>
0053 class ooura_fourier_cos {
0054 public:
0055     ooura_fourier_cos(const Real relative_error_tolerance = tools::root_epsilon<Real>(), size_t levels = sizeof(Real)) : impl_(std::make_shared<detail::ooura_fourier_cos_detail<Real>>(relative_error_tolerance, levels))
0056     {}
0057 
0058     template<class F>
0059     std::pair<Real, Real> integrate(F const & f, Real omega) {
0060         return impl_->integrate(f, omega);
0061     }
0062 private:
0063     std::shared_ptr<detail::ooura_fourier_cos_detail<Real>> impl_;
0064 };
0065 
0066 
0067 }}}
0068 #endif