15 #ifndef FIELD_INCLUDED
16 #define FIELD_INCLUDED
64 size_t myindex(
const int jin,
const int site,
const int jex)
const
81 Field(
const int Nin,
const int Nvol,
const int Nex,
95 void reset(
const int Nin,
const int Nvol,
const int Nex,
143 double cmp(
const int jin,
const int site,
const int jex)
const
148 double cmp(
const int i)
const
153 const double *
ptr(
const int jin,
const int site,
const int jex)
const
156 return &(
const_cast<std::valarray<double>&
>(
field)[
myindex(jin, site, jex)]);
159 double *
ptr(
const int jin,
const int site,
const int jex)
164 const double *
ptr(
const int i)
const
167 return &(
const_cast<std::valarray<double>&
>(
field)[i]);
175 void set(
const int jin,
const int site,
const int jex,
double v)
180 void set(
const int i,
double v)
187 void add(
const int jin,
const int site,
const int jex,
double v)
192 void add(
const int i,
double v)
200 assert(exw < w.
nex());
201 return copy(*
this, ex, w, exw);
207 assert(exw < w.
nex());
208 return axpy(*
this, ex, 1.0, w, exw);
214 assert(exw < w.
nex());
215 return axpy(*
this, ex, prf, w, exw);
220 double norm2()
const;
228 double dot(
const Field& y,
const int exy,
const Field& x,
const int exx);
235 void dot_and_norm2(
double &yx,
double &y2,
double &x2,
const Field& y,
const int exy,
const Field& x,
const int exx);
241 dcomplex
dotc(
const Field& y,
const int exy,
const Field& x,
const int exx);
248 void dotc_and_norm2(
double &yx,
double &y2,
double &x2,
const Field& y,
const int exy,
const Field& x,
const int exx);
254 void axpy(
Field& y,
const int exy,
const double a,
const Field& x,
const int exx);
260 void axpy(
Field& y,
const int exy,
const dcomplex a,
const Field& x,
const int exx);
266 void scal(
Field& x,
const int exx,
const double a);
272 void scal(
Field& x,
const int exx,
const dcomplex a);
278 void copy(
Field& y,
const int exy,
const Field& x,
const int exx);
292 void stat(
double& Fave,
double& Fmax,
double& Fdev)
const;
303 double dot(
const Field& y,
const int exy,
const Field& x,
const int exx);
310 dcomplex
dotc(
const Field& y,
const int exy,
const Field& x,
const int nexx);
316 void axpy(
Field& y,
const int exy,
const double a,
const Field& x,
const int exx);
323 void axpy(
Field& y,
const int exy,
const dcomplex a,
const Field& x,
const int exx);
329 void scal(
Field& x,
const int exx,
const double a);
336 void scal(
Field& x,
const int exx,
const dcomplex a);
342 void copy(
Field& y,
const int exy,
const Field& x,
const int exx);
void report_field_stat(const Bridge::VerboseLevel vl, const std::string &msg, const Field &f)
void scal(Field &x, const double a)
scal(x, a): x = a * x
friend void scal(Field &x, const double a)
scal(x, a): x = a * x
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
const double * ptr(const int jin, const int site, const int jex) const
size_t myindex(const int jin, const int site, const int jex) const
void set(const int jin, const int site, const int jex, double v)
const double * ptr(const int i) const
double * ptr(const int i)
double * ptr(const int jin, const int site, const int jex)
Container of Field-type object.
Bridge::VerboseLevel m_vl
friend void copy(Field &y, const Field &x)
copy(y, x): y = x
friend void dot_and_norm2(double &yx, double &y2, double &x2, const Field &y, const Field &x)
calculate <y|x>, <y|y> and <x|x> simultaneously
double cmp(const int jin, const int site, const int jex) const
friend void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Field & operator=(const Field &v)
bool check_size(const int nin, const int nvol, const int nex) const
checking size parameters. [23 May 2016 H.Matsufuru]
void addpart_ex(int ex, const Field &w, int exw)
static int send_1to1(int count, double *recv_buf, double *send_buf, int p_to, int p_from, int tag)
send array of double from rank p_from to rank p_to. communication distinguished by tag...
Element_type::type element_type
friend double dot(const Field &y, const Field &x)
void addpart_ex(int ex, const Field &w, int exw, double prf)
element_type m_element_type
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
void set(const int i, double v)
friend dcomplex dotc(const Field &y, const Field &x)
Field(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
dcomplex dotc(const Field &y, const Field &x)
static int exchange(int count, double *recv_buf, double *send_buf, int idir, int ipm, int tag)
receive array of double from upstream specified by idir and ipm, and send array to downstream...
Common parameter class: provides parameters as singleton.
double dot(const Field &y, const Field &x)
std::valarray< double > field
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
void add(const int i, double v)
int send_1to1(int count, Field *recv_buf, Field *send_buf, int p_to, int p_from, int tag)
friend void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
element_type field_element_type() const
void add(const int jin, const int site, const int jex, double v)
void stat(double &Fave, double &Fmax, double &Fdev) const
determines the statistics of the field. average, maximum value, and deviation is determined over glob...
void copy(Field &y, const Field &x)
copy(y, x): y = x
void setpart_ex(int ex, const Field &w, int exw)
friend void dotc_and_norm2(double &yx, double &y2, double &x2, const Field &y, const Field &x)
calculate <y|x>, <y|y> and <x|x> simultaneously
int exchange(int count, Field *recv_buf, Field *send_buf, int idir, int ipm, int tag)
double cmp(const int i) const