Bridge++  Ver. 1.3.x
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 "randomNumbers.h"
20 
21 #include "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
209 mult_Field_Gnn(Field_G& w, const int ex,
210  const Field_G& u1, const int ex1,
211  const Field_G& u2, const int ex2);
212 
213 void
214 mult_Field_Gdn(Field_G& w, const int ex,
215  const Field_G& u1, const int ex1,
216  const Field_G& u2, const int ex2);
217 
218 void
219 mult_Field_Gnd(Field_G& w, const int ex,
220  const Field_G& u1, const int ex1,
221  const Field_G& u2, const int ex2);
222 
223 void
224 mult_Field_Gdd(Field_G& w, const int ex,
225  const Field_G& u1, const int ex1,
226  const Field_G& u2, const int ex2);
227 
228 void
229 multadd_Field_Gnn(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
235 multadd_Field_Gdn(Field_G& w, const int ex,
236  const Field_G& u1, const int ex1,
237  const Field_G& u2, const int ex2,
238  const double ff);
239 
240 void
241 multadd_Field_Gnd(Field_G& w, const int ex,
242  const Field_G& u1, const int ex1,
243  const Field_G& u2, const int ex2,
244  const double ff);
245 
246 void
247 multadd_Field_Gdd(Field_G& w, const int ex,
248  const Field_G& u1, const int ex1,
249  const Field_G& u2, const int ex2,
250  const double ff);
251 
252 void
253 at_Field_G(Field_G& w, const int ex);
254 
255 void
256 ah_Field_G(Field_G& w, const int ex);
257 #endif
double i(int c) const
Definition: mat_SU_N.h:115
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 mat_dag(Mat_SU_N &Tmp, const int site, const int mn=0) const
Definition: field_G.h:148
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 copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:381
Definition: mat_SU_N.h:28
Field_G & operator=(const Field_G &v)
Definition: field_G.h:75
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 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
void ah_Field_G(Field_G &w, const int ex)
int nc() const
Definition: field_G.h:83
SU(N) gauge field.
Definition: field_G.h:38
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)
Mat_SU_N reunit(const Mat_SU_N &m)
Definition: mat_SU_N.h:568
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
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 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
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)
Field_G(const int Nvol=CommonParameters::Nvol(), const int Nex=1)
Definition: field_G.h:47
void at_Field_G(Field_G &w, const int ex)
Base class of random number generators.
Definition: randomNumbers.h:39
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 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 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 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