mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-07-19 05:24:29 -04:00
test code for in-place odd rank multidimensional FFTs
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user