Overload List
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
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.
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.
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.
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.
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.
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
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
Returns: Vector
Overload 9: function SubScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Vector;
Compute X - Y - Z*zScale
Returns: Vector
Overload 10: function SubScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Vector;
Compute X - Y - Z*zScale
Returns: Vector
Computes the difference between X and Y, then subtracts Z scaled by zScale, without creating temporary objects.
var
zScale: Double;
X, Y, Z, A1, A2, A3: Vector;
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); // Or via a dedicated overload if available.
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
Returns: Vector
Computes the difference between X and Y scaled by yScale, then subtracts Z scaled by zScale, without creating temporary objects.
var
yScale: Double;
X, Y, Z, A1, A2, A3: Vector;
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
Returns: Vector
Computes the expression X*xScale - Y*yScale - Z*zScale without temporary objects, achieving the same speed as an optimized inplace operation.
var
xScale: Double;
X, Y, Z, A1, A2, A3: Vector;
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;