MtxExpr.AddScaledSqr Method

Overload List

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

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

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

#NameTypeDescription
1XTMtx
2xScaleTCplx
3YTMtxVec
4yScaleTCplx

Returns: Matrix

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

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

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleTCplx

Returns: Matrix

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

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

#NameTypeDescription
1XTMtx
2YTMtxVec
3yScaleDouble

Returns: Matrix

Remarks:

The operation does only per-element math.

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

Compute sqr(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 5: function AddScaledSqr(const X: TVec; const xScale: TCplx; const Y: TMtxVec; const yScale: TCplx): Vector;

Compute sqr(X*xScale + Y*yScale)

#NameTypeDescription
1XTVec
2xScaleTCplx
3YTMtxVec
4yScaleTCplx

Returns: Vector

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

Compute sqr(X + Y*yScale)

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleTCplx

Returns: Vector

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

Compute sqr(X + Y*yScale)

#NameTypeDescription
1XTVec
2YTMtxVec
3yScaleDouble

Returns: Vector

Remarks:

Computes the square of (X + Y*yScale) without temporary objects.

Examples
var
    yScale: Double;
    X, Y, A1, A2, A3: Vector;
begin
yScale := 1.5;
X := [1, 2, 3, 4];
Y := [2, 3, 4, 5];
A1 := MtxExpr.Sqr(X + Y * yScale);
A2 := AddScaledSqr(X, Y, yScale);
A3.AddScaledSqr(X, Y, yScale);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;

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

Compute sqr(X*xScale + Y*yScale)

#NameTypeDescription
1XTVec
2xScaleDouble
3YTMtxVec
4yScaleDouble

Returns: Vector

Remarks:

Computes the square of the expression X*xScale + Y*yScale without temporary objects.

Examples
var
    xScale: Double;
    X, Y, A1, A2, A3: Vector;
begin
xScale := 1.5, yScale = -1.5;
X := [1, 2, 3, 4];
Y := [2, 3, 4, 5];
A1 := MtxExpr.Sqr(X * xScale + Y * yScale);
A2 := AddScaledSqr(X, xScale, Y, yScale);
A3.AddScaledSqr(X, xScale, Y, yScale);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;