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... | |
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 and approximation tolerances
, for
, this function employs cnspla to compute the spline
that minimizes
subject to the approximation 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 and the degree and is defined by AMA_LamdaInterp().
This function does the following:
options | [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvApprox(). |
n | [in] The number of data points ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() |
epsilon | [in] Array of size n containing the approximation tolerances ![]() ![]() ![]() ![]() ![]() ![]() |
degree | [in] The degree ![]() ![]() ![]() |
spline | [out] Pointer to AMA_SPLINE pointer containing the spline approximation. Must satisfy spline ![]() |
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.
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 ![]() ![]() |
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 ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() |
epsilon | [in] Array of size n containing the approximation tolerances ![]() ![]() ![]() ![]() |
splfun | [in] Pointer to CNSPLA_SPLFUN containing spline ![]() ![]() |
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 ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() |
epsilon | [in] Array of size n containing the approximation tolerances ![]() ![]() ![]() ![]() ![]() ![]() |
degree | [in] The degree ![]() ![]() ![]() |
splfun | [in] Pointer to CNSPLA_SPLFUN containing spline ![]() ![]() |
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 ![]() |
degree | [out] The degree ![]() ![]() |
n | [out] The number of data points ![]() ![]() |
x | [out] Array of size n containing the independent variable data ![]() ![]() ![]() |
z | [out] Array of size n containing the dependent variable data ![]() ![]() ![]() |
epsilon | [out] Array of size n containing the approximation tolerances ![]() ![]() ![]() |
wht | [out] Array of size n containing the weights ![]() ![]() ![]() |
theta | [out] The penalty term weight ![]() ![]() |
mlamda | [out] The number of knots ![]() ![]() |
lamda | [out] Array of size mlamda containing the knots ![]() ![]() ![]() |
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 ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() ![]() |
wht | [in] Array of size n containing the weights ![]() ![]() ![]() ![]() ![]() |
epsilon | [in] Array of size n containing the approximation tolerances ![]() ![]() ![]() ![]() ![]() |
degree | [in] The degree ![]() ![]() ![]() |
mlamda | [in] The number of knots ![]() ![]() |
lamda | [in] Array of size mlamda containing the 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_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 , for
, this function employs cnspla to compute the spline
subject to the interpolation 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
. If the degree is even, then the knot vector
is defined such that its distinct knot vector is
and; if the degree is odd, then is defined such that its distinct knot vector is
In either case, its corresponding knot multiplicity vector is
and the number of spline coefficients is
Since there are only interpolation constraints and
coefficients, it is necessary to define additional conditions in order to insure an unique solution when
. Hence, this function imposes boundary conditions on the derivatives
of the spline at its left and right hand boundaries. These conditions are
for
The following table summarizes the boundary conditions imposed for .
Degree | Boundary Conditions |
---|---|
Quadratic | ![]() |
Cubic | ![]() |
Quartic | ![]() |
Quintic | ![]() |
This function performs the follow tasks:
options | [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvInterp(). |
n | [in] The number of data points ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() |
degree | [in] The degree ![]() ![]() ![]() |
spline | [out] Pointer to AMA_SPLINE pointer containing the spline interpolant. Must satisfy spline ![]() |
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 and weights
, for
, this function employs cnspla to compute the spline
that minimizes
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
given as
where the knots must satisfy the conditions
If the knot vector is represented by its distinct knot vector
and its knot multiplicity vector
then the aforementioned conditions are
Also the first and last distinct knots must satisfy the conditions and
, respectively. In this case the number of knots is
.
For convenience this function does not require the definition of the order knots at the left and right hand endpoints and also accepts the knot vector
where the knots satisfy the conditions
If the knot vector is represented by its distinct knot vector
and its knot multiplicity vector
then the aforementioned conditions are
As before, the first and last distinct knots must satisfy the conditions and
, respectively. In this case the number of knots is
.
Additionally, the spline is subject to the bounds
where ,
and
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 by minimizing
subject to the approximation constraints
for , where
and
is the least squares approximation. These constraints insure the condition
that is, the minimum norm optimization does not increase the least squares error.
This function does the following:
options | [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvLstsqr(). |
n | [in] The number of data points ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() |
wht | [in] Array of size n containing the weights ![]() ![]() ![]() ![]() ![]() ![]() |
degree | [in] The degree ![]() ![]() ![]() |
mlamda | [in] The number of knots ![]() ![]() |
lamda | [in] Array of size mlamda containing the knot vector ![]() ![]() |
theta | [in] The penalty term weight ![]() ![]() ![]() |
spline | [out] Pointer to AMA_SPLINE pointer containing the least squares spline approximation. Must satisfy spline ![]() |
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 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 | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Quadratic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Cubic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Quartic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Quintic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
This function performs the follow tasks:
options | [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvMonoApprox(). |
n | [in] The number of data points ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() |
epsilon | [in] Array of size n containing the approximation tolerances ![]() ![]() ![]() ![]() ![]() ![]() |
degree | [in] The degree ![]() ![]() ![]() |
spline | [out] Pointer to AMA_SPLINE pointer containing the monotonic spline approximation. Must satisfy spline ![]() |
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 , 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 | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Quadratic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Cubic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Quartic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
Quintic | ![]() ![]() | ![]() | ![]() ![]() | ![]() |
This function performs the follow tasks:
options | [in] Pointer to AMA_OPTIONS. Must be initialized with AMA_Options() prior to calling AMA_UnvMonoInterp(). |
n | [in] The number of data points ![]() ![]() |
x | [in] Array of size n containing the independent variable data ![]() ![]() |
z | [in] Array of size n containing the dependent variable data ![]() ![]() |
degree | [in] The degree ![]() ![]() ![]() |
spline | [out] Pointer to AMA_SPLINE pointer containing the monotonic spline interpolant. Must satisfy spline ![]() |
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 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 ![]() ![]() ![]() |
porder | [in] The penalty term order ![]() ![]() ![]() |
splfun | [in] Pointer to CNSPLA_SPLFUN containing the spline ![]() ![]() |
User Support Function - Documented 121114 - !!!THIS IS NOT A USER CALLABLE FUNCTION - DOCUMENT IS INCLUDED FOR COMPLETENESS!!!