for n=3:3
    A = magic(n)
    p = randperm(n)
    q = randperm(n)
    B = A(p,q)
    disp(sprintf('sum(A) = %f,\t sum(B) = %f\n', sum(A), sum(B)))
    disp(sprintf('sum(A'')'' = %f,\t sum(B'')'' = %f\n', sum(A')', sum(B')'))
    disp(sprintf('sum(diag(A)) = %f,\t sum(diag(B)) = %f\n', sum(diag(A)), sum(diag(B))))
    disp(sprintf('sum(diag(flipud(A))) = %f,\t sum(diag(flipud(B))) = %f\n', sum(diag(flipud(A))), sum(diag(flipud(B)))))
    disp(sprintf('rank(A) = %f,\t rank(B) = %f\n', rank(A), rank(B)))
end
        
    
    
