function A=sort_perm(A) % Sorting by permutation generation
  n=length(A);          % aka sort by permuting
  b=perms(1:n);
  for  k= 1:length(b)
   if chksrt(A(b( k,:))) == 1
      A=A(b( k,:));
      fprintf('permutation %s sorts! \n',mat2str(b(k,:)));
      return;
   end
  end
end
