Matrix.Sub Method

Overload List

#SignatureDescription
1function Sub(Value: TCplx): TMtxVec;Subtracts complex Value from all calling object complex elements.
└ indexed: function Sub(Value: TCplx; Index: Integer; Len: Integer): TMtxVec;
2function Sub(const Vec: TMtxVec): TMtxVec;Array subtraction.
└ indexed: function Sub(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
3function Sub(const Src: TMtxVec; Value: TCplx): TMtxVec;Subtract complex Value from Src store the results in calling object.
└ indexed: function Sub(const Src: TMtxVec; Value: TCplx; SrcIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
4function Sub(const Vec1: TMtxVec; const Vec2: TMtxVec): TMtxVec;Subtract Vec2 elements from Vec1 elements and store the results in calling object.
└ indexed: function Sub(const Vec1: TMtxVec; const Vec2: TMtxVec; Vec1Index: Integer; Vec2Index: Integer; Index: Integer; Len: Integer): TMtxVec;
5function Sub(const X: TMtxVec; const Y: TMtxVec; const Z: TCplx): TMtxVec;self = X - Y - zScalar
└ indexed: function Sub(const X: TMtxVec; XIndex: Integer; const Y: TMtxVec; YIndex: Integer; const Z: TCplx; Index: Integer; Len: Integer): TMtxVec;
6function Sub(const X: TMtxVec; const Y: TMtxVec; const Z: TMtxVec): TMtxVec;self = X - Y - Z
└ indexed: function Sub(const X: TMtxVec; XIndex: Integer; const Y: TMtxVec; YIndex: Integer; const Z: TMtxVec; zIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
7function Sub(const X: TMtxVec; const Y: TMtxVec; const Z: Double): TMtxVec;self = X - Y - zScalar
└ indexed: function Sub(const X: TMtxVec; XIndex: Integer; const Y: TMtxVec; YIndex: Integer; const Z: Double; Index: Integer; Len: Integer): TMtxVec;
8function Sub(const Src: TMtxVec; Value: Double): TMtxVec;Subtract real Value from Src store the results in calling object.
└ indexed: function Sub(const Src: TMtxVec; Value: Double; SrcIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
9function Sub(Value: Double): TMtxVec;Subtracts Value from object elements.
└ indexed: function Sub(Value: Double; Index: Integer; Len: Integer): TMtxVec;

Overload 1: function Sub(Value: TCplx): TMtxVec;

Subtracts complex Value from all calling object complex elements.

#NameTypeDescription
1ValueTCplxscalar

Result: stored in self (calling object), returns self for chaining

Indexed: function Sub(Value: TCplx; Index: Integer; Len: Integer): TMtxVec;

Subtracts complex Value from calling object complex elements [Index]..[Index+Len-1].

#NameTypeDescription
1ValueTCplxscalar
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

An exception is raised if array borders are overrun.

Overload 2: function Sub(const Vec: TMtxVec): TMtxVec;

Array subtraction.

#NameTypeDescription
1VecTMtxVec

Result: stored in self (calling object), returns self for chaining

Remarks:

Subtract each of Vec elements from corresponding elements in the calling object. An exception is raised if Vec and calling object size and Matrix.Complex properties do not match.

Examples
var
    a, b, expected: Matrix;
begin
    a := [[1.0, 2.0], [3.0, 4.0]];
    b := [[5.0, 6.0], [7.0, 8.0]];
    a.Sub(b);
    expected := [[-4.0, -4.0], [-4.0, -4.0]];
    if not a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute) then
        raise Exception.Create('Matrix.Sub: mismatch');
end;
See Also: Matrix.Add

Indexed: function Sub(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;

Subtract Vec elements [VecIndex]..[VecIndex+Len-1] from corresponding calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1VecTMtxVec
2VecIndexInteger
3IndexIntegerstart index
4LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

The results are stored in the calling object elements [Index]..[Index+Len-1]. Size and Matrix.Complex properties of the calling object must be set explicitly. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun or underrun.

Overload 3: function Sub(const Src: TMtxVec; Value: TCplx): TMtxVec;

Subtract complex Value from Src store the results in calling object.

#NameTypeDescription
1SrcTMtxVec
2ValueTCplxscalar

Result: stored in self (calling object), returns self for chaining

Remarks:

Size and Matrix.Complex property of calling object are adjusted automatically.

Indexed: function Sub(const Src: TMtxVec; Value: TCplx; SrcIndex: Integer; Index: Integer; Len: Integer): TMtxVec;

Subtract complex Value from Src elements [SrcIndex]..[SrcIndex+Len-1].

#NameTypeDescription
1SrcTMtxVec
2ValueTCplxscalar
3SrcIndexIntegersource start index
4IndexIntegerstart index
5LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the result in calling object elements [Index]..[Index+Len-1]. Size and Matrix.Complex properties of the calling object must be set explicitly. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun or underrun.

Overload 4: function Sub(const Vec1: TMtxVec; const Vec2: TMtxVec): TMtxVec;

Subtract Vec2 elements from Vec1 elements and store the results in calling object.

#NameTypeDescription
1Vec1TMtxVec
2Vec2TMtxVec

Result: stored in self (calling object), returns self for chaining

Remarks:

Size and Matrix.Complex property of calling object are adjusted automatically. An exception is raised if Vec1 and Vec2 size and Matrix.Complex property do not match.

Examples
var
    a, x, y, expected: Matrix;
begin
    x := [[1.0, 2.0], [3.0, 4.0]];
    y := [[5.0, 6.0], [7.0, 8.0]];
    a.Sub(x, y);
    expected := [[-4.0, -4.0], [-4.0, -4.0]];
    if not a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute) then
        raise Exception.Create('Matrix.Sub: mismatch');
end;

Indexed: function Sub(const Vec1: TMtxVec; const Vec2: TMtxVec; Vec1Index: Integer; Vec2Index: Integer; Index: Integer; Len: Integer): TMtxVec;

Subtract Vec22 elements [Vec2Index]..[Vec2Index+Len-1] from Vec1 object elements [Vec1Index]..[Vec1Index+Len-1].

#NameTypeDescription
1Vec1TMtxVec
2Vec2TMtxVec
3Vec1IndexInteger
4Vec2IndexInteger
5IndexIntegerstart index
6LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in calling object elements [Index]..[Index+Len-1]. Size and Matrix.Complex properties of the calling object must be set explicitly. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun or underrun.

Overload 5: function Sub(const X: TMtxVec; const Y: TMtxVec; const Z: TCplx): TMtxVec;

Compute X - Y - zScalar

#NameTypeDescription
1XTMtxVec
2YTMtxVec
3ZTCplx

Result: stored in self (calling object), returns self for chaining

Indexed: function Sub(const X: TMtxVec; XIndex: Integer; const Y: TMtxVec; YIndex: Integer; const Z: TCplx; Index: Integer; Len: Integer): TMtxVec;

Compute X - Y - zScalar on sub array

#NameTypeDescription
1XTMtxVec
2XIndexIntegerX start index
3YTMtxVec
4YIndexIntegerY start index
5ZTCplx
6IndexIntegerstart index
7LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Overload 6: function Sub(const X: TMtxVec; const Y: TMtxVec; const Z: TMtxVec): TMtxVec;

Compute X - Y - Z

#NameTypeDescription
1XTMtxVec
2YTMtxVec
3ZTMtxVec

Result: stored in self (calling object), returns self for chaining

Indexed: function Sub(const X: TMtxVec; XIndex: Integer; const Y: TMtxVec; YIndex: Integer; const Z: TMtxVec; zIndex: Integer; Index: Integer; Len: Integer): TMtxVec;

Compute X - Y - Z on sub array

#NameTypeDescription
1XTMtxVec
2XIndexIntegerX start index
3YTMtxVec
4YIndexIntegerY start index
5ZTMtxVec
6zIndexInteger
7IndexIntegerstart index
8LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Overload 7: function Sub(const X: TMtxVec; const Y: TMtxVec; const Z: Double): TMtxVec;

Compute X - Y - zScalar

#NameTypeDescription
1XTMtxVec
2YTMtxVec
3ZDouble

Result: stored in self (calling object), returns self for chaining

Indexed: function Sub(const X: TMtxVec; XIndex: Integer; const Y: TMtxVec; YIndex: Integer; const Z: Double; Index: Integer; Len: Integer): TMtxVec;

Compute X - Y - zScalar on sub array

#NameTypeDescription
1XTMtxVec
2XIndexIntegerX start index
3YTMtxVec
4YIndexIntegerY start index
5ZDouble
6IndexIntegerstart index
7LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Overload 8: function Sub(const Src: TMtxVec; Value: Double): TMtxVec;

Subtract real Value from Src store the results in calling object.

#NameTypeDescription
1SrcTMtxVec
2ValueDoublescalar

Result: stored in self (calling object), returns self for chaining

Remarks:

Size and Matrix.Complex property of calling object are adjusted automatically.

Indexed: function Sub(const Src: TMtxVec; Value: Double; SrcIndex: Integer; Index: Integer; Len: Integer): TMtxVec;

Subtract real Value from Src elements [SrcIndex]..[SrcIndex+Len-1].

#NameTypeDescription
1SrcTMtxVec
2ValueDoublescalar
3SrcIndexIntegersource start index
4IndexIntegerstart index
5LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the result in calling object elements [Index]..[Index+Len-1]. Size and Matrix.Complex properties of the calling object must be set explicitly. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun or underrun.

Overload 9: function Sub(Value: Double): TMtxVec;

Subtracts Value from object elements.

#NameTypeDescription
1ValueDoublescalar

Result: stored in self (calling object), returns self for chaining

Remarks:

Subtracts Value from all calling object elements.

See Also: Matrix.Add

Indexed: function Sub(Value: Double; Index: Integer; Len: Integer): TMtxVec;

Subtracts Value from calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1ValueDoublescalar
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

An exception is raised if array borders are overrun.