1.4.2.26 DSP_MatrixSub32 Function

Subtraction of two matrices C = (A - B).

Description

void DSP_MatrixSub32(matrix32 *resMat, matrix32 *srcMat1, matrix32 *srcMat2);

Vector subtraction of two matrices, where both have 32-bit integer elements. The resulting output will saturate if element addition exceeds MAX32 or MIN32.

Preconditions

Both matrices must be equivalent in rows and columns. All Matrices must be set into structure (ROWS, COLUMNS, vector_pointer)

Parameters

resMat pointer to different Matrix C structure (*int32_t)

srcMat1 pointer to the Matrix A structure (*int32_t)

srcMat2 pointer to the Matrix B structure (*int32_t)

Returns

None.

Remarks

Execution Time (cycles): 222 cycles + 21 / matrix_element. The function will saturate the output value if it exceeds maximum limits per element.

Example

#define ROW 2

#define COL 2

matrix32 *resMat, *srcMat1, *srcMat2;

int32_t result[ROW*COL];

int32_t matA[ROW*COL] = {5,2,-3,8};

int32_t matB[ROW*COL] = {2,2,2,2};

matrix32 mat, mat2, mat3;

resMat=&mat;

srcMat1=&mat2;

srcMat2=&mat3;

srcMat1->row=ROW;

srcMat1->col=COL;

srcMat1->pMatrix=matA;

srcMat2->col=COL;

srcMat2->row=ROW;

srcMat2->pMatrix=matB;

resMat->row=ROW;

resMat->col=COL;

resMat->pMatrix=result;

DSP_MatrixSub32(resMat, srcMat1, srcMat2);

_// result[i] = matA[i] - matB[i] = {3,0,-5,6}_

C

void  DSP_MatrixSub32 (matrix32 * resMat , matrix32 * srcMat1 , matrix32 * srcMat2 );