#include <OptIntp.h>
Inherits Base.
Inheritance diagram for OptIntp:

Public Types | |
| GRID_AVG = 0 | |
| GRID_DEV | |
| GRID_MAX | |
| GRID_SAMPLE = 0 | |
| LOOP_MAXIMUM | |
| enum | PTYPE { GRID_SAMPLE = 0, RANDOM_COUNT, RANDOM_SEED, LOOP_MAXIMUM, PTYPE_CNT } |
| PTYPE_CNT | |
| RANDOM_AVG | |
| RANDOM_COUNT | |
| RANDOM_DEV | |
| RANDOM_MAX | |
| RANDOM_SEED | |
| enum | VTYPE { GRID_AVG = 0, GRID_DEV, GRID_MAX, RANDOM_AVG, RANDOM_DEV, RANDOM_MAX, VTYPE_CNT } |
| VTYPE_CNT | |
Public Member Functions | |
| yType | evalBasis (const xType *vXn) const throw (IntpErr) |
| yType | evalTable (const xType *vXn) throw (IntpErr) |
| yType(* | getBasis (void))(const xType *) |
| xType | getError (enum OptIntp< xType, yType >::VTYPE vType) const |
| NIntp< xType, yType > * | getNIntp (void) |
| int | getParameter (enum OptIntp< xType, yType >::PTYPE pType) const |
| bool | getPrintStatus (void) const |
| bool | gridError (xType **yErr=(xType **)(0)) |
| bool | optimize (const xType *xTol, xType yTol) |
| bool | optimize (xType xTol, xType yTol) |
| OptIntp (const OptIntp< xType, yType > &ei) | |
| OptIntp (yType(&rFn)(const xType *), NIntp< xType, yType > &ni) | |
| bool | randomError (void) |
| bool | setBasis (yType(&rFn)(const xType *)) |
| bool | setParameter (enum OptIntp< xType, yType >::PTYPE pType, int param) |
| bool | setPrintStatus (bool flag) |
| bool | update (const xType *const *arXn=(xType **)(0), const yType *arYn=(yType *)(0)) |
| ~OptIntp (void) | |
Static Public Member Functions | |
| template<typename bType> | |
| static bool | setSpanX (bType **arXn, const bType *arXLo, const bType *arXHi, const int *arNn, int nDimen) |
| template<typename bType> | |
| static bool | setSpanX (bType **arXn, bType vXLo, bType vXHi, const int *arNn, int nDimen) |
Static Public Attributes | |
| static const int | DEF_GRID_SAMPLE = 1 |
| static const int | DEF_LOOP_MAX = 1000 |
| static const int | DEF_RANDOM_COUNT = 2000 |
| static const int | DEF_RANDOM_SEED = 1 |
This class defines interpolation table errors and reduces these errors for multi-dimensional interpolation table formulations expressed as class calc::NIntp through optimization. To optimize data tables, this class perturbs data point locations in a multi-dimensional interpolation table to minimize interpolation error for a static number of data points. A known function describing the interpolation table is incorporated into the error evaluation calc::OptIntp object. The interpolation table can be constructed from any class inheriting the abstract multi-dimensional interpolation class calc::NIntp.
The declaration typename <xType> specifies the form of independent variables used in interpolation calculations. The declaration typename <yType> specifies the form of solution variables and errors used in interpolation calculations. In general, the <yType> variables should be the equal or superset of the <xType> variables.
The objective of the optimization function is to modify the values of the points in an interpolation table such that the table can estimate the behavior of the user-provided function with minimal errors. In the optimization, the number of interpolation points remains fixed along with the interval of interpolation.
For this application, interpolation table optimization is measured by the difference in integral errors (ei) in the intervals on either side of an interpolation point (i). If the interval error on one side of a point is significantly higher than the other side, this function assumes that the interpolation point can be displaced into the higher error interval, until the error difference across the point is near zero. Optimization will halt when all interval errors are roughly equal, or no further point displacement can reduce the overall table error.
To relate interpolation point position change with table error, each point (xi) is moved slightly to determine its influence on the total table error (E). The small error change has correlation with a partial derivative since all other points are held in their original positions.
From the single point displacement, a constant can be estimated relating the total change in error (E) with the local error (ei) change on either side of the point. For small interpolation point displacements, the requirement of a constant (Ki) should hold. The optimization assumes that the term of local error delta times point displacement over total error delta will be roughly constant.
To optimize an interpolation table, the constants (Ki) are calculated for all interpolation points. Then, at each point (i), the current local change in error (ei) and total change in error (Elast) for the previous iteration are used to estimate displacement for each point.
In software application, interpolation points are displaced with the same set of constants (Ki), then, errors are recalculated, until no more total error reduction is possible. At this point, the constants are calculated again and the process repeated, until no further error reduction is possible with new constants.
| enum PTYPE |
Enumeration assigns an index to an optimized interpolation parameter.
| GRID_SAMPLE | test point count per dimension used in error calculations through grid selection (OptIntp::gridError()) |
| RANDOM_COUNT | total test point count used in error calculations through random selection (OptIntp::randomError()) |
| RANDOM_SEED | inital seed value used in error calculations through random selection (OptIntp::randomError()) |
| LOOP_MAXIMUM | inital do-loop value used in optimization iterations (OptIntp::optimize()) |
| PTYPE_CNT | parameter index count |
| enum VTYPE |
Enumeration assigns an index to an optimized interpolation error variable.
| GRID_AVG | average absolute error through table grid selection (OptIntp::gridError()) |
| GRID_DEV | standard deviation absolute error through table grid selection (OptIntp::gridError()) |
| GRID_MAX | maximum absolute error through table grid selection (OptIntp::gridError()) |
| RANDOM_AVG | average absolute error through random selection (OptIntp::randomError()) |
| RANDOM_DEV | standard deviation absolute error through random selection (OptIntp::randomError()) |
| RANDOM_MAX | maximum absolute error through random selection (OptIntp::randomError()) |
| VTYPE_CNT | variable index count |
Constructor initializes an n-Dimension interpolation table error calculation object.
| rFn | a reference to a basis function that supplies exact values for interpolation error calculations over the intervals of interest (see calc::OptIntp::setBasis()) (y units) | |
| ni | a reference to an n-Dimension interpolation object to analyze |
Copy constructor initializes an n-Dimension interpolation error object from the specified existing error object.
| ei | a reference to an n-Dimension interpolation error object |
| ~OptIntp | ( | void | ) |
Destructor frees allocated memory.
| yType evalBasis | ( | const xType * | vXn | ) | const throw (IntpErr) |
Function evaluates the user-specified basis function at the specified independent vector vXn.
| vXn | a pointer to an n-Dimension independent data point vector (x units) |
| IntpErr | type of object thrown
|
| yType evalTable | ( | const xType * | vXn | ) | throw (IntpErr) |
Function determines the interpolated dependent data point value at the specified independent data vector.
| vXn | a pointer to an independent data point vector (x units) |
| IntpErr | type of object thrown
|
| yType(* getBasis | ( | ) |
Function returns a pointer to the basis function of the error deviation object.
Function returns the indicated error value between the error object's n-Dimension interpolation object and the error object's basis function. estimated through random point or grid selection.
| vType | variable index indentifying the type of data |
| NIntp<xType,yType>* getNIntp | ( | void | ) |
Function returns a pointer to the error deviation object's n-Dimension interpolation object.
Function returns the indicated error method parameter for optimization interpolation object.
| pType | parameter index indentifying the type of data |
| bool getPrintStatus | ( | void | ) | const |
Function returns the display status of progress printed to the primary console stream cout for selected function calculations.
| bool gridError | ( | xType ** | yErr = (xType**)(0) |
) |
Function determines averaged and data point interval error values using a grid selection between each data point interval.
| yErr | a pointer to a calculated error by data point interval array (|y| units) |
| bool optimize | ( | const xType * | xTol, | |
| xType | yTol | |||
| ) |
Function optimizes an n-Dimension independent interpolation array (calc::NIntp) by adjusting data point placement to minimize error.
| xTol | a pointer to an incremental tolerance array of independent data values (x units) | |
| yTol | incremental error tolerance of the dependent error values (|y| units) |
| bool optimize | ( | xType | xTol, | |
| xType | yTol | |||
| ) |
Function optimizes an n-Dimension independent interpolation array (calc::NIntp) by adjusting data point placement to minimize error.
| xTol | an incremental error tolerance of the independent data values (x units) | |
| yTol | incremental error tolerance of the dependent error values (|y| units) |
| bool randomError | ( | void | ) |
Function estimates the averaged error between the n-Dimension interpolation object and the error object's basis function through random point selection.
| bool setBasis | ( | yType(&)(const xType *) | rFn | ) |
Function sets the specified function as the basis function for calculating interpolation errors.
| rFn | a reference to a function that supplies exact values for interpolation error calculations (y units) |
yType fn(const xType *vXn); Function returns the indicated error method parameter for optimization interpolation object.
| pType | parameter index indentifying the type of data to store | |
| param | value to store |
| bool setPrintStatus | ( | bool | flag | ) |
Function sets the display status of progress printed to the primary console stream cout for selected function calculations.
| flag | status flag
|
| bool setSpanX | ( | bType ** | arXn, | |
| const bType * | arXLo, | |||
| const bType * | arXHi, | |||
| const int * | arNn, | |||
| int | nDimen | |||
| ) | [static] |
Function initializes an n-Dimension independent interpolation array at equally spaced intervals across the specified indepedent bounds.
| arXLo | a pointer to an n-Dimension independent value lower bound array (x units) | |
| arXHi | a pointer to an n-Dimension independent value upper bound array (x units) | |
| arNn | a pointer to an array containing data counts by dimension for the specified array arXn | |
| nDimen | number of dimensions of the interpolation table to analyze | |
| arXn | a pointer to a calculated n-Dimension independent value interpolation array (x units) |
| bool setSpanX | ( | bType ** | arXn, | |
| bType | vXLo, | |||
| bType | vXHi, | |||
| const int * | arNn, | |||
| int | nDimen | |||
| ) | [static] |
Function initializes an n-Dimension independent interpolation array at equally spaced intervals across the specified indepedent bounds.
| vXLo | an independent value lower bound constant across dimensions (x units) | |
| vXHi | an independent value upper bound constant across dimensions (x units) | |
| arNn | a pointer to an array containing data counts by dimension for the specified array arXn | |
| nDimen | number of dimensions of the interpolation table to analyze | |
| arXn | a pointer to a calculated n-Dimension independent value interpolation array (x units) |
| bool update | ( | const xType *const * | arXn = (xType**)(0), |
|
| const yType * | arYn = (yType*)(0) | |||
| ) |
Function performs preparatory calculations for error analysis.
| arXn | a pointer to an n-Dimension independent value interpolation array (x units) | |
| arYn | a pointer to an n-Dimension dependent value interpolation array (y units) |
const int DEF_GRID_SAMPLE = 1 [static] |
default test point count per dimension used in error calculations through grid selection (OptIntp::gridError())
const int DEF_LOOP_MAX = 1000 [static] |
default inital value used in optimization iterations (OptIntp::optimize())
const int DEF_RANDOM_COUNT = 2000 [static] |
default total test point count used in error calculations through random selection (OptIntp::randomError())
const int DEF_RANDOM_SEED = 1 [static] |
default inital value used in error calculations through random selection (OptIntp::randomError())
1.4.7