test code for in-place odd rank multidimensional FFTs

This commit is contained in:
Mark Borgerding
2004-02-02 01:47:32 +00:00
parent b9edc58bad
commit 490a602472
3 changed files with 158 additions and 10 deletions

View File

@ -1,4 +1,4 @@
function diff=tailscrap()
function maxabsdiff=tailscrap()
% test code for circular convolution with the scrapped portion
% at the tail of the buffer, rather than the front
%
@ -8,19 +8,19 @@ function diff=tailscrap()
nh=10;
nfft=256;
#h=ones(1,nh);
h=rand(1,nh);
#x=[1 zeros(1,nfft-1)];
x=rand(1,nfft);
hpad=[ h(nh) zeros(1,nfft-nh) h(1:nh-1) ];
y = ifft( fft(hpad) .* fft(x) );
yfilt = filter(h,1,x);
yfilt_no_trans = yfilt(nh:nfft);
% baseline comparison
y1 = filter(h,1,x);
y1_notrans = y1(nh:nfft);
% fast convolution
y2 = ifft( fft(hpad) .* fft(x) );
y2_notrans=y2(1:nfft-nh+1);
maxabsdiff = max(abs(y2_notrans - y1_notrans))
#y2=y(nh:nfft);
y2=y(1:nfft-nh+1);
diff=y2 - yfilt_no_trans;
end