Strange values in convolution (using FFT through gpu)
1 回表示 (過去 30 日間)
古いコメントを表示
I want to realize a code in which i use the convolution for GPU computing. So I'm studying all the characteristics of convulution and its application for GPU. I've also read this question https://it.mathworks.com/matlabcentral/answers/38066-difference-between-conv-ifft-fft-when-doing-convolution (very useful):
So look at this code:
len=100;
g=randi(50,1,len);
h=randi(50,1,len);
z=conv(g,h);
s=len+len-1; % it is related to the padding
l=gpuArray([g zeros(1,s-len)]);
m=gpuArray([h zeros(1,s-len)]);
z_2=ifft(fft(l).*fft(m));
z_2=gather(z_2);
Here there are the first components of the results :
z = 8 185 931 1623 2278 3859 4270 5559 7330 6475 7549 7862 7893 10386 10595 11300
z_2= 7,99999999998245 - 3,51000970332467e-12i 184,999999999994 - 1,13000769162752e-12i 930,999999999987 + 2,84583190541624e-12i 1622,99999999998 + 4,19583394168701e-14i 2277,99999999999 - 7,29777384031118e-12i 3858,99999999999 - 6,95099718695151e-12i 4269,99999999998 - 7,31342157267749e-12i 5558,99999999998 + 3,52422064534209e-13i 7329,99999999999 + 5,34843173262111e-12i 6474,99999999998 - 6,95563862181934e-12i 7548,99999999998 - 4,98451114397262e-12i 7862,00000000000 - 1,06265252202149e-11i 7892,99999999998 - 1,42314382643217e-11i 10386,0000000000 + 2,28547111462919e-12i 10595,0000000000 + 8,34669775247101e-12i 11300,0000000000 + 4,30036588495909e-12i
Why is there the imag part in the second "version" ?
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Fourier Analysis and Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!