sort_rows_cols function

Sorts rows and columns of a matrix