• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Nick Thompson, 2019
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  * References:
9  * 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.
10  * http://www.kurims.kyoto-u.ac.jp/~ooura/intde.html
11  */
12 #ifndef BOOST_MATH_QUADRATURE_OOURA_FOURIER_INTEGRALS_HPP
13 #define BOOST_MATH_QUADRATURE_OOURA_FOURIER_INTEGRALS_HPP
14 #include <memory>
15 #include <boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp>
16 
17 namespace boost { namespace math { namespace quadrature {
18 
19 template<class Real>
20 class ooura_fourier_sin {
21 public:
ooura_fourier_sin(const Real relative_error_tolerance=tools::root_epsilon<Real> (),size_t levels=sizeof (Real))22     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))
23     {}
24 
25     template<class F>
integrate(F const & f,Real omega)26     std::pair<Real, Real> integrate(F const & f, Real omega) {
27         return impl_->integrate(f, omega);
28     }
29 
30     // These are just for debugging/unit tests:
big_nodes() const31     std::vector<std::vector<Real>> const & big_nodes() const {
32         return impl_->big_nodes();
33     }
34 
weights_for_big_nodes() const35     std::vector<std::vector<Real>> const & weights_for_big_nodes() const {
36         return impl_->weights_for_big_nodes();
37     }
38 
little_nodes() const39     std::vector<std::vector<Real>> const & little_nodes() const {
40         return impl_->little_nodes();
41     }
42 
weights_for_little_nodes() const43     std::vector<std::vector<Real>> const & weights_for_little_nodes() const {
44         return impl_->weights_for_little_nodes();
45     }
46 
47 private:
48     std::shared_ptr<detail::ooura_fourier_sin_detail<Real>> impl_;
49 };
50 
51 
52 template<class Real>
53 class ooura_fourier_cos {
54 public:
ooura_fourier_cos(const Real relative_error_tolerance=tools::root_epsilon<Real> (),size_t levels=sizeof (Real))55     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))
56     {}
57 
58     template<class F>
integrate(F const & f,Real omega)59     std::pair<Real, Real> integrate(F const & f, Real omega) {
60         return impl_->integrate(f, omega);
61     }
62 private:
63     std::shared_ptr<detail::ooura_fourier_cos_detail<Real>> impl_;
64 };
65 
66 
67 }}}
68 #endif
69