Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : 8 : #include "Utilities/Gsl.hpp" 9 : 10 : namespace intrp { 11 : /*! 12 : * \brief Interpolate `y_values` to `target_x` from tabulated `x_values` using a 13 : * polynomial interpolant of degree `Degree`. 14 : * 15 : * `error_in_y` is an estimate of the error of the interpolated value. Note that 16 : * at least in the tests this is a significant overestimate of the errors 17 : * (several orders of magnitude). However, this could be because in the test the 18 : * polynomial can be represented exactly when all terms are present, but incurs 19 : * significant errors when the largest degree term is omitted. 20 : */ 21 : template <size_t Degree> 22 1 : void polynomial_interpolation(gsl::not_null<double*> y, 23 : gsl::not_null<double*> error_in_y, 24 : double target_x, 25 : const gsl::span<const double>& y_values, 26 : const gsl::span<const double>& x_values); 27 : } // namespace intrp