Bridge++  Ver. 2.0.2
field_G.h
Go to the documentation of this file.
1 
15 #ifndef FIELD_G_INCLUDED
16 #define FIELD_G_INCLUDED
17 
18 #include "field.h"
19 #include "Tools/randomNumbers.h"
20 
21 #include "Tools/mat_SU_N.h"
22 using namespace SU_N;
23 
25 
38 class Field_G : public Field
39 {
40  private:
41  int m_Nc; // number of color elements
42  int m_Ndf; // number of components as real values
43 
44  public:
45 
46  explicit
47  Field_G(const int Nvol = CommonParameters::Nvol(), const int Nex = 1) :
48  Field(
49  2 * CommonParameters::Nc() * CommonParameters::Nc(),
50  Nvol, Nex, Element_type::COMPLEX
51  ),
52  m_Nc(CommonParameters::Nc()),
53  m_Ndf(2 * CommonParameters::Nc() * CommonParameters::Nc())
54  {
55  check();
56  }
57 
58  Field_G clone() const
59  {
60  return Field_G(nvol(), nex());
61  }
62 
63  // conversion from Field type
64 
65  Field_G(const Field& x) :
66  Field(x),
67  m_Nc(CommonParameters::Nc()),
68  m_Ndf(x.nin())
69  {
70  assert(m_Ndf == 2 * m_Nc * m_Nc);
71  check();
72  }
73 
74  // assignment
75  //Field_G& operator=(const double a) { field = a; return *this; }
76  Field_G& operator=(const Field_G& v) { copy(*this, v); return *this; }
77 
78  // resize field
79  void reset(const int Nvol, const int Nex)
80  {
81  Field::reset(m_Ndf, Nvol, Nex);
82  }
83 
84  int nc() const { return m_Nc; }
85 
86  // accessors
87  double cmp_r(const int cc, const int site, const int mn = 0) const
88  {
89  return field[myindex(2 * cc, site, mn)];
90  }
91 
92  double cmp_i(const int cc, const int site, const int mn = 0) const
93  {
94  return field[myindex(2 * cc + 1, site, mn)];
95  }
96 
97  void set_r(const int cc, const int site, const int mn, const double re)
98  {
99  field[myindex(2 * cc, site, mn)] = re;
100  }
101 
102  void set_i(const int cc, const int site, const int mn, const double im)
103  {
104  field[myindex(2 * cc + 1, site, mn)] = im;
105  }
106 
107  void set_ri(const int cc, const int site, const int mn,
108  const double re, const double im)
109  {
110  field[myindex(2 * cc, site, mn)] = re;
111  field[myindex(2 * cc + 1, site, mn)] = im;
112  }
113 
114  Mat_SU_N mat(const int site, const int mn = 0) const
115  {
116  Mat_SU_N Tmp(m_Nc);
117 
118  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
119  Tmp.set(cc,
120  field[myindex(2 * cc, site, mn)],
121  field[myindex(2 * cc + 1, site, mn)]);
122  }
123 
124  return Tmp;
125  }
126 
127  Mat_SU_N mat_dag(const int site, const int mn = 0) const
128  {
129  Mat_SU_N Tmp(m_Nc);
130 
131  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
132  Tmp.set(cc,
133  field[myindex(2 * cc, site, mn)],
134  field[myindex(2 * cc + 1, site, mn)]);
135  }
136 
137  return Tmp.dag();
138  }
139 
140  void mat(Mat_SU_N& Tmp, const int site, const int mn = 0) const
141  {
142  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
143  Tmp.set(cc,
144  field[myindex(2 * cc, site, mn)],
145  field[myindex(2 * cc + 1, site, mn)]);
146  }
147  }
148 
149  void mat_dag(Mat_SU_N& Tmp, const int site, const int mn = 0) const
150  {
151  for (int c1 = 0; c1 < m_Nc; ++c1) {
152  for (int c2 = 0; c2 < m_Nc; ++c2) {
153  Tmp.set(c1 + m_Nc * c2,
154  field[myindex(2 * (c2 + m_Nc * c1), site, mn)],
155  -field[myindex(2 * (c2 + m_Nc * c1) + 1, site, mn)]);
156  }
157  }
158  }
159 
160  void set_mat(const int site, const int mn, const Mat_SU_N& U)
161  {
162  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
163  field[myindex(2 * cc, site, mn)] = U.r(cc);
164  field[myindex(2 * cc + 1, site, mn)] = U.i(cc);
165  }
166  }
167 
168  void add_mat(const int site, const int mn, const Mat_SU_N& U)
169  {
170  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
171  field[myindex(2 * cc, site, mn)] += U.r(cc);
172  field[myindex(2 * cc + 1, site, mn)] += U.i(cc);
173  }
174  }
175 
176  void add_mat(const int site, const int mn, const Mat_SU_N& U, double prf)
177  {
178  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
179  field[myindex(2 * cc, site, mn)] += prf * U.r(cc);
180  field[myindex(2 * cc + 1, site, mn)] += prf * U.i(cc);
181  }
182  }
183 
184  void set_unit();
185 
186  void set_random(RandomNumbers *rand);
187 
188  void reunit();
189 
190 
191  private:
193  void check();
194 };
195 
196 //----------------------------------------------------------------
197 // function style
198 
199 void mult_Field_Gnn(Field_G& W, const int ex,
200  const Field_G& U1, const int ex1,
201  const Field_G& U2, const int ex2);
202 
203 void mult_Field_Gdn(Field_G& W, const int ex,
204  const Field_G& U1, const int ex1,
205  const Field_G& U2, const int ex2);
206 
207 void mult_Field_Gnd(Field_G& W, const int ex,
208  const Field_G& U1, const int ex1,
209  const Field_G& U2, const int ex2);
210 
211 void mult_Field_Gdd(Field_G& W, const int ex,
212  const Field_G& U1, const int ex1,
213  const Field_G& U2, const int ex2);
214 
215 void multadd_Field_Gnn(Field_G& W, const int ex,
216  const Field_G& U1, const int ex1,
217  const Field_G& U2, const int ex2,
218  const double ff);
219 
220 void multadd_Field_Gdn(Field_G& W, const int ex,
221  const Field_G& U1, const int ex1,
222  const Field_G& U2, const int ex2,
223  const double ff);
224 
225 void multadd_Field_Gnd(Field_G& W, const int ex,
226  const Field_G& U1, const int ex1,
227  const Field_G& U2, const int ex2,
228  const double ff);
229 
230 void multadd_Field_Gdd(Field_G& W, const int ex,
231  const Field_G& U1, const int ex1,
232  const Field_G& U2, const int ex2,
233  const double ff);
234 
235 void at_Field_G(Field_G& W, const int ex);
236 void ah_Field_G(Field_G& W, const int ex);
237 
238 // W = exp(alpha * iP) * U
239 // = (U + alpha * iP * (U + alpha/2 * iP * ( ... (U+ alpha/n * iP * U) ...
240 void mult_exp_Field_G(Field_G& W, const double alpha, const Field_G& iP, const Field_G& U, const int Nprec);
241 
242 #endif
Field_G::m_Ndf
int m_Ndf
Definition: field_G.h:42
Element_type
Definition: bridge_defs.h:39
COMPLEX
#define COMPLEX
Definition: eigensolver_IRArnoldi.cpp:21
mult_Field_Gdn
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:134
CommonParameters
Common parameter class: provides parameters as singleton.
Definition: commonParameters.h:42
randomNumbers.h
Field_G::add_mat
void add_mat(const int site, const int mn, const Mat_SU_N &U, double prf)
Definition: field_G.h:176
Field_G::set_i
void set_i(const int cc, const int site, const int mn, const double im)
Definition: field_G.h:102
Field_G::mat_dag
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
Field_G::set_ri
void set_ri(const int cc, const int site, const int mn, const double re, const double im)
Definition: field_G.h:107
Field_G::mat
void mat(Mat_SU_N &Tmp, const int site, const int mn=0) const
Definition: field_G.h:140
Field_G::set_mat
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:160
RandomNumbers
Base class of random number generators.
Definition: randomNumbers.h:43
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Field_G::add_mat
void add_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:168
Field_G::nc
int nc() const
Definition: field_G.h:84
SU_N
Definition: mat_SU_N.h:28
at_Field_G
void at_Field_G(Field_G &W, const int ex)
Definition: field_G_imp.cpp:419
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
multadd_Field_Gnn
void multadd_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2, const double ff)
Definition: field_G_imp.cpp:251
multadd_Field_Gdd
void multadd_Field_Gdd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2, const double ff)
Definition: field_G_imp.cpp:377
SU_N::Mat_SU_N::set
void set(int c, const double &re, const double &im)
Definition: mat_SU_N.h:137
Field_G::set_r
void set_r(const int cc, const int site, const int mn, const double re)
Definition: field_G.h:97
ah_Field_G
void ah_Field_G(Field_G &W, const int ex)
Definition: field_G_imp.cpp:462
SU_N::Mat_SU_N
Definition: mat_SU_N.h:36
field.h
Field_G::Field_G
Field_G(const Field &x)
Definition: field_G.h:65
Field_G::reset
void reset(const int Nvol, const int Nex)
Definition: field_G.h:79
SU_N::Mat_SU_N::r
double r(int c) const
Definition: mat_SU_N.h:115
Field_G::Field_G
Field_G(const int Nvol=CommonParameters::Nvol(), const int Nex=1)
Definition: field_G.h:47
Field_G::operator=
Field_G & operator=(const Field_G &v)
Definition: field_G.h:76
Field::reset
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
multadd_Field_Gnd
void multadd_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2, const double ff)
Definition: field_G_imp.cpp:335
Field_G::cmp_r
double cmp_r(const int cc, const int site, const int mn=0) const
Definition: field_G.h:87
mat_SU_N.h
mult_Field_Gnn
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:95
Field_G::mat_dag
void mat_dag(Mat_SU_N &Tmp, const int site, const int mn=0) const
Definition: field_G.h:149
SU_N::Mat_SU_N::i
double i(int c) const
Definition: mat_SU_N.h:116
Field_G::m_Nc
int m_Nc
Definition: field_G.h:41
Field_G::cmp_i
double cmp_i(const int cc, const int site, const int mn=0) const
Definition: field_G.h:92
mult_Field_Gdd
void mult_Field_Gdd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:212
SU_N::reunit
Mat_SU_N reunit(const Mat_SU_N &m)
Definition: mat_SU_N.h:628
mult_exp_Field_G
void mult_exp_Field_G(Field_G &W, const double alpha, const Field_G &iP, const Field_G &U, const int Nprec)
Definition: field_G_imp.cpp:496
SU_N::Mat_SU_N::dag
Mat_SU_N & dag()
Definition: mat_SU_N.h:329
Field
Container of Field-type object.
Definition: field.h:46
Field_G::mat
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Field_G::clone
Field_G clone() const
Definition: field_G.h:58
multadd_Field_Gdn
void multadd_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2, const double ff)
Definition: field_G_imp.cpp:293
mult_Field_Gnd
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:173