N=1e7;
A=randn(N,1);
printf("sort %e real numbers:\n",N);
tic
sort(A);
toc

A=randn(N,1)+1i;
printf("sort %e complex numbers directly:\n",N);
tic
B=sort(A);
toc

printf("sort %e complex numbers by two-fold sort on real:\n",N);
tic
[~,j]=sort(arg(A));
C=A(j);
[~,j]=sort(abs(C));
B1=C(j);
toc

printf("test for validity of algorithm:\n",N);
all(isequal(B,B1))
