Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:41:22

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 #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_HPP
0008 #define BOOST_MATH_INTERPOLATORS_CARDINAL_QUADRATIC_B_SPLINE_HPP
0009 #include <memory>
0010 #include <boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp>
0011 
0012 
0013 namespace boost{ namespace math{ namespace interpolators {
0014 
0015 template <class Real>
0016 class cardinal_quadratic_b_spline
0017 {
0018 public:
0019     // If you don't know the value of the derivative at the endpoints, leave them as nans and the routine will estimate them.
0020     // y[0] = y(a), y[n - 1] = y(b), step_size = (b - a)/(n -1).
0021     cardinal_quadratic_b_spline(const Real* const y,
0022                                 size_t n,
0023                                 Real t0 /* initial time, left endpoint */,
0024                                 Real h  /*spacing, stepsize*/,
0025                                 Real left_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN(),
0026                                 Real right_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN())
0027      : impl_(std::make_shared<detail::cardinal_quadratic_b_spline_detail<Real>>(y, n, t0, h, left_endpoint_derivative, right_endpoint_derivative))
0028     {}
0029 
0030     // Oh the bizarre error messages if we template this on a RandomAccessContainer:
0031     cardinal_quadratic_b_spline(std::vector<Real> const & y,
0032                                 Real t0 /* initial time, left endpoint */,
0033                                 Real h  /*spacing, stepsize*/,
0034                                 Real left_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN(),
0035                                 Real right_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN())
0036      : impl_(std::make_shared<detail::cardinal_quadratic_b_spline_detail<Real>>(y.data(), y.size(), t0, h, left_endpoint_derivative, right_endpoint_derivative))
0037     {}
0038 
0039 
0040     Real operator()(Real t) const {
0041         return impl_->operator()(t);
0042     }
0043 
0044     Real prime(Real t) const {
0045        return impl_->prime(t);
0046     }
0047 
0048     Real t_max() const {
0049         return impl_->t_max();
0050     }
0051 
0052 private:
0053     std::shared_ptr<detail::cardinal_quadratic_b_spline_detail<Real>> impl_;
0054 };
0055 
0056 }}}
0057 #endif