%  normalize each row to unit
A = A./repmat(sqrt(sum(A.^2,2)),1,size(A,2));
%  normalize each column to unit
A = A./repmat(sqrt(sum(A.^2,1)),size(A,1),1);
% % Nannan wang says that in matlab, cycling(循环) is time-consuming.
% % 能不用循环就不用循环
% % Examples
% A=[3 4;5 12];
% [m n] = size(A);
% % normalize each row to unit
% for i = 1:m
%     A(i,:)=A(i,:)/norm(A(i,:));
% end
% A
% % another beautiful way to normalize each row to unit
% A=[3 4;5 12];
% A = A./repmat(sqrt(sum(A.^2,2)),1,size(A,2));
% A
% % normalize each column to unit
% A=[3 4;5 12];
% for i = 1:n
%     A(:,i)=A(:,i)/norm(A(:,i));
% end
% A
% % another beautiful way to normalize each column to unit
% A=[3 4;5 12];
% A = A./repmat(sqrt(sum(A.^2,1)),size(A,1),1);
% A