Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function Sub(Value: TCplx): TMtxVec; | Subtracts complex Value from all calling object complex elements. |
| └ indexed: function Sub(Value: TCplx; Index: Integer; Len: Integer): TMtxVec; | ||
| 2 | function Sub(const Vec: TMtxVec): TMtxVec; | Array subtraction. |
| └ indexed: function Sub(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 3 | function 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; | ||
| 4 | function 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; | ||
| 5 | function 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; | ||
| 6 | function 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; | ||
| 7 | function 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; | ||
| 8 | function Sub(const Src: TMtxVec; Value: Double): TMtxVec; | Subtract real Value from Src. |
| └ indexed: function Sub(const Src: TMtxVec; Value: Double; SrcIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 9 | function 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.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | TCplx | scalar |
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].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | TCplx | scalar |
| 2 | Index | Integer | start index |
| 3 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if array borders are overrun.
Overload 2: function Sub(const Vec: TMtxVec): TMtxVec;
Array subtraction.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec |
Result: stored in self (calling object), returns self for chaining
Subtract each of Vec elements from corresponding elements in the calling object. An exception is raised if Vec and calling object size and Vector.Complex properties do not match.
var
a, b, expected: Vector;
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('Vector.Sub: mismatch');
end;
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].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | |
| 2 | VecIndex | Integer | |
| 3 | Index | Integer | start index |
| 4 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
The results are stored in the calling object elements [Index]..[Index+Len-1]. Size and Vector.Complex properties of the calling object must be set explicitly. An exception is raised if Vector.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.
Result: stored in self (calling object), returns self for chaining
Size and Vector.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] and store the result in calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | TMtxVec | |
| 2 | Value | TCplx | scalar |
| 3 | SrcIndex | Integer | source start index |
| 4 | Index | Integer | start index |
| 5 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Size and Vector.Complex properties of the calling object must be set explicitly. An exception is raised if Vector.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.
Result: stored in self (calling object), returns self for chaining
Size and Vector.Complex property of calling object are adjusted automatically. An exception is raised if Vec1 and Vec2 size and Vector.Complex property do not match.
var
a, x, y, expected: Vector;
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('Vector.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].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec1 | TMtxVec | |
| 2 | Vec2 | TMtxVec | |
| 3 | Vec1Index | Integer | |
| 4 | Vec2Index | Integer | |
| 5 | Index | Integer | start index |
| 6 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Store the results in calling object elements [Index]..[Index+Len-1]. Size and Vector.Complex properties of the calling object must be set explicitly. An exception is raised if Vector.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
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
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec | |
| 2 | XIndex | Integer | X start index |
| 3 | Y | TMtxVec | |
| 4 | YIndex | Integer | Y start index |
| 5 | Z | TCplx | |
| 6 | Index | Integer | start index |
| 7 | Len | Integer | element 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
Result: stored in self (calling object), returns self for chaining
uses MtxVec, MtxExpr, Math387;
var
X, Y, Z, A1, A2, A3: Vector;
begin
X := [5,6,7,8];
Y := [1,2,3,4];
Z := [1,1,1,1];
A1 := X - Y - Z;
A2 := Sub(X, Y, Z);
A3.Sub(X, Y, Z);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
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
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec | |
| 2 | XIndex | Integer | X start index |
| 3 | Y | TMtxVec | |
| 4 | YIndex | Integer | Y start index |
| 5 | Z | TMtxVec | |
| 6 | zIndex | Integer | |
| 7 | Index | Integer | start index |
| 8 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
uses MtxVec, MtxExpr, Math387;
var
X, Y, A1, A2, A3: Vector;
zScalar: Double;
begin
zScalar := 3.0;
X := [5,6,7,8];
Y := [1,2,3,4];
A1 := X - Y - zScalar;
A2 := Sub(X, Y, zScalar);
A3.Sub(X, Y, zScalar);
if not A2.IsEqual(A1) then ERaise('Problem');
if not A3.IsEqual(A1) then ERaise('Problem');
end;
Overload 7: function Sub(const X: TMtxVec; const Y: TMtxVec; const Z: Double): TMtxVec;
Compute X - Y - zScalar
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
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec | |
| 2 | XIndex | Integer | X start index |
| 3 | Y | TMtxVec | |
| 4 | YIndex | Integer | Y start index |
| 5 | Z | Double | |
| 6 | Index | Integer | start index |
| 7 | Len | Integer | element 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.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | TMtxVec | |
| 2 | Value | Double | scalar |
Result: stored in self (calling object), returns self for chaining
Store the results in calling object. Size and Vector.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] and store the result in calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | TMtxVec | |
| 2 | Value | Double | scalar |
| 3 | SrcIndex | Integer | source start index |
| 4 | Index | Integer | start index |
| 5 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Size and Vector.Complex properties of the calling object must be set explicitly. An exception is raised if Vector.ConditionCheck is True and array borders are overrun or underrun.
Overload 9: function Sub(Value: Double): TMtxVec;
Subtracts Value from object elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | Double | scalar |
Result: stored in self (calling object), returns self for chaining
Subtracts Value from all calling object elements.
Indexed: function Sub(Value: Double; Index: Integer; Len: Integer): TMtxVec;
Subtracts Value from calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | Double | scalar |
| 2 | Index | Integer | start index |
| 3 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if array borders are overrun.