MtxExpr.SubScaled Method

Overload List

#SignatureDescription
1function SubScaled(const X: TMtx; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Matrix;Result = X*xScale - Y*yScale - Z*zScale, where X is a Matrix
2function SubScaled(const X: TMtx; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Matrix;Result = X - Y*yScale - Z*zScale, where X is a Matrix
3function SubScaled(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Matrix;Result = X - Y - Z*zScale, where X is a Matrix
4function SubScaled(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Matrix;Result = X - Y - Z*zScale, where X is a Matrix
5function SubScaled(const X: TMtx; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Matrix;Result = X - Y*yScale - Z*zScale, where X is a Matrix
6function SubScaled(const X: TMtx; const xScale: Double; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Matrix;Result = X*xScale - Y*yScale - Z*zScale, when X is a Matrix
7function SubScaled(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Vector;Result = X*xScale - Y*yScale - Z*zScale
8function SubScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Vector;Result = X - Y*yScale - Z*zScale
9function SubScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Vector;Result = X - Y - Z*zScale
10function SubScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Vector;Result = X - Y - Z*zScale
11function SubScaled(const X: TVec; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Vector;Result = X - Y*yScale - Z*zScale
12function SubScaled(const X: TVec; const xScale: Double; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Vector;Result = X*xScale - Y*yScale - Z*zScale

Overload 1: function SubScaled(const X: TMtx; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Matrix;

Compute X*xScale - Y*yScale - Z*zScale, where X is a Matrix

#NameTypeDescription
1XTMtx
2xScaleTCplx
3YTMtxVec
4yScaleTCplx
5ZTMtxVec
6zScaleTCplx

Returns: Matrix

Overload 2: function SubScaled(const X: TMtx; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Matrix;

Compute X - Y*yScale - Z*zScale, where X is a Matrix.

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleTCplx
4ZTMtxVec
5zScaleTCplx

Returns: Matrix

Overload 3: function SubScaled(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Matrix;

Compute X - Y - Z*zScale, where X is a Matrix.

#NameTypeDescription
1XTMtx
2YTMtxVec
3ZTMtxVec
4zScaleTCplx

Returns: Matrix

Overload 4: function SubScaled(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Matrix;

Compute X - Y - Z*zScale, where X is a Matrix.

#NameTypeDescription
1XTMtx
2YTMtxVec
3ZTMtxVec
4zScaleDouble

Returns: Matrix

Overload 5: function SubScaled(const X: TMtx; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Matrix;

Compute X - Y*yScale - Z*zScale, where X is a Matrix.

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleDouble
4ZTMtxVec
5zScaleDouble

Returns: Matrix

Overload 6: function SubScaled(const X: TMtx; const xScale: Double; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Matrix;

Compute X*xScale - Y*yScale - Z*zScale, when X is a Matrix.

#NameTypeDescription
1XTMtx
2xScaleDouble
3YTMtxVec
4yScaleDouble
5ZTMtxVec
6zScaleDouble

Returns: Matrix

Overload 7: function SubScaled(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Vector;

Compute X*xScale - Y*yScale - Z*zScale

#NameTypeDescription
1XTVec
2xScaleTCplx
3YTMtxVec
4yScaleTCplx
5ZTMtxVec
6zScaleTCplx

Returns: Vector

Overload 8: function SubScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Vector;

Compute X - Y*yScale - Z*zScale

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleTCplx
4ZTMtxVec
5zScaleTCplx

Returns: Vector

Overload 9: function SubScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Vector;

Compute X - Y - Z*zScale

#NameTypeDescription
1XTVec
2YTMtxVec
3ZTMtxVec
4zScaleTCplx

Returns: Vector

Overload 10: function SubScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Vector;

Compute X - Y - Z*zScale

#NameTypeDescription
1XTVec
2YTMtxVec
3ZTMtxVec
4zScaleDouble

Returns: Vector

Remarks:

Computes the difference between X and Y, then subtracts Z scaled by zScale, without creating temporary objects.

Examples
uses MtxVec, MtxExpr, Math387;

var
    X, Y, Z, A1, A2, A3: Vector;
    zScale: Double;
begin
    zScale := 2.0;
    X := [5,6,7,8];
    Y := [1,2,3,4];
    Z := [1,1,1,1];
    A1 := X - Y - Z * zScale;
    A2 := SubScaled(X, Y, Z, zScale);
    A3.Sub(X, Y, Z * zScale); // Alternatively, a dedicated overload can be used.
    if not A2.IsEqual(A1) then ERaise('Problem');
    if not A3.IsEqual(A1) then ERaise('Problem');
end;

Overload 11: function SubScaled(const X: TVec; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Vector;

Compute X - Y*yScale - Z*zScale

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleDouble
4ZTMtxVec
5zScaleDouble

Returns: Vector

Remarks:

Computes the difference between X and Y scaled by yScale, then subtracts Z scaled by zScale, without creating temporary objects.

Examples
uses MtxVec, MtxExpr, Math387;

var
    X, Y, Z, A1, A2, A3: Vector;
    yScale, zScale: Double;
begin
    yScale := 1.5;
    zScale := 2.0;
    X := [5,6,7,8];
    Y := [1,2,3,4];
    Z := [1,1,1,1];
    A1 := X - Y * yScale - Z * zScale;
    A2 := SubScaled(X, Y, yScale, Z, zScale);
    A3.SubScaled(X, Y, yScale, Z, zScale);
    if not A2.IsEqual(A1) then ERaise('Problem');
    if not A3.IsEqual(A1) then ERaise('Problem');
end;

Overload 12: function SubScaled(const X: TVec; const xScale: Double; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Vector;

Compute X*xScale - Y*yScale - Z*zScale

#NameTypeDescription
1XTVec
2xScaleDouble
3YTMtxVec
4yScaleDouble
5ZTMtxVec
6zScaleDouble

Returns: Vector

Remarks:

Computes the expression X*xScale - Y*yScale - Z*zScale without temporary objects, achieving the same speed as an optimized inplace operation.

Examples
uses MtxVec, MtxExpr, Math387;

var
    X, Y, Z, A1, A2, A3: Vector;
    xScale, yScale, zScale: Double;
begin
    xScale := 1.0;
    yScale := 2.0;
    zScale := 3.0;
    X := [5,6,7,8];
    Y := [1,2,3,4];
    Z := [1,1,1,1];
    A1 := X * xScale - Y * yScale - Z * zScale;
    A2 := SubScaled(X, xScale, Y, yScale, Z, zScale);
    A3.SubScaled(X, xScale, Y, yScale, Z, zScale);
    if not A2.IsEqual(A1) then ERaise('Problem');
    if not A3.IsEqual(A1) then ERaise('Problem');
end;