a = [1, 2; 2, 3; 3, 1];
s = [1, 1; 2, 2; 3, 3];
i = [1, 3; 2, 1; 3, 2];
[xs, xi] = sort (a);
sort (a) == s && xs == s && xi == i
