NESSi  v1.0.2 The NonEquilibrium Systems Simulation Library

## ◆ matsubara_dft()

template<typename T , class GG , int SIZE1>
 void cntr::matsubara_dft ( std::complex< T > * mdft, GG & G, int sig )

Computes the Fourier series coefficients of a Matsubara function by plain DFT.

Purpose

Computes $$I = \sum_{r=0}^m f(\tau_r) e^{i \omega_n \tau_r}$$ for $$n=0,\dot,m$$, assuming $$\tau_r = r \beta/m$$. The Matsubara frequencies are given by $$\omega_n= (2n+1)\pi/\beta$$ for fermions, while $$\omega_n= 2n*\pi/\beta$$ for bosons.

Parameters
 mdft [complex] on return, pointer storing the Fourier coeffients in element representation G [GG] Matsubara function to be Fourier transformed sig [int] sig=-1 for fermions, sig=+1 for bosons

Definition at line 134 of file cntr_matsubara_impl.hpp.

134  {
135  typedef std::complex<T> cplx;
136  int ntau, r, m, sg, size1 = G.size1();
137  double arg, one;
138  cplx *z, *z1, expfac;
139  sg = G.element_size();
140  ntau = G.ntau();
141  z = new cplx[sg];
142  z1 = new cplx[sg];
143  one = (sig == -1 ? 1.0 : 0.0);
144  for (m = 0; m <= ntau; m++) {
145  element_set_zero<T, SIZE1>(size1, z);
146  for (r = 0; r <= ntau; r++) {
147  arg = ((2 * m + one) * r * PI) / ntau;
148  expfac = cplx(cos(arg), sin(arg));
149  element_set<T, SIZE1>(size1, z1, G.matptr(r));
150  element_smul<T, SIZE1>(size1, z1, expfac);
151  element_incr<T, SIZE1>(size1, z, z1);
152  }
153  element_set<T, SIZE1>(size1, mdft + m * sg, z);
154  }
155  delete[] z;
156  delete[] z1;
157 }
std::complex< double > cplx
Definition: fourier.cpp:11