%Input g-scalar function r=functionPPMFast(g,L) q=(pi)*g; Pw=sin(q)/(q); %Calculate correlator: H=0.0; for d=1:(L-1) H=H+(L-d)*cos(2.0*q*d); end r=Pw*Pw*(1-(L+2.0*H)/L); end Copyright (C) 2009 Konstantin Kirillov