casacore
Public Member Functions | List of all members
casacore::LinearFitSVD< T > Class Template Reference

More...

#include <LinearFitSVD.h>

Public Member Functions

 LinearFitSVD ()
 Create a fitter: the normal way to generate a fitter object. More...
 
 LinearFitSVD (const LinearFitSVD &other)
 Copy constructor (deep copy) More...
 
LinearFitSVDoperator= (const LinearFitSVD &other)
 Assignment (deep copy) More...
 
virtual ~LinearFitSVD ()
 Destructor. More...
 
- Public Member Functions inherited from casacore::LinearFit< T >
 LinearFit ()
 Create a fitter: the normal way to generate a fitter object. More...
 
 LinearFit (const LinearFit &other)
 Copy constructor (deep copy) More...
 
LinearFitoperator= (const LinearFit &other)
 Assignment (deep copy) More...
 
virtual ~LinearFit ()
 Destructor. More...
 
- Public Member Functions inherited from casacore::GenericL2Fit< T >
 GenericL2Fit ()
 Create a fitter: the normal way to generate a fitter object. More...
 
 GenericL2Fit (const GenericL2Fit &other)
 Copy constructor (deep copy) More...
 
GenericL2Fitoperator= (const GenericL2Fit &other)
 Assignment (deep copy) More...
 
virtual ~GenericL2Fit ()
 Destructor. More...
 
template<class U >
void setFunction (const Function< U, U > &function)
 Sets the function to be fitted. More...
 
template<class U >
Bool setConstraint (const uInt n, const Function< U, U > &function, const Vector< typename FunctionTraits< T >::BaseType > &x, const typename FunctionTraits< T >::BaseType y=typename FunctionTraits< T >::BaseType(0))
 Set the possible constraint functions. More...
 
Bool setConstraint (const uInt n, const Vector< typename FunctionTraits< T >::BaseType > &x, const typename FunctionTraits< T >::BaseType y=typename FunctionTraits< T >::BaseType(0))
 
Bool setConstraint (const uInt n, const typename FunctionTraits< T >::BaseType y=typename FunctionTraits< T >::BaseType(0))
 
Bool addConstraint (const Function< typename FunctionTraits< T >::DiffType, typename FunctionTraits< T >::DiffType > &function, const Vector< typename FunctionTraits< T >::BaseType > &x, const typename FunctionTraits< T >::BaseType y=typename FunctionTraits< T >::BaseType(0))
 
Bool addConstraint (const Vector< typename FunctionTraits< T >::BaseType > &x, const typename FunctionTraits< T >::BaseType y=typename FunctionTraits< T >::BaseType(0))
 
Bool addConstraint (const typename FunctionTraits< T >::BaseType y=typename FunctionTraits< T >::BaseType(0))
 
void setCollinearity (const Double cln)
 Set the collinearity factor as the square of the sine of the minimum angle allowed between input vectors (default zero for non-SVD, 1e-8 for SVD) More...
 
void asWeight (const Bool aswgt)
 Set sigma values to be interpreted as weight (i.e. More...
 
void asSVD (const Bool svd)
 Set the use of SVD or not (default). More...
 
Function< typename FunctionTraits< T >::DiffType, typename FunctionTraits< T >::DiffType > * fittedFunction ()
 Return a pointer to the function being fitted. More...
 
const Function< typename FunctionTraits< T >::DiffType, typename FunctionTraits< T >::DiffType > * fittedFunction () const
 
uInt fittedNumber () const
 Return the number of fitted parameters. More...
 
uInt NConstraints ()
 Return the number of constraints, and pointers to constraint functions. More...
 
Function< typename FunctionTraits< T >::DiffType, typename FunctionTraits< T >::DiffType > * getConstraint (const uInt n)
 
Vector< typename LSQTraits< typename FunctionTraits< T >::BaseType >::base > getSVDConstraint (uInt n)
 Return the nth constraint equation derived from SVD Note that the number present will be given by getDeficiency() More...
 
void setParameterValues (const Vector< typename FunctionTraits< T >::BaseType > &parms)
 Set the parameter values. More...
 
void setMaskedParameterValues (const Vector< typename FunctionTraits< T >::BaseType > &parms)
 
Vector< typename FunctionTraits< T >::BaseType > fit (const Vector< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > &sigma, const Vector< Bool > *const mask=0)
 Fit the function to the data. More...
 
Vector< typename FunctionTraits< T >::BaseType > fit (const Matrix< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > &sigma, const Vector< Bool > *const mask=0)
 
Vector< typename FunctionTraits< T >::BaseType > fit (const Vector< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< Bool > *const mask=0)
 
Vector< typename FunctionTraits< T >::BaseType > fit (const Matrix< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< Bool > *const mask=0)
 
Vector< typename FunctionTraits< T >::BaseType > fit (const Vector< Bool > *const mask=0)
 
Bool fit (Vector< typename FunctionTraits< T >::BaseType > &sol, const Vector< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > &sigma, const Vector< Bool > *const mask=0)
 
Bool fit (Vector< typename FunctionTraits< T >::BaseType > &sol, const Matrix< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > &sigma, const Vector< Bool > *const mask=0)
 
Bool fit (Vector< typename FunctionTraits< T >::BaseType > &sol, const Vector< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const typename FunctionTraits< T >::BaseType &sigma, const Vector< Bool > *const mask=0)
 
Bool fit (Vector< typename FunctionTraits< T >::BaseType > &sol, const Matrix< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const typename FunctionTraits< T >::BaseType &sigma, const Vector< Bool > *const mask=0)
 
Bool fit (Vector< typename FunctionTraits< T >::BaseType > &sol, const Vector< Bool > *const mask=0)
 
Double chiSquare () const
 Obtain the chi squared. More...
 
const Vector< typename FunctionTraits< T >::BaseType > & errors () const
 Get the errors on the solved values. More...
 
Bool errors (Vector< typename FunctionTraits< T >::BaseType > &err) const
 
Matrix< DoublecompuCovariance ()
 Get covariance matrix. More...
 
void compuCovariance (Matrix< Double > &cov)
 
void buildNormalMatrix (const Vector< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > &sigma, const Vector< Bool > *const mask=0)
 Generate the normal equations by one or more calls to the buildNormalMatrix(), before calling a fit() without arguments. More...
 
void buildNormalMatrix (const Matrix< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > &sigma, const Vector< Bool > *const mask=0)
 
void buildNormalMatrix (const Vector< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< Bool > *const mask=0)
 
void buildNormalMatrix (const Matrix< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< Bool > *const mask=0)
 
Bool residual (Vector< typename FunctionTraits< T >::BaseType > &y, const Array< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &sol, const Bool model=False)
 Return the residual after a fit in y. More...
 
Bool residual (Vector< typename FunctionTraits< T >::BaseType > &y, const Array< typename FunctionTraits< T >::BaseType > &x, const Bool model=False)
 
uInt getRank () const
 Get the rank of the solution (or zero of no fit() done yet). More...
 

Additional Inherited Members

- Public Attributes inherited from casacore::GenericL2Fit< T >
const Double COLLINEARITY
 Default collinearity test for SVD. More...
 
- Protected Member Functions inherited from casacore::LinearFit< T >
virtual Bool fitIt (Vector< typename FunctionTraits< T >::BaseType > &sol, const Array< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > *const sigma, const Vector< Bool > *const mask=0)
 Generalised fitter. More...
 
- Protected Member Functions inherited from casacore::GenericL2Fit< T >
void buildMatrix (const Array< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > *const sigma, const Vector< Bool > *const mask=0)
 Build the normal matrix. More...
 
void buildConstraint ()
 Build the constraint equations. More...
 
void fillSVDConstraints ()
 Get the SVD constraints. More...
 
Bool buildResidual (Vector< typename FunctionTraits< T >::BaseType > &y, const Array< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > *const sol, const Bool model=False)
 Calculate residuals. More...
 
FunctionTraits< T >::BaseType getVal_p (const Array< typename FunctionTraits< T >::BaseType > &x, uInt j, uInt i) const
 Function to get evaluated functional value. More...
 
void initfit_p (uInt parcnt)
 Initialise the fitter with number of solvable parameters. More...
 
uInt testInput_p (const Array< typename FunctionTraits< T >::BaseType > &x, const Vector< typename FunctionTraits< T >::BaseType > &y, const Vector< typename FunctionTraits< T >::BaseType > *const sigma)
 Return number of condition equations and check sizes x, y, sigma. More...
 
void resetFunction ()
 Reset all the input. More...
 
- Protected Attributes inherited from casacore::GenericL2Fit< T >
uInt aCount_ai
 Adjustable. More...
 
Bool svd_p
 SVD indicator. More...
 
Function< typename FunctionTraits< T >::DiffType, typename FunctionTraits< T >::DiffType > * ptr_derive_p
 Function to use in evaluating condition equation. More...
 
PtrBlock< Function< typename FunctionTraits< T >::DiffType, typename FunctionTraits< T >::DiffType > * > constrFun_p
 List of functions describing the possible constraint equations e.g. More...
 
PtrBlock< Vector< typename FunctionTraits< T >::BaseType > * > constrArg_p
 List of vectors describing the constraint equations' arguments. More...
 
PtrBlock< typename FunctionTraits< T >::BaseType * > constrVal_p
 List of values describing the constraint equations' value. More...
 
uInt pCount_p
 Number of available parameters. More...
 
uInt ndim_p
 Number of dimensions of input data. More...
 
Bool needInit_p
 No normal equations yet. More...
 
Bool solved_p
 Have solution. More...
 
Bool errors_p
 Have errors. More...
 
Bool ferrors_p
 
Bool asweight_p
 Interpret as weights rather than as sigma the given values. More...
 
uInt nr_p
 The rank of the solution. More...
 
Vector< typename FunctionTraits< T >::BaseType > condEq_p
 Condition equation parameters (for number of adjustable parameters) More...
 
Vector< typename FunctionTraits< T >::BaseType > fullEq_p
 Equation for all available parameters. More...
 
Vector< typename FunctionTraits< T >::ArgType > arg_p
 Contiguous argument areas. More...
 
Vector< typename FunctionTraits< T >::ArgType > carg_p
 
Vector< typename FunctionTraits< T >::BaseType > sol_p
 Local solution area. More...
 
Vector< typename FunctionTraits< T >::BaseType > fsol_p
 
Vector< typename FunctionTraits< T >::BaseType > err_p
 Local error area. More...
 
Vector< typename FunctionTraits< T >::BaseType > ferr_p
 
FunctionTraits< T >::DiffType valder_p
 Local value and derivatives. More...
 
Vector< Vector< typename LSQTraits< typename FunctionTraits< T >::BaseType >::base > > consvd_p
 Local SVD constraints. More...
 

Detailed Description

template<class T>
class casacore::LinearFitSVD< T >


Linear least-squares fit using Singular Value Decomposition method.

Review Status

Reviewed By:
wbrouw
Date Reviewed:
2004/06/15
Test programs:
tLinearFitSVD

Prerequisite

Etymology

Solves the linear least-squares fit problem using the singular value decomposition method.

Synopsis

The operation, calls and results are identical to those for the LinearFit class. The only difference is a collinearity default of 1e-8 rather than 0. The actual calculations do a singular value decomposition solution. A method exists to get the constraints used in solving for missing rank.

Motivation

The creation of this class was driven by the need to provide users with a reliable least-squares fit method. "Numerical Recipes" recommends that singular value decomposition (SVD) method be always used for linear least-squares problems, because of its robustness. Not everybody agrees with this.

Definition at line 72 of file LinearFitSVD.h.

Constructor & Destructor Documentation

◆ LinearFitSVD() [1/2]

template<class T >
casacore::LinearFitSVD< T >::LinearFitSVD ( )

Create a fitter: the normal way to generate a fitter object.

Necessary data will be deduced from the Functional provided with setFunction()

◆ LinearFitSVD() [2/2]

template<class T >
casacore::LinearFitSVD< T >::LinearFitSVD ( const LinearFitSVD< T > &  other)

Copy constructor (deep copy)

◆ ~LinearFitSVD()

template<class T >
virtual casacore::LinearFitSVD< T >::~LinearFitSVD ( )
virtual

Destructor.

Member Function Documentation

◆ operator=()

template<class T >
LinearFitSVD& casacore::LinearFitSVD< T >::operator= ( const LinearFitSVD< T > &  other)

Assignment (deep copy)


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