FUNCTION funz,a,b,X,Y SZ=SIZE(X) N=SZ[1] & M=SZ[2] RETURN,COS(2*!PI*(a*X/N+b*Y/M)) END PRO COS_ARRAY,N,M,T,W,U,V,R ;+ ;COS_ARRAY,N,M,A,W,U,V,R constructs NxM array A containing ;the functions ;fab(x,y)=cos(2*pi*(ax/N+by/M)) as rows for ;a over the range 0,1,2...N-1 and ;b over the range 0,1,2,...M-1. The SVD of A is then ;calculated and returned in W,U,V. The rank R ;is computed by the number of singular values ;that are greater than 1e-5 ;See SVDC. ; ;H. Rhody, July, 2000 ;- meshdom,findgen(N),findgen(M),X,Y T=FLTARR(N*M,N*M) k=0 FOR a=0,N-1 DO BEGIN FOR b=0,M-1 DO BEGIN z=funz(a,b,x,y) T[*,k]=z[*] k=k+1 ENDFOR ENDFOR SVDC,T,W,U,V R=TOTAL(ABS(W) ge 1E-5) END