Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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(), Nvol, Nex, COMPLEX
50  ),
51  m_Nc(CommonParameters::Nc()),
52  m_Ndf(2 * CommonParameters::Nc() * CommonParameters::Nc())
53  {
54  check();
55  }
56 
57  Field_G clone() const
58  {
59  return Field_G(nvol(), nex());
60  }
61 
62  // conversion from Field type
63 
64  Field_G(const Field& x) :
65  Field(x),
66  m_Nc(CommonParameters::Nc()),
67  m_Ndf(x.nin())
68  {
69  assert(m_Ndf == 2 * m_Nc * m_Nc);
70  check();
71  }
72 
73  // assignment
74  //Field_G& operator=(const double a) { field = a; return *this; }
75  Field_G& operator=(const Field_G& v) { copy(*this, v); return *this; }
76 
77  // resize field
78  void reset(const int Nvol, const int Nex)
79  {
80  Field::reset(m_Ndf, Nvol, Nex);
81  }
82 
83  int nc() const { return m_Nc; }
84 
85  // accessors
86  double cmp_r(const int cc, const int site, const int mn = 0) const
87  {
88  return field[myindex(2 * cc, site, mn)];
89  }
90 
91  double cmp_i(const int cc, const int site, const int mn = 0) const
92  {
93  return field[myindex(2 * cc + 1, site, mn)];
94  }
95 
96  void set_r(const int cc, const int site, const int mn, const double re)
97  {
98  field[myindex(2 * cc, site, mn)] = re;
99  }
100 
101  void set_i(const int cc, const int site, const int mn, const double im)
102  {
103  field[myindex(2 * cc + 1, site, mn)] = im;
104  }
105 
106  void set_ri(const int cc, const int site, const int mn,
107  const double re, const double im)
108  {
109  field[myindex(2 * cc, site, mn)] = re;
110  field[myindex(2 * cc + 1, site, mn)] = im;
111  }
112 
113  Mat_SU_N mat(const int site, const int mn = 0) const
114  {
115  Mat_SU_N Tmp(m_Nc);
116 
117  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
118  Tmp.set(cc,
119  field[myindex(2 * cc, site, mn)],
120  field[myindex(2 * cc + 1, site, mn)]);
121  }
122 
123  return Tmp;
124  }
125 
126  Mat_SU_N mat_dag(const int site, const int mn = 0) const
127  {
128  Mat_SU_N Tmp(m_Nc);
129 
130  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
131  Tmp.set(cc,
132  field[myindex(2 * cc, site, mn)],
133  field[myindex(2 * cc + 1, site, mn)]);
134  }
135 
136  return Tmp.dag();
137  }
138 
139  void mat(Mat_SU_N& Tmp, const int site, const int mn = 0) const
140  {
141  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
142  Tmp.set(cc,
143  field[myindex(2 * cc, site, mn)],
144  field[myindex(2 * cc + 1, site, mn)]);
145  }
146  }
147 
148  void mat_dag(Mat_SU_N& Tmp, const int site, const int mn = 0) const
149  {
150  for (int c1 = 0; c1 < m_Nc; ++c1) {
151  for (int c2 = 0; c2 < m_Nc; ++c2) {
152  Tmp.set(c1 + m_Nc * c2,
153  field[myindex(2 * (c2 + m_Nc * c1), site, mn)],
154  -field[myindex(2 * (c2 + m_Nc * c1) + 1, site, mn)]);
155  }
156  }
157  }
158 
159  void set_mat(const int site, const int mn, const Mat_SU_N& U)
160  {
161  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
162  field[myindex(2 * cc, site, mn)] = U.r(cc);
163  field[myindex(2 * cc + 1, site, mn)] = U.i(cc);
164  }
165  }
166 
167  void add_mat(const int site, const int mn, const Mat_SU_N& U)
168  {
169  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
170  field[myindex(2 * cc, site, mn)] += U.r(cc);
171  field[myindex(2 * cc + 1, site, mn)] += U.i(cc);
172  }
173  }
174 
175  void add_mat(const int site, const int mn, const Mat_SU_N& U, double prf)
176  {
177  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
178  field[myindex(2 * cc, site, mn)] += prf * U.r(cc);
179  field[myindex(2 * cc + 1, site, mn)] += prf * U.i(cc);
180  }
181  }
182 
183  void xI()
184  {
185  for (int i = 0, n = field.size(); i < n; i += 2) {
186  double real = field[i];
187  field[i] = -field[i + 1];
188  field[i + 1] = real;
189  }
190  }
191 
192  void set_unit();
193 
194  void set_random(RandomNumbers *rand);
195  void set_random(unique_ptr<RandomNumbers>& rand);
196 
197  void reunit();
198 
199 
200  private:
202  void check();
203 };
204 
205 //----------------------------------------------------------------
206 // function style
207 
208 void mult_Field_Gnn(Field_G& W, const int ex,
209  const Field_G& U1, const int ex1,
210  const Field_G& U2, const int ex2);
211 
212 void mult_Field_Gdn(Field_G& W, const int ex,
213  const Field_G& U1, const int ex1,
214  const Field_G& U2, const int ex2);
215 
216 void mult_Field_Gnd(Field_G& W, const int ex,
217  const Field_G& U1, const int ex1,
218  const Field_G& U2, const int ex2);
219 
220 void mult_Field_Gdd(Field_G& W, const int ex,
221  const Field_G& U1, const int ex1,
222  const Field_G& U2, const int ex2);
223 
224 void multadd_Field_Gnn(Field_G& W, const int ex,
225  const Field_G& U1, const int ex1,
226  const Field_G& U2, const int ex2,
227  const double ff);
228 
229 void multadd_Field_Gdn(Field_G& W, const int ex,
230  const Field_G& U1, const int ex1,
231  const Field_G& U2, const int ex2,
232  const double ff);
233 
234 void multadd_Field_Gnd(Field_G& W, const int ex,
235  const Field_G& U1, const int ex1,
236  const Field_G& U2, const int ex2,
237  const double ff);
238 
239 void multadd_Field_Gdd(Field_G& W, const int ex,
240  const Field_G& U1, const int ex1,
241  const Field_G& U2, const int ex2,
242  const double ff);
243 
244 void at_Field_G(Field_G& W, const int ex);
245 void ah_Field_G(Field_G& W, const int ex);
246 
247 // W = exp(alpha * iP) * U
248 // = (U + alpha * iP * (U + alpha/2 * iP * ( ... (U+ alpha/n * iP * U) ...
249 void mult_exp_Field_G(Field_G& W, const double alpha, const Field_G& iP, const Field_G& U, const int Nprec);
250 #endif
void ah_Field_G(Field_G &W, const int ex)
double i(int c) const
Definition: mat_SU_N.h:115
void mat_dag(Mat_SU_N &Tmp, const int site, const int mn=0) const
Definition: field_G.h:148
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)
void reset(const int Nvol, const int Nex)
Definition: field_G.h:78
Mat_SU_N & dag()
Definition: mat_SU_N.h:283
Container of Field-type object.
Definition: field.h:39
double cmp_i(const int cc, const int site, const int mn=0) const
Definition: field_G.h:91
void at_Field_G(Field_G &W, const int ex)
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:381
Field_G & operator=(const Field_G &v)
Definition: field_G.h:75
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)
void mat(Mat_SU_N &Tmp, const int site, const int mn=0) const
Definition: field_G.h:139
int nc() const
Definition: field_G.h:83
SU(N) gauge field.
Definition: field_G.h:38
Mat_SU_N reunit(const Mat_SU_N &m)
Definition: mat_SU_N.h:568
void mult_Field_Gdd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
void set_i(const int cc, const int site, const int mn, const double im)
Definition: field_G.h:101
Common parameter class: provides parameters as singleton.
void set_r(const int cc, const int site, const int mn, const double re)
Definition: field_G.h:96
Field_G(const int Nvol=CommonParameters::Nvol(), const int Nex=1)
Definition: field_G.h:47
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)
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void mult_exp_Field_G(Field_G &W, const double alpha, const Field_G &iP, const Field_G &U, const int Nprec)
Base class of random number generators.
Definition: randomNumbers.h:36
int m_Ndf
Definition: field_G.h:42
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:126
void add_mat(const int site, const int mn, const Mat_SU_N &U, double prf)
Definition: field_G.h:175
Field_G(const Field &x)
Definition: field_G.h:64
double r(int c) const
Definition: mat_SU_N.h:114
double cmp_r(const int cc, const int site, const int mn=0) const
Definition: field_G.h:86
void set(int c, double re, const double &im)
Definition: mat_SU_N.h:133
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:159
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:113
void add_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:167
Field_G clone() const
Definition: field_G.h:57
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)
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void set_ri(const int cc, const int site, const int mn, const double re, const double im)
Definition: field_G.h:106
void xI()
Definition: field_G.h:183
int m_Nc
Definition: field_G.h:41