MtxExpr.SqrAddScaled Method

Overload List

#SignatureDescription
1function SqrAddScaled(const X: TMtx; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Matrix;Result = sqr(X)*xScale + sqr(Y)*yScale, where X is a Matrix
2function SqrAddScaled(const X: TMtx; const Y: TMtxVec; const yScale: TCplx): Matrix;Result = sqr(X) + sqr(Y)*yScale, where X is a Matrix
3function SqrAddScaled(const X: TMtx; const Y: TMtxVec; const yScale: Double): Matrix;Result = sqr(X) + sqr(Y)*yScale, when X is a Matrix
4function SqrAddScaled(const X: TMtx; const xScale: Double; const Y: TMtxVec; const yScale: Double): Matrix;Result = sqr(X)*xScale + sqr(Y)*yScale, when X is a matrix
5function SqrAddScaled(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Vector;Result = sqr(X)*xScale + sqr(Y)*yScale
6function SqrAddScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx): Vector;Result = sqr(X) + sqr(Y)*yScale
7function SqrAddScaled(const X: TVec; const Y: TMtxVec; const yScale: Double): Vector;Result = sqr(X) + sqr(Y)*yScale
8function SqrAddScaled(const X: TVec; const xScale: Double; const Y: TMtxVec; const yScale: Double): Vector;Result = sqr(X)*xScale + sqr(Y)*yScale

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

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

#NameTypeDescription
1XTMtx
2xScaleTCplx
3YTMtxVec
4yScaleTCplx

Returns: Matrix

Overload 2: function SqrAddScaled(const X: TMtx; const Y: TMtxVec; const yScale: TCplx): Matrix;

Compute sqr(X) + sqr(Y)*yScale, where X is a Matrix

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleTCplx

Returns: Matrix

Overload 3: function SqrAddScaled(const X: TMtx; const Y: TMtxVec; const yScale: Double): Matrix;

Compute sqr(X) + sqr(Y)*yScale, when X is a Matrix.

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleDouble

Returns: Matrix

Remarks:

The operation does only per-element math.

Overload 4: function SqrAddScaled(const X: TMtx; const xScale: Double; const Y: TMtxVec; const yScale: Double): Matrix;

Compute sqr(X)*xScale + sqr(Y)*yScale, when X is a matrix

#NameTypeDescription
1XTMtx
2xScaleDouble
3YTMtxVec
4yScaleDouble

Returns: Matrix

Remarks:

The operation does only per-element math.

Overload 5: function SqrAddScaled(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Vector;

Compute sqr(X)*xScale + sqr(Y)*yScale

#NameTypeDescription
1XTVec
2xScaleTCplx
3YTMtxVec
4yScaleTCplx

Returns: Vector

Overload 6: function SqrAddScaled(const X: TVec; const Y: TMtxVec; const yScale: TCplx): Vector;

Compute sqr(X) + sqr(Y)*yScale

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleTCplx

Returns: Vector

Overload 7: function SqrAddScaled(const X: TVec; const Y: TMtxVec; const yScale: Double): Vector;

Compute sqr(X) + sqr(Y)*yScale

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleDouble

Returns: Vector

Remarks:

Computes the sum of the square of X and the scaled square of Y without temporary objects.

Examples
uses MtxVec, MtxExpr, Math387;

var
    X, Y, A1, A2, A3: Vector;
    yScale: Double;
begin
    yScale := 2.0;
    X := [1,2,3,4];
    Y := [2,3,4,5];
    A1 := Sqr(X) + Sqr(Y) * yScale;
    A2 := SqrAddScaled(X, Y, yScale);
    A3.SqrAddScaled(X, Y, yScale);

    if not A2.IsEqual(A1) then ERaise('Problem');
    if not A3.IsEqual(A1) then ERaise('Problem');
end;

Overload 8: function SqrAddScaled(const X: TVec; const xScale: Double; const Y: TMtxVec; const yScale: Double): Vector;

Compute sqr(X)*xScale + sqr(Y)*yScale

#NameTypeDescription
1XTVec
2xScaleDouble
3YTMtxVec
4yScaleDouble

Returns: Vector

Remarks:

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

Examples
uses MtxVec, MtxExpr, Math387;

var
    X, Y, A1, A2, A3: Vector;
    xScale, yScale: Double;
begin
    xScale := 2.0;
    yScale := 3.0;
    X := [1,2,3,4];
    Y := [2,3,4,5];
    A1 := Sqr(X) * xScale + Sqr(Y) * yScale;
    A2 := SqrAddScaled(X, xScale, Y, yScale);
    A3.SqrAddScaled(X, xScale, Y, yScale);

    if not A2.IsEqual(A1) then ERaise('Problem');
    if not A3.IsEqual(A1) then ERaise('Problem');
end;