Loading...
Searching...
No Matches
volk_32f_x3_sum_of_poly_32f

Overview

Calculates the unscaled area under a fourth order polynomial using the rectangular method. The result is the sum of y-values. To get the area, multiply by the rectangle/bin width.

Expressed as a formula, this function calculates

Dispatcher Prototype

void volk_32f_x3_sum_of_poly_32f(float* target, float* src0, float* center_point_array,
float* cutoff, unsigned int num_points)

Inputs

- src0: x values
- center_point_array: polynomial coefficients in order {c1, c2, c3, c4, c0}
- cutoff: the minimum x value to use (will clamp to cutoff if input < cutoff)
- num_points: The number of values in both input vectors.

Outputs

- complexVector: The sum of y values generated by polynomial.

Example The following estimates by using the Taylor expansion centered around ,

int npoints = 4096;
float* coefficients = (float*)volk_malloc(sizeof(float) * 5, volk_get_alignment());
float* input = (float*)volk_malloc(sizeof(float) * npoints,
volk_get_alignment()); float* result = (float*)volk_malloc(sizeof(float),
volk_get_alignment()); float* cutoff = (float*)volk_malloc(sizeof(float),
volk_get_alignment());
// load precomputed Taylor series coefficients
coefficients[0] = 4.48168907033806f; // c1
coefficients[1] = coefficients[0] * 0.5f; // c2
coefficients[2] = coefficients[0] * 1.0f/6.0f; // c3
coefficients[3] = coefficients[0] * 1.0f/24.0f; // c4
coefficients[4] = coefficients[0]; // c0
*cutoff = -2.0;
*result = 0.0f;
// generate uniform input data
float dx = (float)M_PI/ (float)npoints;
for(unsigned int ii=0; ii < npoints; ++ii){
input[ii] = dx * (float)ii - 1.5f;
}
volk_32f_x3_sum_of_poly_32f(result, input, coefficients, cutoff, npoints);
// multiply by bin width to get approximate area
std::cout << "result is " << *result * (input[1]-input[0]) << std::endl;
volk_free(coefficients);
volk_free(input);
volk_free(result);
volk_free(cutoff);