PolyEv1D

Advanced Analysis Library Only

AnalysisLibErrType PolyEv1D (double inputArray[], int numberOfElements, double coefArray[], int numCoefficients, double outputArray[]);

Purpose

Performs a polynomial evaluation on the input array. PolyEv1D obtains the element of the output array using the following formula:

where i is the array index, k is numCoefficients, p is the coefficient index, and coef is coefArray.

The size of coefArray must be greater than or equal to the order of the polynomial plus 1.

PolyEv1D can perform the operation in place; that is, the input and output arrays can be the same.

Example

/* Generate an array with random numbers, let the Ramp function generate the coefficients { 1, 2, 3, 4, 5} and find the polynomial evaluation of the array. */
double x[20], y[20], a[5];
double first, last;
int n, k;
n = 20;
k = 5;
first = 1.0;
last = 5.0;
Uniform (n, 17, x);
Ramp (k, first, last, a);
PolyEv1D (x, n, a, k, y);

Parameters

Input
Name Type Description
inputArray double-precision array Input array used as the basis for the polynomial evaluation.
numberOfElements integer Number of elements used in the polynomial evaluation of the input array.
coefArray double-precision array The array that contains the coefficients used in the polynomial evaluation of the input array.

If there are k coefficients, the order of the polynomial is k – 1.
numCoefficients integer Number of coefficients used in the polynomial evaluation.

This parameter does not specify the polynomial order. The polynomial order is numCoefficients – 1.

Default Value: 1.
Output
Name Type Description
outputArray double-precision array Polynomially evaluated array.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.