43 const std::vector<Field_F>& sq2,
44 const std::vector<Field_F>& sq3,
45 const std::vector<Field_F>& sq4)
49 std::vector<dcomplex> corr_global(Lt);
50 GammaMatrix gm_sink_12, gm_sink_34, gm_src_12, gm_src_34;
53 std::ofstream log_file;
66 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
67 double result = real(corr_global[0]);
75 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
82 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
89 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
96 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
103 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
110 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
117 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
124 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
131 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
138 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
145 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
152 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
170 const std::vector<Field_F>& sq1,
171 const std::vector<Field_F>& sq2,
172 const std::vector<Field_F>& sq3,
173 const std::vector<Field_F>& sq4)
185 assert(corr_global.size() == Lt);
223 std::vector<dcomplex> corr_direct_1122_global(Lt);
224 std::vector<dcomplex> corr_direct_3344_global(Lt);
225 std::vector<dcomplex> corr_direct_1324_global(Lt);
226 std::vector<dcomplex> corr_direct_3142_global(Lt);
229 gm5_gm_sink_12, gm_gm5_src_12,
232 gm5_gm_sink_34, gm_gm5_src_34,
235 gm5_gm_sink_12, gm_gm5_src_34,
238 gm5_gm_sink_34, gm_gm5_src_12,
241 std::vector<dcomplex> corr_direct_global(Lt);
242 for (
int t_global = 0; t_global < Lt; ++t_global) {
243 corr_direct_global[t_global]
244 = corr_direct_1122_global[t_global] * corr_direct_3344_global[t_global]
245 + corr_direct_1324_global[t_global] * corr_direct_3142_global[t_global];
253 typedef std::vector<dcomplex> CorrSet;
254 std::vector<CorrSet> corr_cross_1124_global(Lt);
255 std::vector<CorrSet> corr_cross_3342_global(Lt);
256 std::vector<CorrSet> corr_cross_1322_global(Lt);
257 std::vector<CorrSet> corr_cross_3144_global(Lt);
258 for (
int t_global = 0; t_global < Lt; ++t_global) {
259 corr_cross_1124_global[t_global].resize(Nc * Nd * Nc * Nd);
260 corr_cross_3342_global[t_global].resize(Nc * Nd * Nc * Nd);
261 corr_cross_1322_global[t_global].resize(Nc * Nd * Nc * Nd);
262 corr_cross_3144_global[t_global].resize(Nc * Nd * Nc * Nd);
266 gm5_gm_sink_12, gm_gm5_src_12,
269 gm5_gm_sink_34, gm_gm5_src_34,
272 gm5_gm_sink_34, gm_gm5_src_12,
275 gm5_gm_sink_12, gm_gm5_src_34,
279 std::vector<dcomplex> corr_cross_global(Lt, cmplx(0.0, 0.0));
280 for (
int t_global = 0; t_global < Lt; ++t_global) {
281 for (
int c0 = 0; c0 < Nc; ++c0) {
282 for (
int d0 = 0; d0 < Nd; ++d0) {
283 for (
int c1 = 0; c1 < Nc; ++c1) {
284 for (
int d1 = 0; d1 < Nd; ++d1) {
285 int i_cd2_01 = c0 + Nc * d0 + Nc * Nd * c1 + Nc * Nd * Nc * d1;
286 int i_cd2_10 = c1 + Nc * d1 + Nc * Nd * c0 + Nc * Nd * Nc * d0;
288 dcomplex corr_1124 = corr_cross_1124_global[t_global][i_cd2_01];
289 dcomplex corr_3342 = corr_cross_3342_global[t_global][i_cd2_10];
291 corr_cross_global[t_global] += corr_1124 * corr_3342;
293 dcomplex corr_3144 = corr_cross_3144_global[t_global][i_cd2_01];
294 dcomplex corr_1322 = corr_cross_1322_global[t_global][i_cd2_10];
296 corr_cross_global[t_global] += corr_3144 * corr_1322;
305 for (
int t_global = 0; t_global < Lt; ++t_global) {
306 corr_global[t_global] = corr_direct_global[t_global] - corr_cross_global[t_global];
309 t_global, real(corr_global[t_global]), imag(corr_global[t_global]));
315 for (
int t_global = 0; t_global < Lt; ++t_global) {
317 t_global, real(corr_direct_global[t_global]), imag(corr_direct_global[t_global]));
322 for (
int t_global = 0; t_global < Lt; ++t_global) {
324 t_global, real(corr_cross_global[t_global]), imag(corr_cross_global[t_global]));
332 const std::vector<Field_F>& sq2,
333 const std::vector<Field_F>& sq3,
334 const std::vector<Field_F>& sq4,
335 const std::vector<int>& source_position)
340 std::vector<dcomplex> corr_global(Lt);
341 GammaMatrix gm_sink_12, gm_sink_34, gm_src_12, gm_src_34;
343 const int N_momentum = 10;
345 typedef std::vector<int> MomentumSet;
346 std::vector<MomentumSet> momentum_sink(N_momentum);
347 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
348 momentum_sink[i_momentum].resize(Ndim - 1);
353 momentum_sink[i_momentum][0] = 1;
354 momentum_sink[i_momentum][1] = 0;
355 momentum_sink[i_momentum][2] = 0;
359 momentum_sink[i_momentum][0] = 0;
360 momentum_sink[i_momentum][1] = 1;
361 momentum_sink[i_momentum][2] = 0;
365 momentum_sink[i_momentum][0] = 0;
366 momentum_sink[i_momentum][1] = 0;
367 momentum_sink[i_momentum][2] = 1;
371 momentum_sink[i_momentum][0] = 1;
372 momentum_sink[i_momentum][1] = 1;
373 momentum_sink[i_momentum][2] = 0;
377 momentum_sink[i_momentum][0] = 0;
378 momentum_sink[i_momentum][1] = 1;
379 momentum_sink[i_momentum][2] = 1;
383 momentum_sink[i_momentum][0] = 1;
384 momentum_sink[i_momentum][1] = 0;
385 momentum_sink[i_momentum][2] = 1;
389 momentum_sink[i_momentum][0] = 1;
390 momentum_sink[i_momentum][1] = 1;
391 momentum_sink[i_momentum][2] = 1;
395 momentum_sink[i_momentum][0] = 2;
396 momentum_sink[i_momentum][1] = 0;
397 momentum_sink[i_momentum][2] = 0;
401 momentum_sink[i_momentum][0] = 0;
402 momentum_sink[i_momentum][1] = 2;
403 momentum_sink[i_momentum][2] = 0;
407 momentum_sink[i_momentum][0] = 0;
408 momentum_sink[i_momentum][1] = 0;
409 momentum_sink[i_momentum][2] = 2;
413 std::ofstream log_file;
425 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
427 momentum_sink[i_momentum][0],
428 momentum_sink[i_momentum][1],
429 momentum_sink[i_momentum][2]);
431 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
432 sq1, sq2, sq3, sq4, source_position);
439 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
441 momentum_sink[i_momentum][0],
442 momentum_sink[i_momentum][1],
443 momentum_sink[i_momentum][2]);
445 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
446 sq1, sq2, sq3, sq4, source_position);
453 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
455 momentum_sink[i_momentum][0],
456 momentum_sink[i_momentum][1],
457 momentum_sink[i_momentum][2]);
459 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
460 sq1, sq2, sq3, sq4, source_position);
467 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
469 momentum_sink[i_momentum][0],
470 momentum_sink[i_momentum][1],
471 momentum_sink[i_momentum][2]);
473 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
474 sq1, sq2, sq3, sq4, source_position);
489 const std::vector<int>& momentum_sink,
494 const std::vector<Field_F>& sq1,
495 const std::vector<Field_F>& sq2,
496 const std::vector<Field_F>& sq3,
497 const std::vector<Field_F>& sq4,
498 const std::vector<int>& source_position)
505 assert(corr_global.size() == Lt);
510 gm_gm5_src = gm_src.
mult(gm5);
511 gm5_gm_sink = gm5.
mult(gm_sink);
513 std::vector<dcomplex> corr_local(Nt);
515 for (
int c0 = 0; c0 < Nc; ++c0) {
516 for (
int d0 = 0; d0 < Nd; ++d0) {
517 int d1 = gm_gm5_src.
index(d0);
519 for (
int t = 0; t < Nt; ++t) {
522 contract_at_t(corr_t, momentum_sink, gm5_gm_sink, source_position,
523 sq1[c0 + Nc * d0], sq2[c0 + Nc * d1], t);
525 corr_local[t] += gm_gm5_src.
value(d0) * corr_t;
532 for (
int t = 0; t < corr_global.size(); ++t) {
534 t, real(corr_global[t]), imag(corr_global[t]));
544 const std::vector<Field_F>& sq1,
545 const std::vector<Field_F>& sq2)
551 std::vector<dcomplex> corr_local(Nt, cmplx(0.0, 0.0));
553 for (
int c0 = 0; c0 < Nc; ++c0) {
554 for (
int d0 = 0; d0 < Nd; ++d0) {
555 int d1 = gm_gm5_src.
index(d0);
557 for (
int t = 0; t < Nt; ++t) {
561 sq1[c0 + Nc * d0], sq2[c0 + Nc * d1], t);
563 corr_local[t] += gm_gm5_src.
value(d0) * corr_t;
575 const std::vector<Field_F>& sq1,
576 const std::vector<Field_F>& sq2)
583 typedef std::vector<dcomplex> CorrSet;
584 std::vector<CorrSet> corr_local_idx(Nt);
585 for (
int t = 0; t < Nt; ++t) {
586 corr_local_idx[t].resize(Nc * Nd * Nc * Nd);
588 for (
int t = 0; t < Nt; ++t) {
589 for (
int i_cd2 = 0; i_cd2 < Nc * Nd * Nc * Nd; ++i_cd2) {
590 corr_local_idx[t][i_cd2] = cmplx(0.0, 0.0);
594 for (
int c0 = 0; c0 < Nc; ++c0) {
595 for (
int d0 = 0; d0 < Nd; ++d0) {
596 for (
int c1 = 0; c1 < Nc; ++c1) {
597 for (
int d1 = 0; d1 < Nd; ++d1) {
598 int d51 = gm_gm5_src.
index(d1);
600 for (
int t = 0; t < Nt; ++t) {
604 sq1[c0 + Nc * d0], sq2[c1 + Nc * d51], t);
606 int i_cd2 = c0 + Nc * d0 + Nc * Nd * c1 + Nc * Nd * Nc * d51;
608 corr_local_idx[t][i_cd2] = gm_gm5_src.
value(d1) * corr_t;
616 for (
int i_cd2 = 0; i_cd2 < Nc * Nd * Nc * Nd; ++i_cd2) {
617 std::vector<dcomplex> corr_local(Nt);
618 std::vector<dcomplex> corr_global(Lt);
620 for (
int t = 0; t < Nt; ++t) {
621 corr_local[t] = corr_local_idx[t][i_cd2];
626 for (
int t_global = 0; t_global < Lt; ++t_global) {
627 corr_cross_global[t_global][i_cd2] = corr_global[t_global];
635 const std::vector<dcomplex>& corr_local)
640 assert(corr_global.size() == Lt);
641 assert(corr_local.size() == Nt);
645 std::vector<dcomplex> corr_tmp(Lt, cmplx(0.0, 0.0));
647 for (
int t = 0; t < Nt; ++t) {
648 int t_global = t + ipe_t * Nt;
649 corr_tmp[t_global] = corr_local[t];
652 for (
int t_global = 0; t_global < Lt; ++t_global) {
656 corr_global[t_global] = cmplx(cr_r, cr_i);