#include <AMA.h>
Functions | |
long int | AMA_MltvLstsqr (AMA_OPTIONS *options, long int nind, 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 Multivariate Data More... | |
long int AMA_MltvLstsqr | ( | AMA_OPTIONS * | options, |
long int | nind, | ||
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 Multivariate Data
This function employs cnspla to compute a least squares spline approximation of independent variable data and dependent variable data . For a given set of independent variable data , dependent variable data and weights , for , this function computes the spline
that minimizes
for . The function imposes a penalty term on the least squares approximation.
In the above definition of the , for and , are the coefficients of the tensor product B-splines
where are the univariate B-splines of degree defined by the knot vector . The knot vector is 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 given as
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 .
The function is used to impose a penalty term on the least squares approximation and is defined as
where . The cross partial terms can be excluded from the penalty term with AMA_OptionsSetPenaltyTerm().
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:
Parameter Note: In the parameter definitions given below the limits on are and k = .
options | [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_MltvLstsqr(). |
nind | [in] The number of independent variables . Must satisfy nind AMA_MXNIND. |
n | [in] The number of data points . Must satisfy n . |
x | [in] Array of size nind containing arrays of size n where x[k] contains the independent variable data , for . |
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] Array of size nind containing the degree where degree[k] . Must satisfy degree[k] . |
mlamda | [in] Array of size nind containing the number of knots where mlamda[k] . Must satisfy mlamda[k] . |
lamda | [in] Array of size nind containing arrays of size mlamda[k] where lamda[k] contains 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