% sort_rows( w, s) - produce sorted row indices from [x s] = sort(w(:))
%
function RR = sort_rows( w, s)

[r c] = size(w);

RR = [1:r]' * ones(1,c);

RR = RR(:);
 
RR = RR(s);
