Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function Divide(const X: TCplx; const Y: TMtxVec; const Z: TMtxVec): TMtxVec; | self = xScalar / (Y*Z) |
| └ indexed: function Divide(const X: TCplx; const Y: TMtxVec; YIndex: Integer; const Z: TMtxVec; zIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 2 | function Divide(const Vec: TMtxVec): TMtxVec; | Divide each of calling Matrix elements with corresponding elements in the Vec object. |
| └ indexed: function Divide(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 3 | function Divide(Num: TMtxVec; Den: TMtxVec): TMtxVec; | Divide each of Num elements with corresponding elements in Den. |
| 4 | function Divide(const X: TMtxVec; const Y: TMtxVec; const Z: TMtxVec): TMtxVec; | self = X / (Y*Z) |
| └ indexed: function Divide(const X: TMtxVec; XIndex: Integer; const Y: TMtxVec; YIndex: Integer; const Z: TMtxVec; zIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 5 | function Divide(const Vec1: TMtxVec; const Vec2: TMtxVec; Threshold: Double): TMtxVec; | Divide each of Vec1 elements with corresponding elements in the Vec2 object. |
| └ indexed: function Divide(const Vec1: TMtxVec; const Vec2: TMtxVec; Threshold: Double; Vec1Index: Integer; Vec2Index: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 6 | function Divide(const Vec: TMtxVec; Threshold: Double): TMtxVec; | Matrix division. |
| └ indexed: function Divide(const Vec: TMtxVec; Threshold: Double; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 7 | function Divide(const X: Double; const Y: TMtxVec; const Z: TMtxVec): TMtxVec; | self = xScalar / (Y*Z) |
| └ indexed: function Divide(const X: Double; const Y: TMtxVec; YIndex: Integer; const Z: TMtxVec; zIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | ||
| 8 | function Divide(Num: TMtxVec; Den: TMtxVec; NumIndex: Integer; DenIndex: Integer; Index: Integer; Len: Integer): TMtxVec; | Divide [NumIndex]..[NumIndex+Len-1] Num elements with [DenIndex]..[DenIndex+Len-1] elements in Den. |
Overload 1: function Divide(const X: TCplx; const Y: TMtxVec; const Z: TMtxVec): TMtxVec;
Compute xScalar / (Y*Z)
Result: stored in self (calling object), returns self for chaining
Indexed: function Divide(const X: TCplx; const Y: TMtxVec; YIndex: Integer; const Z: TMtxVec; zIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Compute xScalar / (Y*Z) on sub array
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TCplx | |
| 2 | Y | TMtxVec | |
| 3 | YIndex | Integer | Y start index |
| 4 | Z | TMtxVec | |
| 5 | zIndex | Integer | |
| 6 | Index | Integer | start index |
| 7 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Overload 2: function Divide(const Vec: TMtxVec): TMtxVec;
Divide each of calling Matrix elements with corresponding elements in the Vec object.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec |
Result: stored in self (calling object), returns self for chaining
Size and Matrix.Complex property of the calling object are set automatically. The result is stored in the calling object.
Note
The result of division by zero will be the INF constant. Division of zero by zero will result in NAN.
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.Divide(b);
expected := [[0.2, 0.333333333333333], [0.428571428571429, 0.5]];
if not a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute) then
raise Exception.Create('Matrix.Divide: mismatch');
end;
Indexed: function Divide(const Vec: TMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Divide calling Matrix elements [Index]...[Index+Len-1] with corresponding elements [VecIndex]...[VecIndex+Len-1] from the Vec object.
| # | 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
Store the result in the claling Matrix. The Matrix.Length of the calling Matrix is not changed. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun or underrun.
Note
The result of division by zero will be the INF constant. Division of zero by zero will result in NAN.
Overload 3: function Divide(Num: TMtxVec; Den: TMtxVec): TMtxVec;
Divide each of Num elements with corresponding elements in Den.
Result: stored in self (calling object), returns self for chaining
Size and Matrix.Complex property of the calling object are set automatically. The result is stored in the calling object.
Note
The result of division by zero will be the INF constant. Division of zero by zero will result in NAN.
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.Divide(x, y);
expected := [[0.2, 0.333333333333333], [0.428571428571429, 0.5]];
if not a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute) then
raise Exception.Create('Matrix.Divide: mismatch');
end;
Overload 4: function Divide(const X: TMtxVec; const Y: TMtxVec; const Z: TMtxVec): TMtxVec;
Compute X / (Y*Z)
Result: stored in self (calling object), returns self for chaining
The following expression would also run at the same or higher speed, when passing Y also for the Z parameter:
X / (Y^2)
Indexed: function Divide(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
Overload 5: function Divide(const Vec1: TMtxVec; const Vec2: TMtxVec; Threshold: Double): TMtxVec;
Divide each of Vec1 elements with corresponding elements in the Vec2 object.
Result: stored in self (calling object), returns self for chaining
Store the result in the calling Matrix.
Indexed: function Divide(const Vec1: TMtxVec; const Vec2: TMtxVec; Threshold: Double; Vec1Index: Integer; Vec2Index: Integer; Index: Integer; Len: Integer): TMtxVec;
Divide Vec1 elements [Vec1Index]...[Vec1Index+Len-1] with corresponding elements [Vec2Index]...[Vec2Index+Len-1] from the Vec object.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec1 | TMtxVec | |
| 2 | Vec2 | TMtxVec | |
| 3 | Threshold | Double | scalar |
| 4 | Vec1Index | Integer | |
| 5 | Vec2Index | Integer | |
| 6 | Index | Integer | start index |
| 7 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Store the result in the calling Matrix [Index]...[Index+Len-1].
Overload 6: function Divide(const Vec: TMtxVec; Threshold: Double): TMtxVec;
Matrix division.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | |
| 2 | Threshold | Double | scalar |
Result: stored in self (calling object), returns self for chaining
Divide each of Vec elements with corresponding elements in the calling object. Size and Matrix.Complex property of the calling object are set automatically. The result is stored in the calling object.
The threshold parameter is used to prevent against division by zero and numerical instabilities in the follow on processing. All values of Vec smaller than Threshold will be replaced with Threshold.
Indexed: function Divide(const Vec: TMtxVec; Threshold: Double; VecIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Divide each of Vec elements with corresponding elements in the calling object.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | |
| 2 | Threshold | Double | scalar |
| 3 | VecIndex | Integer | |
| 4 | Index | Integer | start index |
| 5 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Store the result in the calling object. Size and Matrix.Complex property of the calling object are set automatically.
Overload 7: function Divide(const X: Double; const Y: TMtxVec; const Z: TMtxVec): TMtxVec;
Compute xScalar / (Y*Z)
Result: stored in self (calling object), returns self for chaining
Indexed: function Divide(const X: Double; const Y: TMtxVec; YIndex: Integer; const Z: TMtxVec; zIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Compute xScalar / (Y*Z) on sub array
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | Double | |
| 2 | Y | TMtxVec | |
| 3 | YIndex | Integer | Y start index |
| 4 | Z | TMtxVec | |
| 5 | zIndex | Integer | |
| 6 | Index | Integer | start index |
| 7 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Overload 8: function Divide(Num: TMtxVec; Den: TMtxVec; NumIndex: Integer; DenIndex: Integer; Index: Integer; Len: Integer): TMtxVec;
Divide [NumIndex]..[NumIndex+Len-1] Num elements with [DenIndex]..[DenIndex+Len-1] elements in Den.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Num | TMtxVec | source TVec or TMtx |
| 2 | Den | TMtxVec | source TVec or TMtx |
| 3 | NumIndex | Integer | |
| 4 | DenIndex | Integer | |
| 5 | Index | Integer | start index |
| 6 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
Store result in the calling Matrix at positions [Index]..[Index+Len-1] Matrix.Size and Matrix.Complex property of the calling object are not changed. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun or underrun.
Note
The result of division by zero will be the INF constant. Division of zero by zero will result in NAN.