#include <exampleAMA_MltvGrd.h>
Functions | |
int | main (int argc, char **argv) |
Approximation and Interpolation of Multivariate Gridded Data More... | |
long int | exampleAMA_MltvGrdArguments (int argc, char **argv, long int *appindx, char *approx, char *datfile) |
Parse main() programs parameters. More... | |
long int | exampleAMA_MltvGrdError (AMA_OPTIONS *options, long int nind, long int *ng, double **x, double *z, AMA_SPLINE *spline) |
Produce absolute error table for AMA Spline Library Multivariate Gridded Data Functions. More... | |
long int | exampleAMA_MltvGrdWrite (AMA_OPTIONS *options, const char *approx, const char *datname, AMA_SPLINE *spline) |
Write spline approximation to ascii file. More... | |
long int exampleAMA_MltvGrdArguments | ( | int | argc, |
char ** | argv, | ||
long int * | appindx, | ||
char * | approx, | ||
char * | datfile | ||
) |
Parse main() programs parameters.
argc | [in] main() program argc parameter. |
argv | [in] main() program argv parameter. |
appindx | [out] Approximation index. |
approx | [out] Approximation function. |
datfile | [out] The data file name exampleAMA_MltvGrd_datname.dat. |
Documented 111014
long int exampleAMA_MltvGrdError | ( | AMA_OPTIONS * | options, |
long int | nind, | ||
long int * | ng, | ||
double ** | x, | ||
double * | z, | ||
AMA_SPLINE * | spline | ||
) |
Produce absolute error table for AMA Spline Library Multivariate Gridded Data Functions.
This function writes the absolute error table for AMA Spline Library functions which compute spline approximations of independent variable data and dependent variable data
to stdout. The independent variable data defines the rectilinear grid
where and
. The dependent variable data lies on the grid and is given as
for
; that is, there are
dependent variable values. This function does the following:
Parameter Note: In the parameter definitions given below the limits on are
and k =
.
options | [in] Pointer to AMA_OPTIONS. Should be initialized with AMA_Options(). |
nind | [in] The number of independent variables ![]() |
ng | [in] Array of size nind containing the number of points ![]() ![]() |
x | [in] Array of size nind containing arrays of size ng[k] where x[k] contains the independent variable data ![]() ![]() |
z | [in] Array of size ![]() ![]() ![]() |
spline | [in] Pointer to AMA_SPLINE containing the spline approximation. |
Documented 021616
long int exampleAMA_MltvGrdWrite | ( | AMA_OPTIONS * | options, |
const char * | approx, | ||
const char * | datname, | ||
AMA_SPLINE * | spline | ||
) |
Write spline approximation to ascii file.
This function writes a spline approximation to the ascii file datname_approx.spl.
options | [in] Pointer to AMA_OPTIONS initialized with AMA_Options(). |
approx | [in] Approximation function. Should be one of AMA_MltvGrdApprox, AMA_MltvGrdInterp, AMA_MltvGrdLstsqr, AMA_MltvGrdMonoApprox or AMA_MltvGrdMonoInterp. |
datname | [in] The component datname of the data file name exampleAMA_MltvGrd_datname.dat. |
spline | [in] Pointer to AMA_SPLINE containing the spline approximation. |
Documented 111014
int main | ( | int | argc, |
char ** | argv | ||
) |
Approximation and Interpolation of Multivariate Gridded Data
This program illustrates usage of the AMA Spline Library's Multivariate Gridded Data Functions which it employs to compute spline approximations of independent variable data and dependent variable data
. The independent variable data defines the rectilinear grid
where
and
. The dependent variable data lies on the grid and is given as
for
; that is, there are
dependent variable values. Similarly, the approximation tolerances
for
lie on the grid.
Its usage is:
exampleAMA_MltvGrd approx datfile
where approx is one of AMA_MltvGrdApprox, AMA_MltvGrdInterp, AMA_MltvGrdLstsqr, AMA_MltvGrdMonoApprox or AMA_MltvGrdMonoInterp. Based on the value of approx this program invokes one of the following five functions:
The argument datfile must be of the form exampleAMA_MltvGrd_datname.dat where datname is any valid string. The file consists of a data section and may contain several, optional, approximation option 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 Multivariate Gridded Data Functions approximation options default values.
The Bounds section specifies the lower and upper bounds employed by AMA_MltvGrdLstsqr(). 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_MltvGrdLstsqr(). 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_MltvGrdMonoApprox() and AMA_MltvGrdMonoInterp(). 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.
The data is used by all the functions; but, the weights , for
, are used only if approx equals AMA_MltvGrdLstsqr and the approximation tolerances
, for
, are used only if approx equals AMA_MltvGrdApprox or AMA_MltvGrdMonoApprox. The monotonicity constraint flags and continuity conditions are used if approx equals AMA_MltvGrdMonoApprox or AMA_MltvGrdMonoInterp. The knots
, for
and
, lower bound
, upper bound
, penalty term weight
and the minimum norm optimization flag are used only if approx equals AMA_MltvLstsqr.
This program does the following:
Documented 110215