Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
field.cpp
Go to the documentation of this file.
1 
14 #include "field.h"
15 
16 #include <cstring>
18 
19 #include "IO/bridgeIO.h"
20 using Bridge::vout;
21 
22 using std::string;
23 
24 //====================================================================
25 namespace {
26  inline
27  void set_threadtask(int& i_thread, int& Nthread, int& is, int& ns,
28  const int size)
29  {
32 
33  is = static_cast<long_t>(size) * i_thread / Nthread;
34  ns = static_cast<long_t>(size) * (i_thread + 1) / Nthread;
35  }
36 }
37 
38 //====================================================================
40 {
41  // vout.general("Field was constructed.\n");
42 }
43 
44 
45 //====================================================================
46 double dot(const Field& y, const Field& x)
47 {
48  const double *yp = y.ptr(0);
49  const double *xp = x.ptr(0);
50 
51  // int size = x.ntot();
52  int i_thread, Nthread, is, ns;
53 
54  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
55 
56  double a = 0.0;
57 
58  for (int k = is; k < ns; ++k) {
59  a += yp[k] * xp[k];
60  }
61  ThreadManager_OpenMP::reduce_sum_global(a, i_thread, Nthread);
62 
63  return a;
64 }
65 
66 
67 //====================================================================
68 double dot(const Field& y, const int exy, const Field& x, const int exx)
69 {
70  assert(x.nin() == y.nin());
71  assert(x.nvol() == y.nvol());
72 
73  const double *yp = y.ptr(0, 0, exy);
74  const double *xp = x.ptr(0, 0, exx);
75 
76  // int size = x.nin() * x.nvol();
77  int i_thread, Nthread, is, ns;
78  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
79 
80  double a = 0.0;
81 
82  for (int k = is; k < ns; ++k) {
83  a += yp[k] * xp[k];
84  }
85  ThreadManager_OpenMP::reduce_sum_global(a, i_thread, Nthread);
86 
87  return a;
88 }
89 
90 
91 //====================================================================
92 void dot_and_norm2(double& yx, double& y2, double& x2, const Field& y, const int exy, const Field& x, const int exx)
93 {
94  assert(x.nin() == y.nin());
95  assert(x.nvol() == y.nvol());
96 
97  const double *yp = y.ptr(0, 0, exy);
98  const double *xp = x.ptr(0, 0, exx);
99 
100  // long_t size = x.nin() * x.nvol();
101  int i_thread, Nthread;
102  int is, ns;
103  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
104 
105  double sum_yx=0.0;
106  double sum_x2=0.0;
107  double sum_y2=0.0;
108 
109  for (int k = is; k < ns; ++k) {
110  sum_yx += yp[k] * xp[k];
111  sum_x2 += xp[k] * xp[k];
112  sum_y2 += yp[k] * yp[k];
113  }
114 
115  double prd[3]={sum_yx, sum_x2, sum_y2};
116  ThreadManager_OpenMP::reduce_sum_global(prd, 3, i_thread, Nthread);
117  yx=prd[0];
118  y2=prd[1];
119  x2=prd[2];
120 }
121 
122 //====================================================================
123 void dot_and_norm2(double& yx, double& y2, double& x2, const Field& y, const Field& x)
124 {
125  assert(x.nin() == y.nin());
126  assert(x.nex() == y.nex());
127  assert(x.nvol() == y.nvol());
128 
129  const double *yp = y.ptr(0);
130  const double *xp = x.ptr(0);
131 
132  int i_thread, Nthread;
133  int is, ns;
134  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
135 
136  double sum_yx=0.0;
137  double sum_x2=0.0;
138  double sum_y2=0.0;
139 
140  for (int k = is; k < ns; ++k) {
141  sum_yx += yp[k] * xp[k];
142  sum_x2 += xp[k] * xp[k];
143  sum_y2 += yp[k] * yp[k];
144  }
145 
146  double prd[3]={sum_yx, sum_x2, sum_y2};
147  ThreadManager_OpenMP::reduce_sum_global(prd, 3, i_thread, Nthread);
148  yx=prd[0];
149  y2=prd[1];
150  x2=prd[2];
151 }
152 
153 
154 //====================================================================
155 dcomplex dotc(const Field& y, const Field& x)
156 {
157  const double *yp = y.ptr(0);
158  const double *xp = x.ptr(0);
159 
160  assert(x.ntot() == y.ntot());
161 
162  int i_thread, Nthread;
163  int is, ns;
164  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
165 
168  double prd_r = 0.0;
169  double prd_i = 0.0;
170 
171  for (int k = is; k < ns; k += 2) {
172  prd_r += yp[k] * xp[k] + yp[k + 1] * xp[k + 1];
173  prd_i += yp[k] * xp[k + 1] - yp[k + 1] * xp[k];
174  }
175  double prd[2]={prd_r, prd_i};
176  ThreadManager_OpenMP::reduce_sum_global(prd, 2, i_thread, Nthread);
177  return cmplx(prd[0], prd[1]);
178 
179  } else if ((y.field_element_type() == Element_type::REAL) &&
181  return cmplx(dot(y, x), 0.0);
182  } else {
183  vout.crucial("Error at %s: unsupported arg types.\n", __func__);
184  exit(EXIT_FAILURE);
185 
186  return cmplx(0.0, 0.0); // never reached.
187  }
188 }
189 
190 
191 //====================================================================
192 dcomplex dotc(const Field& y, const int exy, const Field& x, const int exx)
193 {
194  const double *yp = y.ptr(0, 0, exy);
195  const double *xp = x.ptr(0, 0, exx);
196 
197  assert(x.nin() == y.nin());
198  assert(x.nvol() == y.nvol());
199 
200  // int size = x.nin() * x.nvol();
201  int i_thread, Nthread;
202  int is, ns;
203  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
204 
207  double prd_r = 0.0;
208  double prd_i = 0.0;
209 
210  for (int k = is; k < ns; k += 2) {
211  prd_r += yp[k] * xp[k] + yp[k + 1] * xp[k + 1];
212  prd_i += yp[k] * xp[k + 1] - yp[k + 1] * xp[k];
213  }
214  double prd[2]={prd_r, prd_i};
215  ThreadManager_OpenMP::reduce_sum_global(prd, 2, i_thread, Nthread);
216  return cmplx(prd[0], prd[1]);
217 
218  } else if ((y.field_element_type() == Element_type::REAL) &&
220  return cmplx(dot(y, exy, x, exx), 0.0);
221  } else {
222  vout.crucial("Error at %s: unsupported arg types.\n", __func__);
223  exit(EXIT_FAILURE);
224 
225  return cmplx(0.0, 0.0); // never reached.
226  }
227 }
228 //====================================================================
229 void dotc_and_norm2(dcomplex& yx, double& y2, double& x2,
230  const Field& y, const int exy, const Field& x, const int exx)
231 {
232  const double *yp = y.ptr(0, 0, exy);
233  const double *xp = x.ptr(0, 0, exx);
234 
235  assert(x.nin() == y.nin());
236  assert(x.nvol() == y.nvol());
237 
238  int i_thread, Nthread;
239  int is, ns;
240  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
241 
244  double prd_r = 0.0;
245  double prd_i = 0.0;
246  double prd_x2 = 0.0;
247  double prd_y2 = 0.0;
248 
249  for (int k = is; k < ns; k += 2) {
250  prd_r += yp[k] * xp[k] + yp[k + 1] * xp[k + 1];
251  prd_i += yp[k] * xp[k + 1] - yp[k + 1] * xp[k];
252  prd_x2 += xp[k] * xp[k] + xp[k + 1] * xp[k + 1];
253  prd_y2 += yp[k] * yp[k] + yp[k + 1] * yp[k + 1];
254  }
255  double prd[4]={prd_r, prd_i, prd_x2, prd_y2};
256  ThreadManager_OpenMP::reduce_sum_global(prd, 4, i_thread, Nthread);
257  yx=cmplx(prd[0], prd[1]);
258  y2=prd[2];
259  x2=prd[3];
260  } else if ((y.field_element_type() == Element_type::REAL) &&
262  double yx_re=0.0;
263  dot_and_norm2(yx_re, y2, x2, y, exy, x, exx);
264  yx=cmplx(yx_re, 0.0);
265  } else {
266  vout.crucial("Error at %s: unsupported arg types.\n", __func__);
267  exit(EXIT_FAILURE);
268  // never reached.
269  }
270 }
271 
272 
273 //====================================================================
274 void dotc_and_norm2(dcomplex& yx, double& y2, double& x2,
275  const Field& y, const Field& x)
276 {
277  const double *yp = y.ptr(0);
278  const double *xp = x.ptr(0);
279 
280  assert(x.nin() == y.nin());
281  assert(x.nvol() == y.nvol());
282 
283  int i_thread, Nthread;
284  int is, ns;
285  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
286 
289  double prd_r = 0.0;
290  double prd_i = 0.0;
291  double prd_x2 = 0.0;
292  double prd_y2 = 0.0;
293 
294  for (int k = is; k < ns; k += 2) {
295  prd_r += yp[k] * xp[k] + yp[k + 1] * xp[k + 1];
296  prd_i += yp[k] * xp[k + 1] - yp[k + 1] * xp[k];
297  prd_x2 += xp[k] * xp[k] + xp[k + 1] * xp[k + 1];
298  prd_y2 += yp[k] * yp[k] + yp[k + 1] * yp[k + 1];
299  }
300  double prd[4]={prd_r, prd_i, prd_x2, prd_y2};
301  ThreadManager_OpenMP::reduce_sum_global(prd, 4, i_thread, Nthread);
302  yx=cmplx(prd[0], prd[1]);
303  y2=prd[2];
304  x2=prd[3];
305  } else if ((y.field_element_type() == Element_type::REAL) &&
307  double yx_re=0.0;
308  dot_and_norm2(yx_re, y2, x2, y, x);
309  yx=cmplx(yx_re, 0.0);
310  } else {
311  vout.crucial("Error at %s: unsupported arg types.\n", __func__);
312  exit(EXIT_FAILURE);
313  // never reached.
314  }
315 }
316 
317 
318 //====================================================================
319 void axpy(Field& y, const double a, const Field& x)
320 {
321  double *yp = y.ptr(0);
322  const double *xp = x.ptr(0);
323 
324  // int size = x.ntot();
325  int i_thread, Nthread, is, ns;
326 
327  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
328 
329  for (int k = is; k < ns; ++k) {
330  yp[k] += a * xp[k];
331  }
332 }
333 
334 
335 //====================================================================
336 void axpy(Field& y, const int exy, const double a, const Field& x, const int exx)
337 {
338  assert(x.nin() == y.nin());
339  assert(x.nvol() == y.nvol());
340 
341  double *yp = y.ptr(0, 0, exy);
342  const double *xp = x.ptr(0, 0, exx);
343 
344  // int size = x.nin() * x.nvol();
345  int i_thread, Nthread, is, ns;
346  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
347 
348  for (int k = is; k < ns; ++k) {
349  yp[k] += a * xp[k];
350  }
351 }
352 
353 
354 //====================================================================
355 void axpy(Field& y, const dcomplex a, const Field& x)
356 {
357  if (imag(a) == 0.0) {
358  return axpy(y, real(a), x);
359  } else if ((y.field_element_type() == Element_type::REAL) &&
361  vout.crucial("Error at %s: real vector and complex parameter.\n", __func__);
362  exit(EXIT_FAILURE);
363 
364  return axpy(y, real(a), x); // ignore imaginary part of a
365  } else if ((y.field_element_type() == Element_type::COMPLEX) &&
367  double *yp = y.ptr(0);
368  const double *xp = x.ptr(0);
369 
370  assert(x.ntot() == y.ntot());
371 
372  // int ntot = x.ntot();
373  int i_thread, Nthread, is, ns;
374  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
375 
376  double ar = real(a);
377  double ai = imag(a);
378 
379  // for (int k = 0; k < ntot; k += 2) {
380  for (int k = is; k < ns; k += 2) {
381  yp[k] += ar * xp[k] - ai * xp[k + 1];
382  yp[k + 1] += ar * xp[k + 1] + ai * xp[k];
383  }
384 
385  return;
386  } else {
387  vout.crucial("Error at %s: unsupported types.\n", __func__);
388  exit(EXIT_FAILURE);
389  }
390 }
391 
392 
393 //====================================================================
394 void axpy(Field& y, const int exy, const dcomplex a, const Field& x, const int exx)
395 {
396  if (imag(a) == 0.0) {
397  return axpy(y, exy, real(a), x, exx);
398  } else if ((y.field_element_type() == Element_type::REAL) &&
400  vout.crucial("Error at %s: real vector and complex parameter.\n", __func__);
401  exit(EXIT_FAILURE);
402 
403  return axpy(y, real(a), x); // ignore imaginary part of a
404  } else if ((y.field_element_type() == Element_type::COMPLEX) &&
406  double *yp = y.ptr(0, 0, exy);
407  const double *xp = x.ptr(0, 0, exx);
408 
409  assert(x.nin() == y.nin());
410  assert(x.nvol() == y.nvol());
411 
412  // int size = x.nin() * x.nvol();
413  int i_thread, Nthread, is, ns;
414  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
415 
416  double ar = real(a);
417  double ai = imag(a);
418 
419  for (int k = is; k < ns; k += 2) {
420  yp[k] += ar * xp[k] - ai * xp[k + 1];
421  yp[k + 1] += ar * xp[k + 1] + ai * xp[k];
422  }
423 
424  return;
425  } else {
426  vout.crucial("Error at %s: unsupported types.\n", __func__);
427  exit(EXIT_FAILURE);
428  }
429 }
430 
431 
432 //====================================================================
433 void scal(Field& x, const double a)
434 {
435  // x.field *= a;
436 
437  double *xp = x.ptr(0, 0, 0);
438  int i_thread, Nthread, is, ns;
439 
440  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
441 
442  for (int k = is; k < ns; ++k) {
443  xp[k] *= a;
444  }
445 }
446 
447 
448 //====================================================================
449 void scal(Field& x, const int exx, const double a)
450 {
451  double *xp = x.ptr(0, 0, exx);
452  // int size = x.nin() * x.nvol();
453  int i_thread, Nthread, is, ns;
454 
455  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
456 
457  // for (int k = 0; k < size; ++k) {
458  for (int k = is; k < ns; ++k) {
459  // x.field[k] *= a;
460  xp[k] *= a;
461  }
462 }
463 
464 
465 //====================================================================
466 void scal(Field& x, const dcomplex a)
467 {
469  vout.crucial("Error at %s: real vector and complex parameter.\n", __func__);
470  exit(EXIT_FAILURE);
471 
472  // x.field *= real(a); // ignore imaginary part of a
473  scal(x, a);
474  } else if (x.field_element_type() == Element_type::COMPLEX) {
475  double *xp = x.ptr(0);
476  //int ntot = x.ntot();
477  int i_thread, Nthread, is, ns;
478  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
479 
480  double ar = real(a);
481  double ai = imag(a);
482 
483  // for (int k = 0; k < ntot; k += 2) {
484  for (int k = is; k < ns; k += 2) {
485  double xr = xp[k];
486  double xi = xp[k + 1];
487 
488  xp[k] = ar * xr - ai * xi;
489  xp[k + 1] = ar * xi + ai * xr;
490  }
491  } else {
492  vout.crucial("Error at %s: unsupported field type.\n", __func__);
493  exit(EXIT_FAILURE);
494  }
495 }
496 
497 
498 //====================================================================
499 void scal(Field& x, const int exx, const dcomplex a)
500 {
502  vout.crucial("Error at %s: real vector and complex parameter.\n", __func__);
503  exit(EXIT_FAILURE);
504 
505  // x.field *= real(a); // ignore imaginary part of a
506  scal(x, exx, a);
507  } else if (x.field_element_type() == Element_type::COMPLEX) {
508  double *xp = x.ptr(0, 0, exx);
509  // int size = x.nin() * x.nvol();
510  int i_thread, Nthread, is, ns;
511  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
512 
513  double ar = real(a);
514  double ai = imag(a);
515 
516  // for (int k = 0; k < size; k += 2) {
517  for (int k = is; k < ns; k += 2) {
518  double xr = xp[k];
519  double xi = xp[k + 1];
520 
521  xp[k] = ar * xr - ai * xi;
522  xp[k + 1] = ar * xi + ai * xr;
523  }
524  } else {
525  vout.crucial("Error ar %s: unsupported field type.\n", __func__);
526  exit(EXIT_FAILURE);
527  }
528 }
529 
530 
531 //====================================================================
532 void copy(Field& y, const Field& x)
533 {
534  // y.field = x.field;
535 
536  assert(x.nin() == y.nin());
537  assert(x.nvol() == y.nvol());
538  assert(x.nex() == y.nex());
539 
540  double *yp = y.ptr(0, 0, 0);
541  const double *xp = x.ptr(0, 0, 0);
542 
543  int i_thread, Nthread, is, ns;
544  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
545 
546  for (int k = is; k < ns; ++k) {
547  yp[k] = xp[k];
548  }
549 }
550 
551 
552 //====================================================================
553 void copy(Field& y, const int exy, const Field& x, const int exx)
554 {
555  assert(x.nin() == y.nin());
556  assert(x.nvol() == y.nvol());
557 
558  double *yp = y.ptr(0, 0, exy);
559  const double *xp = x.ptr(0, 0, exx);
560 
561  // int size = x.nin() * x.nvol();
562  int i_thread, Nthread, is, ns;
563  set_threadtask(i_thread, Nthread, is, ns, x.nin() * x.nvol());
564 
565  for (int k = is; k < ns; ++k) {
566  yp[k] = xp[k];
567  }
568 
572  // memcpy(yp, xp, sizeof(double) * size);
573 }
574 
575 
576 //====================================================================
577 void Field::set(double a)
578 {
579  int i_thread, Nthread, is, ns;
580 
581  set_threadtask(i_thread, Nthread, is, ns, ntot());
582 
583  double *yp = this->ptr(0);
584 
585  for (int k = is; k < ns; ++k) {
586  yp[k] = a;
587  }
588 }
589 
590 
591 //====================================================================
592 double Field::norm2() const
593 {
594  int i_thread, Nthread, is, ns;
595 
596  set_threadtask(i_thread, Nthread, is, ns, ntot());
597 
598  const double *yp = this->ptr(0);
599 
600  double a = 0.0;
601 
602  for (int k = is; k < ns; ++k) {
603  a += yp[k] * yp[k];
604  }
605  ThreadManager_OpenMP::reduce_sum_global(a, i_thread, Nthread);
606 
607  return a;
608 }
609 
610 
611 //====================================================================
612 void aypx(const double a, Field& y, const Field& x)
613 {
614  int i_thread, Nthread, is, ns;
615 
616  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
617 
618  double *yp = y.ptr(0);
619  const double *xp = x.ptr(0);
620 
621  for (int k = is; k < ns; ++k) {
622  yp[k] = a * yp[k] + xp[k];
623  }
624 }
625 
626 
627 //====================================================================
628 void aypx(const dcomplex a, Field& y, const Field& x)
629 {
630  if (imag(a) == 0.0) {
631  return aypx(real(a), y, x);
632  } else if ((y.field_element_type() == Element_type::REAL) &&
634  vout.crucial("Error at %s: real vector and complex parameter.\n", __func__);
635  exit(EXIT_FAILURE);
636 
637  return aypx(real(a), y, x); // ignore imaginary part of a
638  } else if ((y.field_element_type() == Element_type::COMPLEX) &&
640  double *yp = y.ptr(0);
641  const double *xp = x.ptr(0);
642 
643  assert(x.ntot() == y.ntot());
644 
645  int i_thread, Nthread, is, ns;
646  set_threadtask(i_thread, Nthread, is, ns, x.ntot());
647 
648  double ar = real(a);
649  double ai = imag(a);
650 
651  for (int k = is; k < ns; k += 2) {
652  double ypr = yp[k];
653  double ypi = yp[k + 1];
654  yp[k] = ar * ypr - ai * ypi + xp[k];
655  yp[k + 1] = ar * ypi + ai * ypr + xp[k + 1];
656  }
657 
658  return;
659  } else {
660  vout.crucial("Error at %s: unsupported types.\n", __func__);
661  exit(EXIT_FAILURE);
662  }
663 }
664 
665 
666 //====================================================================
667 void Field::stat(double& Fave, double& Fmax, double& Fdev) const
668 {
670 
671  double sum = 0.0;
672  double sum2 = 0.0;
673 
674  Fmax = 0.0;
675  for (int ex = 0, nnex = nex(); ex < nnex; ++ex) {
676  for (int site = 0, nnvol = nvol(); site < nnvol; ++site) {
677  double fst = 0.0;
678  for (int in = 0, nnin = nin(); in < nnin; ++in) {
679  double fv = field[myindex(in, site, ex)];
680  fst += fv * fv;
681  }
682  sum2 += fst;
683  fst = sqrt(fst);
684  sum += fst;
685  if (fst > Fmax) Fmax = fst;
686  }
687  }
688 
689  sum = Communicator::reduce_sum(sum);
690  sum2 = Communicator::reduce_sum(sum2);
691  Fmax = Communicator::reduce_max(Fmax);
692 
693  double perdeg = 1.0 / ((double)CommonParameters::Lvol() * nex());
694  Fave = sum * perdeg;
695 
696  double fval = sum2 * perdeg;
697  fval -= Fave * Fave;
698  Fdev = sqrt(fval);
699 }
700 
701 
702 //====================================================================
704  const std::string& msg, const Field& f)
705 {
707 
708  double favg, fmax, fdev;
709  f.stat(favg, fmax, fdev);
710 
711  vout.general(vl,
712  " %s: avg = %12.6f max = %12.6f dev = %12.6f\n",
713  msg.c_str(),
714  favg, fmax, fdev);
715 }
716 
717 
718 //====================================================================
719 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
void report_field_stat(const Bridge::VerboseLevel vl, const std::string &msg, const Field &f)
Definition: field.cpp:703
BridgeIO vout
Definition: bridgeIO.cpp:503
static int get_num_threads()
returns available number of threads.
static int reduce_max(int count, double *recv_buf, double *send_buf, int pattern=0)
find a global maximum of an array of double over the communicator. pattern specifies the dimensions t...
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:153
double norm2() const
Definition: field.cpp:592
size_t myindex(const int jin, const int site, const int jex) const
Definition: field.h:64
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
double dot(const Field &y, const Field &x)
Definition: field.cpp:46
void dotc_and_norm2(dcomplex &yx, double &y2, double &x2, const Field &y, const int exy, const Field &x, const int exx)
Definition: field.cpp:229
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Container of Field-type object.
Definition: field.h:45
int nvol() const
Definition: field.h:127
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
static int get_thread_id()
returns thread id.
int nin() const
Definition: field.h:126
static void reduce_sum_global(double &value, const int i_thread, const int Nthread)
global reduction with summation: value is assumed thread local.
dcomplex dotc(const Field &y, const Field &x)
Definition: field.cpp:155
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
Definition: field.cpp:612
void check()
Definition: field.cpp:39
int nex() const
Definition: field.h:128
std::valarray< double > field
Definition: field.h:60
long long_t
definition of long for Bridge++
Definition: bridge_long.h:46
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
Bridge::VerboseLevel vl
int ntot() const
Definition: field.h:131
VerboseLevel
Definition: bridgeIO.h:42
element_type field_element_type() const
Definition: field.h:129
void stat(double &Fave, double &Fmax, double &Fdev) const
determines the statistics of the field. average, maximum value, and deviation is determined over glob...
Definition: field.cpp:667
static int reduce_sum(int count, double *recv_buf, double *send_buf, int pattern=0)
make a global sum of an array of double over the communicator. pattern specifies the dimensions to be...
void dot_and_norm2(double &yx, double &y2, double &x2, const Field &y, const int exy, const Field &x, const int exx)
Definition: field.cpp:92
static long_t Lvol()