1 #ifndef CNTR_CONVOLUTION_IMPL_H 2 #define CNTR_CONVOLUTION_IMPL_H 85 template <
typename T,
int SIZE1>
86 void matsubara_integral_1(
int size1,
int m,
int ntau, std::complex<T> *C,
87 std::complex<T> *A, std::complex<T> *B,
89 typedef std::complex<T>
cplx;
90 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1, j, l, sa1, sb1, sc1;
91 cplx *amat, *bmat, *ctemp1, *ctemp2;
98 ctemp1 =
new cplx[sc1];
99 ctemp2 =
new cplx[sc1];
101 for (l = 0; l < sc1; l++) {
107 for (j = 0; j <= k; j++) {
108 weight =
I.gregory_omega(j);
109 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
113 for (j = k1; j < m - k; j++) {
114 element_incr<T, SIZE1>(size1, ctemp1, amat, bmat);
118 for (j = m - k; j <= m; j++) {
119 weight =
I.gregory_omega(m - j);
120 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
127 for (j = 0; j <= m; j++) {
128 weight =
I.gregory_weights(m, j);
129 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
134 for (l = 0; l <= k; l++) {
135 for (j = 0; j <= k; j++) {
136 weight =
I.rcorr(m, l, j);
137 element_incr<T, SIZE1>(size1, ctemp1, weight, A + l * sa1,
143 for (l = 0; l < sc1; l++) {
146 if (ntau - m >= k2 - 1) {
147 amat = A + sa1 * ntau;
149 for (j = m; j <= m + k; j++) {
150 weight =
I.gregory_omega(j - m);
151 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
155 for (j = m + k1; j < ntau - k; j++) {
156 element_incr<T, SIZE1>(size1, ctemp2, amat, bmat);
160 for (j = ntau - k; j <= ntau; j++) {
161 weight =
I.gregory_omega(ntau - j);
162 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
166 }
else if (ntau - m >= k) {
167 amat = A + sa1 * ntau;
169 for (j = m; j <= ntau; j++) {
170 weight =
I.gregory_weights(ntau - m, ntau - j);
171 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
175 }
else if (ntau - m >
178 for (l = 0; l <= k; l++) {
179 for (j = 0; j <= k; j++) {
180 weight =
I.rcorr(ntau - m, l, j);
181 element_incr<T, SIZE1>(size1, ctemp2, weight,
182 A + sa1 * (ntau - l),
183 B + sb1 * (ntau - j));
188 for (l = 0; l < sc1; l++)
189 C[l] = ctemp1[l] + std::complex<T>(sig, 0.0) * ctemp2[l];
225 template <
typename T,
int SIZE1>
226 void matsubara_integral_1_1(
int size1,
int m,
int ntau, std::complex<T> *C,
227 std::complex<T> *A, std::complex<T> *B,
229 typedef std::complex<T>
cplx;
230 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1, j, l, sa1, sb1, sc1;
231 cplx *amat, *bmat, *ctemp1;
238 ctemp1 =
new cplx[sc1];
240 for (l = 0; l < sc1; l++) {
246 for (j = 0; j <= k; j++) {
247 weight =
I.gregory_omega(j);
248 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
252 for (j = k1; j < m - k; j++) {
253 element_incr<T, SIZE1>(size1, ctemp1, amat, bmat);
257 for (j = m - k; j <= m; j++) {
258 weight =
I.gregory_omega(m - j);
259 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
266 for (j = 0; j <= m; j++) {
267 weight =
I.gregory_weights(m, j);
268 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
273 for (l = 0; l <= k; l++) {
274 for (j = 0; j <= k; j++) {
275 weight =
I.rcorr(m, l, j);
276 element_incr<T, SIZE1>(size1, ctemp1, weight, A + l * sa1,
282 for (l = 0; l < sc1; l++)
318 template <
typename T,
int SIZE1>
319 void matsubara_integral_2_2(
int size1,
int m,
int ntau, std::complex<T> *C,
320 std::complex<T> *A, std::complex<T> *B,
322 typedef std::complex<T>
cplx;
323 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1, j, l, sa1, sb1, sc1;
324 cplx *amat, *bmat, *ctemp2;
329 ctemp2 =
new cplx[sc1];
331 for (l = 0; l < sc1; l++)
334 }
else if (m > ntau - k) {
335 for (l = 0; l <= k; l++) {
336 for (j = 0; j <= k; j++) {
337 weight =
I.rcorr(ntau - m, l, j);
338 element_incr<T, SIZE1>(size1, ctemp2, weight,
339 A + sa1 * (ntau - l), B + sb1 * j);
342 }
else if (m > ntau - k2 + 1) {
345 for (l = 0; l <= ntau - m; l++) {
346 weight =
I.gregory_weights(ntau - m, l);
347 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
354 for (l = m; l <= m + k; l++) {
355 weight =
I.gregory_omega(l - m);
356 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
360 for (l = m + k1; l < ntau - k; l++) {
361 element_incr<T, SIZE1>(size1, ctemp2, amat, bmat);
365 for (l = ntau - k; l <= ntau; l++) {
366 weight =
I.gregory_omega(ntau - l);
367 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
373 for (l = 0; l < sc1; l++)
409 template <
typename T,
int SIZE1>
410 void matsubara_integral_2(
int size1,
int m,
int ntau, std::complex<T> *C,
411 std::complex<T> *A, std::complex<T> *B,
413 typedef std::complex<T>
cplx;
414 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1, j, l, sa1, sb1, sc1;
415 cplx *amat, *bmat, *ctemp1, *ctemp2;
422 ctemp1 =
new cplx[sc1];
423 ctemp2 =
new cplx[sc1];
425 for (l = 0; l < sc1; l++)
430 for (j = 0; j <= k; j++) {
431 for (l = 0; l <= k; l++) {
432 weight =
I.rcorr(m, l, j);
433 element_incr<T, SIZE1>(size1, ctemp1, weight, A + j * sa1,
434 B + sb1 * (ntau - l));
437 }
else if (m < k2 - 1) {
439 bmat = B + sb1 * ntau;
440 for (l = 0; l <= m; l++) {
441 weight =
I.gregory_weights(m, l);
442 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
448 bmat = B + sb1 * ntau;
449 for (l = 0; l <= k; l++) {
450 weight =
I.gregory_omega(l);
451 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
455 for (l = k1; l < m - k; l++) {
456 element_incr<T, SIZE1>(size1, ctemp1, amat, bmat);
460 for (l = m - k; l <= m; l++) {
461 weight =
I.gregory_omega(m - l);
462 element_incr<T, SIZE1>(size1, ctemp1, weight, amat, bmat);
468 for (l = 0; l < sc1; l++)
471 }
else if (m > ntau - k) {
472 for (l = 0; l <= k; l++) {
473 for (j = 0; j <= k; j++) {
474 weight =
I.rcorr(ntau - m, l, j);
475 element_incr<T, SIZE1>(size1, ctemp2, weight,
476 A + sa1 * (ntau - l), B + sb1 * j);
479 }
else if (m > ntau - k2 + 1) {
482 for (l = 0; l <= ntau - m; l++) {
483 weight =
I.gregory_weights(ntau - m, l);
484 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
491 for (l = m; l <= m + k; l++) {
492 weight =
I.gregory_omega(l - m);
493 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
497 for (l = m + k1; l < ntau - k; l++) {
498 element_incr<T, SIZE1>(size1, ctemp2, amat, bmat);
502 for (l = ntau - k; l <= ntau; l++) {
503 weight =
I.gregory_omega(ntau - l);
504 element_incr<T, SIZE1>(size1, ctemp2, weight, amat, bmat);
510 for (l = 0; l < sc1; l++)
511 C[l] = ctemp2[l] + std::complex<T>(sig, 0.0) * ctemp1[l];
544 template <
typename T,
class GG,
int SIZE1>
545 void convolution_matsubara_dispatch(GG &C, GG &A, GG &B,
547 int ntau, l, m, size1 = C.size1();
548 std::complex<T> *cmat;
551 for (m = 0; m <= ntau;
553 matsubara_integral_1<T, SIZE1>(size1, m, ntau, C.matptr(m),
554 A.matptr(0), B.matptr(0),
I, A.sig());
559 m = (ntau + 1) * C.element_size();
560 for (l = 0; l < m; l++)
593 template <
typename T,
class GG>
596 int size1 = A.size1();
597 assert(B.ntau() == A.ntau());
598 assert(C.ntau() == A.ntau());
599 assert(B.size1() == size1);
600 assert(C.size1() == size1);
602 convolution_matsubara_dispatch<T, GG, 1>(C, A, B,
I, beta);
604 convolution_matsubara_dispatch<T, GG, LARGESIZE>(C, A, B,
I, beta);
607 #if CNTR_USE_OMP == 1 638 template <
typename T,
class GG,
int SIZE1>
639 void convolution_matsubara_omp_dispatch(
int nomp, GG &C, GG &A, GG &B,
641 int ntau, l, m, size1 = C.size1();
642 std::complex<T> *cmat;
645 #pragma omp parallel for num_threads(nomp) 646 for (m = 0; m <= ntau;
648 matsubara_integral_1<T, SIZE1>(size1, m, ntau, C.matptr(m),
649 A.matptr(0), B.matptr(0),
I, A.sig());
654 m = (ntau + 1) * C.element_size();
655 for (l = 0; l < m; l++)
688 template <
typename T,
class GG>
691 int size1 = A.size1();
692 assert(B.ntau() == A.ntau());
693 assert(C.ntau() == A.ntau());
694 assert(B.size1() == size1);
695 assert(C.size1() == size1);
697 convolution_matsubara_omp_dispatch<T, GG, 1>(nomp, C, A, B,
I, beta);
699 convolution_matsubara_omp_dispatch<T, GG, LARGESIZE>(nomp, C, A, B,
I, beta);
702 #endif // CNTR_USE_OMP 740 template <
typename T,
class GG,
int SIZE1>
741 void convolution_timestep_ret(
int n, GG &C, GG &A, GG &Acc, GG &B, GG &Bcc,
743 typedef std::complex<T>
cplx;
745 int sa, sb, sc, j, m, j1, n1, l, size1 = C.size1();
746 cplx *aret, *cret, *bret, *btemp, *atemp, *result;
750 sa = A.element_size();
751 sb = B.element_size();
752 sc = C.element_size();
753 n1 = (n < k ? k : n);
754 atemp =
new cplx[sa];
755 btemp =
new cplx[sb];
759 result =
new cplx[(n + 1) * sc];
760 for (l = 0; l < (n + 1) * sc; l++)
763 assert(sa * sb * sc != 0);
764 assert(Acc.element_size() == sa);
765 assert(Bcc.element_size() == sb);
766 assert(A.nt() >= n1);
767 assert(Acc.nt() >= n1);
768 assert(B.nt() >= n1);
769 assert(Bcc.nt() >= n1);
774 for (m = 0; m <= n; m++) {
775 aret = A.retptr(n, m);
776 for (l = 0; l < sa; l++)
777 atemp[l] = aret[l] * h;
779 bret = B.retptr(m, 0);
783 for (j = 0; j < m - k; j++) {
784 element_incr<T, SIZE1>(size1, cret, atemp,
790 weight =
I.gregory_omega(n - m);
791 for (j = 0; j < m - k; j++) {
792 element_incr<T, SIZE1>(size1, cret, weight, atemp,
802 for (j = j1; j <= m; j++) {
803 weight =
I.gregory_weights(n - j, n - m);
804 element_incr<T, SIZE1>(size1, cret, weight, atemp,
811 for (m = n - k; m < n; m++) {
812 aret = A.retptr(n, m);
813 for (l = 0; l < sa; l++)
814 atemp[l] = aret[l] * h;
815 for (j = m + 1; j <= n; j++) {
816 weight =
I.gregory_weights(n - j, n - m);
817 element_conj<T, SIZE1>(size1, btemp, Bcc.retptr(j, m));
819 element_incr<T, SIZE1>(size1, result + j * sc, -weight, atemp,
824 for (j = 0; j <= n; j++) {
825 cret = result + j * sc;
826 for (m = 0; m <= k; m++) {
827 weight =
I.poly_integration(j, n, m) * h;
829 for (l = 0; l < sb; l++)
830 btemp[l] = B.retptr(m, j)[l];
832 element_conj<T, SIZE1>(size1, btemp, Bcc.retptr(j, m));
836 for (l = 0; l < sa; l++)
837 atemp[l] = A.retptr(n, m)[l];
839 element_conj<T, SIZE1>(size1, atemp, Acc.retptr(m, n));
843 element_incr<T, SIZE1>(size1, cret, weight, atemp, btemp);
848 cret = C.retptr(n, 0);
849 for (l = 0; l < (n + 1) * sc; l++)
900 template <
typename T,
class GG,
int SIZE1>
901 void convolution_timestep_tv(
int n, std::complex<T> *ctv, GG &C, GG &A,
902 GG &Acc, GG &B, GG &Bcc,
904 typedef std::complex<T>
cplx;
907 int sa = A.element_size();
908 int sb = B.element_size();
909 int sc = C.element_size();
911 int n1 = (n > k ? n : k);
912 int size1 = C.size1();
913 T dtau = beta / ntau;
915 cplx *ctemp1, *ctv1, *btv, *atemp;
919 assert(sa * sb * sc != 0);
920 assert(Acc.element_size() == sa);
921 assert(Bcc.element_size() == sb);
922 assert(Acc.ntau() == ntau);
923 assert(B.ntau() == ntau);
924 assert(Bcc.ntau() == ntau);
925 assert(C.ntau() == ntau);
926 assert(A.nt() >= n1);
927 assert(Acc.nt() >= n1);
928 assert(B.nt() >= n1);
929 assert(Bcc.nt() >= n1);
933 ctemp1 =
new cplx[sc];
934 for (m = 0; m <= ntau; m++) {
935 matsubara_integral_2<T, SIZE1>(size1, m, ntau, ctemp1, A.tvptr(n, 0),
936 B.matptr(0),
I, B.sig());
937 for (l = 0; l < sc; l++)
938 ctv[m * sc + l] = dtau * ctemp1[l];
944 atemp =
new cplx[sa];
945 for (j = 0; j <= n1; j++) {
946 weight =
I.gregory_weights(n, j);
948 element_conj<T, SIZE1>(size1, atemp, Acc.retptr(j, n));
949 element_smul<T, SIZE1>(size1, atemp, -1);
952 element_set<T, SIZE1>(size1, atemp, A.retptr(n, j));
955 element_smul<T, SIZE1>(size1, atemp, h);
960 for (m = 0; m <= ntau; m++) {
961 element_incr<T, SIZE1>(size1, ctv1, weight, atemp, btv);
966 for (m = 0; m <= ntau; m++) {
967 element_incr<T, SIZE1>(size1, ctv1, atemp, btv);
1015 template <
typename T,
class GG,
int SIZE1>
1016 void convolution_timestep_tv(
int n, GG &C, GG &A, GG &Acc, GG &B, GG &Bcc,
1018 typedef std::complex<T>
cplx;
1019 int ntau, m, sc, size1 = C.size1();
1022 sc = C.element_size();
1024 assert(sc > 0 && ntau > 0);
1025 ctv =
new cplx[(ntau + 1) * sc];
1026 convolution_timestep_tv<T, GG, SIZE1>(n, ctv, C, A, Acc, B, Bcc,
I, beta,
1028 for (m = 0; m <= ntau; m++)
1029 element_set<T, SIZE1>(size1, C.tvptr(n, m), ctv + m * sc);
1074 template <
typename T,
class GG,
int SIZE1>
1076 convolution_timestep_les_tvvt(
int n,
int j1,
int j2, std::complex<T> *cles,
1077 GG &C, GG &A, GG &Acc, GG &B, GG &Bcc,
1079 typedef std::complex<T>
cplx;
1080 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1;
1081 int sa, sb, sc, ntau, j, m, l, n1, sig, size1 = C.size1();
1083 cplx *atv, *btv, *btemp, *cles1, idtau;
1086 sa = A.element_size();
1087 sb = B.element_size();
1088 sc = C.element_size();
1091 n1 = (n < k ? k : n);
1093 assert(sa * sb * sc != 0);
1095 assert(Acc.element_size() == sa);
1096 assert(Bcc.element_size() == sb);
1097 assert(Acc.ntau() == ntau);
1098 assert(B.ntau() == ntau);
1099 assert(Bcc.ntau() == ntau);
1100 assert(C.ntau() == ntau);
1101 assert(A.nt() >= n1);
1102 assert(Acc.nt() >= n1);
1103 assert(B.nt() >= n1);
1104 assert(Bcc.nt() >= n1);
1105 assert(sig == Acc.sig());
1106 assert(sig == B.sig());
1107 assert(sig == Bcc.sig());
1108 assert(0 <= j1 && j1 <= n1);
1109 assert(j1 <= j2 && j2 <= n1);
1113 btemp =
new cplx[(ntau + 1) * sb];
1114 idtau =
cplx(0, -dtau);
1115 for (m = 0; m <= ntau; m++)
1116 element_conj<T, SIZE1>(size1, btemp + m * sb, Bcc.tvptr(n, ntau - m));
1117 for (l = 0; l < (ntau + 1) * sb; l++)
1118 btemp[l] *= idtau * (-(T)sig);
1119 for (j = j1; j <= j2; j++) {
1121 atv = A.tvptr(j, 0);
1122 cles1 = cles + j * sc;
1123 if (ntau < k2 - 1) {
1124 for (m = 0; m <= ntau; m++) {
1125 weight =
I.gregory_weights(ntau, m);
1126 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
1131 for (m = 0; m <= k; m++) {
1132 weight =
I.gregory_omega(m);
1133 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
1137 for (m = k1; m < ntau - k; m++) {
1138 element_incr<T, SIZE1>(size1, cles1, atv, btv);
1142 for (m = ntau - k; m <= ntau; m++) {
1143 weight =
I.gregory_omega(ntau - m);
1144 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
1191 template <
typename T,
class GG,
int SIZE1>
1192 void convolution_timestep_les_tvvt(
int n, std::complex<T> *cles, GG &C, GG &A,
1193 GG &Acc, GG &B, GG &Bcc,
1197 int n1 = (n < k ? k : n);
1198 return convolution_timestep_les_tvvt<T, GG, SIZE1>(
1199 n, 0, n1, cles, C, A, Acc, B, Bcc,
I, beta, h);
1243 template <
typename T,
class GG,
int SIZE1>
1245 convolution_timestep_les_lesadv(
int n,
int j1,
int j2, std::complex<T> *cles,
1246 GG &C, GG &A, GG &Acc, GG &B, GG &Bcc,
1248 typedef std::complex<T>
cplx;
1250 int sa, sb, sc, ntau, j, m, l, n1, size1 = C.size1();
1252 cplx idtau, *ales, *badv;
1255 sa = A.element_size();
1256 sb = B.element_size();
1257 sc = C.element_size();
1259 n1 = (n < k ? k : n);
1261 assert(sa * sb * sc != 0);
1263 assert(Acc.element_size() == sa);
1264 assert(Bcc.element_size() == sb);
1265 assert(Acc.ntau() == ntau);
1266 assert(B.ntau() == ntau);
1267 assert(Bcc.ntau() == ntau);
1268 assert(C.ntau() == ntau);
1269 assert(A.nt() >= n1);
1270 assert(Acc.nt() >= n1);
1271 assert(B.nt() >= n1);
1272 assert(Bcc.nt() >= n1);
1273 assert(0 <= j1 && j1 <= n1);
1274 assert(j1 <= j2 && j2 <= n1);
1277 ales =
new cplx[sa];
1278 badv =
new cplx[(n1 + 1) * sb];
1279 for (m = 0; m <= n1; m++) {
1280 weight = h *
I.gregory_weights(n, m);
1282 element_conj<T, SIZE1>(size1, badv + m * sb, Bcc.retptr(n, m));
1283 for (l = 0; l < sb; l++)
1284 badv[m * sb + l] *= weight;
1286 for (l = 0; l < sb; l++)
1287 badv[m * sb + l] = -weight * B.retptr(m, n)[l];
1291 for (j = j1; j <= j2; j++) {
1292 for (m = 0; m < j; m++) {
1293 element_minusconj<T, SIZE1>(size1, ales, Acc.lesptr(m, j));
1294 element_incr<T, SIZE1>(size1, cles + j * sc, ales, badv + m * sb);
1298 for (m = 0; m <= n1; ++m) {
1299 int jmax = std::min(j2, m);
1300 for (j = j1; j <= jmax; ++j) {
1301 element_incr<T, SIZE1>(size1, cles + j * sc, A.lesptr(j, m),
1347 template <
typename T,
class GG,
int SIZE1>
1348 void convolution_timestep_les_lesadv(
int n, std::complex<T> *cles, GG &C,
1349 GG &A, GG &Acc, GG &B, GG &Bcc,
1353 int n1 = (n < k ? k : n);
1354 return convolution_timestep_les_lesadv<T, GG, SIZE1>(
1355 n, 0, n1, cles, C, A, Acc, B, Bcc,
I, beta, h);
1395 template <
typename T,
class GG,
int SIZE1>
1396 void convolution_timestep_les_retles(
int n, std::complex<T> *cles, GG &C,
1397 GG &A, GG &Acc, GG &B, GG &Bcc,
1400 typedef std::complex<T>
cplx;
1401 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1, size1 = C.size1();
1402 int sa, sb, sc, ntau, j, m, l, n1;
1404 cplx *aret, *atemp, *btemp, *cles1, *bles, idtau;
1407 sa = A.element_size();
1408 sb = B.element_size();
1409 sc = C.element_size();
1411 n1 = (n < k ? k : n);
1413 assert(sa * sb * sc != 0);
1415 assert(Acc.element_size() == sa);
1416 assert(Bcc.element_size() == sb);
1417 assert(Acc.ntau() == ntau);
1418 assert(B.ntau() == ntau);
1419 assert(Bcc.ntau() == ntau);
1420 assert(C.ntau() == ntau);
1421 assert(A.nt() >= n1);
1422 assert(Acc.nt() >= n1);
1423 assert(B.nt() >= n1);
1424 assert(Bcc.nt() >= n1);
1427 btemp =
new cplx[(n1 + 1) * sb];
1428 atemp =
new cplx[sa];
1429 for (m = 0; m <= n1; m++) {
1431 for (l = 0; l < sb; l++)
1432 btemp[m * sb + l] = h * B.lesptr(m, n)[l];
1434 element_conj<T, SIZE1>(size1, btemp + m * sb, Bcc.lesptr(n, m));
1435 for (l = 0; l < sb; l++)
1436 btemp[m * sb + l] *= -h;
1439 for (j = 0; j <= n; j++) {
1440 cles1 = cles + j * sc;
1443 aret = A.retptr(j, 0);
1445 for (m = 0; m <= k; m++) {
1446 weight =
I.gregory_omega(m);
1447 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
1451 for (m = k1; m < j - k; m++) {
1452 element_incr<T, SIZE1>(size1, cles1, aret, bles);
1456 for (m = j - k; m <= j; m++) {
1457 weight =
I.gregory_omega(j - m);
1458 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
1463 aret = A.retptr(j, 0);
1465 for (m = 0; m <= j; m++) {
1466 weight =
I.gregory_weights(j, m);
1467 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
1474 for (m = j + 1; m <= k; m++) {
1475 element_conj<T, SIZE1>(size1, atemp, Acc.retptr(m, j));
1476 weight = -
I.gregory_weights(j, m);
1477 bles = btemp + m * sb;
1478 element_incr<T, SIZE1>(size1, cles1, weight, atemp, bles);
1524 template <
typename T,
class GG,
int SIZE1>
1525 void convolution_timestep_les(
int n, GG &C, GG &A, GG &Acc, GG &B, GG &Bcc,
1527 typedef std::complex<T>
cplx;
1529 int m, sc, n1, k =
I.get_k(), size1 = C.size1();
1530 sc = C.element_size();
1532 n1 = (k > n ? k : n);
1533 cles =
new cplx[(n1 + 1) * sc];
1534 for (m = 0; m < sc * (n1 + 1); m++)
1536 convolution_timestep_les_tvvt<T, GG, SIZE1>(n, cles, C, A, Acc, B, Bcc,
I,
1538 convolution_timestep_les_lesadv<T, GG, SIZE1>(n, cles, C, A, Acc, B, Bcc,
1540 convolution_timestep_les_retles<T, GG, SIZE1>(n, cles, C, A, Acc, B, Bcc,
1542 for (m = 0; m <= n; m++)
1543 element_set<T, SIZE1>(size1, C.lesptr(m, n), cles + m * sc);
1581 template <
typename T>
1582 void convolution_timestep(
int n, herm_matrix<T> &C, herm_matrix<T> &A,
1583 herm_matrix<T> &Acc, herm_matrix<T> &B,
1586 int size1 = C.size1(), ntau = C.ntau(), k =
I.k(), n1 = (n < k ? k : n);
1588 convolution_matsubara(C, A, B,
I, beta);
1592 assert(A.size1() == size1);
1593 assert(Acc.size1() == size1);
1594 assert(B.size1() == size1);
1595 assert(Bcc.size1() == size1);
1596 assert(A.ntau() == ntau);
1597 assert(Acc.ntau() == ntau);
1598 assert(B.ntau() == ntau);
1599 assert(Bcc.ntau() == ntau);
1600 assert(A.nt() >= n1);
1601 assert(Acc.nt() >= n1);
1602 assert(B.nt() >= n1);
1603 assert(Bcc.nt() >= n1);
1604 assert(C.nt() >= n);
1606 convolution_timestep_ret<T, herm_matrix<T>, 1>(n, C, A, Acc, B, Bcc,
1608 convolution_timestep_tv<T, herm_matrix<T>, 1>(n, C, A, Acc, B, Bcc,
I,
1610 convolution_timestep_les<T, herm_matrix<T>, 1>(n, C, A, Acc, B, Bcc,
1613 convolution_timestep_ret<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc,
1615 convolution_timestep_tv<T, herm_matrix<T>, LARGESIZE>(
1616 n, C, A, Acc, B, Bcc,
I, beta, h);
1617 convolution_timestep_les<T, herm_matrix<T>, LARGESIZE>(
1618 n, C, A, Acc, B, Bcc,
I, beta, h);
1656 template <
typename T>
1660 T beta, T h,
int SolveOrder) {
1661 int size1 = C.
size1(), ntau = C.
ntau(), n1 = (n < SolveOrder ? SolveOrder : n);
1663 convolution_matsubara(C, A, B, integration::I<T>(SolveOrder), beta);
1667 assert(A.
size1() == size1);
1668 assert(Acc.
size1() == size1);
1669 assert(B.
size1() == size1);
1670 assert(Bcc.
size1() == size1);
1671 assert(A.
ntau() == ntau);
1672 assert(Acc.
ntau() == ntau);
1673 assert(B.
ntau() == ntau);
1674 assert(Bcc.
ntau() == ntau);
1675 assert(A.
nt() >= n1);
1676 assert(Acc.
nt() >= n1);
1677 assert(B.
nt() >= n1);
1678 assert(Bcc.
nt() >= n1);
1679 assert(C.
nt() >= n);
1681 convolution_timestep_ret<T, herm_matrix<T>, 1>(n, C, A, Acc, B, Bcc,
1682 integration::I<T>(SolveOrder), h);
1683 convolution_timestep_tv<T, herm_matrix<T>, 1>(n, C, A, Acc, B, Bcc, integration::I<T>(SolveOrder),
1685 convolution_timestep_les<T, herm_matrix<T>, 1>(n, C, A, Acc, B, Bcc,
1686 integration::I<T>(SolveOrder), beta, h);
1688 convolution_timestep_ret<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc,
1689 B, Bcc, integration::I<T>(SolveOrder), h);
1690 convolution_timestep_tv<T, herm_matrix<T>, LARGESIZE>(
1691 n, C, A, Acc, B, Bcc, integration::I<T>(SolveOrder), beta, h);
1692 convolution_timestep_les<T, herm_matrix<T>, LARGESIZE>(
1693 n, C, A, Acc, B, Bcc, integration::I<T>(SolveOrder), beta, h);
1728 template <
typename T>
1729 void convolution_timestep(
int n, herm_matrix<T> &C, herm_matrix<T> &A,
1732 convolution_timestep<T>(n, C, A, A, B, B,
I, beta, h);
1766 template <
typename T>
1769 T beta, T h,
int SolveOrder) {
1770 convolution_timestep<T>(n, C, A, A, B, B, beta, h, SolveOrder);
1804 template <
typename T>
1805 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
1806 herm_matrix<T> &B, herm_matrix<T> &Bcc,
1809 convolution_matsubara(C, A, B,
I, beta);
1810 for (tstp = 0; tstp <= C.nt(); tstp++)
1811 convolution_timestep<T>(tstp, C, A, Acc, B, Bcc,
I, beta, h);
1844 template <
typename T,
class GG,
int SIZE1>
1845 void convolution_matsubara_dispatch(GG &C, GG &A, std::complex<T> *f0, GG &B,
1847 int ntau, l, m, size1 = C.size1(), sb = B.element_size();
1848 std::complex<T> *cmat, *bmat;
1851 bmat =
new std::complex<T>[sb * (ntau + 1)];
1852 for (m = 0; m <= ntau; m++)
1853 element_mult<T, SIZE1>(size1, bmat + m * sb, f0, B.matptr(m));
1854 for (m = 0; m <= ntau; m++) {
1855 matsubara_integral_1<T, SIZE1>(size1, m, ntau, C.matptr(m), A.matptr(0), bmat,
I,
1862 m = (ntau + 1) * C.element_size();
1863 for (l = 0; l < m; l++)
1896 template <
typename T,
class GG>
1897 void convolution_matsubara(GG &C, GG &A, std::complex<T> *f0, GG &B,
1899 int size1 = A.size1();
1900 assert(B.ntau() == A.ntau());
1901 assert(C.ntau() == A.ntau());
1902 assert(B.size1() == size1);
1903 assert(C.size1() == size1);
1905 convolution_matsubara_dispatch<T, GG, 1>(C, A, f0, B,
I, beta);
1907 convolution_matsubara_dispatch<T, GG, LARGESIZE>(C, A, f0, B,
I, beta);
1947 template <
typename T,
class GG,
int SIZE1>
1948 void convolution_timestep_ret(
int n, GG &C, GG &A, GG &Acc, std::complex<T> *ft, GG &B,
1950 typedef std::complex<T>
cplx;
1952 int sf, sa, sb, sc, j, m, j1, n1, l, size1 = C.size1();
1953 cplx *aret, *cret, *bret, *btemp, *atemp, *result;
1957 sa = A.element_size();
1958 sb = B.element_size();
1959 sc = C.element_size();
1961 n1 = (n < k ? k : n);
1962 atemp =
new cplx[sa];
1963 aret =
new cplx[sa];
1964 btemp =
new cplx[sb];
1967 result =
new cplx[(n + 1) * sc];
1968 for (l = 0; l < (n + 1) * sc; l++)
1971 assert(sa * sb * sc != 0);
1972 assert(Acc.element_size() == sa);
1973 assert(Bcc.element_size() == sb);
1974 assert(A.nt() >= n1);
1975 assert(Acc.nt() >= n1);
1976 assert(B.nt() >= n1);
1977 assert(Bcc.nt() >= n1);
1978 assert(C.nt() >= n);
1982 for (m = 0; m <= n; m++) {
1983 element_mult<T, SIZE1>(size1, aret, A.retptr(n, m), ft + m * sf);
1985 for (l = 0; l < sa; l++)
1986 atemp[l] = aret[l] * h;
1988 bret = B.retptr(m, 0);
1992 for (j = 0; j < m - k; j++) {
1993 element_incr<T, SIZE1>(size1, cret, atemp, bret);
1998 weight =
I.gregory_omega(n - m);
1999 for (j = 0; j < m - k; j++) {
2000 element_incr<T, SIZE1>(size1, cret, weight, atemp,
2010 for (j = j1; j <= m; j++) {
2011 weight =
I.gregory_weights(n - j, n - m);
2012 element_incr<T, SIZE1>(size1, cret, weight, atemp,
2019 for (m = n - k; m < n; m++) {
2020 element_mult<T, SIZE1>(size1, aret, A.retptr(n, m), ft + m * sf);
2022 for (l = 0; l < sa; l++)
2023 atemp[l] = aret[l] * h;
2024 for (j = m + 1; j <= n; j++) {
2025 weight =
I.gregory_weights(n - j, n - m);
2026 element_conj<T, SIZE1>(size1, btemp, Bcc.retptr(j, m));
2028 element_incr<T, SIZE1>(size1, result + j * sc, -weight, atemp, btemp);
2032 for (j = 0; j <= n; j++) {
2033 cret = result + j * sc;
2034 for (m = 0; m <= k; m++) {
2035 weight =
I.poly_integration(j, n, m) * h;
2037 for (l = 0; l < sb; l++)
2038 btemp[l] = B.retptr(m, j)[l];
2040 element_conj<T, SIZE1>(size1, btemp, Bcc.retptr(j, m));
2044 for (l = 0; l < sa; l++)
2045 atemp[l] = A.retptr(n, m)[l];
2047 element_conj<T, SIZE1>(size1, atemp, Acc.retptr(m, n));
2050 element_mult<T, SIZE1>(size1, aret, atemp, ft + m * sf);
2051 element_incr<T, SIZE1>(size1, cret, weight, aret, btemp);
2057 cret = C.retptr(n, 0);
2058 for (l = 0; l < (n + 1) * sc; l++)
2059 cret[l] = result[l];
2115 template <
typename T,
class GG,
int SIZE1>
2116 void convolution_timestep_tv(
int n, std::complex<T> *ctv, GG &C, GG &A, GG &Acc,
2117 std::complex<T> *f0, std::complex<T> *ft, GG &B, GG &Bcc,
2119 typedef std::complex<T>
cplx;
2120 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1;
2121 int sf, sa, sb, sc, ntau, j, m, l, n1, size1 = C.size1();
2123 cplx *ctemp1, *ctv1, *btv, *atemp, *bmat, *atemp1;
2126 sa = A.element_size();
2127 sb = B.element_size();
2128 sc = C.element_size();
2131 n1 = (n > k ? n : k);
2134 assert(sa * sb * sc != 0);
2136 assert(Acc.element_size() == sa);
2137 assert(Bcc.element_size() == sb);
2138 assert(Acc.ntau() == ntau);
2139 assert(B.ntau() == ntau);
2140 assert(Bcc.ntau() == ntau);
2141 assert(C.ntau() == ntau);
2142 assert(A.nt() >= n1);
2143 assert(Acc.nt() >= n1);
2144 assert(B.nt() >= n1);
2145 assert(Bcc.nt() >= n1);
2148 ctemp1 =
new cplx[sc];
2149 bmat =
new cplx[(ntau + 1) * sb];
2150 for (m = 0; m <= ntau; m++)
2151 element_mult<T, SIZE1>(size1, bmat + m * sb, f0, B.matptr(m));
2152 for (m = 0; m <= ntau; m++) {
2153 matsubara_integral_2<T, SIZE1>(size1, m, ntau, ctemp1, A.tvptr(n, 0), bmat,
I,
2155 for (l = 0; l < sc; l++)
2156 ctv[m * sc + l] = dtau * ctemp1[l];
2161 atemp =
new cplx[sa];
2162 atemp1 =
new cplx[sa];
2163 n1 = (n > k ? n : k);
2164 for (j = 0; j <= n1; j++) {
2165 weight =
I.gregory_weights(n, j);
2167 element_conj<T, SIZE1>(size1, atemp, Acc.retptr(j, n));
2168 element_smul<T, SIZE1>(size1, atemp, -1);
2170 element_set<T, SIZE1>(size1, atemp, A.retptr(n, j));
2172 element_smul<T, SIZE1>(size1, atemp, h);
2173 element_mult<T, SIZE1>(size1, atemp1, atemp, ft + sf * j);
2174 btv = B.tvptr(j, 0);
2177 for (m = 0; m <= ntau; m++) {
2178 element_incr<T, SIZE1>(size1, ctv1, weight, atemp1, btv);
2183 for (m = 0; m <= ntau; m++) {
2184 element_incr<T, SIZE1>(size1, ctv1, atemp1, btv);
2238 template <
typename T,
class GG,
int SIZE1>
2239 void convolution_timestep_tv(
int n, GG &C, GG &A, GG &Acc, std::complex<T> *f0,
2240 std::complex<T> *ft, GG &B, GG &Bcc,
2242 typedef std::complex<T>
cplx;
2243 int ntau, m, sc, size1 = C.size1();
2246 sc = C.element_size();
2248 assert(sc > 0 && ntau > 0);
2249 ctv =
new cplx[(ntau + 1) * sc];
2250 convolution_timestep_tv<T, GG, SIZE1>(n, ctv, C, A, Acc, f0, ft, B, Bcc,
I, beta, h);
2251 for (m = 0; m <= ntau; m++)
2252 element_set<T, SIZE1>(size1, C.tvptr(n, m), ctv + m * sc);
2295 template <
typename T,
class GG,
int SIZE1>
2296 void convolution_timestep_les_tvvt(
int n, std::complex<T> *cles, GG &C, GG &A, GG &Acc,
2297 std::complex<T> *f0, GG &B, GG &Bcc,
2299 typedef std::complex<T>
cplx;
2300 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1;
2301 int sa, sb, sc, ntau, j, m, l, n1, sig, size1 = C.size1();
2303 cplx *atv, *btv, *btemp, *btemp1, *cles1, idtau;
2306 sa = A.element_size();
2307 sb = B.element_size();
2308 sc = C.element_size();
2311 n1 = (n < k ? k : n);
2313 assert(sa * sb * sc != 0);
2315 assert(Acc.element_size() == sa);
2316 assert(Bcc.element_size() == sb);
2317 assert(Acc.ntau() == ntau);
2318 assert(B.ntau() == ntau);
2319 assert(Bcc.ntau() == ntau);
2320 assert(C.ntau() == ntau);
2321 assert(A.nt() >= n1);
2322 assert(Acc.nt() >= n1);
2323 assert(B.nt() >= n1);
2324 assert(Bcc.nt() >= n1);
2325 assert(sig == Acc.sig());
2326 assert(sig == B.sig());
2327 assert(sig == Bcc.sig());
2330 btemp =
new cplx[(ntau + 1) * sb];
2331 btemp1 =
new cplx[sb];
2332 idtau =
cplx(0, -dtau);
2333 for (m = 0; m <= ntau; m++) {
2334 element_conj<T, SIZE1>(size1, btemp1, Bcc.tvptr(n, ntau - m));
2335 element_mult<T, SIZE1>(size1, btemp + m * sb, f0, btemp1);
2338 for (l = 0; l < (ntau + 1) * sb; l++)
2339 btemp[l] *= idtau * (-(T)sig);
2340 for (j = 0; j <= n1; j++) {
2342 atv = A.tvptr(j, 0);
2343 cles1 = cles + j * sc;
2344 if (ntau < k2 - 1) {
2345 for (m = 0; m <= ntau; m++) {
2346 weight =
I.gregory_weights(ntau, m);
2347 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
2352 for (m = 0; m <= k; m++) {
2353 weight =
I.gregory_omega(m);
2354 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
2358 for (m = k1; m < ntau - k; m++) {
2359 element_incr<T, SIZE1>(size1, cles1, atv, btv);
2363 for (m = ntau - k; m <= ntau; m++) {
2364 weight =
I.gregory_omega(ntau - m);
2365 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
2414 template <
typename T,
class GG,
int SIZE1>
2415 void convolution_timestep_les_lesadv(
int n, std::complex<T> *cles, GG &C, GG &A, GG &Acc,
2416 std::complex<T> *ft, GG &B, GG &Bcc,
2418 typedef std::complex<T>
cplx;
2420 int sf, sa, sb, sc, ntau, j, m, l, n1, size1 = C.size1();
2422 cplx *atemp, *btemp, idtau, *ales, *badv, *btemp1;
2425 sa = A.element_size();
2426 sb = B.element_size();
2427 sc = C.element_size();
2430 n1 = (n < k ? k : n);
2432 assert(sa * sb * sc != 0);
2434 assert(Acc.element_size() == sa);
2435 assert(Bcc.element_size() == sb);
2436 assert(Acc.ntau() == ntau);
2437 assert(B.ntau() == ntau);
2438 assert(Bcc.ntau() == ntau);
2439 assert(C.ntau() == ntau);
2440 assert(A.nt() >= n1);
2441 assert(Acc.nt() >= n1);
2442 assert(B.nt() >= n1);
2443 assert(Bcc.nt() >= n1);
2446 atemp =
new cplx[(n1 + 1) * sa];
2447 btemp =
new cplx[(n1 + 1) * sb];
2448 btemp1 =
new cplx[sb];
2449 for (m = 0; m <= n1; m++) {
2450 weight = h *
I.gregory_weights(n, m);
2452 element_conj<T, SIZE1>(size1, btemp1, Bcc.retptr(n, m));
2453 for (l = 0; l < sb; l++)
2454 btemp1[l] *= weight;
2456 for (l = 0; l < sb; l++)
2457 btemp1[l] = -weight * B.retptr(m, n)[l];
2459 element_mult<T, SIZE1>(size1, btemp + m * sb, ft + m * sf, btemp1);
2462 for (j = 0; j <= n1; j++) {
2463 for (m = 0; m <= n1; m++) {
2465 element_conj<T, SIZE1>(size1, atemp + m * sa, Acc.lesptr(m, j));
2466 for (l = 0; l < sa; l++)
2467 atemp[m * sa + l] *= -1;
2469 for (l = 0; l < sa; l++)
2470 atemp[m * sa + l] = A.lesptr(j, m)[l];
2475 for (m = 0; m <= n1; m++) {
2476 element_incr<T, SIZE1>(size1, cles + j * sc, ales, badv);
2525 template <
typename T,
class GG,
int SIZE1>
2526 void convolution_timestep_les_retles(
int n, std::complex<T> *cles, GG &C, GG &A, GG &Acc,
2527 std::complex<T> *ft, GG &B, GG &Bcc,
2529 typedef std::complex<T>
cplx;
2530 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1, size1 = C.size1();
2531 int sf, sa, sb, sc, ntau, j, m, l, n1;
2533 cplx *aret, *atemp, *btemp, *btemp1, *cles1, *bles, idtau;
2536 sa = A.element_size();
2537 sb = B.element_size();
2538 sc = C.element_size();
2541 n1 = (n < k ? k : n);
2543 assert(sa * sb * sc != 0);
2545 assert(Acc.element_size() == sa);
2546 assert(Bcc.element_size() == sb);
2547 assert(Acc.ntau() == ntau);
2548 assert(B.ntau() == ntau);
2549 assert(Bcc.ntau() == ntau);
2550 assert(C.ntau() == ntau);
2551 assert(A.nt() >= n1);
2552 assert(Acc.nt() >= n1);
2553 assert(B.nt() >= n1);
2554 assert(Bcc.nt() >= n1);
2557 btemp =
new cplx[(n1 + 1) * sb];
2558 btemp1 =
new cplx[sb];
2559 atemp =
new cplx[sa];
2560 for (m = 0; m <= n1; m++) {
2562 for (l = 0; l < sb; l++)
2563 btemp1[l] = h * B.lesptr(m, n)[l];
2565 element_conj<T, SIZE1>(size1, btemp1, Bcc.lesptr(n, m));
2566 for (l = 0; l < sb; l++)
2569 element_mult<T, SIZE1>(size1, btemp + m * sb, ft + m * sf, btemp1);
2572 for (j = 0; j <= n; j++) {
2573 cles1 = cles + j * sc;
2576 aret = A.retptr(j, 0);
2578 for (m = 0; m <= k; m++) {
2579 weight =
I.gregory_omega(m);
2580 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
2584 for (m = k1; m < j - k; m++) {
2585 element_incr<T, SIZE1>(size1, cles1, aret, bles);
2589 for (m = j - k; m <= j; m++) {
2590 weight =
I.gregory_omega(j - m);
2591 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
2596 aret = A.retptr(j, 0);
2598 for (m = 0; m <= j; m++) {
2599 weight =
I.gregory_weights(j, m);
2600 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
2607 for (m = j + 1; m <= k; m++) {
2608 element_conj<T, SIZE1>(size1, atemp, Acc.retptr(m, j));
2609 weight = -
I.gregory_weights(j, m);
2610 bles = btemp + m * sb;
2611 element_incr<T, SIZE1>(size1, cles1, weight, atemp, bles);
2662 template <
typename T,
class GG,
int SIZE1>
2663 void convolution_timestep_les(
int n, GG &C, GG &A, GG &Acc, std::complex<T> *f0,
2664 std::complex<T> *ft, GG &B, GG &Bcc,
2666 typedef std::complex<T>
cplx;
2668 int m, sc, n1, k =
I.get_k(), size1 = C.size1();
2669 sc = C.element_size();
2671 n1 = (k > n ? k : n);
2672 cles =
new cplx[(n1 + 1) * sc];
2673 for (m = 0; m < sc * (n1 + 1); m++)
2675 convolution_timestep_les_tvvt<T, GG, SIZE1>(n, cles, C, A, Acc, f0, B, Bcc,
I, beta, h);
2676 convolution_timestep_les_lesadv<T, GG, SIZE1>(n, cles, C, A, Acc, ft, B, Bcc,
I, beta,
2678 convolution_timestep_les_retles<T, GG, SIZE1>(n, cles, C, A, Acc, ft, B, Bcc,
I, beta,
2680 for (m = 0; m <= n; m++)
2681 element_set<T, SIZE1>(size1, C.lesptr(m, n), cles + m * sc);
2723 template <
typename T>
2724 void convolution_timestep(
int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
2725 std::complex<T> *f0, std::complex<T> *ft, herm_matrix<T> &B,
2727 int size1 = C.size1(), ntau = C.ntau(), k =
I.k(), n1 = (n < k ? k : n);
2729 convolution_matsubara(C, A, f0, B,
I, beta);
2733 assert(A.size1() == size1);
2734 assert(Acc.size1() == size1);
2735 assert(B.size1() == size1);
2736 assert(Bcc.size1() == size1);
2737 assert(A.ntau() == ntau);
2738 assert(Acc.ntau() == ntau);
2739 assert(B.ntau() == ntau);
2740 assert(Bcc.ntau() == ntau);
2741 assert(A.nt() >= n1);
2742 assert(Acc.nt() >= n1);
2743 assert(B.nt() >= n1);
2744 assert(Bcc.nt() >= n1);
2745 assert(C.nt() >= n);
2747 convolution_timestep_ret<T, herm_matrix<T>, 1>(n, C, A, Acc, ft, B, Bcc,
I, h);
2748 convolution_timestep_tv<T, herm_matrix<T>, 1>(n, C, A, Acc, f0, ft, B, Bcc,
I, beta,
2750 convolution_timestep_les<T, herm_matrix<T>, 1>(n, C, A, Acc, f0, ft, B, Bcc,
I, beta,
2753 convolution_timestep_ret<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc, ft, B, Bcc,
I,
2755 convolution_timestep_tv<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc, f0, ft, B, Bcc,
2757 convolution_timestep_les<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc, f0, ft, B, Bcc,
2796 template <
typename T>
2797 void convolution_timestep(
int n, herm_matrix<T> &C, herm_matrix<T> &A, std::complex<T> *f0,
2798 std::complex<T> *ft, herm_matrix<T> &B,
2800 convolution_timestep<T>(n, C, A, A, f0, ft, B, B,
I, beta, h);
2841 template <
typename T>
2842 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
2843 std::complex<T> *f0, std::complex<T> *ft, herm_matrix<T> &B,
2846 convolution_matsubara(C, A, f0, B,
I, beta);
2847 for (tstp = 0; tstp <= C.nt(); tstp++)
2848 convolution_timestep<T>(tstp, C, A, Acc, f0, ft, B, Bcc,
I, beta, h);
2888 template <
typename T>
2889 void convolution_timestep(
int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
2890 function<T> &ft, herm_matrix<T> &B, herm_matrix<T> &Bcc,
2892 int size1 = C.size1(), ntau = C.ntau(), k =
I.k(), n1 = (n < k ? k : n);
2893 assert(ft.size1() == size1 && ft.nt() >= -1);
2895 convolution_matsubara(C, A, ft.ptr(-1), B,
I, beta);
2899 assert(A.size1() == size1);
2900 assert(Acc.size1() == size1);
2901 assert(B.size1() == size1);
2902 assert(Bcc.size1() == size1);
2903 assert(A.ntau() == ntau);
2904 assert(Acc.ntau() == ntau);
2905 assert(B.ntau() == ntau);
2906 assert(Bcc.ntau() == ntau);
2907 assert(A.nt() >= n1);
2908 assert(Acc.nt() >= n1);
2909 assert(B.nt() >= n1);
2910 assert(Bcc.nt() >= n1);
2911 assert(ft.nt() >= n1);
2912 assert(C.nt() >= n);
2914 convolution_timestep_ret<T, herm_matrix<T>, 1>(n, C, A, Acc, ft.ptr(0), B, Bcc,
I,
2916 convolution_timestep_tv<T, herm_matrix<T>, 1>(n, C, A, Acc, ft.ptr(-1), ft.ptr(0), B,
2918 convolution_timestep_les<T, herm_matrix<T>, 1>(n, C, A, Acc, ft.ptr(-1), ft.ptr(0),
2919 B, Bcc,
I, beta, h);
2921 convolution_timestep_ret<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc, ft.ptr(0), B,
2923 convolution_timestep_tv<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc, ft.ptr(-1),
2924 ft.ptr(0), B, Bcc,
I, beta, h);
2925 convolution_timestep_les<T, herm_matrix<T>, LARGESIZE>(
2926 n, C, A, Acc, ft.ptr(-1), ft.ptr(0), B, Bcc,
I, beta, h);
2967 template <
typename T>
2970 T beta, T h,
int SolveOrder) {
2971 int size1 = C.
size1(), ntau = C.
ntau(), n1 = (n < SolveOrder ? SolveOrder : n);
2972 assert(ft.
size1() == size1 && ft.
nt() >= -1);
2974 convolution_matsubara(C, A, ft.
ptr(-1), B, integration::I<T>(SolveOrder), beta);
2978 assert(A.
size1() == size1);
2979 assert(Acc.
size1() == size1);
2980 assert(B.
size1() == size1);
2981 assert(Bcc.
size1() == size1);
2982 assert(A.
ntau() == ntau);
2983 assert(Acc.
ntau() == ntau);
2984 assert(B.
ntau() == ntau);
2985 assert(Bcc.
ntau() == ntau);
2986 assert(A.
nt() >= n1);
2987 assert(Acc.
nt() >= n1);
2988 assert(B.
nt() >= n1);
2989 assert(Bcc.
nt() >= n1);
2990 assert(ft.
nt() >= n1);
2991 assert(C.
nt() >= n);
2993 convolution_timestep_ret<T, herm_matrix<T>, 1>(n, C, A, Acc, ft.
ptr(0), B, Bcc, integration::I<T>(SolveOrder),
2995 convolution_timestep_tv<T, herm_matrix<T>, 1>(n, C, A, Acc, ft.
ptr(-1), ft.
ptr(0), B,
2996 Bcc, integration::I<T>(SolveOrder), beta, h);
2997 convolution_timestep_les<T, herm_matrix<T>, 1>(n, C, A, Acc, ft.
ptr(-1), ft.
ptr(0),
2998 B, Bcc, integration::I<T>(SolveOrder), beta, h);
3000 convolution_timestep_ret<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc, ft.
ptr(0), B,
3001 Bcc, integration::I<T>(SolveOrder), h);
3002 convolution_timestep_tv<T, herm_matrix<T>, LARGESIZE>(n, C, A, Acc, ft.
ptr(-1),
3003 ft.
ptr(0), B, Bcc, integration::I<T>(SolveOrder), beta, h);
3004 convolution_timestep_les<T, herm_matrix<T>, LARGESIZE>(
3005 n, C, A, Acc, ft.
ptr(-1), ft.
ptr(0), B, Bcc, integration::I<T>(SolveOrder), beta, h);
3043 template <
typename T>
3044 void convolution_timestep(
int n, herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
3046 convolution_timestep<T>(n, C, A, A, ft, B, B,
I, beta, h);
3081 template <
typename T>
3084 convolution_timestep<T>(n, C, A, A, ft, B, B, beta, h, SolveOrder);
3122 template <
typename T>
3123 void convolution(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc, function<T> &ft,
3127 convolution_matsubara(C, A, ft.ptr(-1), B,
I, beta);
3128 for (tstp = 0; tstp <= C.nt(); tstp++)
3129 convolution_timestep<T>(tstp, C, A, Acc, ft, B, Bcc,
I, beta, h);
3169 template <
typename T>
3172 T beta, T h,
int SolveOrder) {
3174 convolution_matsubara(C, A, ft.
ptr(-1), B, integration::I<T>(SolveOrder), beta);
3175 for (tstp = 0; tstp <= C.
nt(); tstp++)
3176 convolution_timestep<T>(tstp, C, A, Acc, ft, B, Bcc, beta, h, SolveOrder);
3212 template <
typename T>
3215 T beta, T h,
int SolveOrder) {
3217 convolution_matsubara(C, A, B, integration::I<T>(SolveOrder), beta);
3218 for (tstp = 0; tstp <= C.
nt(); tstp++)
3219 convolution_timestep<T>(tstp, C, A, Acc, B, Bcc, beta, h, SolveOrder);
3257 template <
typename T,
class GG,
int SIZE1>
3258 void convolution_matsubara_tau_dispatch(
int m1, std::complex<T> *cc,
int sizec, GG &A,
3259 std::complex<T> *f0, GG &B,
3261 int ntau, l, m, size1 = sizec, sb = B.element_size();
3262 std::complex<T> *bmat;
3265 bmat =
new std::complex<T>[sb * (ntau + 1)];
3267 for (m = 0; m <= ntau; m++)
3268 element_mult<T, SIZE1>(size1, bmat + m * sb, f0, B.matptr(m));
3270 for (m = 0; m <= ntau; m++)
3271 element_set<T, SIZE1>(size1, bmat + m * sb, B.matptr(m));
3274 matsubara_integral_1<T, SIZE1>(size1, m1, ntau, cc, A.matptr(0), bmat,
I, A.sig());
3278 for (l = 0; l < sizec * sizec; l++)
3320 template <
typename T,
class GG,
int SIZE1>
3321 void convolution_timestep_les_jn_lesadv(
int j,
int n, std::complex<T> *cc,
int sizec, GG &A,
3322 GG &Acc, std::complex<T> *ft, GG &B, GG &Bcc,
3324 typedef std::complex<T>
cplx;
3326 int sf, sa, sb, sc, ntau, m, l, n1, size1 = sizec;
3328 cplx *atemp, *btemp, idtau, *ales, *badv, *btemp1;
3331 sa = A.element_size();
3332 sb = B.element_size();
3336 n1 = (n < k ? k : n);
3338 atemp =
new cplx[(n1 + 1) * sa];
3339 btemp =
new cplx[(n1 + 1) * sb];
3340 btemp1 =
new cplx[sb];
3341 for (m = 0; m <= n1; m++) {
3342 weight = h *
I.gregory_weights(n, m);
3344 element_conj<T, SIZE1>(size1, btemp1, Bcc.retptr(n, m));
3345 for (l = 0; l < sb; l++)
3346 btemp1[l] *= weight;
3348 for (l = 0; l < sb; l++)
3349 btemp1[l] = -weight * B.retptr(m, n)[l];
3352 element_mult<T, SIZE1>(size1, btemp + m * sb, ft + m * sf, btemp1);
3354 element_set<T, SIZE1>(size1, btemp + m * sb, btemp1);
3360 for (m = 0; m <= n1; m++) {
3362 element_conj<T, SIZE1>(size1, atemp + m * sa, Acc.lesptr(m, j));
3363 for (l = 0; l < sa; l++)
3364 atemp[m * sa + l] *= -1;
3366 for (l = 0; l < sa; l++)
3367 atemp[m * sa + l] = A.lesptr(j, m)[l];
3372 for (m = 0; m <= n1; m++) {
3373 element_incr<T, SIZE1>(size1, cc, ales, badv);
3420 template <
typename T,
class GG,
int SIZE1>
3421 void convolution_timestep_les_jn_tvvt(
int j,
int n, std::complex<T> *cc,
int sizec, GG &A,
3422 GG &Acc, std::complex<T> *f0, GG &B, GG &Bcc,
3424 typedef std::complex<T>
cplx;
3425 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1;
3426 int sa, sb, sc, ntau, m, l, n1, sig, size1 = sizec;
3428 cplx *atv, *btv, *btemp, *btemp1, *cles1, idtau;
3431 sa = A.element_size();
3432 sb = B.element_size();
3436 n1 = (n < k ? k : n);
3438 btemp =
new cplx[(ntau + 1) * sb];
3439 btemp1 =
new cplx[sb];
3440 idtau =
cplx(0, -dtau);
3441 for (m = 0; m <= ntau; m++) {
3442 element_conj<T, SIZE1>(size1, btemp1, Bcc.tvptr(n, ntau - m));
3444 element_mult<T, SIZE1>(size1, btemp + m * sb, f0, btemp1);
3446 element_set<T, SIZE1>(size1, btemp + m * sb, btemp1);
3450 for (l = 0; l < (ntau + 1) * sb; l++)
3451 btemp[l] *= idtau * (-(T)sig);
3455 atv = A.tvptr(j, 0);
3457 if (ntau < k2 - 1) {
3458 for (m = 0; m <= ntau; m++) {
3459 weight =
I.gregory_weights(ntau, m);
3460 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
3465 for (m = 0; m <= k; m++) {
3466 weight =
I.gregory_omega(m);
3467 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
3471 for (m = k1; m < ntau - k; m++) {
3472 element_incr<T, SIZE1>(size1, cles1, atv, btv);
3476 for (m = ntau - k; m <= ntau; m++) {
3477 weight =
I.gregory_omega(ntau - m);
3478 element_incr<T, SIZE1>(size1, cles1, weight, atv, btv);
3525 template <
typename T,
class GG,
int SIZE1>
3526 void convolution_timestep_les_jn_retles(
int j,
int n, std::complex<T> *cc,
int sizec, GG &A,
3527 GG &Acc, std::complex<T> *ft, GG &B, GG &Bcc,
3529 typedef std::complex<T>
cplx;
3530 int k =
I.get_k(), k1 = k + 1, k2 = 2 * k1, size1 = sizec;
3531 int sf, sa, sb, sc, ntau, m, l, n1;
3533 cplx *aret, *atemp, *btemp, *btemp1, *cles1, *bles, idtau;
3536 sa = A.element_size();
3537 sb = B.element_size();
3541 n1 = (n < k ? k : n);
3543 btemp =
new cplx[(n1 + 1) * sb];
3544 btemp1 =
new cplx[sb];
3545 atemp =
new cplx[sa];
3546 for (m = 0; m <= n1; m++) {
3548 for (l = 0; l < sb; l++)
3549 btemp1[l] = h * B.lesptr(m, n)[l];
3551 element_conj<T, SIZE1>(size1, btemp1, Bcc.lesptr(n, m));
3552 for (l = 0; l < sb; l++)
3556 element_mult<T, SIZE1>(size1, btemp + m * sb, ft + m * sf, btemp1);
3558 element_set<T, SIZE1>(size1, btemp + m * sb, btemp1);
3567 aret = A.retptr(j, 0);
3569 for (m = 0; m <= k; m++) {
3570 weight =
I.gregory_omega(m);
3571 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
3575 for (m = k1; m < j - k; m++) {
3576 element_incr<T, SIZE1>(size1, cles1, aret, bles);
3580 for (m = j - k; m <= j; m++) {
3581 weight =
I.gregory_omega(j - m);
3582 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
3587 aret = A.retptr(j, 0);
3589 for (m = 0; m <= j; m++) {
3590 weight =
I.gregory_weights(j, m);
3591 element_incr<T, SIZE1>(size1, cles1, weight, aret, bles);
3598 for (m = j + 1; m <= k; m++) {
3599 element_conj<T, SIZE1>(size1, atemp, Acc.retptr(m, j));
3600 weight = -
I.gregory_weights(j, m);
3601 bles = btemp + m * sb;
3602 element_incr<T, SIZE1>(size1, cles1, weight, atemp, bles);
3650 template <
typename T,
class GG,
int SIZE1>
3651 void convolution_timestep_les_jn(
int j,
int n, std::complex<T> *cc,
int sizec, GG &A,
3652 GG &Acc, std::complex<T> *f0, std::complex<T> *ft, GG &B,
3654 element_set_zero<T, LARGESIZE>(sizec, cc);
3655 convolution_timestep_les_jn_tvvt<T, GG, SIZE1>(j, n, cc, sizec, A, Acc, f0, B, Bcc,
I,
3657 convolution_timestep_les_jn_lesadv<T, GG, SIZE1>(j, n, cc, sizec, A, Acc, ft, B, Bcc,
I,
3659 convolution_timestep_les_jn_retles<T, GG, SIZE1>(j, n, cc, sizec, A, Acc, ft, B, Bcc,
I,
3706 template <
typename T,
class GG>
3707 void convolution_density_matrix(
int n, std::complex<T> *rho, GG &A, GG &Acc, function<T> &ft,
3709 int size1 = A.size1(), ntau = A.ntau(), k =
I.k(), n1 = (n < k && n >= 0 ? k : n);
3710 assert(ft.size1() == size1 && ft.nt() >= n1);
3711 assert(A.size1() == size1);
3712 assert(Acc.size1() == size1);
3713 assert(B.size1() == size1);
3714 assert(Bcc.size1() == size1);
3715 assert(A.ntau() == ntau);
3716 assert(Acc.ntau() == ntau);
3717 assert(B.ntau() == ntau);
3718 assert(Bcc.ntau() == ntau);
3719 assert(A.nt() >= n1);
3720 assert(Acc.nt() >= n1);
3721 assert(B.nt() >= n1);
3722 assert(Bcc.nt() >= n1);
3723 assert(ft.nt() >= n1);
3727 convolution_matsubara_tau_dispatch<T, GG, 1>(ntau, rho, size1, A, ft.ptr(-1), B,
3730 convolution_matsubara_tau_dispatch<T, GG, LARGESIZE>(ntau, rho, size1, A,
3731 ft.ptr(-1), B,
I, beta);
3733 element_smul<T, LARGESIZE>(size1, rho, -1.0);
3736 convolution_timestep_les_jn<T, GG, 1>(n, n, rho, size1, A, Acc, ft.ptr(-1),
3737 ft.ptr(0), B, Bcc,
I, beta, h);
3739 convolution_timestep_les_jn<T, GG, LARGESIZE>(
3740 n, n, rho, size1, A, Acc, ft.ptr(-1), ft.ptr(0), B, Bcc,
I, beta, h);
3742 element_smul<T, LARGESIZE>(size1, rho, std::complex<T>(0, -1.0));
3783 template <
typename T,
class GG>
3784 void convolution_density_matrix(
int n, cdmatrix &rho, GG &A, GG &Acc,
function<T> &ft,
3785 GG &B, GG &Bcc, T beta, T h,
int SolveOrder) {
3786 int size1 = A.size1();
3787 int element_size = size1;
3788 std::complex<T> *rho_ptr;
3789 rho_ptr =
new std::complex<T>[element_size];
3791 convolution_density_matrix<T, GG>(n, rho_ptr, A, Acc, ft, B, Bcc, integration::I<T>(SolveOrder), beta, h);
3792 map_ptr2matrix<T>(size1, size1, rho_ptr, rho);
3829 template <
typename T,
class GG>
3830 void convolution_density_matrix(
int tstp, std::complex<T> *rho, GG &A, function<T> &ft,
3832 convolution_density_matrix<T, GG>(tstp, rho, A, A, ft, B, B,
I, beta, h);
3869 template <
typename T,
class GG>
3870 void convolution_density_matrix(
int n, cdmatrix &rho, GG &A,
function<T> &ft,
3871 GG &B, T beta, T h,
int SolveOrder) {
3872 int size1 = A.size1();
3873 int element_size = size1;
3874 std::complex<T> *rho_ptr;
3875 rho_ptr =
new std::complex<T>[element_size];
3877 convolution_density_matrix<T, GG>(n, rho_ptr, A, A, ft, B, B, integration::I<T>(SolveOrder), beta, h);
3878 map_ptr2matrix<T>(size1, size1, rho_ptr, rho);
3917 template <
typename T,
class GG>
3918 void convolution_density_matrix(
int n, std::complex<T> *rho, GG &A, GG &Acc, GG &B, GG &Bcc,
3920 int size1 = A.size1(), ntau = A.ntau(), k =
I.k(), n1 = (n < k && n >= 0 ? k : n);
3921 assert(A.size1() == size1);
3922 assert(Acc.size1() == size1);
3923 assert(B.size1() == size1);
3924 assert(Bcc.size1() == size1);
3925 assert(A.ntau() == ntau);
3926 assert(Acc.ntau() == ntau);
3927 assert(B.ntau() == ntau);
3928 assert(Bcc.ntau() == ntau);
3929 assert(A.nt() >= n1);
3930 assert(Acc.nt() >= n1);
3931 assert(B.nt() >= n1);
3932 assert(Bcc.nt() >= n1);
3936 convolution_matsubara_tau_dispatch<T, GG, 1>(ntau, rho, size1, A, NULL, B,
I,
3939 convolution_matsubara_tau_dispatch<T, GG, LARGESIZE>(ntau, rho, size1, A, NULL,
3942 element_smul<T, LARGESIZE>(size1, rho, -1.0);
3945 convolution_timestep_les_jn<T, GG, 1>(n, n, rho, size1, A, Acc, NULL, NULL, B,
3948 convolution_timestep_les_jn<T, GG, LARGESIZE>(n, n, rho, size1, A, Acc, NULL,
3949 NULL, B, Bcc,
I, beta, h);
3951 element_smul<T, LARGESIZE>(size1, rho, std::complex<T>(0, -1.0));
3989 template <
typename T,
class GG>
3990 void convolution_density_matrix(
int n, cdmatrix &rho, GG &A, GG &Acc, GG &B, GG &Bcc,
3991 T beta, T h,
int SolveOrder) {
3993 int size1 = A.size1();
3994 int element_size = size1;
3995 std::complex<T> *rho_ptr;
3996 rho_ptr =
new std::complex<T>[element_size];
3998 convolution_density_matrix<T, GG>(n, rho_ptr, A, Acc, B, Bcc, integration::I<T>(SolveOrder), beta, h);
3999 map_ptr2matrix<T>(size1, size1, rho_ptr, rho);
4035 template <
typename T,
class GG>
4036 void convolution_density_matrix(
int tstp, std::complex<T> *rho, GG &A, GG &B,
4038 convolution_density_matrix<T, GG>(tstp, rho, A, A, B, B,
I, beta, h);
4072 template <
typename T,
class GG>
4073 void convolution_density_matrix(
int tstp, cdmatrix &rho, GG &A, GG &B,
4074 T beta, T h,
int SolveOrder) {
4075 int size1 = A.size1();
4076 int element_size = size1;
4077 std::complex<T> *rho_ptr;
4078 rho_ptr =
new std::complex<T>[element_size];
4080 convolution_density_matrix<T, GG>(tstp, rho_ptr, A, A, B, B, integration::I<T>(SolveOrder), beta, h);
4081 map_ptr2matrix<T>(size1, size1, rho_ptr, rho);
4087 template <
typename T,
class GG>
4088 void convolution_les_timediag(
int tstp, cdmatrix &Cles, GG &A, GG &B,
4090 int size1=A.size1();
4091 std::complex<T> *Cles_ptr =
new std::complex<T>[size1*size1];
4092 assert(Cles.rows() == size1);
4093 assert(Cles.cols() == size1);
4095 convolution_density_matrix<T, GG>(tstp, Cles_ptr, A, A, B, B,
I, beta, h);
4097 for(
int n1=0; n1 < size1; n1++){
4098 for(
int n2=0; n2 < size1; n2++){
4099 Cles(n1,n2) = std::complex<T>(0, 1.0) * Cles_ptr[n1 * size1 + n2];
4108 template <
typename T,
class GG>
4109 void convolution_density_matrix(
int tstp, cdmatrix &Cles, GG &A, GG &B,
4111 int size1=A.size1();
4112 std::complex<T> *Cles_ptr =
new std::complex<T>[size1*size1];
4113 assert(Cles.rows() == size1);
4114 assert(Cles.cols() == size1);
4116 convolution_density_matrix<T, GG>(tstp, Cles_ptr, A, A, B, B,
I, beta, h);
4117 for(
int n1=0; n1 < size1; n1++){
4118 for(
int n2=0; n2 < size1; n2++){
4119 Cles(n1,n2) = std::complex<T>(0, 1.0) * Cles_ptr[n1 * size1 + n2];
4618 int nup = (n > SolveOrder ? n : SolveOrder);
4619 element_set_zero<T, SIZE1>(size1, ctemp1);
4620 if (n <= 2 * SolveOrder + 2) {
4621 for (j = 0; j <= nup; j++) {
4622 wt =
I.gregory_weights(n, j);
4624 element_incr<T, SIZE1>(size1, ctemp1, wt, A.retptr(n, j),
4627 element_minusconj<T, SIZE1>(size1, atemp, Acc.retptr(j, n));
4628 element_incr<T, SIZE1>(size1, ctemp1, wt, atemp,
4633 for (j = 0; j <= SolveOrder; j++) {
4634 wt =
I.gregory_omega(j);
4635 element_incr<T, SIZE1>(size1, ctemp1, wt, A.retptr(n, j),
4638 for (j = SolveOrder + 1; j < n - SolveOrder; j++) {
4639 element_incr<T, SIZE1>(size1, ctemp1, A.retptr(n, j),
4642 for (j = n - SolveOrder; j <= n; j++) {
4643 wt =
I.gregory_omega(n - j);
4644 element_incr<T, SIZE1>(size1, ctemp1, wt, A.retptr(n, j),
4651 element_set_zero<T, SIZE1>(size1, ctemp2);
4652 for (m = 0; m <= SolveOrder; m++) {
4653 wt =
I.gregory_omega(m);
4654 element_incr<T, SIZE1>(size1, ctemp2, wt, A.tvptr(n, m),
4657 for (m = SolveOrder + 1; m < ntau - SolveOrder; m++) {
4658 element_incr<T, SIZE1>(size1, ctemp2, A.tvptr(n, m), bvt + sfb * m);
4660 for (m = ntau - SolveOrder; m <= ntau; m++) {
4661 wt =
I.gregory_omega(ntau - m);
4662 element_incr<T, SIZE1>(size1, ctemp2, wt, A.tvptr(n, m),
4668 element_set_zero<T, SIZE1>(size1, ctemp3);
4669 if (tstp <= 2 * SolveOrder + 2) {
4670 for (j = 0; j <= n; j++) {
4671 wt =
I.gregory_weights(tstp, j);
4672 element_minusconj<T, SIZE1>(size1, atemp, Acc.lesptr(j, n));
4673 element_incr<T, SIZE1>(size1, ctemp3, wt, atemp, badv + sfb * j);
4675 for (j = n + 1; j <= n1; j++) {
4676 wt =
I.gregory_weights(tstp, j);
4677 element_incr<T, SIZE1>(size1, ctemp3, wt, A.lesptr(n, j),
4681 for (j = 0; j <= SolveOrder; j++) {
4682 wt =
I.gregory_omega(j);
4684 element_minusconj<T, SIZE1>(size1, atemp, Acc.lesptr(j, n));
4685 element_incr<T, SIZE1>(size1, ctemp3, wt, atemp,
4688 element_incr<T, SIZE1>(size1, ctemp3, wt, A.lesptr(n, j),
4692 if (n <= SolveOrder) {
4693 for (j = SolveOrder + 1; j < tstp - SolveOrder; j++) {
4694 element_incr<T, SIZE1>(size1, ctemp3, A.lesptr(n, j),
4697 }
else if (n < tstp - SolveOrder) {
4698 for (j = SolveOrder + 1; j < n; j++) {
4699 element_minusconj<T, SIZE1>(size1, atemp, Acc.lesptr(j, n));
4700 element_incr<T, SIZE1>(size1, ctemp3, atemp, badv + sfb * j);
4702 for (j = n; j < tstp - SolveOrder; j++) {
4703 element_incr<T, SIZE1>(size1, ctemp3, A.lesptr(n, j),
4707 for (j = SolveOrder + 1; j < tstp - SolveOrder; j++) {
4708 element_minusconj<T, SIZE1>(size1, atemp, Acc.lesptr(j, n));
4709 element_incr<T, SIZE1>(size1, ctemp3, atemp, badv + sfb * j);
4712 for (j = tstp - SolveOrder; j <= tstp; j++) {
4713 wt =
I.gregory_omega(tstp - j);
4715 element_minusconj<T, SIZE1>(size1, atemp, Acc.lesptr(j, n));
4716 element_incr<T, SIZE1>(size1, ctemp3, wt, atemp,
4719 element_incr<T, SIZE1>(size1, ctemp3, wt, A.lesptr(n, j),
4725 element_incr<T, SIZE1>(size1, C.lesptr(n, tstp), adt, ctemp1);
4726 element_incr<T, SIZE1>(size1, C.lesptr(n, tstp), adt, ctemp3);
4727 element_incr<T, SIZE1>(size1, C.lesptr(n, tstp), adtau * CPLX(0.0, -1.0),
4785 template <
typename T,
class GG,
int SIZE1>
4786 void incr_convolution(
int tstp, CPLX alpha, GG &C, GG &A, GG &Acc, CPLX *f0, CPLX *ft, GG &B,
4788 int ntau = A.ntau();
4791 std::vector<bool> mask(ntau + 1,
true);
4792 incr_convolution_mat<T, GG, SIZE1>(mask, alpha, C, A, f0, B,
I, beta);
4793 }
else if (tstp >= 0) {
4794 std::vector<bool> mask_ret(tstp + 1,
true);
4795 std::vector<bool> mask_tv(ntau + 1,
true);
4796 std::vector<bool> mask_les(tstp + 1,
true);
4797 incr_convolution_ret<T, GG, SIZE1>(tstp, mask_ret, alpha, C, A, Acc, ft, B, Bcc,
I,
4799 incr_convolution_tv<T, GG, SIZE1>(tstp, mask_tv, alpha, C, A, Acc, f0, ft, B, Bcc,
I,
4801 incr_convolution_les<T, GG, SIZE1>(tstp, mask_les, alpha, C, A, Acc, f0, ft, B, Bcc,
4810 template <
typename T>
4811 void convolution_timestep_new(
int tstp, herm_matrix<T> &C, herm_matrix<T> &A,
4812 herm_matrix<T> &Acc, function<T> &ft, herm_matrix<T> &B,
4815 int SolveOrder =
I.k();
4816 int ntmin = (tstp == -1 || tstp > SolveOrder ? tstp : SolveOrder);
4819 int size1 = A.size1();
4820 std::complex<T> *fttemp;
4822 assert(C.size1() == size1);
4823 assert(ft.size1() == size1);
4824 assert(B.size1() == size1);
4825 assert(Bcc.size1() == size1);
4826 assert(Acc.size1() == size1);
4827 assert(SolveOrder > 0 && SolveOrder <= 5);
4828 assert(SolveOrder <= C.ntau());
4829 assert(ntmin <= C.nt());
4830 assert(ntmin <= A.nt());
4831 assert(ntmin <= Acc.nt());
4832 assert(ntmin <= B.nt());
4833 assert(ntmin <= Bcc.nt());
4834 assert(ntmin <= ft.nt());
4835 assert(C.ntau() == A.ntau());
4836 assert(C.ntau() == Acc.ntau());
4837 assert(C.ntau() == B.ntau());
4838 assert(C.ntau() == Bcc.ntau());
4840 C.set_timestep_zero(tstp);
4841 fttemp = (tstp == -1 ? ft.ptr(-1) : ft.ptr(0));
4845 incr_convolution<T, herm_matrix<T>, 1>(tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1),
4846 fttemp, B, Bcc, integration::I<T>(SolveOrder), beta,
4850 incr_convolution<T, herm_matrix<T>, 2>(tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1),
4851 fttemp, B, Bcc, integration::I<T>(SolveOrder), beta,
4855 incr_convolution<T, herm_matrix<T>, 3>(tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1),
4856 fttemp, B, Bcc, integration::I<T>(SolveOrder), beta,
4860 incr_convolution<T, herm_matrix<T>, 4>(tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1),
4861 fttemp, B, Bcc, integration::I<T>(SolveOrder), beta,
4865 incr_convolution<T, herm_matrix<T>, 5>(tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1),
4866 fttemp, B, Bcc, integration::I<T>(SolveOrder), beta,
4870 incr_convolution<T, herm_matrix<T>, 6>(tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1),
4871 fttemp, B, Bcc, integration::I<T>(SolveOrder), beta,
4875 incr_convolution<T, herm_matrix<T>, 8>(tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1),
4876 fttemp, B, Bcc, integration::I<T>(SolveOrder), beta,
4880 incr_convolution<T, herm_matrix<T>, LARGESIZE>(tstp, CPLX(1, 0), C, A, Acc,
4881 ft.ptr(-1), fttemp, B, Bcc,
4882 integration::I<T>(SolveOrder), beta, h);
4887 template <
typename T>
4888 void convolution_timestep_new(
int n, herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
4891 convolution_timestep_new<T>(n, C, A, A, ft, B, B,
I, beta, h);
4894 template <
typename T>
4895 void convolution_matsubara_new(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &B,
4897 convolution_timestep_new<T>(-1, C, A, A, B, B,
I, beta, 0.0);
4900 template <
typename T>
4901 void convolution_matsubara_new(herm_matrix<T> &C, herm_matrix<T> &A, function<T> &ft,
4903 convolution_timestep_new<T>(-1, C, A, A, ft, B, B,
I, beta, 0.0);
4906 template <
typename T>
4907 void convolution_new(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
4908 function<T> &ft, herm_matrix<T> &B, herm_matrix<T> &Bcc,
4911 for (tstp = -1; tstp <= C.nt(); tstp++)
4912 convolution_timestep_new<T>(tstp, C, A, Acc, ft, B, Bcc,
I, beta, h);
4915 template <
typename T>
4916 void convolution_timestep_new(
int tstp, herm_matrix<T> &C, herm_matrix<T> &A,
4917 herm_matrix<T> &Acc, herm_matrix<T> &B, herm_matrix<T> &Bcc,
4919 int SolveOrder =
I.k();
4920 int ntmin = (tstp == -1 || tstp > SolveOrder ? tstp : SolveOrder);
4923 int size1 = A.size1();
4925 assert(C.size1() == size1);
4926 assert(B.size1() == size1);
4927 assert(Bcc.size1() == size1);
4928 assert(Acc.size1() == size1);
4929 assert(SolveOrder > 0 && SolveOrder <= 5);
4930 assert(SolveOrder <= C.ntau());
4931 assert(ntmin <= C.nt());
4932 assert(ntmin <= A.nt());
4933 assert(ntmin <= Acc.nt());
4934 assert(ntmin <= B.nt());
4935 assert(ntmin <= Bcc.nt());
4936 assert(C.ntau() == A.ntau());
4937 assert(C.ntau() == Acc.ntau());
4938 assert(C.ntau() == B.ntau());
4939 assert(C.ntau() == Bcc.ntau());
4941 C.set_timestep_zero(tstp);
4944 incr_convolution<T, herm_matrix<T>, 1>(tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B,
4945 Bcc, integration::I<T>(SolveOrder), beta, h);
4948 incr_convolution<T, herm_matrix<T>, 2>(tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B,
4949 Bcc, integration::I<T>(SolveOrder), beta, h);
4952 incr_convolution<T, herm_matrix<T>, 3>(tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B,
4953 Bcc, integration::I<T>(SolveOrder), beta, h);
4956 incr_convolution<T, herm_matrix<T>, 4>(tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B,
4957 Bcc, integration::I<T>(SolveOrder), beta, h);
4960 incr_convolution<T, herm_matrix<T>, 5>(tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B,
4961 Bcc, integration::I<T>(SolveOrder), beta, h);
4964 incr_convolution<T, herm_matrix<T>, 6>(tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B,
4965 Bcc, integration::I<T>(SolveOrder), beta, h);
4968 incr_convolution<T, herm_matrix<T>, 8>(tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B,
4969 Bcc, integration::I<T>(SolveOrder), beta, h);
4972 incr_convolution<T, herm_matrix<T>, LARGESIZE>(
4973 tstp, CPLX(1, 0), C, A, Acc, NULL, NULL, B, Bcc, integration::I<T>(SolveOrder), beta, h);
4978 template <
typename T>
4979 void convolution_timestep_new(
int n, herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &B,
4981 convolution_timestep_new<T>(n, C, A, A, B, B,
I, beta, h);
4984 template <
typename T>
4985 void convolution_new(herm_matrix<T> &C, herm_matrix<T> &A, herm_matrix<T> &Acc,
4989 for (tstp = -1; tstp <= C.nt(); tstp++)
4990 convolution_timestep_new<T>(tstp, C, A, Acc, B, Bcc,
I, beta, h);
4995 #if CNTR_USE_OMP == 1 4997 #define CPLX std::complex<T> 5040 template <
typename T,
class GG,
int SIZE1>
5041 void incr_convolution_omp(
int omp_num_threads,
int tstp, CPLX alpha, GG &C, GG &A, GG &Acc,
5044 #pragma omp parallel num_threads(omp_num_threads) 5046 int nomp = omp_get_num_threads();
5047 int tid = omp_get_thread_num();
5048 int ntau = A.ntau(), i;
5051 std::vector<bool> mask(ntau + 1,
false);
5052 for (i = 0; i <= ntau; i++)
5053 if (i % nomp == tid)
5055 incr_convolution_mat<T, GG, SIZE1>(mask, alpha, C, A, f0, B,
I, beta);
5056 }
else if (tstp >= 0) {
5057 std::vector<bool> mask_ret(tstp + 1,
false);
5058 std::vector<bool> mask_tv(ntau + 1,
false);
5059 std::vector<bool> mask_les(tstp + 1,
false);
5060 for (i = 0; i <= tstp; i++)
5061 if (i % nomp == tid)
5063 for (i = 0; i <= ntau; i++)
5064 if (i % nomp == tid)
5066 for (i = 0; i <= tstp; i++)
5068 mask_les[tstp - i] =
true;
5069 incr_convolution_ret<T, GG, SIZE1>(tstp, mask_ret, alpha, C, A, Acc, ft, B, Bcc,
5071 incr_convolution_tv<T, GG, SIZE1>(tstp, mask_tv, alpha, C, A, Acc, f0, ft, B,
5073 incr_convolution_les<T, GG, SIZE1>(tstp, mask_les, alpha, C, A, Acc, f0, ft, B,
5117 template <
typename T>
5118 void convolution_timestep_omp(
int omp_num_threads,
int tstp, herm_matrix<T> &C,
5119 herm_matrix<T> &A, herm_matrix<T> &Acc, function<T> &ft,
5120 herm_matrix<T> &B, herm_matrix<T> &Bcc,
5122 int SolveOrder =
I.k();
5123 int ntmin = (tstp == -1 || tstp > SolveOrder ? tstp : SolveOrder);
5126 int size1 = A.size1();
5127 std::complex<T> *fttemp;
5128 assert(C.size1()==size1);
5129 assert(ft.size1()==size1);
5130 assert(B.size1()==size1);
5131 assert(Bcc.size1()==size1);
5132 assert(Acc.size1()==size1);
5133 assert(SolveOrder>=0 && SolveOrder <=5);
5134 assert(C.ntau()>=SolveOrder);
5135 assert(C.nt()>=ntmin);
5136 assert(A.nt()>=ntmin);
5137 assert(Acc.nt()>=ntmin);
5138 assert(B.nt()>=ntmin);
5139 assert(Bcc.nt()>=ntmin);
5140 assert(ft.nt()>=ntmin);
5141 assert(C.ntau()==A.ntau());
5142 assert(C.ntau()==Acc.ntau());
5143 assert(C.ntau()==B.ntau());
5144 assert(C.ntau()==Bcc.ntau());
5145 C.set_timestep_zero(tstp);
5146 fttemp = (tstp == -1 ? ft.ptr(-1) : ft.ptr(0));
5150 incr_convolution_omp<T, herm_matrix<T>, 1>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5151 Acc, ft.ptr(-1), fttemp, B, Bcc,
5152 integration::I<T>(SolveOrder), beta, h);
5155 incr_convolution_omp<T, herm_matrix<T>, 2>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5156 Acc, ft.ptr(-1), fttemp, B, Bcc,
5157 integration::I<T>(SolveOrder), beta, h);
5160 incr_convolution_omp<T, herm_matrix<T>, 3>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5161 Acc, ft.ptr(-1), fttemp, B, Bcc,
5162 integration::I<T>(SolveOrder), beta, h);
5165 incr_convolution_omp<T, herm_matrix<T>, 4>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5166 Acc, ft.ptr(-1), fttemp, B, Bcc,
5167 integration::I<T>(SolveOrder), beta, h);
5170 incr_convolution_omp<T, herm_matrix<T>, 5>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5171 Acc, ft.ptr(-1), fttemp, B, Bcc,
5172 integration::I<T>(SolveOrder), beta, h);
5175 incr_convolution_omp<T, herm_matrix<T>, 6>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5176 Acc, ft.ptr(-1), fttemp, B, Bcc,
5177 integration::I<T>(SolveOrder), beta, h);
5180 incr_convolution_omp<T, herm_matrix<T>, 8>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5181 Acc, ft.ptr(-1), fttemp, B, Bcc,
5182 integration::I<T>(SolveOrder), beta, h);
5185 incr_convolution_omp<T, herm_matrix<T>, LARGESIZE>(
5186 omp_num_threads, tstp, CPLX(1, 0), C, A, Acc, ft.ptr(-1), fttemp, B, Bcc,
5187 integration::I<T>(SolveOrder), beta, h);
5230 template <
typename T>
5234 T beta, T h,
int SolveOrder) {
5235 int ntmin = (tstp == -1 || tstp > SolveOrder ? tstp : SolveOrder);
5238 int size1 = A.
size1();
5239 std::complex<T> *fttemp;
5240 assert(C.
size1()==size1);
5241 assert(ft.
size1()==size1);
5242 assert(B.
size1()==size1);
5243 assert(Bcc.
size1()==size1);
5244 assert(Acc.
size1()==size1);
5245 assert(SolveOrder>=0 && SolveOrder <=5);
5246 assert(C.
ntau()>=SolveOrder);
5247 assert(C.
nt()>=ntmin);
5248 assert(A.
nt()>=ntmin);
5249 assert(Acc.
nt()>=ntmin);
5250 assert(B.
nt()>=ntmin);
5251 assert(Bcc.
nt()>=ntmin);
5252 assert(ft.
nt()>=ntmin);
5258 fttemp = (tstp == -1 ? ft.
ptr(-1) : ft.
ptr(0));
5262 incr_convolution_omp<T, herm_matrix<T>, 1>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5263 Acc, ft.
ptr(-1), fttemp, B, Bcc,
5264 integration::I<T>(SolveOrder), beta, h);
5267 incr_convolution_omp<T, herm_matrix<T>, 2>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5268 Acc, ft.
ptr(-1), fttemp, B, Bcc,
5269 integration::I<T>(SolveOrder), beta, h);
5272 incr_convolution_omp<T, herm_matrix<T>, 3>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5273 Acc, ft.
ptr(-1), fttemp, B, Bcc,
5274 integration::I<T>(SolveOrder), beta, h);
5277 incr_convolution_omp<T, herm_matrix<T>, 4>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5278 Acc, ft.
ptr(-1), fttemp, B, Bcc,
5279 integration::I<T>(SolveOrder), beta, h);
5282 incr_convolution_omp<T, herm_matrix<T>, 5>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5283 Acc, ft.
ptr(-1), fttemp, B, Bcc,
5284 integration::I<T>(SolveOrder), beta, h);
5287 incr_convolution_omp<T, herm_matrix<T>, 6>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5288 Acc, ft.
ptr(-1), fttemp, B, Bcc,
5289 integration::I<T>(SolveOrder), beta, h);
5292 incr_convolution_omp<T, herm_matrix<T>, 8>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5293 Acc, ft.
ptr(-1), fttemp, B, Bcc,
5294 integration::I<T>(SolveOrder), beta, h);
5297 incr_convolution_omp<T, herm_matrix<T>, LARGESIZE>(
5298 omp_num_threads, tstp, CPLX(1, 0), C, A, Acc, ft.
ptr(-1), fttemp, B, Bcc,
5299 integration::I<T>(SolveOrder), beta, h);
5339 template <
typename T>
5340 void convolution_timestep_omp(
int omp_num_threads,
int tstp, herm_matrix<T> &C,
5341 herm_matrix<T> &A, function<T> &ft, herm_matrix<T> &B,
5343 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, A, ft, B, B,
I, beta, h);
5381 template <
typename T>
5384 T beta, T h,
int SolveOrder) {
5385 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, A, ft, B, B, beta, h, SolveOrder);
5419 template <
typename T>
5420 void convolution_matsubara_omp(
int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
5422 convolution_timestep_omp<T>(omp_num_threads, -1, C, A, A, B, B,
I, beta, 0.0);
5456 template <
typename T>
5457 void convolution_matsubara_omp(
int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
5458 function<T> &ft, herm_matrix<T> &B,
5460 convolution_timestep_omp<T>(omp_num_threads, -1, C, A, A, ft, B, B,
I, beta, 0.0);
5499 template <
typename T>
5500 void convolution_omp(
int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
5501 herm_matrix<T> &Acc, function<T> &ft, herm_matrix<T> &B,
5504 for (tstp = -1; tstp <= C.nt(); tstp++)
5505 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, Acc, ft, B, Bcc,
I, beta,
5547 template <
typename T>
5552 for (tstp = -1; tstp <= C.
nt(); tstp++)
5553 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, Acc, ft, B, Bcc, beta,
5595 template <
typename T>
5596 void convolution_timestep_omp(
int omp_num_threads,
int tstp, herm_matrix<T> &C,
5597 herm_matrix<T> &A, herm_matrix<T> &Acc, herm_matrix<T> &B,
5600 int SolveOrder =
I.k();
5601 int ntmin = (tstp == -1 || tstp > SolveOrder ? tstp : SolveOrder);
5604 int size1 = A.size1();
5605 assert(C.size1()==size1);
5606 assert(B.size1()==size1);
5607 assert(Bcc.size1()==size1);
5608 assert(Acc.size1()==size1);
5609 assert(SolveOrder>=0 && SolveOrder <=5);
5610 assert(C.ntau()>=SolveOrder);
5611 assert(C.nt()>=ntmin);
5612 assert(A.nt()>=ntmin);
5613 assert(Acc.nt()>=ntmin);
5614 assert(B.nt()>=ntmin);
5615 assert(Bcc.nt()>=ntmin);
5616 assert(C.ntau()==A.ntau());
5617 assert(C.ntau()==Acc.ntau());
5618 assert(C.ntau()==B.ntau());
5619 assert(C.ntau()==Bcc.ntau());
5620 C.set_timestep_zero(tstp);
5624 incr_convolution_omp<T, herm_matrix<T>, 1>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5625 Acc, NULL, NULL, B, Bcc,
5626 integration::I<T>(SolveOrder), beta, h);
5629 incr_convolution_omp<T, herm_matrix<T>, 2>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5630 Acc, NULL, NULL, B, Bcc,
5631 integration::I<T>(SolveOrder), beta, h);
5634 incr_convolution_omp<T, herm_matrix<T>, 3>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5635 Acc, NULL, NULL, B, Bcc,
5636 integration::I<T>(SolveOrder), beta, h);
5639 incr_convolution_omp<T, herm_matrix<T>, 4>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5640 Acc, NULL, NULL, B, Bcc,
5641 integration::I<T>(SolveOrder), beta, h);
5644 incr_convolution_omp<T, herm_matrix<T>, 5>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5645 Acc, NULL, NULL, B, Bcc,
5646 integration::I<T>(SolveOrder), beta, h);
5649 incr_convolution_omp<T, herm_matrix<T>, 6>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5650 Acc, NULL, NULL, B, Bcc,
5651 integration::I<T>(SolveOrder), beta, h);
5654 incr_convolution_omp<T, herm_matrix<T>, 8>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5655 Acc, NULL, NULL, B, Bcc,
5656 integration::I<T>(SolveOrder), beta, h);
5659 incr_convolution_omp<T, herm_matrix<T>, LARGESIZE>(omp_num_threads, tstp, CPLX(1, 0),
5660 C, A, Acc, NULL, NULL, B, Bcc,
5661 integration::I<T>(SolveOrder), beta, h);
5703 template <
typename T>
5707 T h,
int SolveOrder) {
5708 int ntmin = (tstp == -1 || tstp > SolveOrder ? tstp : SolveOrder);
5711 int size1 = A.
size1();
5712 assert(C.
size1()==size1);
5713 assert(B.
size1()==size1);
5714 assert(Bcc.
size1()==size1);
5715 assert(Acc.
size1()==size1);
5716 assert(SolveOrder>=0 && SolveOrder <=5);
5717 assert(C.
ntau()>=SolveOrder);
5718 assert(C.
nt()>=ntmin);
5719 assert(A.
nt()>=ntmin);
5720 assert(Acc.
nt()>=ntmin);
5721 assert(B.
nt()>=ntmin);
5722 assert(Bcc.
nt()>=ntmin);
5731 incr_convolution_omp<T, herm_matrix<T>, 1>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5732 Acc, NULL, NULL, B, Bcc,
5733 integration::I<T>(SolveOrder), beta, h);
5736 incr_convolution_omp<T, herm_matrix<T>, 2>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5737 Acc, NULL, NULL, B, Bcc,
5738 integration::I<T>(SolveOrder), beta, h);
5741 incr_convolution_omp<T, herm_matrix<T>, 3>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5742 Acc, NULL, NULL, B, Bcc,
5743 integration::I<T>(SolveOrder), beta, h);
5746 incr_convolution_omp<T, herm_matrix<T>, 4>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5747 Acc, NULL, NULL, B, Bcc,
5748 integration::I<T>(SolveOrder), beta, h);
5751 incr_convolution_omp<T, herm_matrix<T>, 5>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5752 Acc, NULL, NULL, B, Bcc,
5753 integration::I<T>(SolveOrder), beta, h);
5756 incr_convolution_omp<T, herm_matrix<T>, 6>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5757 Acc, NULL, NULL, B, Bcc,
5758 integration::I<T>(SolveOrder), beta, h);
5761 incr_convolution_omp<T, herm_matrix<T>, 8>(omp_num_threads, tstp, CPLX(1, 0), C, A,
5762 Acc, NULL, NULL, B, Bcc,
5763 integration::I<T>(SolveOrder), beta, h);
5766 incr_convolution_omp<T, herm_matrix<T>, LARGESIZE>(omp_num_threads, tstp, CPLX(1, 0),
5767 C, A, Acc, NULL, NULL, B, Bcc,
5768 integration::I<T>(SolveOrder), beta, h);
5808 template <
typename T>
5809 void convolution_timestep_omp(
int omp_num_threads,
int tstp, herm_matrix<T> &C,
5810 herm_matrix<T> &A, herm_matrix<T> &B,
5812 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, A, B, B,
I, beta, h);
5847 template <
typename T>
5850 T beta, T h,
int SolveOrder) {
5851 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, A, B, B, beta, h, SolveOrder);
5888 template <
typename T>
5889 void convolution_omp(
int omp_num_threads, herm_matrix<T> &C, herm_matrix<T> &A,
5890 herm_matrix<T> &Acc, herm_matrix<T> &B, herm_matrix<T> &Bcc,
5893 for (tstp = -1; tstp <= C.nt(); tstp++)
5894 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, Acc, B, Bcc,
I, beta, h);
5931 template <
typename T>
5934 T beta, T h,
int SolveOrder) {
5936 for (tstp = -1; tstp <= C.
nt(); tstp++)
5937 convolution_timestep_omp<T>(omp_num_threads, tstp, C, A, Acc, B, Bcc, beta, h, SolveOrder);
5946 #endif // CNTR_CONVOLUTION_IMPL_H Class Integrator contains all kinds of weights for integration and differentiation of a function at ...
std::complex< double > cplx
void set_timestep_zero(int tstp)
Sets all components at time step tstp to zero.
Integrator< T > & I(int k)
Class function for objects with time on real axis.
Class herm_matrix for two-time contour objects with hermitian symmetry.