Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  * Copyright Nick Thompson, 2020
0003  * Use, modification and distribution are subject to the
0004  * Boost Software License, Version 1.0. (See accompanying file
0005  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006  */
0007 #ifndef BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP
0008 #define BOOST_MATH_INTERPOLATORS_SEPTIC_HERMITE_HPP
0009 #include <algorithm>
0010 #include <stdexcept>
0011 #include <memory>
0012 #include <boost/math/interpolators/detail/septic_hermite_detail.hpp>
0013 
0014 namespace boost {
0015 namespace math {
0016 namespace interpolators {
0017 
0018 template<class RandomAccessContainer>
0019 class septic_hermite
0020 {
0021 public:
0022     using Real = typename RandomAccessContainer::value_type;
0023     septic_hermite(RandomAccessContainer && x, RandomAccessContainer && y, RandomAccessContainer && dydx, 
0024                    RandomAccessContainer && d2ydx2, RandomAccessContainer && d3ydx3)
0025      : impl_(std::make_shared<detail::septic_hermite_detail<RandomAccessContainer>>(std::move(x), 
0026      std::move(y), std::move(dydx), std::move(d2ydx2), std::move(d3ydx3)))
0027     {}
0028 
0029     inline Real operator()(Real x) const
0030     {
0031         return impl_->operator()(x);
0032     }
0033 
0034     inline Real prime(Real x) const
0035     {
0036         return impl_->prime(x);
0037     }
0038 
0039     inline Real double_prime(Real x) const
0040     {
0041         return impl_->double_prime(x);
0042     }
0043 
0044     friend std::ostream& operator<<(std::ostream & os, const septic_hermite & m)
0045     {
0046         os << *m.impl_;
0047         return os;
0048     }
0049 
0050     int64_t bytes() const
0051     {
0052         return impl_->bytes() + sizeof(impl_);
0053     }
0054 
0055     std::pair<Real, Real> domain() const
0056     {
0057         return impl_->domain();
0058     }
0059 
0060 private:
0061     std::shared_ptr<detail::septic_hermite_detail<RandomAccessContainer>> impl_;
0062 };
0063 
0064 template<class RandomAccessContainer>
0065 class cardinal_septic_hermite
0066 {
0067 public:
0068     using Real = typename RandomAccessContainer::value_type;
0069     cardinal_septic_hermite(RandomAccessContainer && y, RandomAccessContainer && dydx,
0070                             RandomAccessContainer && d2ydx2, RandomAccessContainer && d3ydx3, Real x0, Real dx)
0071      : impl_(std::make_shared<detail::cardinal_septic_hermite_detail<RandomAccessContainer>>(
0072      std::move(y), std::move(dydx), std::move(d2ydx2), std::move(d3ydx3), x0, dx))
0073     {}
0074 
0075     inline Real operator()(Real x) const
0076     {
0077         return impl_->operator()(x);
0078     }
0079 
0080     inline Real prime(Real x) const
0081     {
0082         return impl_->prime(x);
0083     }
0084 
0085     inline Real double_prime(Real x) const
0086     {
0087         return impl_->double_prime(x);
0088     }
0089 
0090     int64_t bytes() const
0091     {
0092         return impl_->bytes() + sizeof(impl_);
0093     }
0094 
0095     std::pair<Real, Real> domain() const
0096     {
0097         return impl_->domain();
0098     }
0099 
0100 private:
0101     std::shared_ptr<detail::cardinal_septic_hermite_detail<RandomAccessContainer>> impl_;
0102 };
0103 
0104 
0105 template<class RandomAccessContainer>
0106 class cardinal_septic_hermite_aos {
0107 public:
0108     using Point = typename RandomAccessContainer::value_type;
0109     using Real = typename Point::value_type;
0110     cardinal_septic_hermite_aos(RandomAccessContainer && data, Real x0, Real dx)
0111      : impl_(std::make_shared<detail::cardinal_septic_hermite_detail_aos<RandomAccessContainer>>(std::move(data), x0, dx))
0112     {}
0113 
0114     inline Real operator()(Real x) const
0115     {
0116         return impl_->operator()(x);
0117     }
0118 
0119     inline Real prime(Real x) const
0120     {
0121         return impl_->prime(x);
0122     }
0123 
0124     inline Real double_prime(Real x) const 
0125     {
0126         return impl_->double_prime(x);
0127     }
0128 
0129     int64_t bytes() const
0130     {
0131         return impl_.size() + sizeof(impl_);
0132     }
0133 
0134     std::pair<Real, Real> domain() const
0135     {
0136         return impl_->domain();
0137     }
0138 
0139 private:
0140     std::shared_ptr<detail::cardinal_septic_hermite_detail_aos<RandomAccessContainer>> impl_;
0141 };
0142 
0143 }
0144 }
0145 }
0146 #endif