Sorting

next - skip - up - start

To sort the values in a matrix or vector, A, (in general this operation makes sense only for vectors and diagonal matrices) use

    SortAscending(A);
or
    SortDescending(A);
I use the Shell-sort algorithm. This is a medium speed algorithm, you might want to replace it with something faster if speed is critical and your matrices are large.