39 set_threadtask(ith, nth, is, ns,
m_Nvol);
41 double *yp = this->
ptr(0);
43 for (
int ex = 0; ex <
m_Nex; ++ex) {
44 for (
int site = is; site < ns; ++site) {
46 for (
int in = 0; in <
m_Nin; ++in) {
60 dcomplex c = cmplx(a, 0.0);
63 vout.
crucial(
"Error at %s: unsupported arg types.\n", __func__);
75 double *yp = this->
ptr(0);
81 set_threadtask(ith, nth, is, ns,
m_Nvol);
83 for (
int ex = 0; ex <
m_Nex; ++ex) {
84 for (
int site = is; site < ns; ++site) {
86 for (
int k = 0; k < Nin2; ++k) {
101 vout.
crucial(
"Error at %s: real vector and complex parameter.\n",
106 vout.
crucial(
"Error at %s: unsupported arg types.\n", __func__);
115 const double *yp = this->
ptr(0);
117 int ith, nth, is, ns;
118 set_threadtask(ith, nth, is, ns,
m_Nvol);
122 for (
int ex = 0; ex <
m_Nex; ++ex) {
123 for (
int site = is; site < ns; ++site) {
125 for (
int in = 0; in <
m_Nin; ++in) {
126 a += yp[in + kv] * yp[in + kv];
141 vout.
crucial(
"Error at %s: xI() is not available for real field.\n",
146 double *yp = this->
ptr(0);
147 int Nin2 =
m_Nin / 2;
149 int ith, nth, is, ns;
150 set_threadtask(ith, nth, is, ns,
m_Nvol);
152 for (
int ex = 0; ex <
m_Nex; ++ex) {
153 for (
int site = is; site < ns; ++site) {
155 for (
int k = 0; k < Nin2; ++k) {
158 double yr = yp[kr + kv];
159 double yi = yp[ki + kv];
177 const double *yp = this->
ptr(0);
179 int ith, nth, is, ns;
180 set_threadtask(ith, nth, is, ns,
m_Nvol);
183 for (
int ex = 0; ex <
m_Nex; ++ex) {
184 for (
int site = is; site < ns; ++site) {
186 for (
int in = 0; in <
m_Nin; ++in) {
187 double fv = yp[
myindex(in, site, ex)];
193 if (fst > vmax) vmax = fst;
204 Fdev = sqrt(sum2 / vfac - Fave * Fave);
219 double *yp = y.
ptr(0);
220 const double *xp = x.
ptr(0);
222 int ith, nth, is, ns;
223 set_threadtask(ith, nth, is, ns, Nvol);
225 for (
int ex = 0; ex < Nex; ++ex) {
226 for (
int site = is; site < ns; ++site) {
227 int kv = Nin * (site + Nvol * ex);
228 for (
int in = 0; in < Nin; ++in) {
229 yp[in + kv] = xp[in + kv];
242 assert(x.
nin() == Nin);
243 assert(x.
nvol() == Nvol);
245 double *yp = y.
ptr(0, 0, exy);
246 const double *xp = x.
ptr(0, 0, exx);
248 int ith, nth, is, ns;
249 set_threadtask(ith, nth, is, ns, Nvol);
251 for (
int site = is; site < ns; ++site) {
253 for (
int in = 0; in < Nin; ++in) {
254 yp[in + kv] = xp[in + kv];
267 double *xp = x.
ptr(0);
269 int ith, nth, is, ns;
270 set_threadtask(ith, nth, is, ns, Nvol);
272 for (
int ex = 0; ex < Nex; ++ex) {
273 for (
int site = is; site < ns; ++site) {
274 int kv = Nin * (site + Nvol * ex);
275 for (
int in = 0; in < Nin; ++in) {
289 double *xp = x.
ptr(0, 0, exx);
291 int ith, nth, is, ns;
292 set_threadtask(ith, nth, is, ns, Nvol);
294 for (
int site = is; site < ns; ++site) {
296 for (
int in = 0; in < Nin; ++in) {
306 if (imag(a) == 0.0) {
307 return scal(x, real(a));
313 int ith, nth, is, ns;
314 set_threadtask(ith, nth, is, ns, Nvol);
316 double *xp = x.
ptr(0);
321 for (
int ex = 0; ex < Nex; ++ex) {
322 for (
int site = is; site < ns; ++site) {
323 int kv = Nin * (site + Nvol * ex);
324 for (
int k = 0; k < Nin2; ++k) {
327 double xr = xp[kr + kv];
328 double xi = xp[ki + kv];
329 xp[kr + kv] = ar * xr - ai * xi;
330 xp[ki + kv] = ar * xi + ai * xr;
335 vout.
crucial(
"Error at %s: real vector and complex parameter.\n",
345 if (imag(a) == 0.0) {
346 return scal(x, exx, real(a));
352 int ith, nth, is, ns;
353 set_threadtask(ith, nth, is, ns, Nvol);
355 double *xp = x.
ptr(0, 0, exx);
360 for (
int site = is; site < ns; ++site) {
362 for (
int k = 0; k < Nin2; ++k) {
365 double xr = xp[kr + kv];
366 double xi = xp[ki + kv];
367 xp[kr + kv] = ar * xr - ai * xi;
368 xp[ki + kv] = ar * xi + ai * xr;
372 vout.
crucial(
"Error at %s: real vector and complex parameter.\n",
387 double *yp = y.
ptr(0);
388 const double *xp = x.
ptr(0);
390 int ith, nth, is, ns;
391 set_threadtask(ith, nth, is, ns, Nvol);
393 for (
int ex = 0; ex < Nex; ++ex) {
394 for (
int site = is; site < ns; ++site) {
395 int kv = Nin * (site + Nvol * ex);
396 for (
int in = 0; in < Nin; ++in) {
397 yp[in + kv] += a * xp[in + kv];
406 const double a,
const Field& x,
const int exx)
408 assert(x.
nin() == y.
nin());
414 double *yp = y.
ptr(0, 0, exy);
415 const double *xp = x.
ptr(0, 0, exx);
417 int ith, nth, is, ns;
418 set_threadtask(ith, nth, is, ns, Nvol);
420 for (
int site = is; site < ns; ++site) {
422 for (
int in = 0; in < Nin; ++in) {
423 yp[in + kv] += a * xp[in + kv];
432 if (imag(a) == 0.0) {
433 return axpy(y, real(a), x);
441 double *yp = y.
ptr(0);
442 const double *xp = x.
ptr(0);
444 int ith, nth, is, ns;
445 set_threadtask(ith, nth, is, ns, Nvol);
451 for (
int ex = 0; ex < Nex; ++ex) {
452 for (
int site = is; site < ns; ++site) {
453 int kv = Nin * (site + Nvol * ex);
454 for (
int k = 0; k < Nin2; ++k) {
457 yp[kr + kv] += ar * xp[kr + kv] - ai * xp[ki + kv];
458 yp[ki + kv] += ar * xp[ki + kv] + ai * xp[kr + kv];
463 vout.
crucial(
"Error at %s: unsupported types.\n", __func__);
471 const dcomplex a,
const Field& x,
const int exx)
473 if (imag(a) == 0.0) {
474 return axpy(y, exy, real(a), x, exx);
479 assert(x.
nin() == Nin);
480 assert(x.
nvol() == Nvol);
482 double *yp = y.
ptr(0, 0, exy);
483 const double *xp = x.
ptr(0, 0, exx);
485 int ith, nth, is, ns;
486 set_threadtask(ith, nth, is, ns, Nvol);
492 for (
int site = is; site < ns; ++site) {
494 for (
int k = 0; k < Nin2; ++k) {
497 yp[kr + kv] += ar * xp[kr + kv] - ai * xp[ki + kv];
498 yp[ki + kv] += ar * xp[ki + kv] + ai * xp[kr + kv];
502 vout.
crucial(
"Error at %s: unsupported types.\n", __func__);
516 double *yp = y.
ptr(0);
517 const double *xp = x.
ptr(0);
519 int ith, nth, is, ns;
520 set_threadtask(ith, nth, is, ns, Nvol);
522 for (
int ex = 0; ex < Nex; ++ex) {
523 for (
int site = is; site < ns; ++site) {
524 int kv = Nin * (site + Nvol * ex);
525 for (
int in = 0; in < Nin; ++in) {
526 yp[in + kv] = a * yp[in + kv] + xp[in + kv];
536 if (imag(a) == 0.0) {
537 return aypx(real(a), y, x);
545 double *yp = y.
ptr(0);
546 const double *xp = x.
ptr(0);
548 int ith, nth, is, ns;
549 set_threadtask(ith, nth, is, ns, Nvol);
555 for (
int ex = 0; ex < Nex; ++ex) {
556 for (
int site = is; site < ns; ++site) {
557 int kv = Nin * (site + Nvol * ex);
558 for (
int k = 0; k < Nin2; ++k) {
561 double yr = yp[kr + kv];
562 double yi = yp[ki + kv];
563 yp[kr + kv] = ar * yr - ai * yi + xp[kr + kv];
564 yp[ki + kv] = ar * yi + ai * yr + xp[ki + kv];
569 vout.
crucial(
"Error at %s: unsupported types.\n", __func__);
583 const double *yp = y.
ptr(0);
584 const double *xp = x.
ptr(0);
586 int ith, nth, is, ns;
587 set_threadtask(ith, nth, is, ns, Nvol);
591 for (
int ex = 0; ex < Nex; ++ex) {
592 for (
int site = is; site < ns; ++site) {
593 int kv = Nin * (site + Nvol * ex);
594 for (
int in = 0; in < Nin; ++in) {
595 a += yp[in + kv] * xp[in + kv];
609 assert(x.
nin() == y.
nin());
615 const double *yp = y.
ptr(0, 0, exy);
616 const double *xp = x.
ptr(0, 0, exx);
618 int ith, nth, is, ns;
619 set_threadtask(ith, nth, is, ns, Nvol);
623 for (
int site = is; site < ns; ++site) {
625 for (
int in = 0; in < Nin; ++in) {
626 a += yp[in + kv] * xp[in + kv];
638 const Field& y,
const int exy,
639 const Field& x,
const int exx)
643 assert(x.
nin() == Nin);
644 assert(x.
nvol() == Nvol);
646 const double *yp = y.
ptr(0, 0, exy);
647 const double *xp = x.
ptr(0, 0, exx);
649 int ith, nth, is, ns;
650 set_threadtask(ith, nth, is, ns, Nvol);
656 for (
int site = is; site < ns; ++site) {
658 for (
int in = 0; in < Nin; ++in) {
659 sum_yx += yp[in + kv] * xp[in + kv];
660 sum_x2 += xp[in + kv] * xp[in + kv];
661 sum_y2 += yp[in + kv] * yp[in + kv];
665 double prd[3] = { sum_yx, sum_x2, sum_y2 };
682 const double *yp = y.
ptr(0);
683 const double *xp = x.
ptr(0);
685 int ith, nth, is, ns;
686 set_threadtask(ith, nth, is, ns, Nvol);
692 for (
int ex = 0; ex < Nex; ++ex) {
693 for (
int site = is; site < ns; ++site) {
694 int kv = Nin * (site + Nvol * ex);
695 for (
int in = 0; in < Nin; ++in) {
696 sum_yx += yp[in + kv] * xp[in + kv];
697 sum_x2 += xp[in + kv] * xp[in + kv];
698 sum_y2 += yp[in + kv] * yp[in + kv];
703 double prd[3] = { sum_yx, sum_x2, sum_y2 };
719 const double *yp = y.
ptr(0);
720 const double *xp = x.
ptr(0);
722 int ith, nth, is, ns;
723 set_threadtask(ith, nth, is, ns, Nvol);
731 for (
int ex = 0; ex < Nex; ++ex) {
732 for (
int site = is; site < ns; ++site) {
733 int kv = Nin * (site + Nvol * ex);
734 for (
int k = 0; k < Nin2; ++k) {
737 prdr += yp[kr + kv] * xp[kr + kv] + yp[ki + kv] * xp[ki + kv];
738 prdi += yp[kr + kv] * xp[ki + kv] - yp[ki + kv] * xp[kr + kv];
743 double prd[2] = { prdr, prdi };
746 return cmplx(prd[0], prd[1]);
749 return cmplx(
dot(y, x), 0.0);
751 vout.
crucial(
"Error at %s: unsupported arg types\n", __func__);
754 return cmplx(0.0, 0.0);
764 assert(x.
nin() == Nin);
765 assert(x.
nvol() == Nvol);
767 const double *yp = y.
ptr(0, 0, exy);
768 const double *xp = x.
ptr(0, 0, exx);
770 int ith, nth, is, ns;
771 set_threadtask(ith, nth, is, ns, Nvol);
779 for (
int site = is; site < ns; ++site) {
781 for (
int k = 0; k < Nin2; ++k) {
784 prdr += yp[kr + kv] * xp[kr + kv] + yp[ki + kv] * xp[ki + kv];
785 prdi += yp[kr + kv] * xp[ki + kv] - yp[ki + kv] * xp[kr + kv];
789 double prd[2] = { prdr, prdi };
792 return cmplx(prd[0], prd[1]);
795 return cmplx(
dot(y, exy, x, exx), 0.0);
797 vout.
crucial(
"Error at %s: unsupported arg types\n", __func__);
800 return cmplx(0.0, 0.0);
814 const double *yp = y.
ptr(0);
815 const double *xp = x.
ptr(0);
817 int ith, nth, is, ns;
818 set_threadtask(ith, nth, is, ns, Nvol);
828 for (
int ex = 0; ex < Nex; ++ex) {
829 for (
int site = is; site < ns; ++site) {
830 int kv = Nin * (site + Nvol * ex);
831 for (
int k = 0; k < Nin2; ++k) {
834 prd_r += yp[kr + kv] * xp[kr + kv] + yp[ki + kv] * xp[ki + kv];
835 prd_i += yp[kr + kv] * xp[ki + kv] - yp[ki + kv] * xp[kr + kv];
836 prd_x2 += xp[kr + kv] * xp[kr + kv] + xp[ki + kv] * xp[ki + kv];
837 prd_y2 += yp[kr + kv] * yp[kr + kv] + yp[ki + kv] * yp[ki + kv];
842 double prd[4] = { prd_r, prd_i, prd_x2, prd_y2 };
845 yx = cmplx(prd[0], prd[1]);
852 yx = cmplx(yx_re, 0.0);
854 vout.
crucial(
"Error at %s: unsupported arg types.\n", __func__);
862 const Field& y,
const int exy,
863 const Field& x,
const int exx)
867 assert(x.
nin() == Nin);
868 assert(x.
nvol() == Nvol);
870 const double *yp = y.
ptr(0, 0, exy);
871 const double *xp = x.
ptr(0, 0, exx);
873 int ith, nth, is, ns;
874 set_threadtask(ith, nth, is, ns, Nvol);
884 for (
int site = is; site < ns; ++site) {
886 for (
int k = 0; k < Nin2; ++k) {
889 prd_r += yp[kr + kv] * xp[kr + kv] + yp[ki + kv] * xp[ki + kv];
890 prd_i += yp[kr + kv] * xp[ki + kv] - yp[ki + kv] * xp[kr + kv];
891 prd_x2 += xp[kr + kv] * xp[kr + kv] + xp[ki + kv] * xp[ki + kv];
892 prd_y2 += yp[kr + kv] * yp[kr + kv] + yp[ki + kv] * yp[ki + kv];
896 double prd[4] = { prd_r, prd_i, prd_x2, prd_y2 };
899 yx = cmplx(prd[0], prd[1]);
906 yx = cmplx(yx_re, 0.0);
908 vout.
crucial(
"Error at %s: unsupported arg types.\n", __func__);