NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library
cntr_convolution_decl.hpp
Go to the documentation of this file.
1 #ifndef CNTR_CONVOLUTION_DECL_H
2 #define CNTR_CONVOLUTION_DECL_H
3 
5 #include "integration.hpp"
6 
7 namespace cntr {
8 
9 template <typename T> class function;
10 template <typename T> class herm_matrix;
11 
12 /*###########################################################################################
13 #
14 # CONVOLUTION C=A*B or C=A*f*B
15 #
16 # ... currently only implemented for herm_matrix
17 # to compute the convolution of non-hermitian greenfunctions, use the second one ...
18 # implemented in green_cntr_convolution.hpp
19 #
20 ###########################################################################################*/
22 template <typename T, class GG>
23 void convolution_matsubara(GG &C, GG &A, GG &B, integration::Integrator<T> &I, T beta);
24 #if CNTR_USE_OMP == 1
25 template <typename T, class GG>
27 void convolution_matsubara_omp(int nomp, GG &C, GG &A, GG &B, integration::Integrator<T> &I, T beta);
28 #endif
29 template <typename T>
31 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
33  integration::Integrator<T> &I, T beta, T h);
35 template <typename T>
36 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &B,
37  integration::Integrator<T> &I, T beta, T h);
39 template <typename T>
40 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
42  T beta, T h);
43 // with f
45 template <typename T>
46 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
48  integration::Integrator<T> &I, T beta, T h);
50 template <typename T>
51 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
52  herm_matrix<T> &B, integration::Integrator<T> &I, T beta, T h);
54 template <typename T>
55 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc, function<T> &ft,
57  T beta, T h);
58 
59 // simplified new interfaces
60 template <typename T>
61 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
63  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
64 template <typename T>
65 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &B,
66  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
67 template <typename T>
68 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
70  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
71 // with f
72 template <typename T>
73 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
75  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
76 template <typename T>
77 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
78  herm_matrix<T> &B, T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
79 template <typename T>
80 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc, function<T> &ft,
82  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
83 
84 
85 //
86 // only density matrix is computed ... defined in cntr_convolution_with_f.hpp
87 // thus this works with for GG=herm_pseudo and GG=herm_matrix
89 template <typename T, class GG>
90 void convolution_density_matrix(int tstp, std::complex<T> *rho, GG &A, GG &Acc,
91  function<T> &ft, GG &B, GG &Bcc,
92  integration::Integrator<T> &I, T beta, T h);
94 template <typename T, class GG>
95 void convolution_density_matrix(int tstp, std::complex<T> *rho, GG &A, function<T> &ft,
96  GG &B, integration::Integrator<T> &I, T beta, T h);
98 template <typename T, class GG>
99 void convolution_density_matrix(int tstp, std::complex<T> *rho, GG &A, GG &Acc, GG &B,
100  GG &Bcc, integration::Integrator<T> &I, T beta, T h);
102 template <typename T, class GG>
103 void convolution_density_matrix(int tstp, std::complex<T> *rho, GG &A, GG &B,
104  integration::Integrator<T> &I, T beta, T h);
106 template <typename T, class GG>
107 void convolution_density_matrix(int tstp, cdmatrix &Cles, GG &A, GG &B,
108  integration::Integrator<T> &I, T beta, T h);
110 template <typename T, class GG>
111 void convolution_les_timediag(int tstp, cdmatrix &Cles, GG &A, GG &B,
112  integration::Integrator<T> &I, T beta, T h);
113 // simplified new interfaces
114 
115 template <typename T, class GG>
116 void convolution_density_matrix(int tstp, cdmatrix &rho, GG &A, GG &Acc,
117  function<T> &ft, GG &B, GG &Bcc,
118  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
119 template <typename T, class GG>
120 void convolution_density_matrix(int tstp, cdmatrix &rho, GG &A, function<T> &ft,
121  GG &B, T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
122 template <typename T, class GG>
123 void convolution_density_matrix(int tstp, cdmatrix &rho, GG &A, GG &Acc, GG &B,
124  GG &Bcc, T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
125 template <typename T, class GG>
126 void convolution_density_matrix(int tstp, cdmatrix &rho, GG &A, GG &B,
127  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
128 // raw pointer versions
130 template <typename T, class GG>
131 void convolution_matsubara(GG &C, GG &A, std::complex<T> *f0, GG &B,
132  integration::Integrator<T> &I, T beta);
134 template <typename T, class GG, int SIZE1>
135 void convolution_timestep_ret(int n, GG &C, GG &A, GG &Acc, std::complex<T> *ft, GG &B,
136  GG &Bcc, integration::Integrator<T> &I, T h);
138 template <typename T, class GG, int SIZE1>
139 void convolution_timestep_tv(int n, std::complex<T> *ctv, GG &C, GG &A, GG &Acc, GG &B,
140  GG &Bcc, integration::Integrator<T> &I, T beta, T h);
142 template <typename T, class GG, int SIZE1>
143 void convolution_timestep_tv(int n, GG &C, GG &A, GG &Acc, GG &B, GG &Bcc,
144  integration::Integrator<T> &I, T beta, T h);
146 template <typename T, class GG, int SIZE1>
147 void convolution_timestep_tv(int n, std::complex<T> *ctv, GG &C, GG &A, GG &Acc,
148  std::complex<T> *f0, std::complex<T> *ft, GG &B, GG &Bcc,
149  integration::Integrator<T> &I, T beta, T h);
151 template <typename T, class GG, int SIZE1>
152 void convolution_timestep_tv(int n, GG &C, GG &A, GG &Acc, std::complex<T> *f0,
153  std::complex<T> *ft, GG &B, GG &Bcc,
154  integration::Integrator<T> &I, T beta, T h);
156 template <typename T, class GG, int SIZE1>
157 void convolution_timestep_les_tvvt(int n, int j1, int j2, std::complex<T> *cles, GG &C,
158  GG &A, GG &Acc, GG &B, GG &Bcc,
159  integration::Integrator<T> &I, T beta, T h);
161 template <typename T, class GG, int SIZE1>
162 void convolution_timestep_les_tvvt(int n, std::complex<T> *cles, GG &C, GG &A, GG &Acc,
163  GG &B, GG &Bcc, integration::Integrator<T> &I, T beta,
164  T h);
166 template <typename T, class GG, int SIZE1>
167 void convolution_timestep_les_tvvt(int n, std::complex<T> *cles, GG &C, GG &A, GG &Acc,
168  std::complex<T> *f0, GG &B, GG &Bcc,
169  integration::Integrator<T> &I, T beta, T h);
171 template <typename T, class GG, int SIZE1>
172 void convolution_timestep_les_lesadv(int n, int j1, int j2, std::complex<T> *cles, GG &C,
173  GG &A, GG &Acc, GG &B, GG &Bcc,
174  integration::Integrator<T> &I, T beta, T h);
176 template <typename T, class GG, int SIZE1>
177 void convolution_timestep_les_lesadv(int n, std::complex<T> *cles, GG &C, GG &A, GG &Acc,
178  GG &B, GG &Bcc, integration::Integrator<T> &I, T beta,
179  T h);
181 template <typename T, class GG, int SIZE1>
182 void convolution_timestep_les_lesadv(int n, std::complex<T> *cles, GG &C, GG &A, GG &Acc,
183  std::complex<T> *ft, GG &B, GG &Bcc,
184  integration::Integrator<T> &I, T beta, T h);
186 template < typename T, class GG, int SIZE1 >
187 void convolution_timestep_les_retles(int n,std::complex<T> *cles,GG &C,GG &A, GG &Acc,
188 std::complex<T> *ft,GG &B,GG &Bcc,integration::Integrator<T> &I,T beta,T h);
190 template <typename T, class GG, int SIZE1>
191 void convolution_timestep_les(int n, GG &C, GG &A, GG &Acc, std::complex<T> *f0,
192  std::complex<T> *ft, GG &B, GG &Bcc,
193  integration::Integrator<T> &I, T beta, T h);
195 template <typename T>
196 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
197  std::complex<T> *f0, std::complex<T> *ft, herm_matrix<T> &B,
198  herm_matrix<T> &Bcc, integration::Integrator<T> &I, T beta, T h);
200 template <typename T>
201 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, std::complex<T> *f0,
202  std::complex<T> *ft, herm_matrix<T> &B,
203  integration::Integrator<T> &I, T beta, T h);
205 template <typename T>
206 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
207  std::complex<T> *f0, std::complex<T> *ft, herm_matrix<T> &B,
208  herm_matrix<T> &Bcc, integration::Integrator<T> &I, T beta, T h);
209 
211 template <typename T>
212 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
214  integration::Integrator<T> &I, T beta, T h);
216 template <typename T>
217 void convolution_timestep(int n, herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
218  herm_matrix<T> &B, integration::Integrator<T> &I, T beta, T h);
220 template <typename T>
221 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc, function<T> &ft,
223  T beta, T h);
224 
226 template <typename T, class GG, int SIZE1>
227 void convolution_timestep_les_jn_lesadv(int j, int n, std::complex<T> *cc, int sizec, GG &A,
228  GG &Acc, std::complex<T> *ft, GG &B, GG &Bcc,
229  integration::Integrator<T> &I, T beta, T h);
231 template <typename T, class GG, int SIZE1>
232 void convolution_timestep_les_jn_tvvt(int j, int n, std::complex<T> *cc, int sizec, GG &A,
233  GG &Acc, std::complex<T> *f0, GG &B, GG &Bcc,
234  integration::Integrator<T> &I, T beta, T h);
236 template <typename T, class GG, int SIZE1>
237 void convolution_timestep_les_jn_retles(int j, int n, std::complex<T> *cc, int sizec, GG &A,
238  GG &Acc, std::complex<T> *ft, GG &B, GG &Bcc,
239  integration::Integrator<T> &I, T beta, T h);
241 template <typename T, class GG, int SIZE1>
242 void convolution_timestep_les_jn(int j, int n, std::complex<T> *cc, int sizec, GG &A,
243  GG &Acc, std::complex<T> *f0, std::complex<T> *ft, GG &B,
244  GG &Bcc, integration::Integrator<T> &I, T beta, T h);
245 
247 template <typename T, class GG>
248 void convolution_density_matrix(int n, std::complex<T> *rho, GG &A, GG &Acc, function<T> &ft,
249  GG &B, GG &Bcc, integration::Integrator<T> &I, T beta, T h);
251 template <typename T, class GG>
252 void convolution_density_matrix(int tstp, std::complex<T> *rho, GG &A, function<T> &ft,
253  GG &B, integration::Integrator<T> &I, T beta, T h);
255 template <typename T, class GG>
256 void convolution_density_matrix(int n, std::complex<T> *rho, GG &A, GG &Acc, GG &B, GG &Bcc,
257  integration::Integrator<T> &I, T beta, T h);
259 template <typename T, class GG>
260 void convolution_density_matrix(int tstp, std::complex<T> *rho, GG &A, GG &B,
261  integration::Integrator<T> &I, T beta, T h);
263 template <typename T, class GG>
264 void convolution_density_matrix(int tstp, cdmatrix &Cles, GG &A, GG &B,
265  integration::Integrator<T> &I, T beta, T h);
266 
267 /*###########################################################################################
268 #
269 # HELPERS
270 #
271 ###########################################################################################*/
273 template <typename T, int SIZE1>
274 void matsubara_integral_1(int size1, int m, int ntau, std::complex<T> *C, std::complex<T> *A,
275  std::complex<T> *B, integration::Integrator<T> &I, int sig = -1);
277 template <typename T, int SIZE1>
278 void matsubara_integral_1_1(int size1, int m, int ntau, std::complex<T> *C,
279  std::complex<T> *A, std::complex<T> *B,
282 template <typename T, int SIZE1>
283 void matsubara_integral_2(int size1, int m, int ntau, std::complex<T> *C, std::complex<T> *A,
284  std::complex<T> *B, integration::Integrator<T> &I, int sig = -1);
286 template <typename T, int SIZE1>
287 void matsubara_integral_2_2(int size1, int m, int ntau, std::complex<T> *C,
288  std::complex<T> *A, std::complex<T> *B,
290 
291 /* /////////////////////////////////////////////////////////////////////////////////////////
292 // INCREMENETAL
294 #define CPLX std::complex<T>
296 template <typename T, class GG, int SIZE1>
297 void incr_convolution_mat(std::vector<bool> &mask, CPLX alpha, GG &C, GG &A, CPLX *f0, GG &B,
298  integration::Integrator<T> &I, T beta);
300 template <typename T, class GG, int SIZE1>
301 void incr_convolution_ret(int tstp, std::vector<bool> &mask, CPLX alpha, GG &C, GG &A,
302  GG &Acc, CPLX *ft, GG &B, GG &Bcc, integration::Integrator<T> &I,
303  T h);
305 template <typename T, class GG, int SIZE1>
306 void incr_convolution_tv(int tstp, std::vector<bool> &mask, CPLX alpha, GG &C, GG &A,
307  GG &Acc, CPLX *f0, CPLX *ft, GG &B, GG &Bcc,
308  integration::Integrator<T> &I, T beta, T h);
310 template <typename T, class GG, int SIZE1>
311 void incr_convolution_les(int tstp, std::vector<bool> &mask, CPLX alpha, GG &C, GG &A,
312  GG &Acc, CPLX *f0, CPLX *ft, GG &B, GG &Bcc,
313  integration::Integrator<T> &I, T beta, T h);
315 template <typename T, class GG, int SIZE1>
316 void incr_convolution(int tstp, CPLX alpha, GG &C, GG &A, GG &Acc, CPLX *f0, CPLX *ft, GG &B,
317  GG &Bcc, integration::Integrator<T> &I, T beta, T h);
318 
320 // NEW VERSIONS
322 template <typename T>
323 void convolution_timestep_new(int tstp, herm_matrix<T> &C, herm_matrix<T> &A,
324  herm_matrix<T> &Acc, function<T> &ft, herm_matrix<T> &B,
325  herm_matrix<T> &Bcc, integration::Integrator<T> &I, T beta,
326  T h);
328 template <typename T>
329 void convolution_timestep_new(int n, herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
330  herm_matrix<T> &B, integration::Integrator<T> &I, T beta, T h);
332 template <typename T>
333 void convolution_matsubara_new(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &B,
334  integration::Integrator<T> &I, T beta);
336 template <typename T>
337 void convolution_matsubara_new(herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
338  herm_matrix<T> &B, integration::Integrator<T> &I, T beta);
340 template <typename T>
341 void convolution_new(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
342  function<T> &ft, herm_matrix<T> &B, herm_matrix<T> &Bcc,
343  integration::Integrator<T> &I, T beta, T h);
345 template <typename T>
346 void convolution_timestep_new(int tstp, herm_matrix<T> &C, herm_matrix<T> &A,
347  herm_matrix<T> &Acc, herm_matrix<T> &B, herm_matrix<T> &Bcc,
348  integration::Integrator<T> &I, T beta, T h);
350 template <typename T>
351 void convolution_timestep_new(int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &B,
352  integration::Integrator<T> &I, T beta, T h);
354 template <typename T>
355 void convolution_new(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
356  herm_matrix<T> &B, herm_matrix<T> &Bcc, integration::Integrator<T> &I,
357  T beta, T h);
358 
359 #undef CPLX
360 
361 /* #######################################################################################
362 # Parallel
363 ###########################################################################################*/
364 #define CPLX std::complex<T>
365 
366 #if CNTR_USE_OMP == 1
367 template <typename T, class GG, int SIZE1>
369 void incr_convolution_omp(int omp_num_threads, int tstp, CPLX alpha, GG &C, GG &A, GG &Acc,
370  CPLX *f0, CPLX *ft, GG &B, GG &Bcc, integration::Integrator<T> &I,
371  T beta, T h);
373 template <typename T>
374 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
377  integration::Integrator<T> &I, T beta, T h);
379 template <typename T>
380 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
382  integration::Integrator<T> &I, T beta, T h);
384 template <typename T>
385 void convolution_matsubara_omp(int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
388 template <typename T>
389 void convolution_matsubara_omp(int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
390  function<T> &ft, herm_matrix<T> &B,
391  integration::Integrator<T> &I, T beta);
393 template <typename T>
394 void convolution_omp(int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
396  herm_matrix<T> &Bcc, integration::Integrator<T> &I, T beta, T h);
398 template <typename T>
399 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
402  T h);
404 template <typename T>
405 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
407  integration::Integrator<T> &I, T beta, T h);
409 template <typename T>
410 void convolution_omp(int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
412  integration::Integrator<T> &I, T beta, T h);
413 
414 // simplified new interfaces
415 template <typename T>
416 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
419  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
420 template <typename T>
421 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
423  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
424 
425 template <typename T>
426 void convolution_omp(int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
428  herm_matrix<T> &Bcc, T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
429 template <typename T>
430 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
432  herm_matrix<T> &Bcc, T beta,
433  T h, int SolveOrder=MAX_SOLVE_ORDER);
434 template <typename T>
435 void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix<T> &C,
437  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
438 template <typename T>
439 void convolution_omp(int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
441  T beta, T h, int SolveOrder=MAX_SOLVE_ORDER);
442 
443 
444 
445 #undef CPLX
446 #endif // CNTR_USE_OMP
447 
448 } // namespace cntr
449 
450 #endif // CNTR_CONVOLUTION_DECL_H
Class Integrator contains all kinds of weights for integration and differentiation of a function at ...
Integrator< T > & I(int k)
Class function for objects with time on real axis.
void convolution_omp(int omp_num_threads, herm_matrix< T > &C, herm_matrix< T > &A, herm_matrix< T > &Acc, herm_matrix< T > &B, herm_matrix< T > &Bcc, T beta, T h, int SolveOrder=MAX_SOLVE_ORDER)
Returns convolution for all timesteps.
void convolution_timestep_omp(int omp_num_threads, int tstp, herm_matrix< T > &C, herm_matrix< T > &A, herm_matrix< T > &B, T beta, T h, int SolveOrder=MAX_SOLVE_ORDER)
Returns convolution at a given time step.
Class herm_matrix for two-time contour objects with hermitian symmetry.
void convolution_density_matrix(int tstp, cdmatrix &rho, GG &A, GG &B, T beta, T h, int SolveOrder=MAX_SOLVE_ORDER)
Returns the result of the contour convolution for a density matrix