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

## Functions

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

## Function Documentation

 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 and approximation tolerances , for , this function employs cnspla to compute the spline that minimizes subject to the approximation constraints for , and the local monotonicity constraints for . 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.

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 approximation 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 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 , see AMA_UnvPnltrm().
• Invokes cnspla to compute a spline which minimizes 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 . 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 . epsilon [in] Array of size n containing the approximation tolerances , for . Must satisfy for all . If epsilon = NULL, then this function uses for all . degree [in] The degree . Must satisfy degree . spline [out] Pointer to AMA_SPLINE pointer containing the monotonic spline approximation. Must satisfy spline NULL.
Returns
Success/Error Code.

User Callable Function - Documented 101715