Overload List
Overload 1: function MulAndDiv(const X: TMtx; const Y: TMtxVec; const Z: TCplx): Matrix;
Compute X * Y / zScalar, where X is a Matrix
Returns: Matrix
Overload 2: function MulAndDiv(const X: TMtx; const Y: TMtxVec; const xyScale: TCplx; const Z: TMtxVec): Matrix;
Compute X Y xyScale / Z, where X is a Matrix
Returns: Matrix
Overload 3: function MulAndDiv(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec): Matrix;
Compute X * Y / Z, where X is a Matrix
Returns: Matrix
The operation does only per-element math.
Overload 4: function MulAndDiv(const X: TMtx; const Y: TMtxVec; const Z: Double): Matrix;
Compute X * Y / zScalar, when X is a Matrix.
Returns: Matrix
The operation does only per-element math.
Overload 5: function MulAndDiv(const X: TMtx; const Y: TMtxVec; const xyScale: Double; const Z: TMtxVec): Matrix;
Compute X Y xyScale / Z, when X is a Matrix.
Returns: Matrix
The operation does only per-element math.
Overload 6: function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: TCplx): Vector;
Overload 7: function MulAndDiv(const X: TVec; const Y: TMtxVec; const xyScale: TCplx; const Z: TMtxVec): Vector;
Compute X Y xyScale / Z
Returns: Vector
Overload 8: function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: TMtxVec): Vector;
Compute X * Y / Z
Returns: Vector
Computes the element-wise product of X and Y, then divides the result by Z, all without creating temporary objects.
uses MtxVec, MtxExpr, Math387;
var
X, Y, Z, A1, A2, A3: Vector;
begin
// Example: compute (X*Y)/Z element-wise.
X := [4,8,12,16];
Y := [2,2,2,2];
Z := [2,4,6,8];
A1 := (X * Y) / Z;
A2 := MulAndDiv(X, Y, Z);
A3.MulAndDiv(X, Y, Z);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
Overload 9: function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: Double): Vector;
Compute X * Y / zScalar
Returns: Vector
Computes the product of X and Y divided by the scalar zScalar without temporary objects.
uses MtxVec, MtxExpr, Math387;
var
X, Y, A1, A2, A3: Vector;
zScalar: Double;
begin
zScalar := 2.0;
X := [3,6,9,12];
Y := [1,2,3,4];
A1 := (X * Y) / zScalar;
A2 := MulAndDiv(X, Y, zScalar);
A3.MulAndDiv(X, Y, zScalar);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
Overload 10: function MulAndDiv(const X: TVec; const Y: TMtxVec; const xyScale: Double; const Z: TMtxVec): Vector;
Compute X Y xyScale / Z
Returns: Vector
Computes the product of X and Y scaled by xyScale, then divided by Z, without temporary objects.
uses MtxVec, MtxExpr, Math387;
var
X, Y, Z, A1, A2, A3: Vector;
xyScale: Double;
begin
xyScale := 1.5;
X := [2,4,6,8];
Y := [1,1,1,1];
Z := [2,2,2,2];
A1 := (X * Y * xyScale) / Z;
A2 := MulAndDiv(X, Y, xyScale, Z);
A3.MulAndDiv(X, Y, xyScale, Z);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;