Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function SortDescend: TVec; | Sorts vector elements in descending order. |
| └ indexed: function SortDescend(Index: Integer; Len: Integer): TVec; | ||
| 2 | function SortDescend(const IndexVec: TVecInt): TVec; | Sort all calling vector elements. IndexVec contains contains the new order of elements. |
| └ indexed: function SortDescend(Index: Integer; Len: Integer; const IndexVec: TVecInt): TVec; |
Overload 1: function SortDescend: TVec;
Sorts vector elements in descending order.
Result: stored in self (calling object), returns self for chaining
Sort all calling vector elements in descending order.
Note
If the vector is complex, the complex values are first compared by the absolute value and then by the argument.
var a: Vector;
begin
a.SetIt(True,[2,1,3,4]);
a.SortDescend; // a = [4,3,2,1]
var
a, expected: Vector;
begin
a := [1.0, 2.0, 3.0, 4.0];
a.SortDescend;
expected := [4.0, 3.0, 2.0, 1.0];
if not a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute) then
raise Exception.Create('Vector.SortDescend: mismatch');
end;
Indexed: function SortDescend(Index: Integer; Len: Integer): TVec;
Sort calling vector elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Integer | start index |
| 2 | Len | Integer | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if Vector.ConditionCheck is True and array borders are overrun.
Overload 2: function SortDescend(const IndexVec: TVecInt): TVec;
Sort all calling vector elements. IndexVec contains contains the new order of elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | IndexVec | TVecInt |
Result: stored in self (calling object), returns self for chaining
Indexed: function SortDescend(Index: Integer; Len: Integer; const IndexVec: TVecInt): TVec;
Sort calling vector elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Integer | start index |
| 2 | Len | Integer | element count |
| 3 | IndexVec | TVecInt |
Result: stored in self (calling object), returns self for chaining
An exception is raised if Vector.ConditionCheck is True and array borders are overrun. IndexVec contains the new order of elements.