#include <AMA.h>
Functions  
long int  AMA_MltvBoundaryConditions (AMA_OPTIONS *options, enum AMA_Boolean interp, CNSPLA_SPLFUN *splfun) 
Define boundary conditions for multivariate approximation and interpolation functions. More...  
long int  AMA_MltvData (AMA_OPTIONS *options, const char *datfile, long int *nind, long int *degree, long int *n, double ***x, double **z, double **epsilon, double **wht, double *theta, long int *mlamda, double ***lamda) 
Read data and approximation options for AMA Spline Library Multivariate Random Data Functions. More...  
long int  AMA_MltvDataFree (AMA_OPTIONS *options, long int nind, double ***x, double **z, double **epsilon, double **wht, double ***lamda) 
Free Multivariate Data Functions data arrays. More...  
long int  AMA_MltvGrdData (AMA_OPTIONS *options, const char *datfile, long int *nind, long int *degree, long int *ng, double ***x, double **z, double **epsilon, double **wht, double *theta, long int *mlamda, double ***lamda) 
Read data and approximation options for AMA Spline Library Multivariate Gridded Data Functions. More...  
long int  AMA_MltvGrdInputCheck (AMA_OPTIONS *options, long int nind, long int *ng, double **x, double *z, double *wht, double *epsilon, long int *degree, long int *mlamda, double **lamda, enum AMA_Boolean lstsqr, enum AMA_Boolean *mltknt) 
Perform input check for multivariate gridded data. More...  
long int  AMA_MltvInputCheck (AMA_OPTIONS *options, long int nind, long int n, double **x, double *z, double *wht, double *epsilon, long int *degree, long int *mlamda, double **lamda, enum AMA_Boolean lstsqr) 
Perform input check for multivariate data approximation functions. More...  
long int  AMA_MltvPnltrm (AMA_OPTIONS *options, double theta, long int porder, CNSPLA_SPLFUN *splfun) 
Define penalty term on a multivariate spline. More...  
long int  AMA_MltvConpnt (AMA_OPTIONS *options, long int nind, long int n, double **x, double *z, double *epsilon, CNSPLA_SPLFUN *splfun) 
Define approximation or interpolation constraints on a multivariate spline. More...  
long int  AMA_MltvConreg (AMA_OPTIONS *options, long int nind, long int n, double **x, double *z, double *epsilon, long int *degree, CNSPLA_SPLFUN *splfun) 
Define monotonicity constraints on a multivariate spline. More...  
long int AMA_MltvBoundaryConditions  (  AMA_OPTIONS *  options, 
enum AMA_Boolean  interp,  
CNSPLA_SPLFUN *  splfun  
) 
Define boundary conditions for multivariate approximation and interpolation functions.
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_MltvBoundaryConditions(). 
interp  [in] Interpolation function flag. It has one of the following two values:

splfun  [in] Pointer to CNSPLA_SPLFUN containing the spline upon which the penalty term is imposed. Should satisfy splfun NULL. 
User Support Function  Documented nnnnnn  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvConpnt  (  AMA_OPTIONS *  options, 
long int  nind,  
long int  n,  
double **  x,  
double *  z,  
double *  epsilon,  
CNSPLA_SPLFUN *  splfun  
) 
Define approximation or interpolation constraints on a multivariate spline.
For a given set of independent variable data , dependent variable data and approximation tolerances , for , this function defines either the approximation constraints
or the interpolation constraints
for , on a multivariate spline given as
Parameter Note: In the parameter definitions given below the limits on are and k = .
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_MltvConpnt(). 
nind  [in] The number of independent variables . Should satisfy nind . 
n  [in] The number of data points . Should 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 . 
epsilon  [in] Array of size n containing the approximation tolerances , for . Should satisfy for all . If epsilon = NULL, then the interpolation constraints are defined. Otherwise, the approximation constraints are defined. 
splfun  [in] Pointer to CNSPLA_SPLFUN containing spline upon which approximation or interpolation constraints are imposed. Should satisfy splfun NULL. 
User Support Function  Documented 110914  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvConreg  (  AMA_OPTIONS *  options, 
long int  nind,  
long int  n,  
double **  x,  
double *  z,  
double *  epsilon,  
long int *  degree,  
CNSPLA_SPLFUN *  splfun  
) 
Define monotonicity constraints on a multivariate spline.
For a given set of independent variable data , dependent variable data and approximation tolerances , for , this function defines local monotonicity constraints on a multivariate spline given as
This function first defines the rectilinear grid upon which the independent variable data lies and then it defines the gridded dependent variable data and the gridded approximation tolerances for and . If the independent variable data defines a gridded data distribution, then . If it defines a gridded data with holes distribution, then ; that is, dependent variable data does not lie everywhere on the grid. In the latter case the local monotonicity constraints are not defined in regions of missing data.
After determining the data's underlying rectilinear grid this function imposes constraints on the first order partials , for all , which insure the spline satisfies the local monotonicity constraints. The form of the constraints depends on the approximation tolerances.
If , then for some a local monotonicity constraint is defined for all with and it is of the form
The above constraint is defined for all . The notation and refers to the dependent variable data associated with the grid points and , respectively. If data does not lie at both grid points, then the constraint is not defined.
Alternatively, if there exists an for which , then for some a local monotonicity constraint is defined for all with and it is of the form
The above constraint is defined for all . The notation and refers to the approximation tolerances associated with the grid points and , respectively. If data does not lie at both grid points, then the constraint is not defined.
If for some the above conditions are not met, then the intervals and intersect and the equality constraint
can be imposed over the interval . However, it is possible for the intervals and to intersect, for each and ; without an intersection existing between all the intervals. In this case the aforementioned equality constraint is inconsistent with the approximation constraints
for ; and, therefore, can not be imposed over the interval . Hence, instead of imposing an equality constraint this function minimizes
over all intervals for which the intervals and intersect.
Parameter Note: In the parameter definitions given below the limits on are and k = .
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_MltvConreg(). 
nind  [in] The number of independent variables . Should satisfy nind . 
n  [in] The number of data points . Should 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 . 
epsilon  [in] Array of size n containing the approximation tolerances , for . Should satisfy for all . If epsilon = NULL, then this function uses for all . 
degree  [in] Array of size nind containing the degree where degree[k] . Should satisfy degree[k] . 
splfun  [in] Pointer to CNSPLA_SPLFUN containing spline upon which monotonicity constraints are imposed. Should satisfy splfun NULL. 
User Support Function  Documented 121114  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvData  (  AMA_OPTIONS *  options, 
const char *  datfile,  
long int *  nind,  
long int *  degree,  
long int *  n,  
double ***  x,  
double **  z,  
double **  epsilon,  
double **  wht,  
double *  theta,  
long int *  mlamda,  
double ***  lamda  
) 
Read data and approximation options for AMA Spline Library Multivariate Random Data Functions.
This function reads data and approximation options for AMA Spline Library functions which compute spline approximations of independent variable data and dependent variable data .
The argument datfile should reference a readable file which consists of a data section and several, optional, approximation options sections. The Data section must preceed the approximation options sections and has the following structure:
where the Epsilon and Wht columns are optional. The data must satisfy the following conditions:
Following the Data section may be one or more of the Bounds, Least_Squares, Monotonicity or Penalty_Term sections. If an approximation options section is not defined, then this function sets the options to their default values. See Table Approximation Options Defaults for a list of Multivariate Random Data Functions approximation options default values.
The Bounds section specifies the lower and upper bounds. It has the following structure:
and its options must satisfy the following conditions:
The lower bound is read as a string lwrstr and based on the value of lwrstr the value of is set as follows:
Similarly, the upper bound is read as a string uprstr and based on the value of uprstr the value of is set as follows:
The Least_Squares section specifies the approximation options and knots employed by AMA_MltvLstsqr(). It has the following structure:
and its options must satisfy the following conditions:
The Monotonicity section specifies the monotonicity constraints and continuity conditions employed by AMA_MltvMonoApprox() and AMA_MltvMonoInterp(). It has the the following structure:
and its options must satisfy the following conditions:
The Penalty_Term section specifies which cross partial terms are used in the penalty term. It has the following structure:
and its options must satisfy the following condition:
The bold keywords are case sensitive and the string values for the approximation options are case insensitive.
This function performs the following tasks:
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_MltvData(). 
datfile  [in] The data file name. Must satisfy datfile NULL. 
nind  [out] The number of independent variables . Must satisfy nind NULL. 
degree  [out] Array of size nind containing the degree where degree[k] . Must satisfy degree NULL. 
n  [out] The number of data points . Must satisfy n NULL. 
x  [out] Array of size nind containing arrays of size n where x[k] contains the independent variable data , for . Must satisfy x NULL. 
z  [out] Array of size n containing the dependent variable data , for . Must satisfy z NULL. 
epsilon  [out] Array of size n containing the approximation tolerances , for . Must satisfy epsilon NULL. 
wht  [out] Array of size n containing the weights , for . Must satisfy wht NULL. 
theta  [out] The penalty term weight . Must satisfy theta NULL. 
mlamda  [out] Array of size nind containing the number of knots where mlamda[k] . Must satisfy mlamda NULL. 
lamda  [out] Array of size nind containing arrays of size mlamda[k] where lamda[k] contains the knots , for . Must satisfy lambda NULL. 
User Support Function  Documented 110315  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvDataFree  (  AMA_OPTIONS *  options, 
long int  nind,  
double ***  x,  
double **  z,  
double **  epsilon,  
double **  wht,  
double ***  lamda  
) 
Free Multivariate Data Functions data arrays.
This function frees the arrays allocated by AMA_MltvData() and AMA_MltvGrdData().
options  [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_MltvDataFree(). 
nind  [out] The number of independent variables . Must satisfy nind . 
x  [out] Pointer to array of size nind containing the independent variable data arrays. 
z  [out] Pointer to array containing the dependent variable data. 
epsilon  [out] Pointer to array containing the approximation tolerances. 
wht  [out] Pointer to array containing the weights. 
lamda  [out] Pointer to array of size nind containing the knot arrays. 
User Support Function  Documented 110515  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvGrdData  (  AMA_OPTIONS *  options, 
const char *  datfile,  
long int *  nind,  
long int *  degree,  
long int *  ng,  
double ***  x,  
double **  z,  
double **  epsilon,  
double **  wht,  
double *  theta,  
long int *  mlamda,  
double ***  lamda  
) 
Read data and approximation options for AMA Spline Library Multivariate Gridded Data Functions.
This function reads data for AMA Spline Library functions which compute spline approximations of independent variable data and dependent variable data . The independent variable data defines the rectilinear grid
where and . The dependent variable data lies on the grid and is given as for ; that is, there are dependent variable values. Similarly, the approximation tolerances for lie on the grid.
The argument datfile should reference a readable file which consists of a data section and several, optional, approximation options sections. The Data section must preceed the approximation options sections and has the following structure:
where the Epsilon and Wht columns are optional. The data must satisfy the following conditions:
Following the Data section may be one or more of the Bounds, Least_Squares or Monotonicity sections. If an approximation options section is not defined, then this function sets the options to their default values. See Table Approximation Options Defaults for a list of Multivariate Gridded Data Functions approximation options default values.
The Bounds section specifies the lower and upper bounds employed by AMA_MltvGrdLstsqr(). It has the following structure:
and its options must satisfy the following conditions:
The lower bound is read as a string lwrstr and based on the value of lwrstr the value of is set as follows:
Similarly, the upper bound is read as a string uprstr and based on the value of uprstr the value of is set as follows:
The Least_Squares section specifies the approximation options and knots employed by AMA_MltvGrdLstsqr(). It has the following structure:
and its options must satisfy the following conditions:
The Monotonicity section specifies the monotonicity constraints and continuity conditions employed by AMA_MltvGrdMonoApprox() and AMA_MltvGrdMonoInterp(). It has the the following structure:
and its options must satisfy the following conditions:
The bold keywords are case sensitive and the string values for the approximation options are case insensitive.
This function performs the following tasks:
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_MltvGrdData(). 
datfile  [in] The data file name. Must satisfy datfile NULL. 
nind  [out] The number of independent variables . Must satisfy nind NULL. 
degree  [out] Array of size nind containing the degree where degree[k] . Must satisfy degree NULL. 
ng  [out] Array of size nind containing the number of points where ng[k] . Must satisfy ng NULL. 
x  [out] Array of size nind containing arrays of size ng[k] where x[k] contains the independent variable data , . Must satisfy x NULL. 
z  [out] Array of size containing the dependent variable data , for . Must satisfy z NULL. 
epsilon  [out] Array of size containing the approximation tolerances , for . Must satisfy epsilon NULL. 
wht  [out] Array of size containing the weights , for . Must satisfy wht NULL. 
theta  [out] The penalty term weight . Must satisfy theta NULL. 
mlamda  [out] Array of size nind containing the number of knots where mlamda[k] . Must satisfy mlamda NULL. 
lamda  [out] Array of size nind containing arrays of size mlamda[k] where lamda[k] contains the knots , for . Must satisfy lamda NULL. 
User Support Function  Documented 110315  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvGrdInputCheck  (  AMA_OPTIONS *  options, 
long int  nind,  
long int *  ng,  
double **  x,  
double *  z,  
double *  wht,  
double *  epsilon,  
long int *  degree,  
long int *  mlamda,  
double **  lamda,  
enum AMA_Boolean  lstsqr,  
enum AMA_Boolean *  mltknt  
) 
Perform input check for multivariate gridded data.
This function checks the input parameters for the Multivariate Gridded Data Functions which compute the spline
of degree which is based on the knot vectors , for .
Along with the degree the Multivariate Gridded Data Functions require the independent variable data , for and , which defines the rectilinear grid
and either the weights or the approximation tolerances , for . There are a total of N points. Also, for least squares approximation functions the knot vectors , for , are required. This function insures the following conditions are satisfied:
Also, if lstsqr equals AMA_Boolean_True and the knot vector is represented by its distinct knot vector
and its knot multiplicity vector
then, for all , this function insures either the conditions
or
are satisfied. It also insures the first and last distinct knots satisfy the conditions and , respectively.
Parameter Note: In the parameter definitions given below the limits on are , k = and N .
options  [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_MltvGrdInputCheck(). 
nind  [in] The number of independent variables . Must satisfy nind . 
ng  [in] Array of size nind containing the number of points where ng[k] . Must satisfy ng NULL and ng[k] . 
x  [in] Array of size nind containing arrays of size ng[k] where x[k] contains the independent variable data , for . Must satisfy x NULL and x[k] NULL. Also, x[k] must be in ascending order. 
z  [in] Array of size N containing the dependent variable data , for . Must satisfy z NULL. 
wht  [in] Array of size N containing the weights , for . If wht NULL, then must satisfy for all . 
epsilon  [in] Array of size N containing the approximation tolerances , for . If epsilon NULL, then must satisfy for all . 
degree  [in] Array of size nind containing the degree where degree[k] . Must satisfy degree NULL and degree[k] . 
mlamda  [in] Array of size nind containing the number of knots where mlamda[k] . If lstsqr AMA_Boolean_True, then must satisfy mlamda NULL and mlamda[k] . 
lamda  [in] Array of size nind containing arrays of size mlamda[k] where lamda[k] contains the knot vector . If lstsqr equals AMA_Boolean_True, then must satisfy lamda NULL and lamda[k] NULL. Also, lamda[k] must be a valid knot vector. 
lstsqr  [in] Least squares approximation flag. If it equals AMA_Boolean_True, then this function is being called by a least squares approximation function. 
mltknt  [out] Array of size nind containing the multiple knot flag. Defined only if lstsqr equals AMA_Boolean_True. It has one of the following two values:

User Support Function  Documented 021116  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvInputCheck  (  AMA_OPTIONS *  options, 
long int  nind,  
long int  n,  
double **  x,  
double *  z,  
double *  wht,  
double *  epsilon,  
long int *  degree,  
long int *  mlamda,  
double **  lamda,  
enum AMA_Boolean  lstsqr  
) 
Perform input check for multivariate data approximation functions.
This function checks the input parameters for the Multivariate Random Data Functions which compute the spline
of degree which is based on the knot vectors , for . Along with the degree the Multivariate Random Data Functions require the independent variable data data , for , and either the weights or the approximation tolerances , for . Also, for least squares approximation functions the knot vectors , for , are required. This function insures the following conditions are satisfied:
Also, if lstsqr equals AMA_Boolean_True and the knot vector is represented by its distinct knot vector
and its knot multiplicity vector
then, for all , this function insures either the conditions
or
are satisfied. It also insures the first and last distinct knots satisfy the conditions and , respectively.
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_MltvInputCheck(). 
nind  [in] The number of independent variables . Must satisfy nind . 
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 . Must satisfy x NULL and x[k] NULL. Also, x[k] must be in ascending order. 
z  [in] Array of size n containing the dependent variable data , for . Must satisfy z NULL. 
wht  [in] Array of size n containing the weights , for . If wht NULL, then must satisfy for all . 
epsilon  [in] Array of size n containing the approximation tolerances , for . If epsilon NULL, then must satisfy for all . 
degree  [in] Array of size nind containing the degree where degree[k] . Must satisfy degree NULL and degree[k] . 
mlamda  [in] Array of size nind containing the number of knots where mlamda[k] . If lstsqr AMA_Boolean_True, then must satisfy mlamda NULL and mlamda[k] . 
lamda  [in] Array of size nind containing arrays of size mlamda[k] where lamda[k] contains the knot vector . If lstsqr equals AMA_Boolean_True, then must satisfy lamda NULL and lamda[k] NULL. Also, lamda[k] must be a valid knot vector. 
lstsqr  [in] Least squares approximation flag. If it equals AMA_Boolean_True, then this function is being called by a least squares approximation function. 
User Support Function  Documented 021116  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_MltvPnltrm  (  AMA_OPTIONS *  options, 
double  theta,  
long int  porder,  
CNSPLA_SPLFUN *  splfun  
) 
Define penalty term on a multivariate spline.
This function defines a penalty term for or on a multivariate spline given as
where the s, for and , are the coefficients of the tensor product Bsplines
The s are the univariate Bsplines of degree defined by the knot vectors
For the penalty term is
where . Alternately, for the penalty term is
The cross partial terms can be excluded from the penalty term with AMA_OptionsSetPenaltyTerm().
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_MltvPnltrm(). 
theta  [in] The penalty term weight . Should satisfy theta . 
porder  [in] The penalty term order . Should satisfy porder or porder . 
splfun  [in] Pointer to CNSPLA_SPLFUN containing spline upon which penalty term is imposed. Should satisfy splfun NULL. 
User Support Function  Documented 121114  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!