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

Functions

void tpt_cmplx_mag_f32 (f32_t *__restrict aOutData, const f32_t *__restrict aInData, uint32_t aCount)
 Floating-point complex magnitude. More...
 
void tpt_cmplx_mag_f64 (f64_t *__restrict aOutData, const f64_t *__restrict aInData, uint32_t aCount)
 Floating-point complex magnitude. More...
 
void tpt_cmplx_mag_q15 (q1_14_t *__restrict aOutData, const q15_t *__restrict aInData, uint32_t aCount)
 Q15 complex magnitude. More...
 
void tpt_cmplx_mag_q31 (q1_30_t *__restrict aOutData, const q31_t *__restrict aInData, uint32_t aCount)
 Q31 complex magnitude. More...
 

Detailed Description

Computes the magnitude of the elements of a complex data vector.

The aInData points to the source data and aOutData points to the where the result should be written. aCount specifies the number of complex samples in the input array and the data is stored in an interleaved fashion (real, imag, real, imag, ...). The input array has a total of 2*aCount values; the output array has a total of aCount values.

The underlying algorithm is used:

    for (n = 0; n < aCount; n++)
    {
      aOutData[n] = sqrt(aInData[2 * n + 0] ^ 2 + aInData[2 * n + 1] ^ 2);
    }
  

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

Function Documentation

◆ tpt_cmplx_mag_f32()

void tpt_cmplx_mag_f32 ( f32_t *__restrict  aOutData,
const f32_t *__restrict  aInData,
uint32_t  aCount 
)

Floating-point complex magnitude.

Parameters
[out]aOutDatapoints to the output vector.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in each vector
Returns
none

◆ tpt_cmplx_mag_f64()

void tpt_cmplx_mag_f64 ( f64_t *__restrict  aOutData,
const f64_t *__restrict  aInData,
uint32_t  aCount 
)

Floating-point complex magnitude.

Parameters
[out]aOutDatapoints to the output vector.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in each vector
Returns
none

◆ tpt_cmplx_mag_q15()

void tpt_cmplx_mag_q15 ( q1_14_t *__restrict  aOutData,
const q15_t *__restrict  aInData,
uint32_t  aCount 
)

Q15 complex magnitude.

Parameters
[out]aOutDatapoints to the output vector.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The function implements 1.15 by 1.15 multiplications and finally output is converted into 2.14 format.

◆ tpt_cmplx_mag_q31()

void tpt_cmplx_mag_q31 ( q1_30_t *__restrict  aOutData,
const q31_t *__restrict  aInData,
uint32_t  aCount 
)

Q31 complex magnitude.

Parameters
[out]aOutDatapoints to the output vector.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in each vector
Returns
none
Scaling and Overflow Behavior
The function implements 1.31 by 1.31 multiplications and finally output is converted into 2.30 format. Input down scaling is not required.