VF_polyVD_polyVE_poly
VFx_polyVDx_polyVEx_poly
FunctionPolynomial
Syntax C/C++#include <VFmath.h>
int VF_poly( fVector Y, fVector X, ui size, fVector Coeff, unsigned deg );
int VFx_poly( fVector Y, fVector X, ui size, fVector Coeff, unsigned deg, float A, float B );
int VFu_poly( fVector Y, fVector X, ui size, fVector Coeff, unsigned deg );
int VFux_poly( fVector Y, fVector X, ui size, fVector Coeff, unsigned deg, float A, float B );
C++ VecObj#include <OptiVec.h>
int vector<T>::poly( const vector<T>& X, const vector<T>& Coeff, unsigned deg );
int vector<T>::x_poly( const vector<T>& X, const vector<T>& Coeff, unsigned deg, const T& A, const T& B );
Pascal/Delphiuses VFmath;
function VF_poly( Y, X:fVector; size:UIntSize; Coeff:fVector; deg:UInt ): IntBool;
function VFx_poly( Y, X:fVector; size:UIntSize; Coeff:fVector; deg:UInt; A, B:Single ): IntBool;
function VFu_poly( Y, X:fVector; size:UIntSize; Coeff:fVector; deg:UInt ): IntBool;
function VFux_poly( Y, X:fVector; size:UIntSize; Coeff:fVector; deg:UInt; A, B:Single ): IntBool;
CUDA function C/C++#include <cudaVFmath.h>
int cudaVF_poly( fVector d_Y, fVector d_X, ui size, fVector h_Coeff, unsigned deg );
int cusdVF_poly( fVector d_Y, fVector d_X, ui size, fVector d_Coeff, unsigned deg );
int cudaVFx_poly( fVector d_Y, fVector d_X, ui size, fVector h_Coeff, unsigned deg, float A, float B );
int cusdVFx_poly( fVector d_Y, fVector d_X, ui size, fVector d_Coeff, unsigned deg, float *d_A, float *d_B );
int cudaVFu_poly( fVector d_Y, fVector d_X, ui size, fVector h_Coeff, unsigned deg );
int cusdVFu_poly( fVector d_Y, fVector d_X, ui size, fVector d_Coeff, unsigned deg );
int cudaVFux_poly( fVector d_Y, fVector d_X, ui size, fVector h_Coeff, unsigned deg, float A, float B );
int cusdVFux_poly( fVector d_Y, fVector d_X, ui size, fVector d_Coeff, unsigned deg, float *d_A, float *d_B );
int VFcu_poly( fVector h_Y, fVector h_X, ui size, fVector h_Coeff, unsigned deg );
int VFxcu_poly( fVector h_Y, fVector h_X, ui size, fVector h_Coeff, unsigned deg, float A, float B );
int VFucu_poly( fVector h_Y, fVector h_X, ui size, fVector h_Coeff, unsigned deg );
int VFuxcu_poly( fVector h_Y, fVector h_X, ui size, fVector h_Coeff, unsigned deg, float A, float B );
CUDA function Pascal/Delphiuses VFmath;
function cudaVF_poly( d_Y, d_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt ): IntBool;
function cusdVF_poly( d_Y, d_X:fVector; size:UIntSize; d_Coeff:fVector; deg:UInt ): IntBool;
function cudaVFx_poly( d_Y, d_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt; A, B:Single ): IntBool;
function cusdVFx_poly( d_Y, d_X:fVector; size:UIntSize; d_Coeff:fVector; deg:UInt; d_A, d_B:PSingle ): IntBool;
function cudaVFu_poly( d_Y, d_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt ): IntBool;
function cusdVFu_poly( d_Y, d_X:fVector; size:UIntSize; d_Coeff:fVector; deg:UInt ): IntBool;
function cudaVFux_poly( d_Y, d_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt; A, B:Single ): IntBool;
function cusdVFux_poly( d_Y, d_X:fVector; size:UIntSize; d_Coeff:fVector; deg:UInt; d_A, d_B:PSingle ): IntBool;
function VFcu_poly( h_Y, h_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt ): IntBool;
function VFxcu_poly( h_Y, h_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt; A, B:Single ): IntBool;
function VFucu_poly( h_Y, h_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt ): IntBool;
function VFuxcu_poly( h_Y, h_X:fVector; size:UIntSize; h_Coeff:fVector; deg:UInt; A, B:Single ): IntBool;
Descriptionnormal versions:
Yi = c0 + c1 * Xi + c2 * Xi2 + ... + cn * Xin
expanded versions:
xi = (A*Xi + B),
Yi = c0 + c1 * xi + c2 * xi2 + ... + cn * xin

A polynomial of degree deg is generated for every element of X, using the coefficients contained in the vector Coeff. The coefficients in Coeff have to be ordered in such a way that the constant term is the zero'th element, the linear coefficient the first element etc., up to the deg'th element which is the coefficient for the highest power used in the polynomial. (Beware a frequent source of errors: for a polynomial of deg = 4, there are 5 (!) coefficients; do not forget the constant term).

"unprotected" versions (prefix VFu_,   VFux_, etc.):
These functions do not perform any error handling, which makes them much faster (up to 50%) than the standard versions.

Error handlingOVERFLOW errors lead to ±HUGE_VAL as the default result. In contrast to the ANSI C function poly (where deg is declared as int), the declaration of deg as unsigned precludes DOMAIN errors (which would occur for negative deg).
Return valueFALSE (0), if no error occurred, otherwise TRUE (non-zero)
See alsoVF_ipow,   VF_pow,   poly

VectorLib Table of Contents  OptiVec home