% % macm 202 -- 31 mar 03 -- djm % % w12shuff8.m: Ncards = 52; Nh = Ncards/2; Nshuffles = 8; % make the permutation matrix for the shuffle Pn = zeros(Ncards,Ncards); for k=1:Nh Pn(2*k-1, k) = 1; Pn(2*k ,Nh+k) = 1; end % make it go fast (special "sparse" matrix form) Pn = sparse(Pn); figure(1); clf % no shuffles yet shuff = eye(Ncards); spy(shuff); title(['\bf after shuffles # ' num2str(0)]) % loop over shuffle matrices for k=1:Nshuffles pause(1) shuff = Pn*shuff; spy(shuff) title(['\bf after shuffles # ' num2str(k)]) end