lexicographic matrix rows sorting
[N, [k]]=lex_sort(M [,sel] [,'unique'])
real matrix
real matrix
column vector of integers
the lex_sort function is now obsolete. It can be
replaced by functions gsort and unique.
N=lex_sort(M) sorts the rows (as a group) of the
matrix M in ascending order. If required the output
argument k contains the ordering:
[N,k]=lex_sort(M) returns k such as
N is equal to M(k,:) .
N=lex_sort(M,sel [,'unique']) produces the same
result as the following sequence of instructions:
The 'unique' flag has to be given if one wants to
retain only unique rows in the result. Note that
lex_sort(M,sel,'unique') retains only rows such that
M(:,sel) are unique.