1 #ifndef CNTR_BUBBLE_IMPL_H 2 #define CNTR_BUBBLE_IMPL_H 23 void get_bubble_1_mat(std::complex<T> *cmat,
int sc,
int c1,
int c2, std::complex<T> *amat,
24 int sa,
int a1,
int a2, std::complex<T> *bmat,
int sb,
int b1,
int b2,
27 int a12 = a1 * sa + a2, sa2 = sa * sa;
28 int b21 = b2 * sb + b1, sb2 = sb * sb;
29 int c12 = c1 * sc + c2, sc2 = sc * sc;
30 double sig = -1.0 * sigb;
31 for (m = 0; m <= ntau; m++)
32 cmat[c12 + m * sc2] = sig * amat[m * sa2 + a12] * bmat[(ntau - m) * sb2 + b21];
37 get_bubble_1_timestep(
int tstp, std::complex<T> *cret, std::complex<T> *ctv,
38 std::complex<T> *cles,
int sc,
int c1,
int c2, std::complex<T> *aret,
39 std::complex<T> *atv, std::complex<T> *ales, std::complex<T> *accret,
40 std::complex<T> *acctv, std::complex<T> *accles,
int sa,
int a1,
41 int a2, std::complex<T> *bret, std::complex<T> *btv,
42 std::complex<T> *bles, std::complex<T> *bccret, std::complex<T> *bcctv,
43 std::complex<T> *bccles,
int sb,
int b1,
int b2,
int sigb,
int ntau) {
45 int a12 = a1 * sa + a2, a21 = a2 * sa + a1, sa2 = sa * sa;
46 int b12 = b1 * sb + b2, b21 = b2 * sb + b1, sb2 = sb * sb;
47 int c12 = c1 * sc + c2, sc2 = sc * sc;
48 std::complex<T> msigb = -1.0 * sigb, ii = std::complex<T>(0, 1.0);
49 std::complex<T> bgtr21_tt1, cgtr_tt1, cles_tt1, ales12_tt1, bgtr21_t1t, agtr12_tt1,
50 bles21_t1t, bvt21, bles21_tt1;
51 for (m = 0; m <= tstp; m++) {
53 bles21_tt1 = -conj(bccles[m * sb2 + b12]);
55 bgtr21_tt1 = bret[m * sb2 + b21] + bles21_tt1;
59 bles21_t1t = bles[m * sb2 + b21];
60 bgtr21_t1t = -conj(bccret[m * sb2 + b12]) + bles21_t1t;
62 ales12_tt1 = -conj(accles[sa2 * m + a21]);
64 agtr12_tt1 = aret[m * sa2 + a12] + ales12_tt1;
66 cgtr_tt1 = ii * agtr12_tt1 * bles21_t1t;
68 cles_tt1 = ii * ales12_tt1 * bgtr21_t1t;
70 cret[m * sc2 + c12] = cgtr_tt1 - cles_tt1;
72 cles[m * sc2 + c12] = ii * ales[m * sa2 + a12] * bgtr21_tt1;
74 for (m = 0; m <= ntau; m++) {
75 bvt21 = msigb * conj(bcctv[(ntau - m) * sb2 + b12]);
76 ctv[m * sc2 + c12] = ii * atv[m * sa2 + a12] * bvt21;
87 void get_bubble_2_mat(std::complex<T> *cmat,
int sc,
int c1,
int c2, std::complex<T> *amat,
88 int sa,
int a1,
int a2, std::complex<T> *bmat,
int sb,
int b1,
int b2,
91 int a12 = a1 * sa + a2, sa2 = sa * sa;
92 int b12 = b1 * sb + b2, sb2 = sb * sb;
93 int c12 = c1 * sc + c2, sc2 = sc * sc;
94 for (m = 0; m <= ntau; m++)
95 cmat[c12 + m * sc2] = -amat[m * sa2 + a12] * bmat[m * sb2 + b12];
100 get_bubble_2_timestep(
int tstp, std::complex<T> *cret, std::complex<T> *ctv,
101 std::complex<T> *cles,
int sc,
int c1,
int c2, std::complex<T> *aret,
102 std::complex<T> *atv, std::complex<T> *ales, std::complex<T> *accret,
103 std::complex<T> *acctv, std::complex<T> *accles,
int sa,
int a1,
104 int a2, std::complex<T> *bret, std::complex<T> *btv,
105 std::complex<T> *bles, std::complex<T> *bccret, std::complex<T> *bcctv,
106 std::complex<T> *bccles,
int sb,
int b1,
int b2,
int ntau) {
108 int a12 = a1 * sa + a2, a21 = a2 * sa + a1, sa2 = sa * sa;
109 int b12 = b1 * sb + b2, b21 = b2 * sb + b1, sb2 = sb * sb;
110 int c12 = c1 * sc + c2, sc2 = sc * sc;
111 std::complex<T> ii = std::complex<T>(0, 1.0);
112 std::complex<T> bgtr12_tt1, agtr12_tt1, cgtr_tt1, cles_tt1;
113 for (m = 0; m <= tstp; m++) {
114 bgtr12_tt1 = bret[m * sb2 + b12] - conj(bccles[m * sb2 + b21]);
115 agtr12_tt1 = aret[m * sa2 + a12] - conj(accles[m * sa2 + a21]);
117 cgtr_tt1 = ii * agtr12_tt1 * bgtr12_tt1;
119 cles_tt1 = ii * conj(accles[m * sa2 + a21]) * conj(bccles[m * sb2 + b21]);
121 cret[m * sc2 + c12] = cgtr_tt1 - cles_tt1;
123 cles[m * sc2 + c12] = ii * ales[m * sa2 + a12] * bles[m * sb2 + b12];
125 for (m = 0; m <= ntau; m++) {
126 ctv[m * sc2 + c12] = ii * atv[m * sa2 + a12] * btv[m * sb2 + b12];
137 template <
typename T>
138 void Bubble1(
int tstp, herm_matrix_timestep_view<T> &C,
int c1,
int c2,
139 herm_matrix_timestep_view<T> &A, herm_matrix_timestep_view<T> &Acc,
int a1,
140 int a2, herm_matrix_timestep_view<T> &B, herm_matrix_timestep_view<T> &Bcc,
143 assert(ntau == A.ntau());
144 assert(ntau == B.ntau());
145 assert(ntau == Acc.ntau());
146 assert(ntau == Bcc.ntau());
147 assert(tstp == C.tstp_);
148 assert(tstp == B.tstp_);
149 assert(tstp == A.tstp_);
150 assert(tstp == Acc.tstp_);
151 assert(tstp == Bcc.tstp_);
152 assert(a1 <= A.size1());
153 assert(a2 <= A.size1());
154 assert(b1 <= B.size1());
155 assert(b2 <= B.size1());
156 assert(c1 <= C.size1());
157 assert(c2 <= C.size1());
158 assert(Acc.size1() == A.size1());
159 assert(Bcc.size1() == B.size1());
162 get_bubble_1_mat(C.matptr(0), C.size1(), c1, c2, A.matptr(0), A.size1(), a1, a2,
163 B.matptr(0), B.size1(), b1, b2, B.sig(), ntau);
165 get_bubble_1_timestep(tstp, C.retptr(0), C.tvptr(0), C.lesptr(0), C.size1(), c1, c2,
166 A.retptr(0), A.tvptr(0), A.lesptr(0), Acc.retptr(0),
167 Acc.tvptr(0), Acc.lesptr(0), A.size1(), a1, a2, B.retptr(0),
168 B.tvptr(0), B.lesptr(0), Bcc.retptr(0), Bcc.tvptr(0),
169 Bcc.lesptr(0), B.size1(), b1, b2, B.sig(), ntau);
173 template <
typename T>
174 void Bubble1(
int tstp, herm_matrix_timestep_view<T> &C,
int c1,
int c2,
175 herm_matrix_timestep_view<T> &A,
int a1,
int a2,
176 herm_matrix_timestep_view<T> &B,
int b1,
int b2) {
177 return Bubble1(tstp, C, c1, c2, A, A, a1, a2, B, B, b1, b2);
180 template <
typename T>
181 void Bubble1(
int tstp, herm_matrix_timestep_view<T> &C, herm_matrix_timestep_view<T> &A,
182 herm_matrix_timestep_view<T> &Acc, herm_matrix_timestep_view<T> &B,
183 herm_matrix_timestep_view<T> &Bcc) {
184 return Bubble1(tstp, C, 0, 0, A, Acc, 0, 0, B, Bcc, 0, 0);
187 template <
typename T>
188 void Bubble1(
int tstp, herm_matrix_timestep_view<T> &C, herm_matrix_timestep_view<T> &A,
189 herm_matrix_timestep_view<T> &B) {
190 return Bubble1(tstp, C, A, A, B, B);
193 template <
class GGC,
class GGA,
class GGB>
194 void Bubble1(
int tstp, GGC &C,
int c1,
int c2, GGA &A, GGA &Acc,
int a1,
int a2, GGB &B,
195 GGB &Bcc,
int b1,
int b2) {
201 Bubble1(tstp, ctmp, c1, c2, atmp, acctmp, a1, a2, btmp, bcctmp, b1, b2);
204 template <
class GGC,
class GGA,
class GGB>
205 void Bubble1(
int tstp, GGC &C,
int c1,
int c2, GGA &A,
int a1,
int a2, GGB &B,
int b1,
210 Bubble1(tstp, ctmp, c1, c2, atmp, a1, a2, btmp, b1, b2);
213 template <
class GGC,
class GGA,
class GGB>
214 void Bubble1(
int tstp, GGC &C, GGA &A, GGA &Acc, GGB &B, GGB &Bcc) {
220 Bubble1(tstp, ctmp, atmp, acctmp, btmp, bcctmp);
223 template <
class GGC,
class GGA,
class GGB>
void Bubble1(
int tstp, GGC &C, GGA &A, GGB &B) {
227 Bubble1(tstp, ctmp, atmp, btmp);
233 template <
typename T>
234 void Bubble2(
int tstp, herm_matrix_timestep_view<T> &C,
int c1,
int c2,
235 herm_matrix_timestep_view<T> &A, herm_matrix_timestep_view<T> &Acc,
int a1,
236 int a2, herm_matrix_timestep_view<T> &B, herm_matrix_timestep_view<T> &Bcc,
240 assert(ntau == A.ntau());
241 assert(ntau == B.ntau());
242 assert(ntau == Acc.ntau());
243 assert(ntau == Bcc.ntau());
244 assert(tstp == C.tstp_);
245 assert(tstp == B.tstp_);
246 assert(tstp == A.tstp_);
247 assert(tstp == Acc.tstp_);
248 assert(tstp == Bcc.tstp_);
249 assert(a1 <= A.size1());
250 assert(a2 <= A.size1());
251 assert(b1 <= B.size1());
252 assert(b2 <= B.size1());
253 assert(c1 <= C.size1());
254 assert(c2 <= C.size1());
255 assert(Acc.size1() == A.size1());
256 assert(Bcc.size1() == B.size1());
259 get_bubble_2_mat(C.matptr(0), C.size1(), c1, c2, A.matptr(0), A.size1(), a1, a2,
260 B.matptr(0), B.size1(), b1, b2, ntau);
262 get_bubble_2_timestep(tstp, C.retptr(0), C.tvptr(0), C.lesptr(0), C.size1(), c1, c2,
263 A.retptr(0), A.tvptr(0), A.lesptr(0), Acc.retptr(0),
264 Acc.tvptr(0), Acc.lesptr(0), A.size1(), a1, a2, B.retptr(0),
265 B.tvptr(0), B.lesptr(0), Bcc.retptr(0), Bcc.tvptr(0),
266 Bcc.lesptr(0), B.size1(), b1, b2, ntau);
270 template <
typename T>
271 void Bubble2(
int tstp, herm_matrix_timestep_view<T> &C,
int c1,
int c2,
272 herm_matrix_timestep_view<T> &A,
int a1,
int a2,
273 herm_matrix_timestep_view<T> &B,
int b1,
int b2) {
274 return Bubble2(tstp, C, c1, c2, A, A, a1, a2, B, B, b1, b2);
277 template <
typename T>
278 void Bubble2(
int tstp, herm_matrix_timestep_view<T> &C, herm_matrix_timestep_view<T> &A,
279 herm_matrix_timestep_view<T> &Acc, herm_matrix_timestep_view<T> &B,
280 herm_matrix_timestep_view<T> &Bcc) {
281 return Bubble2(tstp, C, 0, 0, A, Acc, 0, 0, B, Bcc, 0, 0);
284 template <
typename T>
285 void Bubble2(
int tstp, herm_matrix_timestep_view<T> &C, herm_matrix_timestep_view<T> &A,
286 herm_matrix_timestep_view<T> &B) {
287 return Bubble2(tstp, C, A, A, B, B);
290 template <
class GGC,
class GGA,
class GGB>
291 void Bubble2(
int tstp, GGC &C,
int c1,
int c2, GGA &A, GGA &Acc,
int a1,
int a2, GGB &B,
292 GGB &Bcc,
int b1,
int b2) {
298 Bubble2(tstp, ctmp, c1, c2, atmp, acctmp, a1, a2, btmp, bcctmp, b1, b2);
301 template <
class GGC,
class GGA,
class GGB>
302 void Bubble2(
int tstp, GGC &C,
int c1,
int c2, GGA &A,
int a1,
int a2, GGB &B,
int b1,
307 Bubble2(tstp, ctmp, c1, c2, atmp, a1, a2, btmp, b1, b2);
310 template <
class GGC,
class GGA,
class GGB>
311 void Bubble2(
int tstp, GGC &C, GGA &A, GGA &Acc, GGB &B, GGB &Bcc) {
317 Bubble2(tstp, ctmp, atmp, acctmp, btmp, bcctmp);
320 template <
class GGC,
class GGA,
class GGB>
void Bubble2(
int tstp, GGC &C, GGA &A, GGB &B) {
324 Bubble2(tstp, ctmp, atmp, btmp);
329 #endif // CNTR_BUBBLE_IMPL_H Class herm_matrix_timestep_view serves for interfacing with class herm_matrix_timestep without copyi...
void Bubble2(int tstp, GGC &C, int c1, int c2, GGA &A, GGA &Acc, int a1, int a2, GGB &B, GGB &Bcc, int b1, int b2)
Evaluate a bubble diagram ( ) from two-time contour functions at the time step; ...
void Bubble1(int tstp, GGC &C, int c1, int c2, GGA &A, GGA &Acc, int a1, int a2, GGB &B, GGB &Bcc, int b1, int b2)
Evaluate a bubble diagram ( ) from two-time contour functions at the time step; ...