Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtx MulElem(TMtx Mtx) | Matrix element-wise 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 | TMtx MulElem(TMtxVec X, TMtxVec Y, TCplx Z) | self = X*Y*zScalar |
| 4 | TMtx MulElem(TMtxVec X, TMtxVec Y, TMtxVec Z) | self = X*Y*Z |
| 5 | TMtx MulElem(TMtxVec X, TMtxVec Y, Double Z) | self = X*Y*zScalar |
Overload 1: TMtx MulElem(TMtx Mtx)
Matrix element-wise 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.TMtx.Rows, Dew.Math.TMtx.Cols and Dew.Math.TMtxVec.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");
TMtx A;
TMtx B;
TMtx C;
MtxVec.CreateIt(out A, out B, out C);
try
{
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]
}
finally
{
MtxVec.FreeIt(ref A, ref B, ref C);
}
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.TMtx.Rows, Dew.Math.TMtx.Cols and Dew.Math.TMtxVec.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 excetion is raised. 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: TMtx 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
Overload 4: TMtx 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
Overload 5: TMtx 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