4.4.1 MatrixAdd
Description
MatrixAdd adds the value of each element in the source one matrix with its counterpart in the source two matrix and places the result in the destination matrix.
Prototype
fractional* MatrixAdd (int numRows, int numCols, fractional* dstM, fractional* srcM1, fractional* srcM2);
Arguments
Parameters |
Description |
---|---|
numRows |
Number of rows in the source matrices. |
numCols |
Number of columns in the source matrices. |
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 srcM1[r][c] + srcM2[r][c] is larger than the maximum value of the 1.31 fractional data type, this operation results in saturation for the nth element.
This function can be computed in place.
This function can be self applicable.
Source File
- madd_aa.s
Function Profile
Device |
Program Words |
Cycles |
---|---|---|
PIC32A |
11 |
38 + 4*(numRows * numCols) |
System resource usage
- W0…W5 - used, not restored
- ACCA - used, not restored
- CORCON - saved, used, restored
- REPEAT instruction(s) usage – None