Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TVec SortAscend | Sorts vector elements in ascending order. |
| └ indexed: TVec SortAscend(Int32 Index, Int32 Len) | ||
| 2 | TVec SortAscend(TVecInt IndexVec) | Sort all calling vector elements. IndexVec contains the new (zero based) order of elements. |
| └ indexed: TVec SortAscend(Int32 Index, Int32 Len, TVecInt IndexVec) |
Overload 1: TVec SortAscend
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.
Vector a = new Vector();
a.SetIt(new double[] { 1.0, 2.0, 3.0, 4.0 });
a.SortAscend();
Vector expected = new Vector();
expected.SetIt(new double[] { 1.0, 2.0, 3.0, 4.0 });
if (!a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute))
throw new Exception("Vector.SortAscend: mismatch");
Vector a;
a.SetIt(true,new double[] {2,1,3,4});
a.SortAscend; // a = new double[] {1,2,3,4}
Indexed: TVec SortAscend(Int32 Index, Int32 Len)
Sort calling vector elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Int32 | start index |
| 2 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
An exception is raised if Dew.Math.Vector.ConditionCheck is True and array borders are overrun.
Overload 2: TVec SortAscend(TVecInt IndexVec)
Sort all calling vector elements. IndexVec contains the new (zero based) order of elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | IndexVec | TVecInt | source 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: TVec SortAscend(Int32 Index, Int32 Len, TVecInt IndexVec)
Sort calling vector elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Int32 | start index |
| 2 | Len | Int32 | element count |
| 3 | IndexVec | TVecInt | source TVecInt |
Result: stored in self (calling object), returns self for chaining
An exception is raised if Dew.Math.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.