4.4.2 MatrixMultiply

Description

MatrixMultiply performs the matrix multiplication between the source one and source two matrices and places the result in the destination matrix.

Symbolically:

where:

0 ≤ i < numRows1

0 ≤ j < numCols2

0 ≤ k < numCols1Rows2

Prototype

fractional* MatrixMultiply (int numRows1, int numCols1Rows2, int numCols2, fractional* dstM, fractional* srcM1, fractional* srcM2);

Arguments

Parameters

Description

numRows1

Number of rows in the source one matrix.

numCols1Rows2

Number of columns in the source one matrix which is same as number of rows in the source two matrix.

numCols2

Number of columns in the source two matrix.

dstM

Pointer to the destination matrix

srcM1

Pointer to the source one matrix

srcM2

Pointer to the source two matrix

Returns

Pointer to the base address of the destination matrix.

Remarks

If the absolute value of result in dstM[r][c] is larger than the maximum value of the 1.31 fractional data type, this operation results in saturation for the (r,c)th element.

If the source one matrix is squared, then this function can be computed in place and can be self-applicable.

Source File

  • mmul_aa.s

Function Profile

Device

Program Words

Cycles

PIC32A

27

45+numRows1*(6+numCols2*(9+4*(numCols1Rows2 - 1)))

System resource usage

  • W0…W7 - used, not restored
  • W8…W12 - saved, used, restored
  • ACCA - used, not restored
  • CORCON - saved, used, restored
  • REPEAT instruction(s) usage – None