Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
action_F_Ratio_eo.cpp
Go to the documentation of this file.
1 
14 #include "action_F_Ratio_eo.h"
15 
16 const std::string Action_F_Ratio_eo::class_name = "Action_F_Ratio_eo";
17 
18 //====================================================================
20 {
22 
24 }
25 
26 
27 //====================================================================
29 {
30  vout.general(m_vl, "%s:\n", class_name.c_str());
31 }
32 
33 
34 //====================================================================
36 {
37  m_U = U;
38 
39  //- NB. only solver part is even-odd preconditioned.
42  m_fopr->set_config(U);
44 }
45 
46 
47 //====================================================================
49 {
50  const int Nvol = CommonParameters::Nvol();
51  const int Ndim = CommonParameters::Ndim();
52 
53  const int NinF = m_fopr_prec->field_nin();
54  const int NvolF = m_fopr_prec->field_nvol();
55  const int NexF = m_fopr_prec->field_nex();
56  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
57 
58  assert(NvolF == Nvol);
59  m_psf.reset(NinF, NvolF, NexF);
60 
61  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
62 
63  Field xi(NinF, NvolF, NexF);
64  rand->gauss_lex_global(xi);
65 
68 
69  Field v2(NinF, NvolF, NexF);
70  m_fopr->set_mode("H");
71  m_fopr->mult_dag(v2, xi);
72 
73  Field v1(NinF, NvolF, NexF);
74  int Nconv;
75  double diff;
77  m_fprop_H_prec->invert_DdagD(v1, v2, Nconv, diff);
78  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
79 
80  m_fopr_prec->set_mode("H");
81  m_fopr_prec->mult(m_psf, v1);
82 
83  const double H_psf = xi.norm2();
84 
85  vout.general(m_vl, " H_Fratio = %18.8f\n", H_psf);
86  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
87 
88  return H_psf;
89 }
90 
91 
92 //====================================================================
94 {
95  const int Nvol = CommonParameters::Nvol();
96  const int Ndim = CommonParameters::Ndim();
97 
98  const int NinF = m_fopr_prec->field_nin();
99  const int NvolF = m_fopr_prec->field_nvol();
100  const int NexF = m_fopr_prec->field_nex();
101  const int size_psf = NinF * NvolF * NexF * CommonParameters::NPE();
102 
103  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
104 
107 
108  Field v1(NinF, NvolF, NexF);
109  m_fopr_prec->set_mode("H");
110  m_fopr_prec->mult_dag(v1, m_psf);
111 
112  Field v2(NinF, NvolF, NexF);
113  int Nconv;
114  double diff;
116  m_fprop_H->invert_DdagD(v2, v1, Nconv, diff);
117  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
118 
119  const double H_psf = dot(v1, v2);
120 
121  vout.general(m_vl, " H_Fratio = %18.8f\n", H_psf);
122  vout.general(m_vl, " H_F/dof = %18.8f\n", H_psf / size_psf);
123 
124  return H_psf;
125 }
126 
127 
128 //====================================================================
130 {
131  const int Nin = m_U->nin();
132  const int Nvol = m_U->nvol();
133  const int Nex = m_U->nex();
134  const int Nc = CommonParameters::Nc();
135  const int Ndim = CommonParameters::Ndim();
136 
137  assert(force.nin() == Nin);
138  assert(force.nvol() == Nvol);
139  assert(force.nex() == Nex);
140 
141  const int NinF = m_fopr_prec->field_nin();
142  const int NvolF = m_fopr_prec->field_nvol();
143  const int NexF = m_fopr_prec->field_nex();
144 
145  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
146 
151 
152  Field v1(NinF, NvolF, NexF);
153  m_fopr_prec->set_mode("H");
154  m_fopr_prec->mult_dag(v1, m_psf);
155 
156  Field v2(NinF, NvolF, NexF);
157  int Nconv;
158  double diff;
160  m_fprop_MD->invert_DdagD(v2, v1, Nconv, diff);
161  vout.general(m_vl, " Solver: Nconv = %6d diff = %12.6e\n", Nconv, diff);
162 
163  m_fopr_force->force_core(force, v2);
164 
165  Field force_tmp(Nin, Nvol, Nex);
166  m_fopr_prec_force->set_mode("Hdag");
167  m_fopr_prec_force->force_core1(force_tmp, v2, m_psf);
168  axpy(force, -1.0, force_tmp);
169 
171  m_fopr_prec_force->force_core1(force_tmp, m_psf, v2);
172  axpy(force, -1.0, force_tmp);
173 
174  double Fave, Fmax, Fdev;
175  force.stat(Fave, Fmax, Fdev);
176  vout.general(m_vl, " Fratio_ave = %12.6f Fratio_max = %12.6f Fratio_dev = %12.6f\n",
177  Fave, Fmax, Fdev);
178 }
179 
180 
181 //====================================================================
182 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
double norm2() const
Definition: field.cpp:592
double dot(const Field &y, const Field &x)
Definition: field.cpp:46
virtual void set_config(Field *)=0
static const std::string class_name
double calcH()
calculate Hamiltonian of this action term.
void general(const char *format,...)
Definition: bridgeIO.cpp:197
virtual void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: fopr.h:94
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
Container of Field-type object.
Definition: field.h:45
virtual void set_config(Field *)=0
int nvol() const
Definition: field.h:127
void set_config(Field *U)
setting pointer to the gauge configuration.
Class for parameters.
Definition: parameters.h:46
virtual void force_core1(Field &, const Field &, const Field &)
Definition: force_F.cpp:34
virtual void gauss_lex_global(Field &)
gaussian random number defined on global lattice.
virtual int field_nin()=0
returns the on-site d.o.f. for which the fermion operator is defined.
void set_parameter_verboselevel(const Bridge::VerboseLevel vl)
Definition: action.h:53
int nin() const
Definition: field.h:126
double langevin(RandomNumbers *)
Langevis step.
virtual void set_mode(const std::string &mode)
in Force, setting the mode is optional when H is nonhermitian.
Definition: force_F.h:53
virtual void invert_DdagD(Field &, const Field &, int &, double &)=0
virtual int field_nex()=0
returns the external d.o.f. for which the fermion operator is defined.
int nex() const
Definition: field.h:128
virtual void force_core(Field &, const Field &)
Definition: force_F.cpp:18
Bridge::VerboseLevel get_VerboseLevel() const
Definition: parameters.cpp:320
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
Bridge::VerboseLevel m_vl
Definition: action.h:75
Base class of random number generators.
Definition: randomNumbers.h:43
Bridge::VerboseLevel vl
VerboseLevel
Definition: bridgeIO.h:42
virtual void mult(Field &, const Field &)=0
multiplies fermion operator to a given field (2nd argument)
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
void force(Field &)
returns force for molcular dynamical update of conjugate momenta.
virtual void mult_dag(Field &, const Field &)
hermitian conjugate of mult(Field&, const Field&).
Definition: fopr.h:73
virtual int field_nvol()=0
returns the volume for which the fermion operator is defined.