Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TVec SortDescend | Sorts vector elements in descending order. |
| └ indexed: TVec SortDescend(Int32 Index, Int32 Len) | ||
| 2 | TVec SortDescend(TVecInt IndexVec) | Sort all calling vector elements. IndexVec contains contains the new order of elements. |
| └ indexed: TVec SortDescend(Int32 Index, Int32 Len, TVecInt IndexVec) |
Overload 1: TVec SortDescend
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.
Vector a = new Vector();
a.SetIt(new double[] { 1.0, 2.0, 3.0, 4.0 });
a.SortDescend();
Vector expected = new Vector();
expected.SetIt(new double[] { 4.0, 3.0, 2.0, 1.0 });
if (!a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute))
throw new Exception("Vector.SortDescend: mismatch");
TVec a;
MtxVec.CreateIt(out a);
try
{
a.SetIt(true,new double[] {2,1,3,4});
a.SortDescend; // a = new double[] {4,3,2,1}
}
finally
{
MtxVec.FreeIt(ref a);
}
Indexed: TVec SortDescend(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.TMtxVecBase.ConditionCheck is True and array borders are overrun.
Overload 2: TVec SortDescend(TVecInt IndexVec)
Sort all calling vector elements. IndexVec contains contains the new order of elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | IndexVec | TVecInt | source TVecInt |
Result: stored in self (calling object), returns self for chaining
Indexed: TVec SortDescend(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.TMtxVecBase.ConditionCheck is True and array borders are overrun.
IndexVec contains the new order of elements.