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 quicksort algorithm. The algorithm is similar to that in Sedgewick's algorithms in C++. If the sort seems to be failing (as quicksort can do) an exception is thrown.

You will get incorrect results if you try to sort a band matrix - but why would you want to sort a band matrix?