LinearFitConstraint.h

Classes

LinearFitConstraint -- Linear least-squares fit with known linear constraints. (full description)

template<class Type> class LinearFitConstraint : public LinearFit<Type>

Interface

Public Members
LinearFitConstraint()
virtual ~LinearFitConstraint()
Int addConstraint(const HyperPlane<Type> &function)
Int nConstraints()
const HyperPlane<Type> *constraintFunc(uInt which) const
HyperPlane<Type> *constraintFunc(uInt which)

Description

Review Status

Programs:
Tests:

Prerequisite

Etymology

A linear combination of functions is used to fit a set data points. The parameters being fitted are subjected to linear constraints. The equations solved are linear equations.

Synopsis

The following is a brief summary of the linear least-squares fit with constraint problem. See module header, Fitting.h, for a more complete description.

Given a set of N data points (measurements), (x(i), y(i)) i = 0,...,N-1, along with a set of standard deviations, sigma(i), for the data points, and M specified functions, f(j)(x) j = 0,...,M-1, we form a linear combination of the functions:

    z(i) = a(0)f(0)(x(i)) + a(1)f(1)(x(i)) + ... + a(M-1)f(M-1)(x(i)),
    
where a(j) j = 0,...,M-1 are a set of parameters to be determined.

Besides the M specified functions, we are also given a set of P linear equations (constraints) for the parameters a(i) to satisfy:

    e(0,j)a(0) + e(1,j)a(1) + ... + e(M-1,j)a(M-1) + c(j) = 0, j=0,P-1,
    
where e(i,j) are known constants. The linear least-squares fit with constraints tries to minimize chi-square
    chi-square = [(y(0)-z(0))/sigma(0)]^2 + [(y(1)-z(1))/sigma(1)]^2 + ... 
                 + [(y(N-1)-z(N-1))/sigma(N-1)]^2.
    
by adjusting parameters a(i) within the limit imposed by the constraint equations.

Motivation

Sometimes, the fitted parameters of a linear least-squares fit are related to each other through some specified equations (known constraints). This requires fit be performed under the constraints.

Template Arguments

The following data types can be used to instantiate the LinearFitConstraint template class:

  • Float
  • Double
  • Complex
  • DComplex

    Issues of Precision

    If the class is instantaited with Float, all computations are carried out in single precision. If more precise results are desired, Double should be used.

    Large Number of Unknowns or Large Number of Data Points

    If there are a large Number of unknowns or a large number of data points machine memory limit may not allow a complete in core fitting (calling fit(...) function) to be performed.

    Member Description

    LinearFitConstraint()

    virtual ~LinearFitConstraint()

    Int addConstraint(const HyperPlane<Type> &function)

    addConstraint() adds a constraint function (object) to the list of constraint functions. The function should be an instance of HyperPlane class. The function returns the number assigned to the constraint function which has just been added.

    Int nConstraints()

    Return number of constraint equations

    const HyperPlane<Type> *constraintFunc(uInt which) const
    HyperPlane<Type> *constraintFunc(uInt which)

    Return pointer to a specific constraint equation. Should never delete the pointer.