Permuting the rows of a matrix based on given a given permutation

You can also write sortslices(A, dims=1, by=row->row[2]), although I agree it’s not super-obvious what’s going to happen.

3 Likes