Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtx MulElem(TMtx Mtx) | Matrix array multiplication. |
| 2 | TMtx MulElem(TMtx Mtx1, TMtx Mtx2) | Multiplies elements in Mtx1 matrix with the elements in Mtx2 matrix (array multiplication) and stores the results in calling matrix. |
| 3 | TMtxVec MulElem(TMtxVec X, TMtxVec Y, TCplx Z) | self = X*Y*zScalar |
| └ indexed: TMtxVec MulElem(TMtxVec X, Int32 XIndex, TMtxVec Y, Int32 YIndex, TCplx Z, Int32 Index, Int32 Len) | ||
| 4 | TMtxVec MulElem(TMtxVec X, TMtxVec Y, TMtxVec Z) | self = X*Y*Z |
| └ indexed: TMtxVec MulElem(TMtxVec X, Int32 XIndex, TMtxVec Y, Int32 YIndex, TMtxVec Z, Int32 zIndex, Int32 Index, Int32 Len) | ||
| 5 | TMtxVec MulElem(TMtxVec X, TMtxVec Y, Double Z) | self = X*Y*zScalar |
| └ indexed: TMtxVec MulElem(TMtxVec X, Int32 XIndex, TMtxVec Y, Int32 YIndex, Double Z, Int32 Index, Int32 Len) |
Overload 1: TMtx MulElem(TMtx Mtx)
Matrix array multiplication.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Mtx | TMtx | source TMtx |
Result: stored in self (calling object), returns self for chaining
Multiplies elements in Mtx matrix with the elements in the calling matrix (array multiplication) and stores the results in calling matrix. The Dew.Math.Matrix.Rows, Dew.Math.Matrix.Cols and Dew.Math.Matrix.Complex properties of both matrices must match, otherwise an exception is raised.
Matrix a = new Matrix();
a.SetIt(2, 2, false, new double[] { 1.0, 2.0, 3.0, 4.0 });
Matrix b = new Matrix();
b.SetIt(2, 2, false, new double[] { 5.0, 6.0, 7.0, 8.0 });
a.MulElem(b);
Matrix expected = new Matrix();
expected.SetIt(2, 2, false, new double[] { 5.0, 12.0, 21.0, 32.0 });
if (!a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute))
throw new Exception("Matrix.MulElem: mismatch");
Matrix A;
Matrix B;
Matrix C;
A.SetIt(2,2,false,[1,2,
2,4]);
B.SetIt(2,2,false,[1,2,
2,4]);
C.MulElem(A,B);
// C becomes:
// [1, 4,
// 4,16]
Overload 2: TMtx MulElem(TMtx Mtx1, TMtx Mtx2)
Multiplies elements in Mtx1 matrix with the elements in Mtx2 matrix (array multiplication) and stores the results in calling matrix.
Result: stored in self (calling object), returns self for chaining
The Dew.Math.Matrix.Rows, Dew.Math.Matrix.Cols and Dew.Math.Matrix.Complex properties of calling matrix are set implicitly to match those of Mtx1 and Mtx2 matrices. Mtx1 and Mtx2 Rows, Cols, and Complex properties must be the same, otherwise an exception is raised.
Matrix a = new Matrix();
Matrix x = new Matrix();
x.SetIt(2, 2, false, new double[] { 1.0, 2.0, 3.0, 4.0 });
Matrix y = new Matrix();
y.SetIt(2, 2, false, new double[] { 5.0, 6.0, 7.0, 8.0 });
a.MulElem(x, y);
Matrix expected = new Matrix();
expected.SetIt(2, 2, false, new double[] { 5.0, 12.0, 21.0, 32.0 });
if (!a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute))
throw new Exception("Matrix.MulElem: mismatch");
Overload 3: TMtxVec MulElem(TMtxVec X, TMtxVec Y, TCplx Z)
Compute X*Y*zScalar
Result: stored in self (calling object), returns self for chaining
The following expression would also run at the same or higher speed, when passing X also for the Z parameter:
X^2*zScalar
Indexed: TMtxVec MulElem(TMtxVec X, Int32 XIndex, TMtxVec Y, Int32 YIndex, TCplx Z, Int32 Index, Int32 Len)
Compute X*Y*zScalar on sub array
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec | source TVec or TMtx |
| 2 | XIndex | Int32 | X start index |
| 3 | Y | TMtxVec | source TVec or TMtx |
| 4 | YIndex | Int32 | Y start index |
| 5 | Z | TCplx | scalar |
| 6 | Index | Int32 | start index |
| 7 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
Overload 4: TMtxVec MulElem(TMtxVec X, TMtxVec Y, TMtxVec Z)
Compute X*Y*Z
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec | source TVec or TMtx |
| 2 | Y | TMtxVec | source TVec or TMtx |
| 3 | Z | TMtxVec | source TVec or TMtx |
Result: stored in self (calling object), returns self for chaining
The following expression would also run at the same or higher speed, when passing X also for the Z parameter:
X^2*Y
Indexed: TMtxVec MulElem(TMtxVec X, Int32 XIndex, TMtxVec Y, Int32 YIndex, TMtxVec Z, Int32 zIndex, Int32 Index, Int32 Len)
Compute X*Y*Z on sub array
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec | source TVec or TMtx |
| 2 | XIndex | Int32 | X start index |
| 3 | Y | TMtxVec | source TVec or TMtx |
| 4 | YIndex | Int32 | Y start index |
| 5 | Z | TMtxVec | source TVec or TMtx |
| 6 | zIndex | Int32 | |
| 7 | Index | Int32 | start index |
| 8 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
Overload 5: TMtxVec MulElem(TMtxVec X, TMtxVec Y, Double Z)
Compute X*Y*zScalar
Result: stored in self (calling object), returns self for chaining
The following expression would also run at the same or higher speed, when passing X also for the Z parameter:
X^2*zScalar