LIBML  Version 3.2.4
LIBML DSP Software Library
Functions
Vector Dot Product
Collaboration diagram for Vector Dot Product:

Functions

void tpt_dot_prod_f32 (f32_t *aResult, const f32_t *aInDataA, const f32_t *aInDataB, uint32_t aCount)
 Dot product of floating-point vectors. More...
 
void tpt_dot_prod_f64 (f64_t *aResult, const f64_t *aInDataA, const f64_t *aInDataB, uint32_t aCount)
 Dot product of floating-point vectors. More...
 
void tpt_dot_prod_q15 (q33_30_t *aResult, const q15_t *aInDataA, const q15_t *aInDataB, uint32_t aCount)
 Dot product of Q15 vectors. More...
 
void tpt_dot_prod_q31 (q15_48_t *aResult, const q31_t *aInDataA, const q31_t *aInDataB, uint32_t aCount)
 Dot product of Q31 vectors. More...
 
void tpt_dot_prod_q7 (q17_14_t *aResult, const q7_t *aInDataA, const q7_t *aInDataB, uint32_t aCount)
 Dot product of Q7 vectors. More...
 

Detailed Description

Computes the dot product of two vectors. The vectors are multiplied element-by-element and then summed.

     sum = aInDataA[0]*aInDataB[0] + aInDataA[1]*aInDataB[1] + ... +
     aInDataA[aCount-1]*aInDataB[aCount-1]
  

There are separate functions for floating-point, Q7, Q15, and Q31 data types.

Function Documentation

◆ tpt_dot_prod_f32()

void tpt_dot_prod_f32 ( f32_t aResult,
const f32_t aInDataA,
const f32_t aInDataB,
uint32_t  aCount 
)

Dot product of floating-point vectors.

Parameters
[out]aResultoutput result returned here.
[in]aInDataApoints to first input vector
[in]aInDataBpoints to second input vector
[in]aCountnumber of samples in each vector
Returns
none

◆ tpt_dot_prod_f64()

void tpt_dot_prod_f64 ( f64_t aResult,
const f64_t aInDataA,
const f64_t aInDataB,
uint32_t  aCount 
)

Dot product of floating-point vectors.

Parameters
[out]aResultoutput result returned here.
[in]aInDataApoints to first input vector
[in]aInDataBpoints to second input vector
[in]aCountnumber of samples in each vector
Returns
none

◆ tpt_dot_prod_q15()

void tpt_dot_prod_q15 ( q33_30_t aResult,
const q15_t aInDataA,
const q15_t aInDataB,
uint32_t  aCount 
)

Dot product of Q15 vectors.

Parameters
[out]aResultoutput result returned here.
[in]aInDataApoints to first input vector
[in]aInDataBpoints to second input vector
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The intermediate multiplications are in 1.15 x 1.15 = 2.30 format and these results are added to a 64-bit accumulator in 34.30 format. Nonsaturating additions are used and given that there are 33 guard bits in the accumulator there is no risk of overflow. The return result is in 34.30 format.

◆ tpt_dot_prod_q31()

void tpt_dot_prod_q31 ( q15_48_t aResult,
const q31_t aInDataA,
const q31_t aInDataB,
uint32_t  aCount 
)

Dot product of Q31 vectors.

Parameters
[out]aResultoutput result returned here.
[in]aInDataApoints to first input vector
[in]aInDataBpoints to second input vector
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The intermediate multiplications are in 1.31 x 1.31 = 2.62 format and these are truncated to 2.48 format by discarding the lower 14 bits. The 2.48 result is then added without saturation to a 64-bit accumulator in 16.48 format. There are 15 guard bits in the accumulator and there is no risk of overflow as long as the length of the vectors is less than 2^16 elements. The return result is in 16.48 format.

◆ tpt_dot_prod_q7()

void tpt_dot_prod_q7 ( q17_14_t aResult,
const q7_t aInDataA,
const q7_t aInDataB,
uint32_t  aCount 
)

Dot product of Q7 vectors.

Parameters
[out]aResultoutput result returned here.
[in]aInDataApoints to first input vector
[in]aInDataBpoints to second input vector
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The intermediate multiplications are in 1.7 x 1.7 = 2.14 format and these results are added to an accumulator in 18.14 format. Nonsaturating additions are used and there is no danger of wrap around as long as the vectors are less than 2^18 elements long. The return result is in 18.14 format.