template<class T>
class gnsstk::CubicSpline< T >
Cubic spline interpolation.
*&;/
Definition at line 56 of file CubicSpline.hpp.
#include <CubicSpline.hpp>
|
T | fd1 |
| Values of the derivative dy/dx at the first and last data points. More...
|
|
T | fdN |
|
int | N |
| size of the arrays X,Y,S More...
|
|
std::vector< T > | S |
|
std::vector< T > | X |
| Data arrays. More...
|
|
std::vector< T > | Y |
|
◆ CubicSpline() [1/2]
◆ CubicSpline() [2/2]
Constructor given vectors of data X(N) Y(N); calls initialize(X,Y).
- Exceptions
-
Definition at line 65 of file CubicSpline.hpp.
◆ build()
initialize array of second derivatives with the values of the data x(N) and y(N). If the first derivative at the end points has been fixed, the input boolean is true. Called by all versions of initialize().
- Parameters
-
x | Vector of data for independent variable, must parallel y, and must be strictly increasing. |
y | Vector of data for dependent variable, must parallel x. |
fixEnds | if true, initial and final values of derivative dy/dx have been set using member data fd1 and fdN. |
- Exceptions
-
Exception | if input is invalid: arrays are empty or x not strictly increasing. |
Definition at line 253 of file CubicSpline.hpp.
◆ evaluate() [1/2]
Compute interpolated values of y at a vector of x's; cf. Evalute(x).
- Parameters
-
x | vector of values of independent variable X at which to evaluate. |
- Returns
- y output vector of interpolated values parallel to x.
- Exceptions
-
Definition at line 185 of file CubicSpline.hpp.
◆ evaluate() [2/2]
Compute the value of y at the given x, using interpolation by cubic spline. The object must have been initialized before this call, either by using the constructor CubicSpline(X,Y) or by calling initialize() with the data arrays X and Y.
- Parameters
-
x | value of independent variable X at which to evaluate spline. |
- Returns
- y(x) the interpolated value
- Exceptions
-
Definition at line 140 of file CubicSpline.hpp.
◆ initialize() [1/2]
Initialize array of second derivatives, which is used by Interpolate(). Called by constructor. If the arrays are shorter than 4 points, then linear interpolation is used. Do not fix derivatives at end points; if this is desired, call initialize(X,Y,deriv1,derivN).
- Parameters
-
X | Vector of data for independent variable, must parallel Y |
Y | Vector of data for dependent variable, must parallel X |
- Exceptions
-
Definition at line 78 of file CubicSpline.hpp.
◆ initialize() [2/2]
Initialize array of second derivatives with the values of the derivative at the first and last points set by input. Cf. initialize(X,Y);
- Parameters
-
X | Vector of data for independent variable, must parallel Y |
Y | Vector of data for dependent variable, must parallel X |
DYDX1 | Initial value of derivative dy/dx |
DYDXN | Final value of derivative dy/dx |
- Exceptions
-
Definition at line 92 of file CubicSpline.hpp.
◆ interpolate()
Given an index k into the array S, and a value x such that X[k-1] < x < X[k], find the interpolated value y at x.
Definition at line 354 of file CubicSpline.hpp.
◆ size()
Return the current size of the second derivative array.
Definition at line 238 of file CubicSpline.hpp.
◆ testLimits()
Determine if the given value of x is within the range of the data used to initialize the object; if it is not, return the value of Y which is closest to x (either Y[0] or Y[N-1]).
- Parameters
-
x | value of independent variable X at which to test limits |
y | return value of data Y at endpoint closest to x |
- Returns
- true if x lies within the range of the data.
- Exceptions
-
Definition at line 109 of file CubicSpline.hpp.
◆ fd1
Values of the derivative dy/dx at the first and last data points.
Definition at line 372 of file CubicSpline.hpp.
◆ fdN
The documentation for this class was generated from the following file: