Functions | |
float32_t | arm_cos_f32 (float32_t x) |
q31_t | arm_cos_q31 (q31_t x) |
q15_t | arm_cos_q15 (q15_t x) |
Variables | |
static const float32_t | cosTable [259] |
static const q31_t | cosTableQ31 [259] |
static const q15_t | cosTableQ15 [259] |
Computes the trigonometric cosine function using a combination of table lookup and cubic interpolation. There are separate functions for Q15, Q31, and floating-point data types. The input to the floating-point version is in radians while the fixed-point Q15 and Q31 have a scaled input with the range [0 1) mapping to [0 2*pi).
The implementation is based on table lookup using 256 values together with cubic interpolation. The steps used are:
a*wa + b*wb + c*wc + d*wd
where
a=Table[index-1]; b=Table[index+0]; c=Table[index+1]; d=Table[index+2];
and
wa=-(1/6)*fract.^3 + (1/2)*fract.^2 - (1/3)*fract; wb=(1/2)*fract.^3 - fract.^2 - (1/2)*fract + 1; wc=-(1/2)*fract.^3+(1/2)*fract.^2+fract; wd=(1/6)*fract.^3 - (1/6)*fract;
float32_t arm_cos_f32 | ( | float32_t | x ) |
Fast approximation to the trigonometric cosine function for floating-point data.
[in] | x | input value in radians. |
Definition at line 186 of file arm_cos_f32.c.
q31_t arm_cos_q31 | ( | q31_t | x ) |
Fast approximation to the trigonometric cosine function for Q31 data.
[in] | x | Scaled input value in radians. |
The Q31 input value is in the range [0 +1) and is mapped to a radian value in the range [0 2*pi).
Definition at line 130 of file arm_cos_q31.c.
q15_t arm_cos_q15 | ( | q15_t | x ) |
Fast approximation to the trigonometric cosine function for Q15 data.
[in] | x | Scaled input value in radians. |
The Q15 input value is in the range [0 +1) and is mapped to a radian value in the range [0 2*pi).
Definition at line 99 of file arm_cos_q15.c.
const float32_t cosTable[259] [static] |
for(n = -1; n < (tableSize + 1); n++) { cosTable[n+1]= cos(2*pi*n/tableSize); }where pi value is 3.14159265358979
Definition at line 80 of file arm_cos_f32.c.
const q31_t cosTableQ31[259] [static] |
for(n = -1; n < (tableSize + 1); n++) { cosTable[n+1]= cos(2*pi*n/tableSize); }where pi value is 3.14159265358979
Definition at line 54 of file arm_cos_q31.c.
const q15_t cosTableQ15[259] [static] |
for(n = -1; n < (tableSize + 1); n++) { cosTable[n+1]= cos(2*pi*n/tableSize); }where pi value is 3.14159265358979
Definition at line 54 of file arm_cos_q15.c.