#include <AMA.h>
Functions | |
long int | AMA_UnvLstsqr (AMA_OPTIONS *options, long int n, double *x, double *z, double *wht, long int degree, long int mlamda, double *lamda, double theta, AMA_SPLINE **spline) |
Least Squares Approximation of Univariate Data More... | |
long int AMA_UnvLstsqr | ( | AMA_OPTIONS * | options, |
long int | n, | ||
double * | x, | ||
double * | z, | ||
double * | wht, | ||
long int | degree, | ||
long int | mlamda, | ||
double * | lamda, | ||
double | theta, | ||
AMA_SPLINE ** | spline | ||
) |
Least Squares Approximation of Univariate Data
For a given set of data and weights , for , this function employs cnspla to compute the spline
that minimizes
for . In the above definition of the , for , are the coefficients of the univariate B-splines of degree which are based on the knot vector given as
where the knots must satisfy the conditions
If the knot vector is represented by its distinct knot vector
and its knot multiplicity vector
then the aforementioned conditions are
Also the first and last distinct knots must satisfy the conditions and , respectively. In this case the number of knots is .
For convenience this function does not require the definition of the order knots at the left and right hand endpoints and also accepts the knot vector
where the knots satisfy the conditions
If the knot vector is represented by its distinct knot vector
and its knot multiplicity vector
then the aforementioned conditions are
As before, the first and last distinct knots must satisfy the conditions and , respectively. In this case the number of knots is .
Additionally, the spline is subject to the bounds
where , and equals AMA_SplineInfbnd(). By default the spline is unbounded but finite bounds can be set with AMA_OptionsSetBounds().
Depending on the number and distribution of the knots relative to the independent variable data it is possible for the least squares approximation problem to have a non-unique solution. Hence, this function provides the capability of performing a minimum norm optimization subsequent to computing the least squares approximation. The minimum norm optimization computes an alternate spline by minimizing
subject to the approximation constraints
for , where and is the least squares approximation. These constraints insure the condition
that is, the minimum norm optimization does not increase the least squares error.
This function does the following:
options | [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvLstsqr(). |
n | [in] The number of data points . Must satisfy n . |
x | [in] Array of size n containing the independent variable data , for . Must be in ascending order. |
z | [in] Array of size n containing the dependent variable data , for . |
wht | [in] Array of size n containing the weights , for . Must satisfy for all . If wht = NULL, then this function uses for all . |
degree | [in] The degree . Must satisfy degree . |
mlamda | [in] The number of knots . Must satisfy mlamda . |
lamda | [in] Array of size mlamda containing the knot vector or . |
theta | [in] The penalty term weight . Must satisfy theta . |
spline | [out] Pointer to AMA_SPLINE pointer containing the least squares spline approximation. Must satisfy spline NULL. |
User Callable Function - Documented 101715