14 #ifndef FIELD_INCLUDED
15 #define FIELD_INCLUDED
65 size_t myindex(
const int jin,
const int site,
const int jex)
const
82 Field(
const int Nin,
const int Nvol,
const int Nex,
96 void reset(
const int Nin,
const int Nvol,
const int Nex,
144 double cmp(
const int jin,
const int site,
const int jex)
const
149 double cmp(
const int i)
const
154 const double *
ptr(
const int jin,
const int site,
const int jex)
const
157 return &(
const_cast<std::valarray<double>&
>(
field)[
myindex(jin, site, jex)]);
160 double *
ptr(
const int jin,
const int site,
const int jex)
165 const double *
ptr(
const int i)
const
168 return &(
const_cast<std::valarray<double>&
>(
field)[i]);
176 void set(
const int jin,
const int site,
const int jex,
double v)
181 void set(
const int i,
double v)
190 void setc(dcomplex a);
192 void add(
const int jin,
const int site,
const int jex,
double v)
197 void add(
const int i,
double v)
205 assert(exw < w.
nex());
206 return copy(*
this, ex, w, exw);
212 assert(exw < w.
nex());
213 return axpy(*
this, ex, 1.0, w, exw);
219 assert(exw < w.
nex());
220 return axpy(*
this, ex, prf, w, exw);
225 double norm2()
const;
233 double dot(
const Field& y,
const int exy,
const Field& x,
const int exx);
240 void dot_and_norm2(
double& yx,
double& y2,
double& x2,
const Field& y,
const int exy,
const Field& x,
const int exx);
246 dcomplex
dotc(
const Field& y,
const int exy,
const Field& x,
const int exx);
253 void dotc_and_norm2(
double& yx,
double& y2,
double& x2,
const Field& y,
const int exy,
const Field& x,
const int exx);
259 void axpy(
Field& y,
const int exy,
const double a,
const Field& x,
const int exx);
265 void axpy(
Field& y,
const int exy,
const dcomplex a,
const Field& x,
const int exx);
271 void scal(
Field& x,
const int exx,
const double a);
277 void scal(
Field& x,
const int exx,
const dcomplex a);
283 void copy(
Field& y,
const int exy,
const Field& x,
const int exx);
297 void stat(
double& Fave,
double& Fmax,
double& Fdev)
const;
308 double dot(
const Field& y,
const int exy,
const Field& x,
const int exx);
315 dcomplex
dotc(
const Field& y,
const int exy,
const Field& x,
const int nexx);
321 void axpy(
Field& y,
const int exy,
const double a,
const Field& x,
const int exx);
328 void axpy(
Field& y,
const int exy,
const dcomplex a,
const Field& x,
const int exx);
334 void scal(
Field& x,
const int exx,
const double a);
341 void scal(
Field& x,
const int exx,
const dcomplex a);
347 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)
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 send_1to1(int count, dcomplex *recv_buf, dcomplex *send_buf, int p_to, int p_from, int tag)
send array of dcomplex from rank p_from to rank p_to. communication distinguished by tag...
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)
static int exchange(int count, dcomplex *recv_buf, dcomplex *send_buf, int idir, int ipm, int tag)
receive array of dcomplex from upstream specified by idir and ipm, and send array to downstream...
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