Approximating cubic spline
Compute an approximating cubic spline to the points {x,y}. The boundary conditions are fixed to zero second derivative. The x values must be strictly monotonically increasing. The degree of smoothing is controlled by the parameter mu, with 0 <= mu <= 1. mu = 0 implies no smoothing (the spline is interpolating), mu = 1 implies maximal smoothing (the spline approaches a linear fit to the data).
typedef T SSpline< T >::value_type |
SSpline< T >::SSpline | ( | const MArray< T, 1 > & | x, | |
const MArray< T, 1 > & | y, | |||
const MArray< T, 1 > & | sigma, | |||
const T | mu | |||
) | [inline] |
Construct an approximating spline to the data {x,y+-sigma} with smoothing parameter mu.
Sigma are the uncertainties in the y
data. 0 <= Mu <= 1 is the smoothing paremeter, mu=0
no smoothing, mu=1
maximal smoothing.
References SSpline< T >::calculateCoefficients().
SSpline< T >::SSpline | ( | const MArray< T, 1 > & | x, | |
const MArray< T, 1 > & | y, | |||
const T | mu | |||
) | [inline] |
Construct an approximating spline to the data {x,y} with smoothing parameter mu.
All data are assumed to have the same weights. 0 <= Mu <= 1 is the smoothing paremeter, mu=0
no smoothing, mu=1
maximal smoothing.
References SSpline< T >::calculateCoefficients().
T SSpline< T >::eval | ( | const T | x | ) | const [inline] |
evaluate the spline at position x
References SSpline< T >::A, SSpline< T >::B, SSpline< T >::C, SSpline< T >::D, SSpline< T >::find_index(), and SSpline< T >::X.
Referenced by SSpline< T >::operator()().
T SSpline< T >::operator() | ( | const T | x | ) | const [inline] |
evaluate the spline at position x
References SSpline< T >::eval().
T SSpline< T >::eval | ( | const T | x, | |
T * | dfdx1, | |||
T * | dfdx2 | |||
) | const [inline] |
evaluate the spline at position x
, and return the first and second derivatives in dfdx1
and dfdx2
, respectively. either may be NULL
in which case the derivative is not evaluated.
References SSpline< T >::A, SSpline< T >::B, SSpline< T >::C, SSpline< T >::D, SSpline< T >::find_index(), and SSpline< T >::X.
void SSpline< T >::calculateCoefficients | ( | const MArray< T, 1 > & | x, | |
const MArray< T, 1 > & | y, | |||
const MArray< T, 1 > & | sigma, | |||
const T | mu | |||
) | [inline, protected] |
References SSpline< T >::A, SSpline< T >::B, SSpline< T >::C, SSpline< T >::D, SSpline< T >::quincunx(), v, and SSpline< T >::X.
Referenced by SSpline< T >::SSpline().
void SSpline< T >::quincunx | ( | MArray< T, 1 > & | u, | |
MArray< T, 1 > & | v, | |||
MArray< T, 1 > & | w, | |||
MArray< T, 1 > & | q | |||
) | [inline, protected] |
References v.
Referenced by SSpline< T >::calculateCoefficients().
int SSpline< T >::find_index | ( | const MArray< T, 1 > & | X, | |
const T | x | |||
) | const [inline, protected] |
Given an MArray X, and given a value x, returns a value j such that x is between X(j) and X(j+1). X must be monotonically increasing. j=minIndex
(X) or j=maxIndex
(X)-1 is returned if x
is out of range.
This routine uses bisection and scales as O(log2 N)
References SSpline< T >::X.
Referenced by SSpline< T >::eval().
Referenced by SSpline< T >::calculateCoefficients(), SSpline< T >::eval(), and SSpline< T >::find_index().
Referenced by SSpline< T >::calculateCoefficients(), and SSpline< T >::eval().
Referenced by SSpline< T >::calculateCoefficients(), and SSpline< T >::eval().
Referenced by SSpline< T >::calculateCoefficients(), and SSpline< T >::eval().
Referenced by SSpline< T >::calculateCoefficients(), and SSpline< T >::eval().