Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function SortAscend: TVec; | Sorts vector elements in ascending order. |
| └ indexed: function SortAscend(Index: Integer; Len: Integer): TVec; | ||
| 2 | function SortAscend(const IndexVec: TVecInt): TVec; | Sort all calling vector elements. IndexVec contains the new (zero based) order of elements. |
| └ indexed: function SortAscend(Index: Integer; Len: Integer; const IndexVec: TVecInt): TVec; |
Overload 1: function SortAscend: TVec;
Sorts vector elements in ascending order.
Result: stored in self (calling object), returns self for chaining
Sort all calling vector elements.
Note
If the vector is complex, the complex values are first compared by the absolute value and then (if absolute value is equal) by the argument.
var a: Vector;
begin
a.SetIt(True,[2,1,3,4]);
a.SortAscend; // a = [1,2,3,4]
end;
var
a, expected: Vector;
begin
a := [1.0, 2.0, 3.0, 4.0];
a.SortAscend;
expected := [1.0, 2.0, 3.0, 4.0];
if not a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute) then
raise Exception.Create('Vector.SortAscend: mismatch');
end;
Indexed: function SortAscend(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 SortAscend(const IndexVec: TVecInt): TVec;
Sort all calling vector elements. IndexVec contains the new (zero based) order of elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | IndexVec | TVecInt |
Result: stored in self (calling object), returns self for chaining
The order is stored in an array of integers which are accessible via the IValues property.
Indexed: function SortAscend(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. The order is stored in an array of integers which are accessible via the IValues property.