Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxVecInt *SortDescend(const int Index, const int Len) const; | Sort calling vector elements [Index..Index+Len-1] in descending order in-place. |
| 2 | TMtxVecInt *SortDescend(TMtxVecInt *DstSortIdx, const int SortIdxIndex, const int Index, const int Len) const; | Sort all calling vector elements in descending order in-place. |
| 3 | TMtxInt *SortDescend() const; | Sorts the elements in a matrix row(s) in descending order. |
| 4 | TMtxInt *SortDescend(int Col) const; | Performs row based sort in descending order. The Col parameter defines the column based on which the rows are compared with each other. |
Overload 1: TMtxVecInt *SortDescend(const int Index, const int Len) const;
Sort calling vector elements [Index..Index+Len-1] in descending order in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | const int | |
| 2 | Len | const int |
Examples
#include "MtxExprInt.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
MatrixInt A;
A = {{1, 2}, {4, 2}};
A.SortDescend();
// A becomes:
// [2,1]
// [4,2]
}
Declared in Dew::Math::MatrixInt · Dew.Math/MtxExprInt.h · Cross-compiler
Overload 2: TMtxVecInt *SortDescend(TMtxVecInt *DstSortIdx, const int SortIdxIndex, const int Index, const int Len) const;
Sort all calling vector elements in descending order in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | DstSortIdx | TMtxVecInt * | After execution stores sorted values indices. |
| 2 | SortIdxIndex | const int | The starting index for the DstSortIdx parameter. |
| 3 | Index | const int | The starting index at which to start the sort. |
| 4 | Len | const int | The number of elements to sort starting from including zero-based Index. |
Returns: calling vector, storing sorted values.
Remarks:
Size of DstSortIdx and calling vector are adjusted automatically.
Declared in Dew::Math::MatrixInt · Dew.Math/MtxExprInt.h · Cross-compiler
Overload 3: TMtxInt *SortDescend() const;
Sorts the elements in a matrix row(s) in descending order.
Remarks:
Sorts the elements in calling matrix row(s) in descending order in-place. If the calling matrix is complex, then complex values are first compared by the absolute value and then by the argument.
Note
Each row is sorted independently from the other.
Examples
#include "MtxVecInt.h"
#include "Units.MtxVecInt.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxVecInt;
void Example()
{
TMtxInt* A;
CreateIt(A);
A->SetIt(2, 2, DewArray<int>{1, 2, 4, 2});
A->SortDescend();
// A becomes:
// [2,1]
// [4,2]
FreeIt(A);
}
See Also: MatrixInt::SortAscend
Declared in Dew::Math::MatrixInt · Dew.Math/MtxExprInt.h · Cross-compiler
Overload 4: TMtxInt *SortDescend(int Col) const;
Performs row based sort in descending order. The Col parameter defines the column based on which the rows are compared with each other.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Col | int |
Declared in Dew::Math::MatrixInt · Dew.Math/MtxExprInt.h · Cross-compiler