pro sfu4,t,lc,f,nk,binsize,bw,tmin,tmax ,tt ; same as sfu3 but attempts to avoid do loops ; this attempt removes the innermost loop and gains a factor 16 ; in this version the SF binsize is SMALLER than the light curve one ; and there is an oversampling parameter bw (usually = binsize of SF) mpts=n_elements(t) npts=(tmax-tmin)/binsize tt=findgen(npts-1)*binsize f=fltarr(npts-1) nk=intarr(npts-1) tau=tt+tmin tt=tau ; so that it returns back lbw=tau-bw/2 ubw=tau+bw/2 for k=0,npts-2 do begin n=0 ;; s=0.0 s=fltarr(mpts-1) for i=0,mpts-2 do begin ;; for j=i+1,mpts-1 do begin ;; u=where(abs(t(j)-t(i)) ge lbw(k) and abs(t(j)-t(i)) lt ubw(k),m) u=where(abs(t(i+1:*)-t(i)) ge lbw(k) and abs(t(i+1:*)-t(i)) lt ubw(k),m) ; but this offset is relative to i+1 u=u+i+1 ; print,k,i,j,m ; print,k,i,m,u ; note that m is always 1 or 0 ! ? if(m ne 0)then begin ;; n=n+1 ;+m ;; s=s+( (lc(j)-lc(i))^2 ) n=n+m ;; s=s+( (lc(u)-lc(i))^2 ) s(i)= (lc(u)-lc(i))^2 endif ;; endfor endfor ;; print,k,i,s nk(k)=n ;; f(k)=s f(k)=total(s) ; print,k,n,s ; read,c endfor return end