]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/math/quadrature/ooura_fourier_integrals.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / math / quadrature / ooura_fourier_integrals.hpp
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:
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>
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:
31 std::vector<std::vector<Real>> const & big_nodes() const {
32 return impl_->big_nodes();
33 }
34
35 std::vector<std::vector<Real>> const & weights_for_big_nodes() const {
36 return impl_->weights_for_big_nodes();
37 }
38
39 std::vector<std::vector<Real>> const & little_nodes() const {
40 return impl_->little_nodes();
41 }
42
43 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:
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>
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