#include <AMA.h>
Functions  
long int  AMA_UnvBoundaryConditions (AMA_OPTIONS *options, enum AMA_Boolean interp, CNSPLA_SPLFUN *splfun) 
Define boundary conditions for univariate approximation and interpolation functions. More...  
long int  AMA_UnvData (AMA_OPTIONS *options, const char *datfile, 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 Univariate Data Functions. More...  
long int  AMA_UnvDataFree (AMA_OPTIONS *options, double **x, double **z, double **epsilon, double **wht, double **lamda) 
Free Univariate Data Functions data arrays. More...  
long int  AMA_UnvInputCheck (AMA_OPTIONS *options, 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 univariate data approximation functions. More...  
long int  AMA_UnvPnltrm (AMA_OPTIONS *options, double theta, long int porder, CNSPLA_SPLFUN *splfun) 
Define penalty term on an univariate spline. More...  
long int  AMA_UnvConpnt (AMA_OPTIONS *options, long int n, double *x, double *z, double *epsilon, CNSPLA_SPLFUN *splfun) 
Define approximation or interpolation constraints on an univariate spline. More...  
long int  AMA_UnvConreg (AMA_OPTIONS *options, long int n, double *x, double *z, double *epsilon, long int degree, CNSPLA_SPLFUN *splfun) 
Define local monotonicity constraints on an univariate spline. More...  
long int AMA_UnvBoundaryConditions  (  AMA_OPTIONS *  options, 
enum AMA_Boolean  interp,  
CNSPLA_SPLFUN *  splfun  
) 
Define boundary conditions for univariate approximation and interpolation functions.
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_UnvBoundaryConditions(). 
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_UnvConpnt  (  AMA_OPTIONS *  options, 
long int  n,  
double *  x,  
double *  z,  
double *  epsilon,  
CNSPLA_SPLFUN *  splfun  
) 
Define approximation or interpolation constraints on an univariate spline.
For a given set of data and approximation tolerances , for , this function defines either the approximation constraints
or the interpolation constraints
for , on a univariate spline
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_UnvConpnt(). 
n  [in] The number of data points . Should satisfy n . 
x  [in] Array of size n containing the independent variable data , for . Should be in strictly ascending order. 
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_UnvConreg  (  AMA_OPTIONS *  options, 
long int  n,  
double *  x,  
double *  z,  
double *  epsilon,  
long int  degree,  
CNSPLA_SPLFUN *  splfun  
) 
Define local monotonicity constraints on an univariate spline.
For a given set of data and approximation tolerances , for , this function defines the local monotonicity constraints on an univariate spline
If , then this function imposes the constraints
for . Alternatively, if there exists a for which , then the local monotonicity constraints
for are imposed. If for some the above conditions are not met, then the intervals and intersect and the 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 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.
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_UnvConreg(). 
n  [in] The number of data points . Should satisfy n . 
x  [in] Array of size n containing the independent variable data , for . Should be in strictly ascending order. 
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] The degree . Should satisfy degree . 
splfun  [in] Pointer to CNSPLA_SPLFUN containing spline upon which monotonicity 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_UnvData  (  AMA_OPTIONS *  options, 
const char *  datfile,  
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 Univariate 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 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 Univariate Data Functions approximation options default values.
The Bounds section specifies the lower and upper bounds employed by AMA_UnvLstsqr(). 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_UnvLstsqr(). 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_UnvMonoApprox() and AMA_UnvMonoInterp(). 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:
options  [in] Pointer to AMA_OPTIONS initialized with AMA_Options(). Must be initialized with AMA_Options() prior to calling AMA_UnvData(). 
datfile  [in] The data file name. Must satisfy datfile NULL. 
degree  [out] The degree . Must satisfy degree NULL. 
n  [out] The number of data points . Must satisfy n NULL. 
x  [out] Array of size n containing 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] The number of knots . Must satisfy mlamda NULL. 
lamda  [out] Array of size mlamda containing the knots , for . Must satisfy lamda NULL. 
User Support Function  Documented 110415  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_UnvDataFree  (  AMA_OPTIONS *  options, 
double **  x,  
double **  z,  
double **  epsilon,  
double **  wht,  
double **  lamda  
) 
Free Univariate Data Functions data arrays.
This function frees the arrays allocated by AMA_UnvData().
options  [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvDataFree(). 
x  [out] Pointer to array containing the independent variable data. 
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 containing the knots. 
User Support Function  Documented 110515  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_UnvInputCheck  (  AMA_OPTIONS *  options, 
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 univariate data approximation functions.
This function checks the input parameters for the Univariate Data Functions which compute the spline
of degree which is based on the knot vector . Along with the degree the Univariate Data Functions require the independent variable data , for , and either the weights or the approximation tolerances , for . Also, for least squares approximation functions the knot vector is 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 this function insures either the conditions
or
are satisfied. It also insures the first and last distinct knots satisfy the conditions and , respectively.
options  [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvInputCheck(). 
n  [in] The number of data points . Must satisfy n . 
x  [in] Array of size n containing the independent variable data , for . Must satisfy x NULL and 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] The degree . Must satisfy degree . 
mlamda  [in] The number of knots . If lstsqr AMA_Boolean_True, then must satisfy mlamda . 
lamda  [in] Array of size mlamda containing the knot vector . If lstsqr AMA_Boolean_True, then must be a valid knot vector. 
lstsqr  [in] The 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 101115  !!!THIS IS NOT A USER CALLABLE FUNCTION  DOCUMENT IS INCLUDED FOR COMPLETENESS!!!
long int AMA_UnvPnltrm  (  AMA_OPTIONS *  options, 
double  theta,  
long int  porder,  
CNSPLA_SPLFUN *  splfun  
) 
Define penalty term on an univariate spline.
This function defines a penalty term for or on an univariate spline
of degree where is
The penalty term is
options  [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_UnvPnltrm(). 
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 the spline upon which the 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!!!