Summary
Matrix multiplication.
Class
TMtx
Declaration
Function Mul(Mtx1, Mtx2: TMtx; Mtx1Type: TMtxType; Mtx2Type: TMtxType = mtGeneral; Operation1: TMtxOperation = opNone; Operation2: TMtxOperation = opNone): TMtx;
Description
Left side multiply Mtx2 with Mtx1 matrix and store the results in the calling matrix. If parameters Mtx1Type and/or Mtx2Type are specified, the optimized multiplication method will be used. If parameters Mtx1Type and/or Mtx2Type are omitted, default values (general matrix) will be used. If Operation1 and/or Operation2 parameters are specified, perform additional operation on Mtx1 or Mtx2. If Operation1 and/or Operation2 parameters are omitted, the default values (no operation) will be used. The
Rows,
Cols and
Complex properties of the calling matrix are adjusted automatically. An exception is raised is Mtx1 Cols property does not match the Mtx2 Rows property (matrix multiplication is not possible). An exception is raised, if Complex property of Mtx1 and Mtx2 does not match.
Declaration
Function Mul(Mtx1, Mtx2: TMtx; Operation1: TMtxOperation; Operation2: TMtxOperation = opNone): TMtx;
Description
If Operation1 and/or Operation2 parameters are specified, perform additional operation on Mtx1 or Mtx2. If Operation1 and/or Operation2 parameters are omitted, the default values (no operation) will be used. The
Rows,
Cols and
Complex properties of the calling matrix are adjusted automatically. An exception is raised is Mtx1 Cols property does not match the Mtx2 Rows property (matrix multiplication is not possible). An exception is raised, if Complex property of Mtx1 and Mtx2 does not match.
Declaration
Function Mul(Mtx1, Mtx2: TMtx): TMtx;
Description
Performs matrix multiplication. In most general case the matrix multiplication is defined by the following equation (result = calling matrix):

where a and b are Alfa and Beta variables. The default values for a and b are Cplx(1,0) and Cplx(0,0), so the above equation is reduced to:

The Operation1 and Operation2 indicate additional operations, performed on Mtx1 and Mtx2 respectively. Default value for operation is opNone (no additional operation). The Mtx1Type and Mtx2Type parameters indicate the type of Mtx1 and Mtx2 matrices. Depending what type of matrices you are multiplying, the Mul method will choose most optimized multiplication method. So, choosing the correct values for Mtx1Type and Mtx2Type can significantly speed up the multiplication.
This overloaded function performs a left side multiply operation Mtx2 with Mtx1 matrix and stores the results in the calling matrix. If Operation1 and/or Operation2 parameters are specified, perform additional operation on Mtx1 or Mtx2. If Operation1 and/or Operation2 parameters are omitted, the default values (no operation) will be used. The Rows, Cols and Complex properties of the calling matrix are adjusted automatically. An exception is raised is Mtx1 Cols property does not match the Mtx2 Rows property (matrix multiplication is not possible). An exception is raised, if Complex property of Mtx1 and Mtx2 does not match.
Notes:
1. NOTE: If you are not sure, which type of matrix are you multiplying, you can use the mtGeneral type (general case). You can also use the DetectMtxType method to determine the type of matrix.
2. The routine is multithreaded, if specified by the environment variable.
Example 1
var A,B,C: TMtx;
begin
CreateIt(A,B,C);
try
A.SetIt(2,2,False,[1,2,
2,4]);
B.SetIt(2,2,False,[1,2,
2,4]);
C.Mul(A,B);
finally
FreeIt(A,B,C);
end;
end;
| Copyright 2008 Dew Research |
http://www.dewresearch.com