2013-07-17 19:24:07 +02:00
.. highlight :: c
Fourier transforms
###################
2013-10-23 15:51:51 +02:00
The Fourier transforms from real and imaginary frequencies to times, and inverse, are currently implemented,
along with the analogous transformation from the Legendre expansion to imaginary time and frequencies.
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
Synopsis and example
======================
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
**Synopsis** ::
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
lazy_object fourier (gf<imfreq,Target,Opt> const &)
lazy_object fourier (gf_const_view<imfreq,Target,Opt> const &)
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
lazy_object inverse_fourier (gf<imfreq,Target,Opt> const &)
lazy_object inverse_fourier (gf_const_view<imfreq,Target,Opt> const &)
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
The fourier/inverse_fourier functions do **not** perform the Fourier transformation,
but returns a small lazy object (basically saying "Fourier Transform of XXX"),
which is then used in an assignment of a *view* of a gf.
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
Example
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
.. compileblock ::
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
#include <triqs/gfs.hpp>
using namespace triqs::gfs;
int main() {
double beta =1, a=1;
int N=10000;
auto gw = gf<imfreq> {{beta, Fermion, N}, {1,1}};
auto gt = gf<imtime> {{beta, Fermion, N}, {1,1}};
triqs::clef::placeholder<0> om_;
gw (om_) << 1/(om_-a);
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
gt() = inverse_fourier(gw); // fills the *View* with the contents of the FFT.
// NB : the mesh must have the same size.
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
// make a new fresh gf, with the same size mesh, from the FFT of gt
auto gw2 = make_gf_from_fourier(gt);
}
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
Note that :
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
* the LHS of the = must be a view, since the RHS can not compute the domain of the function
(how many points to use ?).
2013-07-19 13:27:16 +02:00
2013-10-23 15:51:51 +02:00
* In the make_gf_from_fourier function, choice is explicitly made to generate a new gf with the same number of points in the mesh.
2013-07-19 16:37:01 +02:00
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
Convention
===========
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
For real time/frequency:
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
.. math :: \tilde G(\omega)=\int_{-\infty}^\infty dt G(t)e^{i\omega t}
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
.. math :: G(t)=\int_{-\infty}^\infty \frac{d\omega}{2\pi} \tilde G(\omega)e^{-i\omega t}
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
For Matsubara (imaginary) time/frequency:
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
.. math :: \tilde G(i\omega_n)=\int_{0}^\beta d\tau G(t)e^{i\omega_n \tau}
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
.. math :: G(\tau)=\sum_{n=-\infty}^\infty \frac{1}{\beta} \tilde G(i\omega_n)e^{-i\omega_n \tau}
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
The :math: `\omega_n` 's are :math: `\frac{(2n+1)\pi}{\beta}` for fermions, :math: `\frac{2n\pi}{\beta}` for bosons (as :math: `G(\tau+\beta)=-G(\tau)` for fermions, :math: `G(\tau)` for bosons).
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
*
.. toctree ::
:maxdepth: 1
2013-07-17 19:24:07 +02:00
2013-10-23 15:51:51 +02:00
fourier_impl_notes
2013-07-17 19:24:07 +02:00