Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function Mul(const Value: TCplx): TMtxVec; | Multiply all calling object elements with complex Value in-place. |
| └ indexed: function Mul(const Value: TCplx; Index: Integer; Len: Integer): TMtxVec; | ||
| 2 | function Mul(const Mtx1: TMtx; const Mtx2: TMtx): TMtx; | Matrix multiplication. |
| 3 | function Mul(const Mtx1: TMtx; const Mtx2: TMtx; const Mtx3: TMtx): TMtx; | Returns the matrix product of three matrices. |
| 4 | function Mul(const Mtx1: TMtx; const Mtx2: TMtx; const Mtx3: TMtx; const Mtx4: TMtx): TMtx; | Returns the matrix product of four matrices. |
| 5 | function Mul(const Mtx1: TMtx; const Mtx2: TMtx; Operation1: TMtxOperation; Operation2: TMtxOperation): TMtx; | Left side multiply Mtx2 with Mtx1 matrix and store the results in the calling matrix. |
| 6 | function Mul(const Mtx1: TMtx; const Mtx2: TMtx; Mtx1Type: TMtxType; Mtx2Type: TMtxType; Operation1: TMtxOperation; Operation2: TMtxOperation): TMtx; | 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. |
| 7 | function Mul(const Vec: TMtxVec): TMtxVec; | Matrix multiplication. |
| └ indexed: function Mul(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 8 | function Mul(const Vec: TMtxVec; Value: TCplx): TMtxVec; | Multiply each element of Vec with complex Value and store the result in the calling object. |
| └ indexed: function Mul(const Vec: TMtxVec; Value: TCplx; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 9 | function Mul(const Vec: TMtxVec; Value: Double): TMtxVec; | Multiply each element of Vec with Value and store the result in the calling object. |
| └ indexed: function Mul(const Vec: TMtxVec; Value: Double; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 10 | function Mul(const Value: Double): TMtxVec; | Multiply object elements with Value. |
| └ indexed: function Mul(const Value: Double; Index: Integer; Len: Integer): TMtxVec; | ||
| 11 | function Mul(const Vec1: TMtxVec; const Vec2: TMtxVec; Vec1Index: Integer; Vec2Index: Integer; Index: Integer; Len: Integer): TMtxVec; | Multiply Vec1 elements [Vec1Index]..[Vec1Index+Len-1] with Vec2 object elements [Vec2Index]..[Vec2Index+Len-1] and store the results in calling object elements [Index]..[Index+Len-1]. |
Overload 1: function Mul(const Value: TCplx): TMtxVec;
Multiply all calling object elements with complex Value in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | TCplx |
Result: stored in self (calling object), returns self for chaining
Indexed: function Mul(const Value: TCplx; Index: Integer; Len: Integer): TMtxVec;
Multipy calling object elements [Index]..[Index+Len-1] with complex Value in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | TCplx | |
| 2 | Index | Integer | start index |
| 3 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if array borders are overrun or underrun.
Overload 2: function Mul(const Mtx1: TMtx; const Mtx2: TMtx): TMtx;
Matrix multiplication.
Result: stored in self (calling object), returns self for chaining
Performs matrix multiplication, which is JIT-ed (faster) up to size 64 for square matrices. In most general case the matrix multiplication is defined by the following equation (result = calling matrix):
where a and b are and 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 TMtxOperation, performed on Mtx1 and Mtx2 respectively. Default value for operation is opNone (no additional operation). The Mtx1Type and Mtx2Type parameters indicate the TMtxType 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 Matrix.Rows, Matrix.Cols and Matrix.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 Matrix.Complex property of Mtx1 and Mtx2 does not match.
Notes
1. NOTE: If you are not sure, which TMtxType of matrix are you multiplying, you can use the mtGeneral type (general case). You can also use the Matrix.DetectMtxType method to determine the type of matrix. 2. The routine is multithreaded, if specified by the environment variable.
var A,B,C: Matrix;
begin
A.SetIt(2,2,False,[1,2,
2,4]);
B.SetIt(2,2,False,[1,2,
2,4]);
C.Mul(A,B); //or
C := Mul(a,b); // but this is not the same as:
c := a*b; //which is the same as
c.MulElem(A,B);s
end;
Overload 3: function Mul(const Mtx1: TMtx; const Mtx2: TMtx; const Mtx3: TMtx): TMtx;
Returns the matrix product of three matrices.
Result: stored in self (calling object), returns self for chaining
Internally calls TMtx.Mul and does JIT-ed (faster) multiply for small square matrices.
Overload 4: function Mul(const Mtx1: TMtx; const Mtx2: TMtx; const Mtx3: TMtx; const Mtx4: TMtx): TMtx;
Returns the matrix product of four matrices.
Result: stored in self (calling object), returns self for chaining
Internally calls TMtx.Mul and does JIT-ed (faster) multiply for small square matrices.
Overload 5: function Mul(const Mtx1: TMtx; const Mtx2: TMtx; Operation1: TMtxOperation; Operation2: TMtxOperation): TMtx;
Left side multiply Mtx2 with Mtx1 matrix and store the results in the calling matrix.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Mtx1 | TMtx | |
| 2 | Mtx2 | TMtx | |
| 3 | Operation1 | TMtxOperation | |
| 4 | Operation2 | TMtxOperation |
Result: stored in self (calling object), returns self for chaining
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 Matrix.Rows, Matrix.Cols and Matrix.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.
Overload 6: function Mul(const Mtx1: TMtx; const Mtx2: TMtx; Mtx1Type: TMtxType; Mtx2Type: TMtxType; Operation1: TMtxOperation; Operation2: TMtxOperation): TMtx;
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.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Mtx1 | TMtx | |
| 2 | Mtx2 | TMtx | |
| 3 | Mtx1Type | TMtxType | |
| 4 | Mtx2Type | TMtxType | |
| 5 | Operation1 | TMtxOperation | |
| 6 | Operation2 | TMtxOperation |
Result: stored in self (calling object), returns self for chaining
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 Matrix.Rows, Matrix.Cols and Matrix.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.
Overload 7: function Mul(const Vec: TMtxVec): TMtxVec;
Matrix multiplication.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec |
Result: stored in self (calling object), returns self for chaining
Multiply each of Vec elements with corresponding elements in the calling object. Size and Matrix.Complex property of the calling object are set automatically. The result is stored in the calling object.
Indexed: function Mul(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with calling object elements [Index]..[Index+Len-1] in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | |
| 2 | VecIndex | Integer | |
| 3 | Index | Integer | start index |
| 4 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if Vec and calling object Matrix.Complex property do not match or if array borders are overrun/underrun.
Overload 8: function Mul(const Vec: TMtxVec; Value: TCplx): TMtxVec;
Multiply each element of Vec with complex Value and store the result in the calling object.
Result: stored in self (calling object), returns self for chaining
Size of the calling object is set automatically. Matrix.Complex property of the calling object is set to True.
Indexed: function Mul(const Vec: TMtxVec; Value: TCplx; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with complex Value and store the result in calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | |
| 2 | Value | TCplx | scalar |
| 3 | VecIndex | Integer | |
| 4 | Index | Integer | start index |
| 5 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Size of the calling object is not changed. An exception is raised if array borders are overrun or underrun. Matrix.Complex propertiy of the calling object is set to True.
Overload 9: function Mul(const Vec: TMtxVec; Value: Double): TMtxVec;
Multiply each element of Vec with Value and store the result in the calling object.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | |
| 2 | Value | Double | scalar |
Result: stored in self (calling object), returns self for chaining
Size and Matrix.Complex properties of the calling object are adjusted automatically.
Indexed: function Mul(const Vec: TMtxVec; Value: Double; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with Value and store the result in calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | |
| 2 | Value | Double | scalar |
| 3 | VecIndex | Integer | |
| 4 | Index | Integer | start index |
| 5 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Size of the calling object is not changed. An exception is raised if array borders are overrun or underrun. Matrix.Complex propertiy of the calling object is set implicitly.
Overload 10: function Mul(const Value: Double): TMtxVec;
Multiply object elements with Value.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | Double |
Result: stored in self (calling object), returns self for chaining
Multiply all calling object elements with Value in-place.
var v: Vector;
begin
v.SetIt(1,3,false,[2,3,5]); // v = [2,3,5]
v := v*3; // v = [6,9,15]
end;
Indexed: function Mul(const Value: Double; Index: Integer; Len: Integer): TMtxVec;
Multipy calling object elements [Index]..[Index+Len-1] with Value in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | Double | |
| 2 | Index | Integer | start index |
| 3 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if array borders are overrun or underrun.
Overload 11: function Mul(const Vec1: TMtxVec; const Vec2: TMtxVec; Vec1Index: Integer; Vec2Index: Integer; Index: Integer; Len: Integer): TMtxVec;
Multiply Vec1 elements [Vec1Index]..[Vec1Index+Len-1] with Vec2 object elements [Vec2Index]..[Vec2Index+Len-1] and store the results in calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec1 | TMtxVec | |
| 2 | Vec2 | TMtxVec | |
| 3 | Vec1Index | Integer | |
| 4 | Vec2Index | Integer | |
| 5 | Index | Integer | start index |
| 6 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Size and Matrix.Complex properties of the calling object must be set explicitly. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun or underrun.