FUNCTION TRANSFORM_BASIS,N,name ;+ ;A=TRANSFORM_BASIS(N,NAME) returns the NxN matrix A ;whose rows are the 1D basis vectors of length N defined ;for the transform selected by the string NAME. ; ;A is unitary with A##A^H=A^H##A=I, where A^H is the ;conjugate transpose of A. ; ;NAME may be one of the following (not case sensitive): ;'DCT' for the discrete cosine transform ;'DFT' for the DFT ; ;H. Rhody, July, 2000 ;- name=STRUPCASE(name) CASE name OF 'DCT': BEGIN MESHDOM,INDGEN(N),INDGEN(N),X,Y A=SQRT(2.0/N)*COS(!PI*Y*(2*X+1)/2./N) A[*,0]=SQRT(1.0/N) END 'DFT': BEGIN MESHDOM,INDGEN(N),INDGEN(N),X,Y A=EXP(COMPLEX(0,-1)*2*!PI*X*Y/N)/SQRT(N) END ELSE: MESSAGE,name + ' is not a recognized NAME' ENDCASE RETURN,A END