Functions
AMA_Unv.h File Reference

Go to the source code of this file.

Functions

long int AMA_UnvApprox (AMA_OPTIONS *options, long int n, double *x, double *z, double *epsilon, long int degree, AMA_SPLINE **spline)
 Approximation of Univariate Data More...
 
long int AMA_UnvInterp (AMA_OPTIONS *options, long int n, double *x, double *z, long int degree, AMA_SPLINE **spline)
 Interpolation 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 More...
 
long int AMA_UnvMonoApprox (AMA_OPTIONS *options, long int n, double *x, double *z, double *epsilon, long int degree, AMA_SPLINE **spline)
 Monotonic Approximation of Univariate Data More...
 
long int AMA_UnvMonoInterp (AMA_OPTIONS *options, long int n, double *x, double *z, long int degree, AMA_SPLINE **spline)
 Monotonic Interpolation of Univariate Data More...
 
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...
 

Function Documentation

long int AMA_UnvApprox ( AMA_OPTIONS options,
long int  n,
double *  x,
double *  z,
double *  epsilon,
long int  degree,
AMA_SPLINE **  spline 
)

Approximation of Univariate Data

For a given set of data $(x_\ell,z_\ell)$ and approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$, this function employs cnspla to compute the spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}) \]

that minimizes

\[ F^{(2)}(s(x)) = \int_{x_1}^{x_N}\left( s^{(2)}(x) \right)^2 dx \]

subject to the approximation constraints

\[ z_\ell - \epsilon_\ell \le s(x_\ell) \le z_\ell + \epsilon_\ell \]

for $\ell=1,\ldots,N$.

In the above definition of $s(x)$ the $\alpha_j$, for $j=1,\ldots,m$, are the coefficients of the $m$univariate B-splines $B_{d,j}(x|{\bf\Lambda})$ of degree $1\le d\le 5$ which are based on the knot vector ${\bf\Lambda}$. The knot vector ${\bf\Lambda}$ depends on the independent variable data and the degree and is defined by AMA_LamdaInterp().

This function does the following:

  • Checks the input parameters for validity, see AMA_UnvInputCheck().
  • Defines the spline $s(x)$ based on a knot vector defined by AMA_LamdaInterp().
  • Defines CNSPLA_CONPNT constraints to represent the approximation constraints, see AMA_UnvConpnt().
  • Defines CNSPLA_PNLTRM condition to represent the function $F^{(2)}(s(x))$, see AMA_UnvPnltrm().
  • Invokes cnspla to compute a spline which minimizes $ F^{(2)}(s(x))$ subject to the approximation constraints.
  • Stores approximation into spline.
Note
By default the spline coefficients are initialized to zero but a different initial value for the spline coefficients can be set with AMA_OptionsSetCoefficients().
Parameters
options[in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvApprox().
n[in] The number of data points $N$. Must satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Must be in strictly ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$.
epsilon[in] Array of size n containing the approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$. Must satisfy $\epsilon_\ell\ge 0.0$ for all $\ell=1,\ldots,N$. If epsilon = NULL, then this function uses $\epsilon_\ell = 0.0$ for all $\ell=1,\ldots,N$.
degree[in] The degree $d$. Must satisfy $1\le$ degree $\le 5$.
spline[out] Pointer to AMA_SPLINE pointer containing the spline approximation. Must satisfy spline $\ne$ NULL.
Returns
Success/Error Code.

User Callable Function - Documented 101715

long int AMA_UnvBoundaryConditions ( AMA_OPTIONS options,
enum AMA_Boolean  interp,
CNSPLA_SPLFUN *  splfun 
)

Define boundary conditions for univariate approximation and interpolation functions.

Parameters
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 $s(x)$ upon which the penalty term is imposed. Should satisfy splfun $\ne$ NULL.
Returns
Success/Error Code.

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 $(x_\ell,z_\ell)$ and approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$, this function defines either the approximation constraints

\[ z_\ell - \epsilon_\ell \le s(x_\ell) \le z_\ell + \epsilon_\ell \]

or the interpolation constraints

\[ s(x_\ell) = z_\ell, \]

for $\ell=1,\ldots,N$, on a univariate spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}). \]

Parameters
options[in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_UnvConpnt().
n[in] The number of data points $N$. Should satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Should be in strictly ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$.
epsilon[in] Array of size n containing the approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$. Should satisfy $\epsilon_\ell\ge 0.0$ for all $\ell=1,\ldots,N$. If epsilon = NULL, then the interpolation constraints are defined. Otherwise, the approximation constraints are defined.
splfun[in] Pointer to CNSPLA_SPLFUN containing spline $s(x)$ upon which approximation or interpolation constraints are imposed. Should satisfy splfun $\ne$ NULL.
Returns
Success/Error Code.

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 $(x_\ell,z_\ell)$ and approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$, this function defines the local monotonicity constraints on an univariate spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}). \]

If $\max_\ell\lbrace{\epsilon_\ell\rbrace}=0.0$, then this function imposes the constraints

\[ s'(x) \cases { \ge 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell < z_{\ell+1}$; \cr \le 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell > z_{\ell+1}$; \cr = 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & otherwise; \cr } \]

for $\ell=1,\ldots,N-1$. Alternatively, if there exists a $1\le \ell\le N$ for which $\epsilon_\ell\ne 0.0$, then the local monotonicity constraints

\[ s'(x) \cases { \ge 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell + \epsilon_\ell < z_{\ell+1} - \epsilon_{\ell+1}$; \cr \le 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell - \epsilon_\ell > z_{\ell+1} + \epsilon_{\ell+1}$; \cr } \]

for $\ell=1,\ldots,N-1$ are imposed. If for some $1\le \ell\le N-1$ the above conditions are not met, then the intervals $[z_\ell - \epsilon_\ell,z_\ell + \epsilon_\ell]$ and $[z_{\ell+1} - \epsilon_{\ell+1},z_{\ell+1} + \epsilon_{\ell+1}]$ intersect and the constraint $s'(x)=0$ can be imposed over the interval $[x_\ell,x_{\ell+1}]$. However, it is possible for the intervals $[z_q - \epsilon_q, z_q + \epsilon_q]$ and $[z_{q+1} - \epsilon_{q+1}, z_{q+1} + \epsilon_{q+1}]$ to intersect, for each $\ell\le q\le \ell+r$ and $r\ge 1$; without an intersection existing between all the intervals. In this case the equality constraint is inconsistent with the approximation constraints

\[ z_q - \epsilon_q \le s(x_q) \le z_q + \epsilon_q, \]

for $\ell\le q\le \ell+r+1$; and, therefore, can not be imposed over the interval $[x_l,x_{l+r+1}]$. Hence, instead of imposing an equality constraint this function minimizes $\vert\vert s'(x) \vert\vert_\infty$ over all intervals $[x_\ell,x_{\ell+1}]$ for which the intervals $[z_\ell - \epsilon_\ell,z_\ell + \epsilon_\ell]$ and $[z_{\ell+1} - \epsilon_{\ell+1},z_{\ell+1} + \epsilon_{\ell+1}]$ intersect.

Parameters
options[in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_UnvConreg().
n[in] The number of data points $N$. Should satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Should be in strictly ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$.
epsilon[in] Array of size n containing the approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$. Should satisfy $\epsilon_\ell \ge 0.0$ for all $\ell=1,\ldots,N$. If epsilon = NULL, then this function uses $\epsilon_\ell = 0.0$ for all $\ell=1,\ldots,N$.
degree[in] The degree $d$. Should satisfy $1\le$ degree $\le 5$.
splfun[in] Pointer to CNSPLA_SPLFUN containing spline $s(x)$ upon which monotonicity constraints are imposed. Should satisfy splfun $\ne$ NULL.
Returns
Success/Error Code.

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 ${\bf X}\in{\rm R}^1$ and dependent variable data ${\bf Z}\in{\rm R}^1$.

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:

\[ \begin{array}{llll} {\bf Data} & & & \cr {\bf N:}N &{\bf Degree:}d & & \cr {\bf X} &{\bf Z} &{\bf Epsilon} &{\bf Wht} \cr x_1 &z_1 &\epsilon_1 &w_1 \cr x_2 &z_2 &\epsilon_2 &w_2 \cr \vdots &\vdots &\vdots &\vdots \cr x_N &z_N &\epsilon_N &w_N \cr {\bf End\_Data} & & & \cr \end{array} \]

where the Epsilon and Wht columns are optional. The data must satisfy the following conditions:

  • $1\le d \le 5$;
  • $N\ge 2$;
  • the independent variable data $x_\ell$, for $\ell=1,\cdots,N$, must be in increasing order;
  • the approximation tolerances must satisfy $\epsilon_\ell\ge 0.0$, for $\ell=1,\cdots,N$;
  • the weights must satisfy $w_\ell\ge 0.0$, for $\ell=1,\cdots,N$.

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:

\[ \begin{array}{ll} {\bf Bounds} & \cr {\bf Lwrbnd:}\alpha_l &{\bf Uprbnd:}\alpha_u \cr {\bf End\_Bounds} & \cr \end{array} \]

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 $\alpha_l$ is set as follows:

  • If lwrstr equals infbnd, then $\alpha_l = -\alpha_\infty$ where $\alpha_\infty$ = AMA_SplineInfbnd(); or,
  • If lwrstr equals zmin , then $\alpha_l = \min_\ell\lbrace{z_\ell\rbrace}$.
  • Otherwise, $\alpha_l =$ atof(lwrstr).

Similarly, the upper bound is read as a string uprstr and based on the value of uprstr the value of $\alpha_u$ is set as follows:

  • If uprstr equals infbnd, then $\alpha_u = \alpha_\infty$ where $\alpha_\infty$ = AMA_SplineInfbnd(); or,
  • If uprstr equals zmax , then $\alpha_u = \max_\ell\lbrace{z_\ell\rbrace}$.
  • Otherwise, $\alpha_u =$ atof(uprstr).

The Least_Squares section specifies the approximation options and knots employed by AMA_UnvLstsqr(). It has the following structure:

\[ \begin{array}{lll} {\bf Least\_Squares} & & \cr {\bf Mlamda:}m &{\bf Theta:}\theta &{\bf Minorm:\rm minorm} \cr \lambda^o_1 & & \cr \lambda^o_2 & & \cr \vdots & & \cr \lambda^o_m & & \cr {\bf End\_Least\_Squares} & & \cr \end{array} \]

and its options must satisfy the following conditions:

  • $0.0\le\theta < 1.0$;
  • ${\rm minorm}$ must be Enabled or Disabled;
  • $m\ge 2$;
  • the knots $\lambda^o_i$, for $i=1,\cdots,m$, must be in increasing order;
  • $\lambda^o_1 \le x_1$ and $\lambda^o_{m} \ge x_N$.

The Monotonicity section specifies the monotonicity constraints and continuity conditions employed by AMA_UnvMonoApprox() and AMA_UnvMonoInterp(). It has the the following structure:

\[ \begin{array}{llll} {\bf Monotonicity} & & & \cr {\bf Monpos:\rm monpos} &{\bf Monneg:\rm monneg} &{\bf Monzer:\rm monzer} &{\bf Concnd:\rm concnd} \cr {\bf End\_Monotonicity} & & & \cr \end{array} \]

and its options must satisfy the following conditions:

  • the positive monotonicity constraint flag ${\rm monpos}$, negative monotonicity constraint flag ${\rm monneg}$ and zero monotonicity constraint flag ${\rm monzer}$ must be Enabled or Disabled;
  • the continuity condition ${\rm concnd}$ must be Full or Reduced.

The bold keywords are case sensitive and the string values for the approximation options are case insensitive.

This function performs the following tasks:

Parameters
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 $\ne$ NULL.
degree[out] The degree $d$. Must satisfy degree $\ne$ NULL.
n[out] The number of data points $N$. Must satisfy n $\ne$ NULL.
x[out] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Must satisfy x $\ne$ NULL.
z[out] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$. Must satisfy z $\ne$ NULL.
epsilon[out] Array of size n containing the approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$. Must satisfy epsilon $\ne$ NULL.
wht[out] Array of size n containing the weights $w_\ell$, for $\ell=1,\ldots,N$. Must satisfy wht $\ne$ NULL.
theta[out] The penalty term weight $\theta$. Must satisfy theta $\ne$ NULL.
mlamda[out] The number of knots $m$. Must satisfy mlamda $\ne$ NULL.
lamda[out] Array of size mlamda containing the knots $\lambda^o_i$, for $i=1,\ldots,m$. Must satisfy lamda $\ne$ NULL.
Returns
Success/Error Code.

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().

Parameters
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.
Returns
Success/Error Code.

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

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}) \]

of degree $d$ which is based on the knot vector ${\bf\Lambda}$. Along with the degree the Univariate Data Functions require the independent variable data $x_\ell$, for $\ell=1,\ldots,N$, and either the weights $w_\ell$ or the approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$. Also, for least squares approximation functions the knot vector ${\bf\Lambda}\in{\rm R}^M$ is required. This function insures the following conditions are satisfied:

  • $N\ge 2$;
  • $1\le d\le 5$;
  • $x_\ell$, for $1\le\ell\le N$, is in ascending order and if lstsqr equals AMA_Boolean_False, then it is in strictly ascending order;
  • $w_\ell\ge 0.0$ for all $1\le\ell\le N$ and $w_\ell >0.0$ for at least one $1\le\ell\le N$;
  • $\epsilon_\ell\ge 0.0$ for all $1\le\ell\le N$;
  • $M\ge 2$.

Also, if lstsqr equals AMA_Boolean_True and the knot vector ${\bf\Lambda}$ is represented by its distinct knot vector

\[ {\bf\rm K}^{{\bf\Lambda}} = ( \kappa_1, \kappa_2, \cdots, \kappa_{m^d-1}, \kappa_{m^d} )^T \]

and its knot multiplicity vector

\[ {\bf\rm H}^{{\bf\Lambda}} = ( \eta_1, \eta_2, \cdots, \eta_{m^d-1}, \eta_{m^d} )^T, \]

then this function insures either the conditions

  • $\kappa_i < \kappa_{i+1}$, for $1\le i\le m^d - 1$;
  • $\eta_i \le d + 1$, for $2\le i\le m^d-1$;
  • $\eta_1 = \eta_{m^d} = d+1$;

or

  • $\kappa_i < \kappa_{i+1}$, for $1\le i\le m^d - 1$;
  • $\eta_i \le d + 1$, for $2\le i\le m^d-1$;
  • $\eta_1 = \eta_{m^d} = 1$;

are satisfied. It also insures the first and last distinct knots satisfy the conditions $\kappa_1\le x_1$ and $\kappa_{m^d}\ge x_N$, respectively.

Parameters
options[in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvInputCheck().
n[in] The number of data points $N$. Must satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Must satisfy x $\ne$ NULL and be in ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$. Must satisfy z $\ne$ NULL.
wht[in] Array of size n containing the weights $w_\ell$, for $\ell=1,\ldots,N$. If wht $\ne$ NULL, then must satisfy $w_\ell\ge 0.0$ for all $\ell=1,\ldots,N$.
epsilon[in] Array of size n containing the approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$. If epsilon $\ne$ NULL, then must satisfy $\epsilon_\ell\ge 0.0$ for all $\ell=1,\ldots,N$.
degree[in] The degree $d$. Must satisfy $1\le$ degree $\le 5$.
mlamda[in] The number of knots $M$. If lstsqr AMA_Boolean_True, then must satisfy mlamda $\ge 2$.
lamda[in] Array of size mlamda containing the knot vector ${\bf\Lambda}$. 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.
Returns
Success/Error Code.

User Support Function - Documented 101115 - !!!THIS IS NOT A USER CALLABLE FUNCTION - DOCUMENT IS INCLUDED FOR COMPLETENESS!!!

long int AMA_UnvInterp ( AMA_OPTIONS options,
long int  n,
double *  x,
double *  z,
long int  degree,
AMA_SPLINE **  spline 
)

Interpolation of Univariate Data

For a given set of data $(x_\ell,z_\ell)$, for $\ell=1,\ldots,N$, this function employs cnspla to compute the spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}) \]

subject to the interpolation constraints

\[ s(x_\ell) = z_\ell \]

for $\ell=1,\ldots,N$.

In the above definition of $s(x)$ the $\alpha_j$, for $j=1,\ldots,m$, are the coefficients of the $m$ univariate B-splines $B_{d,j}(x|{\bf\Lambda})$ of degree $1 \le d\le 5$ which are based on the knot vector ${\bf\Lambda}$. If the degree is even, then the knot vector ${\bf\Lambda}$ is defined such that its distinct knot vector is

\[ {\bf\rm K}^{\bf\Lambda} = (x_1,0.5(x_1+x_2),\cdots,0.5(x_{N-1}+x_N),x_N)^T \]

and; if the degree is odd, then ${\bf\Lambda}$ is defined such that its distinct knot vector is

\[ {\bf\rm K}^{\bf\Lambda} = (x_1,x_2,\cdots,x_{N-1},x_N)^T. \]

In either case, its corresponding knot multiplicity vector is

\[ {\bf\rm H}^{\bf\Lambda} = (d+1,1,\cdots,1,d+1)^T \]

and the number of spline coefficients $m$ is

\[ m = \cases{ N + d , & {\rm if the degree is even}; \cr N + d-1, & {\rm if the degree is odd}. \cr} \]

Since there are only $N$ interpolation constraints and $m\ge N$ coefficients, it is necessary to define additional conditions in order to insure an unique solution when $d>1$. Hence, this function imposes boundary conditions on the derivatives $s^{(p)}(x)$ of the spline at its left and right hand boundaries. These conditions are $s^{(p)}(x_1) = s^{(p)}(x_N) = 0.0$ for

\[ p = \cases{ {d\over 2 }+1,\ldots, d, & {\rm if the degree is even}; \cr {d+1\over 2} ,\ldots, d-1, & {\rm if the degree is odd}. \cr} \]

The following table summarizes the boundary conditions imposed for $2\le d\le 5$.

Degree Boundary Conditions
Quadratic $s^{(2)}(x_1) = 0.0 \hspace{5pt} {\rm and } \hspace{5pt} s^{(2)}(x_N) = 0.0$
Cubic $s^{(2)}(x_1) = 0.0 \hspace{5pt} {\rm and } \hspace{5pt} s^{(2)}(x_N) = 0.0$
Quartic $s^{(3)}(x_1) = s^{(4)}(x_1) = 0.0 \hspace{5pt} {\rm and }\hspace{5pt} s^{(3)}(x_N) = s^{(4)}(x_N) = 0.0$
Quintic $s^{(3)}(x_1) = s^{(4)}(x_1) = 0.0 \hspace{5pt} { \rm and }\hspace{5pt} s^{(3)}(x_N) = s^{(4)}(x_N) = 0.0$

This function performs the follow tasks:

  • Checks the input parameters for validity, see AMA_UnvInputCheck().
  • Defines the spline $s(x)$ based on the knot vector ${\bf\Lambda}$ described above.
  • Defines CNSPLA_CONPNT constraints to represent the interpolation constraints, see AMA_UnvConpnt().
  • Defines CNSPLA_CONPNT constraints to represent the boundary conditions.
  • Invokes cnspla to compute a spline which minimizes $F^{(2)}(s(x))$ subject to the interpolation constraints and boundary conditions.
  • Stores interpolant into spline.
Note
By default the spline coefficients are initialized to zero but a different initial value for the spline coefficients can be set with AMA_OptionsSetCoefficients().
Parameters
options[in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvInterp().
n[in] The number of data points $N$. Must satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Must be in strictly ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$.
degree[in] The degree $d$. Must satisfy $1\le$ degree $\le 5$.
spline[out] Pointer to AMA_SPLINE pointer containing the spline interpolant. Must satisfy spline $\ne$ NULL.
Returns
Success/Error Code.

User Callable Function - Documented 101715

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 $(x_\ell,z_\ell)$ and weights $w_\ell$, for $\ell=1,\ldots,N$, this function employs cnspla to compute the spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}) \]

that minimizes

\[ (1.0-\theta)\sum_\ell^N w_\ell ( s(x_\ell) - z_\ell )^2 + \theta \int_{\lambda_1}^{\lambda_{m+d+1}}\left( s^{(2)}(x) \right)^2 dx \]

for $0.0\le\theta< 1.0$. In the above definition of $s(x)$ the $\alpha_j$, for $j=1,\ldots,m$, are the coefficients of the $m$ univariate B-splines $B_{d,j}(x|{\bf\Lambda})$ of degree $1 \le d \le 5$ which are based on the knot vector ${\bf\Lambda}\in{\rm R}^M$ given as

\[ {\bf\Lambda} = ( \lambda_1,\cdots,\lambda_{d+1}, \lambda_{d+2}, \cdots, \lambda_m, \lambda_{m+1},\cdots,\lambda_{m+d+1} )^T \]

where the knots $\lambda_i$ must satisfy the conditions

  • $\lambda_1 = \ldots = \lambda_{d+1}$;
  • $\lambda_i \le \lambda_{i+1}$, for $1\le i\le m+d$;
  • $\lambda_i < \lambda_{i+d+1}$, for $1\le i\le m$;
  • $\lambda_{m+1} = \ldots = \lambda_{m+d+1}$.

If the knot vector ${\bf\Lambda}$ is represented by its distinct knot vector

\[ {\bf\rm K}^{{\bf\Lambda}} = ( \kappa_1, \kappa_2, \cdots, \kappa_{m^d-1}, \kappa_{m^d} )^T \]

and its knot multiplicity vector

\[ {\bf\rm H}^{{\bf\Lambda}} = ( \eta_1, \eta_2, \cdots, \eta_{m^d-1}, \eta_{m^d} )^T \]

then the aforementioned conditions are

  • $\kappa_i < \kappa_{i+1}$, for $1\le i\le m^d - 1$;
  • $\eta_i \le d + 1$, for $2\le i\le m^d-1$;
  • $\eta_1 = \eta_{m^d} = d+1$.

Also the first and last distinct knots must satisfy the conditions $\kappa_1\le x_1$ and $\kappa_{m^d}\ge x_N$, respectively. In this case the number of knots is $M = m + d + 1$.

For convenience this function does not require the definition of the $d+1$ order knots at the left and right hand endpoints and also accepts the knot vector ${\bf\Lambda}^o\in{\rm R}^M$

\[ {\bf\Lambda}^o = ( \lambda_{d+1}, \lambda_{d+2}, \cdots, \lambda_m, \lambda_{m+1} )^T \]

where the knots $\lambda_i$ satisfy the conditions

  • $\lambda_i \le \lambda_{i+1}$, for $d+2\le i\le m-1$;
  • $\lambda_i < \lambda_{i+d+1}$, for $d+1\le i\le m-d$;
  • $\lambda_{d+1} < \lambda_{d+2}$ and $\lambda_m < \lambda_{m+1}$.

If the knot vector ${\bf\Lambda}^o$ is represented by its distinct knot vector

\[ {\bf\rm K}^{{\bf\Lambda}^o} = ( \kappa_1, \kappa_2, \cdots, \kappa_{m^d-1}, \kappa_{m^d} )^T \]

and its knot multiplicity vector

\[ {\bf\rm H}^{{\bf\Lambda}^o} = ( \eta_1, \eta_2, \cdots, \eta_{m^d-1}, \eta_{m^d} )^T \]

then the aforementioned conditions are

  • $\kappa_i < \kappa_{i+1}$, for $1\le i\le m^d - 1$;
  • $\eta_i \le d + 1$, for $2\le i\le m^d-1$;
  • $\eta_1 = \eta_{m^d} = 1$.

As before, the first and last distinct knots must satisfy the conditions $\kappa_1\le x_1$ and $\kappa_{m^d}\ge x_N$, respectively. In this case the number of knots is $M = m - d + 1$.

Additionally, the spline $s(x)$ is subject to the bounds

\[ \alpha_l \le s(x) \le \alpha_u \]

where $\alpha_l=-\alpha_\infty$, $\alpha_u=\alpha_\infty$ and $\alpha_\infty$ 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 $\bar s({\bf X})$ by minimizing

\[ \int_{\lambda_1}^{\lambda_{m+d+1}}\left(\bar s^{(2)}(x)\right)^2dx \]

subject to the approximation constraints

\[ z_l - \epsilon_\ell \le \bar s(x_\ell) \le z_l + \epsilon_\ell, \]

for $\ell=1,\ldots,N$, where $\epsilon_l = s(x_\ell)-z_\ell$ and $s(x_\ell)$ is the least squares approximation. These constraints insure the condition

\[ \sum_\ell^N w_\ell ( \bar s(x_\ell) - z_\ell )^2 \le \sum_\ell^N w_\ell ( s(x_\ell) - z_\ell )^2, \]

that is, the minimum norm optimization does not increase the least squares error.

This function does the following:

  • Checks input parameters for validity, see AMA_UnvInputCheck().
  • Defines the spline $s(x)$ based on the knot vector ${\bf\Lambda}$ or ${\bf\Lambda}^o$.
  • Invokes cnspla to compute a least squares spline approximation.
  • Invokes cnspla to perform a minimum norm optimization.
  • Stores approximation into spline.
Note
By default the spline coefficients are initialized to zero but a different initial value for the spline coefficients can be set with AMA_OptionsSetCoefficients().
By default the spline is unbounded but finite bounds can be set with AMA_OptionsSetBounds().
By default the minimum norm optimization is not performed but it can be enabled with AMA_OptionsSetMinimumNorm().
The penalty term and minimum norm optimization options are mutually exclusive; that is, the minimum norm optimization is not performed if $\theta > 0.0$.
Parameters
options[in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvLstsqr().
n[in] The number of data points $N$. Must satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Must be in ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$.
wht[in] Array of size n containing the weights $w_\ell$, for $\ell=1,\ldots,N$. Must satisfy $w_\ell\ge 0.0$ for all $\ell=1,\ldots,N$. If wht = NULL, then this function uses $w_\ell = 1.0$ for all $\ell=1,\ldots,N$.
degree[in] The degree $d$. Must satisfy $1\le$ degree $\le 5$.
mlamda[in] The number of knots $M$. Must satisfy mlamda $\ge 2$.
lamda[in] Array of size mlamda containing the knot vector ${\bf\Lambda}$ or ${\bf\Lambda}^o$.
theta[in] The penalty term weight $\theta$. Must satisfy $0.0\le$ theta $< 1.0$.
spline[out] Pointer to AMA_SPLINE pointer containing the least squares spline approximation. Must satisfy spline $\ne$ NULL.
Returns
Success/Error Code.

User Callable Function - Documented 101715

long int AMA_UnvMonoApprox ( AMA_OPTIONS options,
long int  n,
double *  x,
double *  z,
double *  epsilon,
long int  degree,
AMA_SPLINE **  spline 
)

Monotonic Approximation of Univariate Data

For a given set of data $(x_\ell,z_\ell)$ and approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$, this function employs cnspla to compute the spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}) \]

that minimizes

\[ F^{(2)}(s(x)) = \int_{x_1}^{x_N}\left( s^{(2)}(x) \right)^2 dx \]

subject to the approximation constraints

\[ z_\ell - \epsilon_\ell \le s(x_\ell) \le z_\ell + \epsilon_\ell, \]

for $\ell=1,\ldots,N$, and the local monotonicity constraints

\[ s'(x) \cases { \ge 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell + \epsilon_\ell < z_{\ell+1} - \epsilon_{\ell+1}$; \cr \le 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell - \epsilon_\ell > z_{\ell+1} + \epsilon_{\ell+1}$; \cr } \]

for $\ell=1,\ldots,N-1$. If for some $1\le \ell\le N-1$ the above conditions are not met, then the intervals $[z_\ell - \epsilon_\ell,z_\ell + \epsilon_\ell]$ and $[z_{\ell+1} - \epsilon_{\ell+1},z_{\ell+1} + \epsilon_{\ell+1}]$ intersect and the constraint $s'(x)=0$ can be imposed over the interval $[x_\ell,x_{\ell+1}]$. However, it is possible for the intervals $[z_q - \epsilon_q, z_q + \epsilon_q]$ and $[z_{q+1} - \epsilon_{q+1}, z_{q+1} + \epsilon_{q+1}]$ to intersect, for each $\ell\le q\le \ell+r$ and $r\ge 1$; without an intersection existing between all the intervals. In this case the equality constraint is inconsistent with the approximation constraints

\[ z_q - \epsilon_q \le s(x_q) \le z_q + \epsilon_q, \]

for $\ell\le q\le \ell+r+1$; and, therefore, can not be imposed over the interval $[x_l,x_{l+r+1}]$. Hence, instead of imposing an equality constraint this function minimizes $\vert\vert s'(x) \vert\vert_\infty$ over all intervals $[x_\ell,x_{\ell+1}]$ for which the intervals $[z_\ell - \epsilon_\ell,z_\ell + \epsilon_\ell]$ and $[z_{\ell+1} - \epsilon_{\ell+1},z_{\ell+1} + \epsilon_{\ell+1}]$ intersect.

In the above definition of $s(x)$ the $\alpha_j$, for $j=1,\ldots,m$, are the coefficients of the $m$ univariate B-splines $B_{d,j}(x|{\bf\Lambda})$ of degree $1\le d\le 5$ which are based on the knot vector ${\bf\Lambda}$. The knot vector ${\bf\Lambda}$ depends on the independent variable data, the degree and the continuity of the spline at the interior data points. This function computes a spline which satisfies either the full or reduced continuity condition at the interior data points, as well as, the approximation and local monotonicity constraints. The knot vector ${\bf\Lambda}$ is defined by AMA_LamdaMonoInterp().

The following table summarizes the continuity of $s(x_\ell)$, for $\ell=2,\ldots,N-1$, and the number of coefficients, $m$, for a spline that satisfies the full and reduced continuity conditions.

Degree Full Continuity $m$ Reduced Continuity $m$
Linear $s^{(p)}(x_\ell)$ is continuous for $p=0$ $N$ $s^{(p)}(x_\ell)$ is continuous for $p=0$ $N$
Quadratic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 1$ $2N$ $s^{(p)}(x_\ell)$ is continuous for $p=0$ $2N-1$
Cubic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 2$ $3N$ $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 1$ $2N$
Quartic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 3$ $4N$ $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 2$ $3N$
Quintic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 4$ $5N$ $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 3$ $4N$

This function performs the follow tasks:

  • Checks input parameters for validity, see AMA_UnvInputCheck().
  • Defines the spline $s(x)$ based on a knot vector defined by AMA_LamdaMonoInterp().
  • Defines CNSPLA_CONPNT constraints to represent the approximation constraints, see AMA_UnvConpnt().
  • Defines CNSPLA_CONREG constraints to represent the local monotonicity constraints, see AMA_UnvConreg().
  • Defines CNSPLA_PNLTRM condition to represent the function $F^{(2)}(s(x))$, see AMA_UnvPnltrm().
  • Invokes cnspla to compute a spline which minimizes $F^{(2)}(s(x))$ subject to the approximation and local monotonicity constraints.
  • Stores approximation into spline.
Note
By default the spline coefficients are initialized to zero but a different initial value for the spline coefficients can be set with AMA_OptionsSetCoefficients().
By default the monotonicity constraints are enabled but they can be disabled with AMA_OptionsSetMonotonicity().
By default the spline satisfies the full continutiy condition but the reduced continuity condition can be requested with AMA_OptionsSetContinuity().
Parameters
options[in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvMonoApprox().
n[in] The number of data points $N$. Must satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Must be in strictly ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$.
epsilon[in] Array of size n containing the approximation tolerances $\epsilon_\ell$, for $\ell=1,\ldots,N$. Must satisfy $\epsilon_\ell\ge 0.0$ for all $\ell=1,\ldots,N$. If epsilon = NULL, then this function uses $\epsilon_\ell = 0.0$ for all $\ell=1,\ldots,N$.
degree[in] The degree $d$. Must satisfy $1\le$ degree $\le 5$.
spline[out] Pointer to AMA_SPLINE pointer containing the monotonic spline approximation. Must satisfy spline $\ne$ NULL.
Returns
Success/Error Code.

User Callable Function - Documented 101715

long int AMA_UnvMonoInterp ( AMA_OPTIONS options,
long int  n,
double *  x,
double *  z,
long int  degree,
AMA_SPLINE **  spline 
)

Monotonic Interpolation of Univariate Data

For a given set of data $(x_\ell,z_\ell)$, for $\ell=1,\ldots,N$, this function employs cnspla to compute the spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}) \]

that minimizes

\[ F^{(2)}(s(x)) = \int_{x_1}^{x_N}\left( s^{(2)}(x) \right)^2 dx \]

subject to the interpolation constraints

\[ s(x_\ell) = z_\ell, \]

for $\ell=1,\ldots,N$, and the local monotonicity constraints

\[ s'(x) \cases { \ge 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell < z_{\ell+1}$; \cr \le 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & if $z_\ell > z_{\ell+1}$; \cr = 0.0 {\rm \hspace{5pt}for\hspace{5pt}all\hspace{5pt}} x\in[x_\ell,x_{\ell+1}], & otherwise; \cr } \]

for $\ell=1,\ldots,N-1$.

In the above definition of $s(x)$ the $\alpha_j$, for $j=1,\ldots,m$, are the coefficients of the $m$ univariate B-splines $B_{d,j}(x|{\bf\Lambda})$ of degree $1\le d\le 5$ which are based on the knot vector ${\bf\Lambda}$. The knot vector ${\bf\Lambda}$ depends on the independent variable data, the degree and the continuity of the spline at the interior data points. This function computes a spline which satisfies either the full or reduced continuity condition at the interior data points, as well as, the interpolation and local monotonicity constraints. The knot vector ${\bf\Lambda}$ is defined by AMA_LamdaMonoInterp().

The following table summarizes the continuity of $s(x_\ell)$, for $\ell=2,\ldots,N-1$, and the number of coefficients, $m$, for a spline that satisfies the full and reduced continuity conditions.

Degree Full Continuity $m$ Reduced Continuity $m$
Linear $s^{(p)}(x_\ell)$ is continuous for $p=0$ $N$ $s^{(p)}(x_\ell)$ is continuous for $p=0$ $N$
Quadratic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 1$ $2N$ $s^{(p)}(x_\ell)$ is continuous for $p=0$ $2N-1$
Cubic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 2$ $3N$ $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 1$ $2N$
Quartic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 3$ $4N$ $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 2$ $3N$
Quintic $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 4$ $5N$ $s^{(p)}(x_\ell)$ is continuous for $0\le p\le 3$ $4N$

This function performs the follow tasks:

  • Checks input parameters for validity, see AMA_UnvInputCheck().
  • Defines the spline $s(x)$ based on a knot vector defined by AMA_LamdaMonoInterp().
  • Defines CNSPLA_CONPNT constraints to represent the interpolation constraints, see AMA_UnvConpnt().
  • Defines CNSPLA_CONREG constraints to represent the local monotonicity constraints, see AMA_UnvConreg().
  • Defines CNSPLA_PNLTRM condition to represent the function $F^{(2)}(s(x))$, see AMA_UnvPnltrm().
  • Invokes cnspla to compute a spline which minimizes $F^{(2)}(s(x))$ subject to the interpolation and local monotonicity constraints.
  • Stores interpolant into spline.
Note
By default the spline coefficients are initialized to zero but a different initial value for the spline coefficients can be set with AMA_OptionsSetCoefficients().
By default the monotonicity constraints are enabled but they can be disabled with AMA_OptionsSetMonotonicity().
By default the spline satisfies the full continutiy condition but the reduced continuity condition can be requested with AMA_OptionsSetContinuity().
Parameters
options[in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvMonoInterp().
n[in] The number of data points $N$. Must satisfy n $\ge 2$.
x[in] Array of size n containing the independent variable data $x_\ell$, for $\ell=1,\ldots,N$. Must be in strictly ascending order.
z[in] Array of size n containing the dependent variable data $z_\ell$, for $\ell=1,\ldots,N$.
degree[in] The degree $d$. Must satisfy $1\le$ degree $\le 5$.
spline[out] Pointer to AMA_SPLINE pointer containing the monotonic spline interpolant. Must satisfy spline $\ne$ NULL.
Returns
Success/Error Code.

User Callable Function - Documented 101715

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 $\theta F^{(p)}(s(x)$ for $p=0$ or $p=2$ on an univariate spline

\[ s(x) = \sum_{j=1}^{m}\alpha_jB_{d,j}(x|{\bf\Lambda}) \]

of degree $d$ where ${\bf\Lambda}$ is

\[ {\bf\Lambda} = ( \lambda_1,\cdots,\lambda_{d+1}, \lambda_{d+2}, \cdots, \lambda_m, \lambda_{m+1},\cdots,\lambda_{m+d+1} )^T. \]

The penalty term is

\[ F^{(p)}(s(x)) = \int_{\lambda_1}^{\lambda_{m+d+1}}\left( s^{(p)}(x) \right)^2dx. \]

Parameters
options[in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options() prior to calling AMA_UnvPnltrm().
theta[in] The penalty term weight $\theta$. Should satisfy $0.0\le$ theta $\le 1.0$.
porder[in] The penalty term order $p$. Should satisfy porder $=0$ or porder $=2$.
splfun[in] Pointer to CNSPLA_SPLFUN containing the spline $s(x)$ upon which the penalty term is imposed. Should satisfy splfun $\ne$ NULL.
Returns
Success/Error Code.

User Support Function - Documented 121114 - !!!THIS IS NOT A USER CALLABLE FUNCTION - DOCUMENT IS INCLUDED FOR COMPLETENESS!!!