MtxExpr.MulAndDiv Method

Overload List

#SignatureDescription
1function MulAndDiv(const X: TMtx; const Y: TMtxVec; const Z: TCplx): Matrix;Result = X * Y / zScalar, where X is a Matrix
2function MulAndDiv(const X: TMtx; const Y: TMtxVec; const xyScale: TCplx; const Z: TMtxVec): Matrix;Result = X * Y * xyScale / Z, where X is a Matrix
3function MulAndDiv(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec): Matrix;Result = X * Y / Z, where X is a Matrix
4function MulAndDiv(const X: TMtx; const Y: TMtxVec; const Z: Double): Matrix;Result = X * Y / zScalar, when X is a Matrix
5function MulAndDiv(const X: TMtx; const Y: TMtxVec; const xyScale: Double; const Z: TMtxVec): Matrix;Result = X * Y * xyScale / Z, when X is a Matrix
6function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: TCplx): Vector;Result = X * Y / zScalar
7function MulAndDiv(const X: TVec; const Y: TMtxVec; const xyScale: TCplx; const Z: TMtxVec): Vector;Result = X * Y * xyScale / Z
8function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: TMtxVec): Vector;Result = X * Y / Z
9function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: Double): Vector;Result = X * Y / zScalar
10function MulAndDiv(const X: TVec; const Y: TMtxVec; const xyScale: Double; const Z: TMtxVec): Vector;Result = X * Y * xyScale / Z

Overload 1: function MulAndDiv(const X: TMtx; const Y: TMtxVec; const Z: TCplx): Matrix;

Compute X * Y / zScalar, where X is a Matrix

#NameTypeDescription
1XTMtx
2YTMtxVec
3ZTCplx

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

#NameTypeDescription
1XTMtx
2YTMtxVec
3xyScaleTCplx
4ZTMtxVec

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

#NameTypeDescription
1XTMtx
2YTMtxVec
3ZTMtxVec

Returns: Matrix

Remarks:

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.

#NameTypeDescription
1XTMtx
2YTMtxVec
3ZDouble

Returns: Matrix

Remarks:

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.

#NameTypeDescription
1XTMtx
2YTMtxVec
3xyScaleDouble
4ZTMtxVec

Returns: Matrix

Remarks:

The operation does only per-element math.

Overload 6: function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: TCplx): Vector;

Compute X * Y / zScalar

#NameTypeDescription
1XTVec
2YTMtxVec
3ZTCplx

Returns: Vector

Overload 7: function MulAndDiv(const X: TVec; const Y: TMtxVec; const xyScale: TCplx; const Z: TMtxVec): Vector;

Compute X Y xyScale / Z

#NameTypeDescription
1XTVec
2YTMtxVec
3xyScaleTCplx
4ZTMtxVec

Returns: Vector

Overload 8: function MulAndDiv(const X: TVec; const Y: TMtxVec; const Z: TMtxVec): Vector;

Compute X * Y / Z

#NameTypeDescription
1XTVec
2YTMtxVec
3ZTMtxVec

Returns: Vector

Remarks:

Computes the element-wise product of X and Y, then divides the result by Z, all without creating temporary objects.

Examples
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

#NameTypeDescription
1XTVec
2YTMtxVec
3ZDouble

Returns: Vector

Remarks:

Computes the product of X and Y divided by the scalar zScalar without temporary objects.

Examples
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

#NameTypeDescription
1XTVec
2YTMtxVec
3xyScaleDouble
4ZTMtxVec

Returns: Vector

Remarks:

Computes the product of X and Y scaled by xyScale, then divided by Z, without temporary objects.

Examples
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;