FunctionDiagonal-rational interpolation of X-Y-MZ-table values
Syntax C/C++#include <MFstd.h>
void MF_ratinterpol( fMatrix MZ, fVector X, fVector Y, ui ht, ui len, fVector XTab, fVector YTab, fMatrix MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
C++ VecObj#include <OptiVec.h>
void matrix<T>::ratinterpol( const vector<T>& X, const vector<T>& Y, const vector<T>& XTab, const vector<T>& YTab, const matrix<T>& MZTab, unsigned degX, unsigned degY );
Pascal/Delphiuses MFstd;
procedure MF_ratinterpol( MZ:fMatrix; X, Y:fVector; ht, len:UIntSize; XTab, YTab:fVector; MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt );
CUDA function C/C++#include <cudaMFstd.h>
int cudaMF_ratinterpol( fMatrix d_MZ, fVector d_X, fVector d_Y, ui ht, ui len, fVector d_XTab, fVector d_YTab, fMatrix d_MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
void MFcu_ratinterpol( fMatrix h_MZ, fVector h_X, fVector h_Y, ui ht, ui len, fVector h_XTab, fVector h_YTab, fMatrix h_MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
CUDA function Pascal/Delphiuses MFstd;
function cudaMF_ratinterpol( d_MZ:fMatrix; d_X, d_Y:fVector; ht, len:UIntSize; d_XTab, d_YTab:fVector; d_MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt ): IntBool;
procedure MFcu_ratinterpol( h_MZ:fMatrix; h_X, h_Y:fVector; ht, len:UIntSize; h_XTab, h_YTab:fVector; h_MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt );
DescriptionFor each of the htlen x / y coordinates defined by X and Y, the corresponding element of MZ is interpolated from the XTab-YTab-MZTab values. XTab and YTab must be ordered (either ascending or descending). All values of XTab as well as of YTab must be distinct; otherwise a division by zero may occur and lead to a program abort. The parameter degX denotes the number of points that will be taken into account for the interpolation in X direction. Similarly, degY denotes the number of points taken into account for the interpolation in Y direction. The diagonal rational interpolation scheme by Stoer and Bulirsch is used. The interpolating function is formed by the quotient of two polynomials, the polynomial in the denominator being of the same order (for even deg) or of an order higher by one (for odd deg) than the polynomial of the numerator.
Diagonal rational interpolation is superior to polynomial interpolation, especially in the presence of poles. It is, however, much slower.
deg must be between 3 and 20. Additionally, degX may not be larger than lentab-1; degY may not be larger than httab-1.
Error handlingA pole (infinity) in the interpolated function is recognized and leads to a SING error with the proposed result being ±HUGE_VAL. (Note: the x-value passed to _matherr is the first element of XTab, if the error occurs while interpolating in X directions, or the first element of YTab, if the error occurs while interpolationg in Y directions). Trying to use too many elements for the interpolation (degX or degY > 20) leads to an error message "Not possible with more than 20 elements" and to a program abort. If degX or degY are < 3, or if degX exceeds lentab-1, or if degY exceeds httab-1, an error message "Invalid parameter(s)" is displayed and the program aborted.
No other errors are detected (you have to take care yourself that the XTab and YTab values are distinct).
Return valuenone
See alsoMF_polyinterpol,   MF_natCubSplineInterpol,   VF_ratinterpol

MatrixLib Table of Contents  OptiVec home