Poly Class Template Reference

Class template interpolates tabulated data with polynomials. More...

#include <Intp.h>

Inherits Intp< xType, yType >.

Inheritance diagram for Poly:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual yType eval (xType x) throw (IntpErr)
xType getError (void) const
 Poly (const Intp< xType, yType > &in)
 Poly (const Poly< xType, yType > &po)
 Poly (const xType *arX, const yType *arY, int nCount, int nPoints=DEF_POINTS)
bool setCount (int nPoints)
 ~Poly (void)

Static Public Attributes

static const int DEF_POINTS = 4

Detailed Description

template<typename xType, typename yType>
class calc::Poly< xType, yType >

Class template interpolates tabulated data with polynomials.

In instantiation, an object is supplied with a one-dimensional set of independent variable and corresponding dependent variable data tables with a specific domain and range. The dependent data must be defined at every independent data point, continuous, and single-valued. When the interpolation object is evaluated within the data table domain, an interpolation value is calculated and returned. Fixed degree polynomials of a user-specified number are used for interpolation. A polynomial curve is calculated to fit sequential data points. The data point count of the curve is based on the order of the polynomial.

The declaration typename <xType> specifies the form of independent variables used in interpolation calculations. The declaration typename <yType> specifies the form of solution variables used in interpolation calculations. In general, the <yType> variables should be the equal or superset of the <xType> variables.

Author
efgeorge
Date
2006/07/19 13:21:43
Revision
1.3
Examples:

example_Intp.txt.


Constructor & Destructor Documentation

Poly ( const xType *  arX,
const yType *  arY,
int  nCount,
int  nPoints = DEF_POINTS 
)

Constructor initializes a polynomial interpolation object.

Parameters:
arX a pointer to an independent value interpolation array (x units)
arY a pointer to a dependent value interpolation array (y units)
nCount data count for the specified arrays arX and arY
nPoints data point count of polynomials used in interpolation evaluations (optional)
Remarks:
  • The data count value nCount must be greater than zero.
  • The polynomial point count value nPoints must be greater than zero.
  • The value nPoints should, be at most, equal to the data count value nCount.
  • If the value nPoints is not specified, a default value of Poly::DEF_POINTS is used, and may be decreased based on the data count value nCount.
  • The degree of polynomials used in interpolation evaluations is one less than the polynomial point count.

Poly ( const Poly< xType, yType > &  po  ) 

Copy constructor initializes a polynomial interpolation object from the specified existing polynomial interpolation object.

Parameters:
po a reference to a polynomial interpolation object

Poly ( const Intp< xType, yType > &  in  ) 

Copy constructor initializes a polynomial interpolation object from the specified existing interpolation object.

Parameters:
in a reference to an interpolation object
Remarks:
  • The existing interpolation polynomial data point count is is transferred to the new interpolation object.
  • Cube interpolation objects carry an existing interpolation polynomial data point count of Cube::DEF_POINTS.

~Poly ( void   ) 

Destructor frees allocated memory.


Member Function Documentation

yType eval ( xType  x  )  throw (IntpErr) [virtual]

Virtual function interpolates the dependent data at the specified independent data value.

Parameters:
x an independent value interpolation point (x units)
Returns:
calculated interpolation value evaluated at value x (y units)
Exceptions:
IntpErr type of object thrown

Implements Intp.

xType getError ( void   )  const

Function returns an error estimate to the last polynomial evaluation made through a call to Poly::eval().

Returns:
an error estimate to the polynomial interpolation (|y| units)

bool setCount ( int  nPoints  ) 

Function sets the number of data points used in polynomial interpolation evaluations.

Parameters:
nPoints the point count of interpolation polynomials
Returns:
status flag
  • false (successful execution)
  • true (execution error, parameter not set)
Remarks:
  • The polynomial point count value nPoints must be greater than zero and less than or equal to the data count value of the independent and dependent interpolation arrays.
  • The degree of polynomials used in interpolation evaluations is one less than the polynomial point count.


Member Data Documentation

const int DEF_POINTS = 4 [static]

default interpolation polynomial data point count

Reimplemented from Intp.


The documentation for this class was generated from the following files:
Generated on Wed Jul 19 09:24:21 2006 for CalcLib by  doxygen 1.4.7