Matrices Library
mikroPascal PRO for dsPIC30/33 and PIC24 includes a library for operating and working with matrices. All routines work with fractional Q15 format.
Library Routines
Matrix_Transpose
Prototype |
procedure Matrix_Transpose(var src, dest: array[1024] of word; numRows, numCols: word); |
---|---|
Description |
Function does matrix transposition. dstM[i][j] = srcM[j][i] |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
var mx1 : array[6] of word; mxDest : array[9] of word; ... Matrix_Transpose(mx1, mxDest, 2, 3); |
Notes | [W0..W5] used, not restored |
Matrix_Subtract
Prototype |
procedure Matrix_Subtract(var src1, src2, dest: array[1024] of word; numRows, numCols: word); |
---|---|
Description |
Function does matrix subtraction. dstM[i][j] = srcM1[i][j] - srcM2[i][j] |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
var mx1 : array[6] of word; mx2 : array[6] of word; mxDest : array[9] of word; ... Matrix_Subtract(mx1, mx2, mxDest, 2, 3); |
Notes |
|
Matrix_Scale
Prototype |
procedure Matrix_Scale(ScaleValue: word; var src1, dest: array[1024] of word; numRows, numCols: word); |
---|---|
Description |
Function does matrix scale. dstM[i][j] = sclVal * srcM[i][j] |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
var mx1 : array[6] of word; mxDest : array[9] of word; ... Matrix_Scale(0x4000, mx1, mxDest, 2,3); |
Notes |
|
Matrix_Multiply
Prototype |
procedure Matrix_Multiply(var src1, src2, dest: array[256] of word; numRows1, numCols2, numCols1Rows2: word); |
---|---|
Description |
Function does matrix multiplication.
|
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
var mx1 : array[6] of word; mx2 : array[6] of word; mxDest : array[9] of word; ... Matrix_Multiply(mx1,mx2,mxDest,2,2,3); |
Notes |
|
Matrix_Add
Prototype |
procedure Matrix_Add(var src1, src2, dest: array[1024] of word; numRows, numCols: word); |
---|---|
Description |
Function does matrix addition. dstM[i][j] = srcM1[i][j] + srcM2[i][j] |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
var mx1 : array[6] of word; mx2 : array[6] of word; ... Matrix_Add(mx1,mx2,mxDest,2,3); |
Notes |
|
What do you think about this topic ? Send us feedback!