AMA_UnvMonoInterp.c File Reference
#include <AMA.h>

## Functions

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

## Function Documentation

 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 , for , this function employs cnspla to compute the spline that minimizes subject to the interpolation constraints for , and the local monotonicity constraints 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 . The knot vector 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 is defined by AMA_LamdaMonoInterp().

The following table summarizes the continuity of , for , and the number of coefficients, , for a spline that satisfies the full and reduced continuity conditions.

Degree Full Continuity Reduced Continuity Linear is continuous for   is continuous for  Quadratic is continuous for   is continuous for  Cubic is continuous for   is continuous for  Quartic is continuous for   is continuous for  Quintic is continuous for   is continuous for  This function performs the follow tasks:

• Checks input parameters for validity, see AMA_UnvInputCheck().
• Defines the spline 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 , see AMA_UnvPnltrm().
• Invokes cnspla to compute a spline which minimizes 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 . Must satisfy n . x [in] Array of size n containing the independent variable data , for . Must be in strictly ascending order. z [in] Array of size n containing the dependent variable data , for . degree [in] The degree . Must satisfy degree . spline [out] Pointer to AMA_SPLINE pointer containing the monotonic spline interpolant. Must satisfy spline NULL.
Returns
Success/Error Code.

User Callable Function - Documented 101715