% % Optical Imaging and Spectroscopy % % David J. Brady % Duke University % www.opticalimaging.org % % function to find the quadratic residues modulo prime number p between 1 % and p-1. The function returns a list with value 1 for all indices which % are quadratic residues modulo p and value 0 for indices which are not % quadratic residues. % function qr=qres(p) qr=zeros(1,p-1); for i=1:(p-1) qr(mod(i^2,p))=1; end