Overload List
Overload 1: function AddScaled(const X: TMtx; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Matrix;
Compute X*xScale + Y*yScale, where X is a Matrix
Returns: Matrix
Overload 2: function AddScaled(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 3: function AddScaled(const X: TMtx; const Y: TMtx; const aScale: TCplx): Matrix;
Overload 4: function AddScaled(const X: TMtx; const Y: TMtx; aScale: Double): Matrix;
Overload 5: function AddScaled(const X: TMtx; const Y: TMtxVec; const yScale: TCplx): Matrix;
Compute X + Y*yScale, where X is a Matrix.
Returns: Matrix
Overload 6: function AddScaled(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 7: function AddScaled(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 8: function AddScaled(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 9: function AddScaled(const X: TMtx; const Y: TMtxVec; const yScale: Double): Matrix;
Compute X + Y*yScale, where X is a Matrix.
Returns: Matrix
Overload 10: function AddScaled(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 11: function AddScaled(const X: TMtx; const xScale: Double; const Y: TMtxVec; const yScale: Double): Matrix;
Compute X*xScale + Y*yScale, when X is a Matrix
Returns: Matrix
The operation does only per-element math.
Overload 12: function AddScaled(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
Returns: Matrix
Overload 13: function AddScaled(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Vector;
Compute X*xScale + Y*yScale
Returns: Vector
Overload 14: function AddScaled(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 15: function AddScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx): Vector;
Overload 16: function AddScaled(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 17: function AddScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Vector;
Compute X + Y + Z*zScale
Returns: Vector
Overload 18: function AddScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Vector;
Compute X + Y + Z*zScale
Returns: Vector
Computes the sum of X and Y plus Z scaled by zScale without creating temporary objects.
uses MtxVec, MtxExpr, Math387;
var
X, Y, Z, A1, A2, A3: Vector;
zScale: Double;
begin
zScale := 2.0;
X := [1,2,3,4];
Y := [2,3,4,5];
Z := [3,4,5,6];
A1 := X + Y + Z * zScale;
A2 := AddScaled(X, Y, Z, zScale);
A3.AddScaled(X, Y, Z, zScale);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
Overload 19: function AddScaled(const X: TVec; const Y: TMtxVec; const yScale: Double): Vector;
Compute X + Y*yScale
Returns: Vector
Computes the sum of two vector-based operands, X and Y, where Y is first scaled by yScale. This operation is performed without creating temporary objects.
uses MtxVec, MtxExpr, Math387;
var
X, Y, A1, A2, A3: Vector;
yScale: Double;
begin
yScale := 1.5;
X := [1,2,3,4];
Y := [2,3,4,5];
A1 := X + Y * yScale;
A2 := AddScaled(X, Y, yScale);
A3.AddScaled(X, Y, yScale);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
Overload 20: function AddScaled(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 sum of X and Y scaled by yScale plus Z scaled by zScale without temporary objects.
uses MtxVec, MtxExpr, Math387;
var
X, Y, Z, A1, A2, A3: Vector;
yScale, zScale: Double;
begin
yScale := 1.5;
zScale := 2.0;
X := [1,2,3,4];
Y := [2,3,4,5];
Z := [3,4,5,6];
A1 := X + Y * yScale + Z * zScale;
A2 := AddScaled(X, Y, yScale, Z, zScale);
A3.AddScaled(X, Y, yScale, Z, zScale);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
Overload 21: function AddScaled(const X: TVec; const Y: TVec; const aScale: TCplx): Vector;
Overload 22: function AddScaled(const X: TVec; const Y: TVec; aScale: Double): Vector;
Overload 23: function AddScaled(const X: TVec; const xScale: Double; const Y: TMtxVec; const yScale: Double): Vector;
Compute X*xScale + Y*yScale
Returns: Vector
Computes the specified expression without temporary objects and at the same speed as computing only X + Y.
uses MtxVec, MtxExpr, Math387;
var
X, Y, A1, A2, A3: Vector;
xScale, yScale: Double;
begin
xScale := 1.5;
yScale := -1.5;
X := [1,2,3,4];
Y := [2,3,4,5];
A1 := X * xScale + Y * yScale; // easiest to read, but creates temporaries
A2 := AddScaled(X, xScale, Y, yScale); // faster, but still one temporary
A3.AddScaled(X, xScale, Y, yScale); // fastest (in-place)
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
Overload 24: function AddScaled(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 weighted sum of X, Y, and Z without temporary objects.
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 := [1,2,3,4];
Y := [2,3,4,5];
Z := [3,4,5,6];
A1 := X * xScale + Y * yScale + Z * zScale;
A2 := AddScaled(X, xScale, Y, yScale, Z, zScale);
A3.AddScaled(X, xScale, Y, yScale, Z, zScale);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;