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.
The following data types can be used to instantiate the LinearFitConstraint
template class:
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.
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.
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.
Return number of constraint equations
Return pointer to a specific constraint equation. Should never delete the pointer.