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

Functions

void tpt_mat_cmplx_mult_f32 (f32_t *aOutMat, const f32_t *aInMatA, const f32_t *aInMatB, uint16_t aM, uint16_t aK, uint16_t aN)
 Floating-point Complex matrix multiplication. More...
 
void tpt_mat_cmplx_mult_f64 (f64_t *aOutMat, const f64_t *aInMatA, const f64_t *aInMatB, uint16_t aM, uint16_t aK, uint16_t aN)
 Floating-point Complex matrix multiplication. More...
 
void tpt_mat_cmplx_mult_q15 (q15_t *aOutMat, const q15_t *aInMatA, const q15_t *aInMatB, uint16_t aM, uint16_t aK, uint16_t aN)
 Q15 Complex matrix multiplication. More...
 
void tpt_mat_cmplx_mult_q31 (q31_t *aOutMat, const q31_t *aInMatA, const q31_t *aInMatB, uint16_t aM, uint16_t aK, uint16_t aN)
 Q31 Complex matrix multiplication. More...
 

Detailed Description

Complex Matrix Multiplication

Complex Matrix multiplication is only defined if the number of columns of the first matrix equals the number of rows of the second matrix. Multiplying an aM x aK matrix with an aK x aN matrix results in an aM x aN matrix. The caller should ensure that the number of columns of aInMatA equals the number of rows of aInMatB. There are separate functions for floating-point, Q15, and Q31 data types.

Function Documentation

◆ tpt_mat_cmplx_mult_f32()

void tpt_mat_cmplx_mult_f32 ( f32_t aOutMat,
const f32_t aInMatA,
const f32_t aInMatB,
uint16_t  aM,
uint16_t  aK,
uint16_t  aN 
)

Floating-point Complex matrix multiplication.

Parameters
[out]aOutMatpoints to output complex matrix
[in]aInMatApoints to first input complex matrix
[in]aInMatBpoints to second input complex matrix
[in]aMrows of first input complex matrix and output complex matrix
[in]aKcolumns of first input complex matrix and rows of second input complex matrix
[in]aNcolumns of second input complex matrix and output complex matrix
Returns
none

◆ tpt_mat_cmplx_mult_f64()

void tpt_mat_cmplx_mult_f64 ( f64_t aOutMat,
const f64_t aInMatA,
const f64_t aInMatB,
uint16_t  aM,
uint16_t  aK,
uint16_t  aN 
)

Floating-point Complex matrix multiplication.

Parameters
[out]aOutMatpoints to output complex matrix
[in]aInMatApoints to first input complex matrix
[in]aInMatBpoints to second input complex matrix
[in]aMrows of first input complex matrix and output complex matrix
[in]aKcolumns of first input complex matrix and rows of second input complex matrix
[in]aNcolumns of second input complex matrix and output complex matrix
Returns
none

◆ tpt_mat_cmplx_mult_q15()

void tpt_mat_cmplx_mult_q15 ( q15_t aOutMat,
const q15_t aInMatA,
const q15_t aInMatB,
uint16_t  aM,
uint16_t  aK,
uint16_t  aN 
)

Q15 Complex matrix multiplication.

Parameters
[out]aOutMatpoints to output complex matrix
[in]aInMatApoints to first input complex matrix
[in]aInMatBpoints to second input complex matrix
[in]aMrows of first input complex matrix and output complex matrix
[in]aKcolumns of first input complex matrix and rows of second input complex matrix
[in]aNcolumns of second input complex matrix and output complex matrix
Returns
none
Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator. The inputs to the multiplications are in 1.15 format and multiplications yield a 2.30 result. The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. This approach provides 33 guard bits and there is no risk of overflow. The 34.30 result is then truncated to 34.15 format by discarding the low 15 bits and then saturated to 1.15 format.

◆ tpt_mat_cmplx_mult_q31()

void tpt_mat_cmplx_mult_q31 ( q31_t aOutMat,
const q31_t aInMatA,
const q31_t aInMatB,
uint16_t  aM,
uint16_t  aK,
uint16_t  aN 
)

Q31 Complex matrix multiplication.

Parameters
[out]aOutMatpoints to output complex matrix
[in]aInMatApoints to first input complex matrix
[in]aInMatBpoints to second input complex matrix
[in]aMrows of first input complex matrix and output complex matrix
[in]aKcolumns of first input complex matrix and rows of second input complex matrix
[in]aNcolumns of second input complex matrix and output complex matrix
Returns
none
Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator. The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. There is no saturation on intermediate additions. Thus, if the accumulator overflows it wraps around and distorts the result. The input signals should be scaled down to avoid intermediate overflows. The input is thus scaled down by log2(aK) bits to avoid overflows, as a total of aK additions are performed internally. The 2.62 accumulator is right shifted by 31 bits and saturated to 1.31 format to yield the final result.