ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
|
Interpolates functions using cubic splines. Uses GSL: https://www.gnu.org/software/gsl/doc/html/interp.html. More...
Classes | |
class | Interp |
Performs interpolation using GSL (GNU Scientific Library) More... | |
Enumerations | |
enum class | Method { linear , polynomial , cspline , cspline_periodic , akima , akima_periodic , steffen } |
Method (type) of 1D Interpolation used. More... | |
Functions | |
std::vector< double > | interpolate (const std::vector< double > &x_in, const std::vector< double > &y_in, const std::vector< double > &x_out, Method method=Method::cspline) |
Performs interpolation using GSL (GNU Scientific Library) More... | |
Interpolates functions using cubic splines. Uses GSL: https://www.gnu.org/software/gsl/doc/html/interp.html.
|
strong |
Method (type) of 1D Interpolation used.
The following interpolation types are provided by GSL (see https://www.gnu.org/software/gsl/doc/html/interp.html#c.gsl_interp_type)
linear
Linear interpolation. This interpolation method does not require any additional memory.
polynomial
Polynomial interpolation. This method should only be used for interpolating small numbers of points because polynomial interpolation introduces large oscillations, even for well-behaved datasets. The number of terms in the interpolating polynomial is equal to the number of points.
cspline
Cubic spline with natural boundary conditions. The resulting curve is piecewise cubic on each interval, with matching first and second derivatives at the supplied data-points. The second derivative is chosen to be zero at the first point and last point.
cspline_periodic
Cubic spline with periodic boundary conditions. The resulting curve is piecewise cubic on each interval, with matching first and second derivatives at the supplied data-points. The derivatives at the first and last points are also matched. Note that the last point in the data must have the same y-value as the first point, otherwise the resulting periodic interpolation will have a discontinuity at the boundary.
akima
Non-rounded Akima spline with natural boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
akima_periodic
Non-rounded Akima spline with periodic boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
steffen
Steffen’s method guarantees the monotonicity of the interpolating function between the given data points. Therefore, minima and maxima can only occur exactly at the data points, and there can never be spurious oscillations between data points. The interpolated function is piecewise cubic in each interval. The resulting curve and its first derivative are guaranteed to be continuous, but the second derivative may be discontinuous.
|
inline |
Performs interpolation using GSL (GNU Scientific Library)
Takes set of points {xin, yin}, interpolates and evaluates new y values at positions defined by {x_out}; returns as vector. Just a wrapper for class Interp