<div dir="ltr">Dear Lorenzo,<div><br></div><div style>Thank you for your response. I must agree that in the end my question has nothing to do with FFT.</div><div style><br></div><div style>Well, I agree that my example is obviously an example of aliasing. What I wanted to understand is why it occurred in that particular piece of code that I quoted. The thing is that discrete Fourier transform is a map. It is an invertible transformation. Therefore if one takes a square wave on a discrete mesh of points and performs FFT and then IFFT, one should get back the original square wave.</div>
<div style><br></div><div style>Indeed, I tested that if I only uncomment the lines</div><div style><br></div><div style><div class="im" style="font-family:arial,sans-serif;font-size:13px">CALL fwfft ('Dense', psic, dfftp)<br>
</div><div class="im" style="font-family:arial,sans-serif;font-size:13px">CALL invfft ('Dense', psic, dfftp)</div><div class="im" style="font-family:arial,sans-serif;font-size:13px"><br></div><div class="im" style="font-family:arial,sans-serif;font-size:13px">
I get the linear function back (as in before_fft.eps).</div></div><div style><br></div><div style>So it looks that aliasing occurs because of these mappings:</div><div style>rho%of_g(:,1) = psic(nl(:))<br></div><div style>
and</div><div style>psic(nl(:)) = rho%of_g(:,1)<br></div><div style><br></div><div style>(this is what you called re-shuffling of the order of planewaves, right?)</div><div style><br></div><div style>Perhaps, for some reason some of the planewaves got lost when this re-shuffling was done.</div>
<div style>So I still have a question whether this is expected behavior of the code or not.</div><div style><br></div><div style>Thanks for your help!</div><div style><br></div><div style>Best regards,</div><div style>Andrei</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 16, 2013 at 4:27 PM, Lorenzo Paulatto <span dir="ltr"><<a href="mailto:lorenzo.paulatto@impmc.upmc.fr" target="_blank">lorenzo.paulatto@impmc.upmc.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 05/16/2013 08:50 PM, Andrei Malashevich wrote:<br>
<br>
> So it looks that by doing FFT and inverse FFT did not return the<br>
> original function.<br>
> I understand that my function rho(z) is not realistic and has a huge<br>
> discontinuity but I thought that it should not really matter for this<br>
> FFT test.<br>
> At least when I took a similar function in 1D, and did FFT and inverse<br>
> FFT in my python script I got my original function back.<br>
><br>
<br>
</div>The fourier transforms are:<br>
<div class="im">CALL fwfft ('Dense', psic, dfftp)<br>
</div><div class="im">CALL invfft ('Dense', psic, dfftp)<br>
<br>
<br>
</div>The other lines in the code snip you pasted have nothing to do with the<br>
fourier transform; they are a re-shuffling of the order of the plane waves.<br>
<br>
That said, the noise in "after" looks like a typical example of<br>
aliasing. Like here: <<a href="http://en.wikipedia.org/wiki/File:SquareWave.gif" target="_blank">http://en.wikipedia.org/wiki/File:SquareWave.gif</a>><br>
<br>
bests<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Dr. Lorenzo Paulatto<br>
IdR @ IMPMC -- CNRS & Université Paris 6<br>
phone:<a href="tel:%2B33%20%280%291%2044275%20084" value="+33144275084">+33 (0)1 44275 084</a> / skype: paulatz<br>
www: <a href="http://www-int.impmc.upmc.fr/~paulatto/" target="_blank">http://www-int.impmc.upmc.fr/~paulatto/</a><br>
mail: 23-24/4é16 Boîte courrier 115, 4 place Jussieu 75252 Paris Cédex 5<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Pw_forum mailing list<br>
<a href="mailto:Pw_forum@pwscf.org">Pw_forum@pwscf.org</a><br>
<a href="http://pwscf.org/mailman/listinfo/pw_forum" target="_blank">http://pwscf.org/mailman/listinfo/pw_forum</a><br>
</div></div></blockquote></div><br></div>