/* * Copyright Nick Thompson, 2020 * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP #include #include #include #include namespace boost { namespace math { namespace interpolators { template class septic_hermite { public: using Real = typename RandomAccessContainer::value_type; septic_hermite(RandomAccessContainer && x, RandomAccessContainer && y, RandomAccessContainer && dydx, RandomAccessContainer && d2ydx2, RandomAccessContainer && d3ydx3) : impl_(std::make_shared>(std::move(x), std::move(y), std::move(dydx), std::move(d2ydx2), std::move(d3ydx3))) {} inline Real operator()(Real x) const { return impl_->operator()(x); } inline Real prime(Real x) const { return impl_->prime(x); } inline Real double_prime(Real x) const { return impl_->double_prime(x); } friend std::ostream& operator<<(std::ostream & os, const septic_hermite & m) { os << *m.impl_; return os; } int64_t bytes() const { return impl_->bytes() + sizeof(impl_); } std::pair domain() const { return impl_->domain(); } private: std::shared_ptr> impl_; }; template class cardinal_septic_hermite { public: using Real = typename RandomAccessContainer::value_type; cardinal_septic_hermite(RandomAccessContainer && y, RandomAccessContainer && dydx, RandomAccessContainer && d2ydx2, RandomAccessContainer && d3ydx3, Real x0, Real dx) : impl_(std::make_shared>( std::move(y), std::move(dydx), std::move(d2ydx2), std::move(d3ydx3), x0, dx)) {} inline Real operator()(Real x) const { return impl_->operator()(x); } inline Real prime(Real x) const { return impl_->prime(x); } inline Real double_prime(Real x) const { return impl_->double_prime(x); } int64_t bytes() const { return impl_->bytes() + sizeof(impl_); } std::pair domain() const { return impl_->domain(); } private: std::shared_ptr> impl_; }; template class cardinal_septic_hermite_aos { public: using Point = typename RandomAccessContainer::value_type; using Real = typename Point::value_type; cardinal_septic_hermite_aos(RandomAccessContainer && data, Real x0, Real dx) : impl_(std::make_shared>(std::move(data), x0, dx)) {} inline Real operator()(Real x) const { return impl_->operator()(x); } inline Real prime(Real x) const { return impl_->prime(x); } inline Real double_prime(Real x) const { return impl_->double_prime(x); } int64_t bytes() const { return impl_.size() + sizeof(impl_); } std::pair domain() const { return impl_->domain(); } private: std::shared_ptr> impl_; }; } } } #endif