MtxExpr.AddScaled Method

Overload List

#SignatureDescription
1function AddScaled(const X: TMtx; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Matrix;Result = X*xScale + Y*yScale, where X is a Matrix
2function AddScaled(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
3function AddScaled(const X: TMtx; const Y: TMtx; const aScale: TCplx): Matrix;Computes X + Y*Ascale
4function AddScaled(const X: TMtx; const Y: TMtx; aScale: Double): Matrix;Computes X + Y*Ascale
5function AddScaled(const X: TMtx; const Y: TMtxVec; const yScale: TCplx): Matrix;Result = X + Y*yScale, where X is a Matrix
6function AddScaled(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
7function AddScaled(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Matrix;Result = X + Y + Z*zScale, where X is a Matrix
8function AddScaled(const X: TMtx; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Matrix;Result = X + Y + Z*zScale, where X is a Matrix
9function AddScaled(const X: TMtx; const Y: TMtxVec; const yScale: Double): Matrix;Result = X + Y*yScale, where X is a Matrix
10function AddScaled(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
11function AddScaled(const X: TMtx; const xScale: Double; const Y: TMtxVec; const yScale: Double): Matrix;Result = X*xScale + Y*yScale, when X is a Matrix
12function AddScaled(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
13function AddScaled(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Vector;Result = X*xScale + Y*yScale
14function AddScaled(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
15function AddScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx): Vector;Result = X + Y*yScale
16function AddScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx; const Z: TMtxVec; const zScale: TCplx): Vector;Result = X + Y*yScale + Z*zScale
17function AddScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: TCplx): Vector;Result = X + Y + Z*zScale
18function AddScaled(const X: TVec; const Y: TMtxVec; const Z: TMtxVec; const zScale: Double): Vector;Result = X + Y + Z*zScale
19function AddScaled(const X: TVec; const Y: TMtxVec; const yScale: Double): Vector;Result = X + Y*yScale
20function AddScaled(const X: TVec; const Y: TMtxVec; const yScale: Double; const Z: TMtxVec; const zScale: Double): Vector;Result = X + Y*yScale + Z*zScale
21function AddScaled(const X: TVec; const Y: TVec; const aScale: TCplx): Vector;Computes X + Y*Ascale
22function AddScaled(const X: TVec; const Y: TVec; aScale: Double): Vector;Computes X + Y*Ascale
23function AddScaled(const X: TVec; const xScale: Double; const Y: TMtxVec; const yScale: Double): Vector;Result = X*xScale + Y*yScale
24function AddScaled(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 AddScaled(const X: TMtx; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Matrix;

Compute X*xScale + Y*yScale, where X is a Matrix

#NameTypeDescription
1XTMtx
2xScaleTCplx
3YTMtxVec
4yScaleTCplx

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

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

Returns: Matrix

Overload 3: function AddScaled(const X: TMtx; const Y: TMtx; const aScale: TCplx): Matrix;

Computes X + Y*Ascale

#NameTypeDescription
1XTMtx
2YTMtx
3aScaleTCplx

Returns: Matrix

Remarks:

Internally calls Matrix.AddScaled

Overload 4: function AddScaled(const X: TMtx; const Y: TMtx; aScale: Double): Matrix;

Computes X + Y*Ascale

#NameTypeDescription
1XTMtx
2YTMtx
3aScaleDoublescalar

Returns: Matrix

Remarks:

Internally calls Matrix.AddScaled

Overload 5: function AddScaled(const X: TMtx; const Y: TMtxVec; const yScale: TCplx): Matrix;

Compute X + Y*yScale, where X is a Matrix.

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleTCplx

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.

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

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.

#NameTypeDescription
1XTMtx
2YTMtxVec
3ZTMtxVec
4zScaleTCplx

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.

#NameTypeDescription
1XTMtx
2YTMtxVec
3ZTMtxVec
4zScaleDouble

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.

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleDouble

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.

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

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

#NameTypeDescription
1XTMtx
2xScaleDouble
3YTMtxVec
4yScaleDouble

Returns: Matrix

Remarks:

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

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

Returns: Matrix

Overload 13: function AddScaled(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Vector;

Compute X*xScale + Y*yScale

#NameTypeDescription
1XTVec
2xScaleTCplx
3YTMtxVec
4yScaleTCplx

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

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

Returns: Vector

Overload 15: function AddScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx): Vector;

Compute X + Y*yScale

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleTCplx

Returns: 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

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

Returns: Vector

Overload 17: function AddScaled(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 18: function AddScaled(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 sum of X and Y plus 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 := [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

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleDouble

Returns: Vector

Remarks:

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.

Examples
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

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

Returns: Vector

Remarks:

Computes the sum of X and Y scaled by yScale plus Z scaled by zScale without 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 := [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;

Computes X + Y*Ascale

#NameTypeDescription
1XTVec
2YTVec
3aScaleTCplx

Returns: Vector

Remarks:

Internally calls Vector.AddScaled

Overload 22: function AddScaled(const X: TVec; const Y: TVec; aScale: Double): Vector;

Computes X + Y*Ascale

#NameTypeDescription
1XTVec
2YTVec
3aScaleDoublescalar

Returns: Vector

Remarks:

Internally calls Vector.AddScaled

Overload 23: function AddScaled(const X: TVec; const xScale: Double; const Y: TMtxVec; const yScale: Double): Vector;

Compute X*xScale + Y*yScale

#NameTypeDescription
1XTVec
2xScaleDouble
3YTMtxVec
4yScaleDouble

Returns: Vector

Remarks:

Computes the specified expression without temporary objects and at the same speed as computing only X + Y.

Examples
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

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

Returns: Vector

Remarks:

Computes the weighted sum of X, Y, and Z without temporary objects.

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 := [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;