lsst.afw  19.0.0-25-g6c8df7140+1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lsst::afw::math::detail::SmoothedSpline Class Reference

#include <Spline.h>

Inheritance diagram for lsst::afw::math::detail::SmoothedSpline:
lsst::afw::math::detail::Spline

Public Member Functions

 SmoothedSpline (std::vector< double > const &x, std::vector< double > const &y, std::vector< double > const &dy, double s, double *chisq=NULL, std::vector< double > *errs=NULL)
 Cubic spline data smoother. More...
 
void interpolate (std::vector< double > const &x, std::vector< double > &y) const
 Interpolate a Spline. More...
 
void derivative (std::vector< double > const &x, std::vector< double > &dydx) const
 Find the derivative of a Spline. More...
 
std::vector< double > roots (double const value, double const x0, double const x1) const
 Find the roots of Spline - val = 0 in the range [x0, x1). More...
 

Protected Member Functions

void _allocateSpline (int const nknot)
 Allocate the storage a Spline needs. More...
 

Protected Attributes

std::vector< double > _knots
 
std::vector< std::vector< double > > _coeffs
 

Detailed Description

Definition at line 159 of file Spline.h.

Constructor & Destructor Documentation

◆ SmoothedSpline()

lsst::afw::math::detail::SmoothedSpline::SmoothedSpline ( std::vector< double > const &  x,
std::vector< double > const &  y,
std::vector< double > const &  dy,
double  s,
double *  chisq = NULL,
std::vector< double > *  errs = NULL 
)

Cubic spline data smoother.

Algorithm 642 collected algorithms from ACM. Algorithm appeared in Acm-Trans. Math. Software, vol.12, no. 2, Jun., 1986, p. 150.

Translated from fortran by a combination of f2c and RHL.

    Author              - M.F.Hutchinson
                          CSIRO Division of Mathematics and Statistics
                          P.O. Box 1965
                          Canberra, ACT 2601
                          Australia

latest revision - 15 August 1985

Parameters
[in]xarray of length n containing the abscissae of the n data points (x(i),f(i)) i=0..n-1. x must be ordered so that x(i) < x(i+1)
[in]yvector of length >= 3 containing the ordinates (or function values) of the data points
[in]dyvector of standard deviations of y the error associated with the data point; each dy[] must be positive.
[in]sdesired chisq
[out]chisqfinal chisq (if non-NULL)
[out]errserror estimates, (if non-NULL). You'll need to delete it
Note
y,c: spline coefficients (output). y is an array of length n; c is an n-1 by 3 matrix. The value of the spline approximation at t is s(t) = c[2][i]*d^3 + c[1][i]*d^2 + c[0][i]*d + y[i] where x[i] <= t < x[i+1] and d = t - x[i].
var: error variance. If var is negative (i.e. unknown) then the smoothing parameter is determined by minimizing the generalized cross validation and an estimate of the error variance is returned. If var is non-negative (i.e. known) then the smoothing parameter is determined to minimize an estimate, which depends on var, of the true mean square error. In particular, if var is zero, then an interpolating natural cubic spline is calculated. Set var to 1 if absolute standard deviations have been provided in dy (see above).
Additional information on the fit is available in the stat array. on normal exit the values are assigned as follows: stat[0] = smoothing parameter (= rho/(rho + 1)) stat[1] = estimate of the number of degrees of freedom of the residual sum of squares; this reduces to the usual value of n-2 when a least squares regression line is calculated. stat[2] = generalized cross validation stat[3] = mean square residual stat[4] = estimate of the true mean square error at the data points stat[5] = estimate of the error variance; chi^2/nu in the case of linear regression
If stat[0]==0 (rho==0) an interpolating natural cubic spline has been calculated; if stat[0]==1 (rho==infinite) a least squares regression line has been calculated.
Returns stat[4], an estimate of the true rms error
precision/hardware - double (originally VAX double)
the number of arithmetic operations required by the subroutine is proportional to n. The subroutine uses an algorithm developed by M.F. Hutchinson and F.R. de Hoog, 'Smoothing Noisy Data with Spline Functions', Numer. Math. 47 p.99 (1985)

Definition at line 534 of file Spline.cc.

Member Function Documentation

◆ _allocateSpline()

void lsst::afw::math::detail::Spline::_allocateSpline ( int const  nknot)
protectedinherited

Allocate the storage a Spline needs.

Definition at line 21 of file Spline.cc.

◆ derivative()

void lsst::afw::math::detail::Spline::derivative ( std::vector< double > const &  x,
std::vector< double > &  dydx 
) const
inherited

Find the derivative of a Spline.

Parameters
[in]xpoints to evaluate derivative at
[out]dydxderivatives at x

Definition at line 57 of file Spline.cc.

◆ interpolate()

void lsst::afw::math::detail::Spline::interpolate ( std::vector< double > const &  x,
std::vector< double > &  y 
) const
inherited

Interpolate a Spline.

Parameters
[in]xpoints to interpolate at
[out]yvalues of spline interpolation at x

Definition at line 29 of file Spline.cc.

◆ roots()

std::vector< double > lsst::afw::math::detail::Spline::roots ( double const  value,
double const  x0,
double const  x1 
) const
inherited

Find the roots of Spline - val = 0 in the range [x0, x1).

Return a vector of all the roots found

Parameters
valuedesired value
x0,x1specify desired range is [x0,x1)

Definition at line 1226 of file Spline.cc.

Member Data Documentation

◆ _coeffs

std::vector<std::vector<double> > lsst::afw::math::detail::Spline::_coeffs
protectedinherited

Definition at line 56 of file Spline.h.

◆ _knots

std::vector<double> lsst::afw::math::detail::Spline::_knots
protectedinherited

Definition at line 55 of file Spline.h.


The documentation for this class was generated from the following files: