Loading...
Searching...
No Matches
volk_32f_sincos_32f_x2

Overview

Computes sine and cosine of the input vector simultaneously. More efficient than calling sin and cos separately since argument reduction is shared.

Dispatcher Prototype

void volk_32f_sincos_32f_x2(float* sinVector, float* cosVector, const float* inVector,
unsigned int num_points)

Inputs

- inVector: The input vector of angles in radians.
- num_points: The number of data points.

Outputs

- sinVector: The output vector of sine values.
- cosVector: The output vector of cosine values.

Example Calculate sin and cos for common angles.

int N = 4;
unsigned int alignment = volk_get_alignment();
float* in = (float*)volk_malloc(sizeof(float)*N, alignment);
float* sin_out = (float*)volk_malloc(sizeof(float)*N, alignment);
float* cos_out = (float*)volk_malloc(sizeof(float)*N, alignment);
in[0] = 0.000;
in[1] = 0.524; // ~pi/6
in[2] = 1.047; // ~pi/3
in[3] = 1.571; // ~pi/2
volk_32f_sincos_32f_x2(sin_out, cos_out, in, N);
for(unsigned int ii = 0; ii < N; ++ii){
printf("sincos(%1.3f) = (%1.3f, %1.3f)\n", in[ii], sin_out[ii], cos_out[ii]);
}
volk_free(in);
volk_free(sin_out);
volk_free(cos_out);