% FMF.M   Fourier Transformation of a matrix
% by XXL
% 
% inputs : A .... m x n Matrix with the non trivial data
%
% output: the mxn matrix FSF with 
%           FSF = F_m * A * F'_n
%
% this uses the unitary FFT!
%
% notes: fast version (01/03/2005) 
%
% XXL .. Peter Balazs, contact: a8927259@unet.univie.ac.at

function U = FMF(A);

[n m] = size(A);

% (1) slow but instructive:
% F = fftu(eye(n));
% F1 = fftu(eye(m));
% UT = F*A*F1';
%
% (2) fast
UT = ifft(fft(A).').';
UT = UT*(sqrt(m)/sqrt(n));
% to get unitary result!
indx = find(abs(UT)>10*eps);
U=zeros(m,n);
U(indx)=UT(indx);

