CSI-DSP  Version 1.0.0
CSI DSP Software Library
Functions

Functions

q31_t csky_dsp_lib_vec_dot_q15 (q15_t *A, q15_t *B, uint32_t N)
 Q15 vector dot product. More...
 
q31_t csky_dsp_lib_vec_dot_q31 (q31_t *A, q31_t *B, uint32_t N)
 Q31 vector dot product. More...
 

Description

Compute the dot product of two vector, the computaional process is:

for(i=0; i < N; i++)
{
    Result += (*(A+i)) * (*(B+i));
}

support for q15 and q31 format.

Function Documentation

q31_t csky_dsp_lib_vec_dot_q15 ( q15_t A,
q15_t B,
uint32_t  N 
)
Parameters
[in]*Apoints to the input buffer a
[in]*Bpoints to the input buffer b
[in]Nnumber of samples in each vector
Returns
the dot product result

Scaling and Overflow Behavior:

32 bit arithmetic is used throughout this function. when two Q15 numbers are multiplied together, the resulting Q30 bit number is added to the Q31 accumulator. Finally, the result will be shift to left in one bit with saturation, so the output value is between[0x80000000, 0x7FFFFFFF].

Note
The accuumulator used in this function is 32 bit, so only one bit can be used as guard bit. Care to use it avoid of overflow.
q31_t csky_dsp_lib_vec_dot_q31 ( q31_t A,
q31_t B,
uint32_t  N 
)
Parameters
[in]*Apoints to the input buffer a
[in]*Bpoints to the input buffer b
[in]Nnumber of samples in each vector
Returns
the dot product result

Scaling and Overflow Behavior:

64 bit arithmetic is used throughout this function. when two Q31 numbers are multiplied together, the resulting Q62 bit number is added to the Q63 accumulator. Finally, the result will be shift to right in 31 bit with saturation, so the output value is between[0x80000000, 0x7FFFFFFF].

Note
The accuumulator used in this function is 64 bit, so only one bit can be used as guard bit. Care to use it avoid of overflow.