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

Functions

void tpt_cmplx_dot_prod_f32 (f32_t *__restrict aRealResult, f32_t *__restrict aImagResult, const f32_t *__restrict aInDataA, const f32_t *__restrict aInDataB, uint32_t aCount)
 Floating-point complex dot product. More...
 
void tpt_cmplx_dot_prod_q15 (q33_30_t *__restrict aRealResult, q33_30_t *__restrict aImagResult, const q15_t *__restrict aInDataA, const q15_t *__restrict aInDataB, uint32_t aCount)
 Q15 complex dot product. More...
 
void tpt_cmplx_dot_prod_q31 (q15_48_t *__restrict aRealResult, q15_48_t *__restrict aImagResult, const q31_t *__restrict aInDataA, const q31_t *__restrict aInDataB, uint32_t aCount)
 Q31 complex dot product. More...
 

Detailed Description

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

The aInDataA points to the first complex input vector and aInDataB points to the second complex input vector. aCount specifies the number of complex samples and the data in each array is stored in an interleaved fashion (real, imag, real, imag, ...). Each array has a total of 2 * aCount values.

The underlying algorithm is used:

    aRealResult = 0;
    aImagResult = 0;
    for (n = 0; n < aCount; n++)
    {
      aRealResult += aInDataA[2 * n + 0] * aInDataB[2 * n + 0]
  There are separate functions for floating-point, Q15, and Q31 data types. 

Function Documentation

◆ tpt_cmplx_dot_prod_f32()

void tpt_cmplx_dot_prod_f32 ( f32_t *__restrict  aRealResult,
f32_t *__restrict  aImagResult,
const f32_t *__restrict  aInDataA,
const f32_t *__restrict  aInDataB,
uint32_t  aCount 
)

Floating-point complex dot product.

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

◆ tpt_cmplx_dot_prod_q15()

void tpt_cmplx_dot_prod_q15 ( q33_30_t *__restrict  aRealResult,
q33_30_t *__restrict  aImagResult,
const q15_t *__restrict  aInDataA,
const q15_t *__restrict  aInDataB,
uint32_t  aCount 
)

Q15 complex dot product.

Parameters
[out]aRealResultreal part of the result returned here
[out]aImagResultimaginary part of the result returned here
[in]aInDataApoints to the first input vector.
[in]aInDataBpoints to the second input vector.
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator. The intermediate 1.15 by 1.15 multiplications are performed with full precision and yield a 2.30 result. These are accumulated in a 32-bit accumulator with 8.24 precision. The return results aRealResult and aImagResult are in Q24 format.

◆ tpt_cmplx_dot_prod_q31()

void tpt_cmplx_dot_prod_q31 ( q15_48_t *__restrict  aRealResult,
q15_48_t *__restrict  aImagResult,
const q31_t *__restrict  aInDataA,
const q31_t *__restrict  aInDataB,
uint32_t  aCount 
)

Q31 complex dot product.

Parameters
[out]aRealResultreal part of the result returned here
[out]aImagResultimaginary part of the result returned here
[in]aInDataApoints to the first input vector.
[in]aInDataBpoints to the second input vector.
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator. The intermediate 1.31 by 1.31 multiplications are performed with 64-bit precision and then shifted to 16.48 format. The internal real and imaginary accumulators are in 16.48 format and provide 15 guard bits. Additions are nonsaturating and no overflow will occur as long as aCount is less than 32768. The return results aRealResult and aImagResult are in 16.48 format. Input down scaling is not required.