MatrixInt.SortAscend Method

Overload List

#SignatureDescription
1function SortAscend: TMtxInt;Sorts the elements in a matrix row(s) in ascending order.
└ indexed: function SortAscend(const Index: Integer; const Len: Integer): TMtxVecInt;
2function SortAscend(Col: Integer): TMtxInt;Performs row based sort in ascending order. The Col parameter defines the column based on which the rows are compared with each other.
3function SortAscend(const DstSortIdx: TMtxVecInt; const SortIdxIndex: Integer; const Index: Integer; const Len: Integer): TMtxVecInt;Sort all calling vector elements in ascending order in-place.

Overload 1: function SortAscend: TMtxInt;

Sorts the elements in a matrix row(s) in ascending order.

Result: stored in self (calling object), returns self for chaining

Remarks:

Sorts the elements in calling matrix row(s) in ascending 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
var  A: TMtxInt;
begin
    CreateIt(A);
    try
        A.SetIt(2,2,[1,2,
            4,2]);
        A.SortAscend;
        // A becomes:
        // [1,2]
        // [2,4]
    finally
        FreeIt(A);
    end;
end;
See Also: MatrixInt.SortDescend

Indexed: function SortAscend(const Index: Integer; const Len: Integer): TMtxVecInt;

Sort calling vector elements [Index..Index+Len-1] in ascending order in-place.

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Overload 2: function SortAscend(Col: Integer): TMtxInt;

Performs row based sort in ascending order. The Col parameter defines the column based on which the rows are compared with each other.

#NameTypeDescription
1ColInteger

Result: stored in self (calling object), returns self for chaining

Overload 3: function SortAscend(const DstSortIdx: TMtxVecInt; const SortIdxIndex: Integer; const Index: Integer; const Len: Integer): TMtxVecInt;

Sort all calling vector elements in ascending order in-place.

#NameDescription
1DstSortIdxAfter execution stores sorted values indices.
2SortIdxIndexThe starting index for the DstSortIdx parameter.
3IndexThe starting index at which to start the sort.
4LenThe number of elements to sort starting from including zero-based Index.

Result: stored in self (calling object), returns self for chaining

Returns: calling vector, storing sorted values.

Remarks:

Size of DstSortIdx and calling vector are adjusted automatically.