Bridge++  Ver. 1.2.x
 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 "mat_SU_N.h"
20 using namespace SU_N;
21 
22 #include "randomNumbers.h"
23 
25 
36 class Field_G : public Field
37 {
38  private:
39  int m_Nc; // number of color elements
40  int m_Ndf; // number of components as real values
41 
42  public:
43 
44  explicit
45  Field_G(const int Nvol = CommonParameters::Nvol(), const int Nex = 1) :
46  Field(
47  2 * CommonParameters::Nc() * CommonParameters::Nc(), Nvol, Nex, COMPLEX
48  ),
49  m_Nc(CommonParameters::Nc()),
50  m_Ndf(2 * CommonParameters::Nc() * CommonParameters::Nc())
51  {
52  check();
53  }
54 
55  Field_G clone() const
56  {
57  return Field_G(nvol(), nex());
58  }
59 
60  // conversion from Field type
61 
62  Field_G(const Field& x) :
63  Field(x),
64  m_Nc(CommonParameters::Nc()),
65  m_Ndf(x.nin())
66  {
67  assert(m_Ndf == 2 * m_Nc * m_Nc);
68  check();
69  }
70 
71  // assignment
72  Field_G& operator=(const double a) { field = a; return *this; }
73 
74  // resize field
75  void reset(const int Nvol, const int Nex)
76  {
77  Field::reset(m_Ndf, Nvol, Nex);
78  }
79 
80  int nc() const { return m_Nc; }
81 
82  // accessors
83  double cmp_r(const int cc, const int site, const int mn = 0) const
84  {
85  return field[myindex(2 * cc, site, mn)];
86  }
87 
88  double cmp_i(const int cc, const int site, const int mn = 0) const
89  {
90  return field[myindex(2 * cc + 1, site, mn)];
91  }
92 
93  void set_r(const int cc, const int site, const int mn, const double re)
94  {
95  field[myindex(2 * cc, site, mn)] = re;
96  }
97 
98  void set_i(const int cc, const int site, const int mn, const double im)
99  {
100  field[myindex(2 * cc + 1, site, mn)] = im;
101  }
102 
103  void set_ri(const int cc, const int site, const int mn,
104  const double re, const double im)
105  {
106  field[myindex(2 * cc, site, mn)] = re;
107  field[myindex(2 * cc + 1, site, mn)] = im;
108  }
109 
110  Mat_SU_N mat(const int site, const int mn = 0) const
111  {
112  Mat_SU_N Tmp(m_Nc);
113 
114  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
115  Tmp.set(cc,
116  field[myindex(2 * cc, site, mn)],
117  field[myindex(2 * cc + 1, site, mn)]);
118  }
119 
120  return Tmp;
121  }
122 
123  Mat_SU_N mat_dag(const int site, const int mn = 0) const
124  {
125  Mat_SU_N Tmp(m_Nc);
126 
127  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
128  Tmp.set(cc,
129  field[myindex(2 * cc, site, mn)],
130  field[myindex(2 * cc + 1, site, mn)]);
131  }
132 
133  return Tmp.dag();
134  }
135 
136  void mat(Mat_SU_N& Tmp, const int site, const int mn = 0) const
137  {
138  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
139  Tmp.set(cc,
140  field[myindex(2 * cc, site, mn)],
141  field[myindex(2 * cc + 1, site, mn)]);
142  }
143  }
144 
145  void mat_dag(Mat_SU_N& Tmp, const int site, const int mn = 0) const
146  {
147  for (int c1 = 0; c1 < m_Nc; ++c1) {
148  for (int c2 = 0; c2 < m_Nc; ++c2) {
149  Tmp.set(c1 + m_Nc * c2,
150  field[myindex(2 * (c2 + m_Nc * c1), site, mn)],
151  -field[myindex(2 * (c2 + m_Nc * c1) + 1, site, mn)]);
152  }
153  }
154  }
155 
156  void set_mat(const int site, const int mn, const Mat_SU_N& U)
157  {
158  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
159  field[myindex(2 * cc, site, mn)] = U.r(cc);
160  field[myindex(2 * cc + 1, site, mn)] = U.i(cc);
161  }
162  }
163 
164  void add_mat(const int site, const int mn, const Mat_SU_N& U)
165  {
166  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
167  field[myindex(2 * cc, site, mn)] += U.r(cc);
168  field[myindex(2 * cc + 1, site, mn)] += U.i(cc);
169  }
170  }
171 
172  void add_mat(const int site, const int mn, const Mat_SU_N& U, double prf)
173  {
174  for (int cc = 0; cc < m_Nc * m_Nc; ++cc) {
175  field[myindex(2 * cc, site, mn)] += prf * U.r(cc);
176  field[myindex(2 * cc + 1, site, mn)] += prf * U.i(cc);
177  }
178  }
179 
180  void xI()
181  {
182  for (int i = 0, n = field.size(); i < n; i += 2) {
183  double real = field[i];
184  field[i] = -field[i + 1];
185  field[i + 1] = real;
186  }
187  }
188 
189  void set_unit();
190 
191  void set_random(RandomNumbers *rand);
192 
193  void reunit();
194 
195 
196  private:
198  void check();
199 };
200 
201 //----------------------------------------------------------------
202 // function style
203 
204 void
205 mult_Field_Gnn(Field_G& w, const int ex,
206  const Field_G& u1, const int ex1,
207  const Field_G& u2, const int ex2);
208 
209 void
210 mult_Field_Gdn(Field_G& w, const int ex,
211  const Field_G& u1, const int ex1,
212  const Field_G& u2, const int ex2);
213 
214 void
215 mult_Field_Gnd(Field_G& w, const int ex,
216  const Field_G& u1, const int ex1,
217  const Field_G& u2, const int ex2);
218 
219 void
220 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
225 multadd_Field_Gnn(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
231 multadd_Field_Gdn(Field_G& w, const int ex,
232  const Field_G& u1, const int ex1,
233  const Field_G& u2, const int ex2,
234  const double ff);
235 
236 void
237 multadd_Field_Gnd(Field_G& w, const int ex,
238  const Field_G& u1, const int ex1,
239  const Field_G& u2, const int ex2,
240  const double ff);
241 
242 void
243 multadd_Field_Gdd(Field_G& w, const int ex,
244  const Field_G& u1, const int ex1,
245  const Field_G& u2, const int ex2,
246  const double ff);
247 
248 void
249 at_Field_G(Field_G& w, const int ex);
250 
251 void
252 ah_Field_G(Field_G& w, const int ex);
253 
254 #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:145
void reset(const int Nvol, const int Nex)
Definition: field_G.h:75
Mat_SU_N & dag()
Definition: mat_SU_N.h:283
Container of Field-type object.
Definition: field.h:37
double cmp_i(const int cc, const int site, const int mn=0) const
Definition: field_G.h:88
Field_G & operator=(const double a)
Definition: field_G.h:72
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:136
void ah_Field_G(Field_G &w, const int ex)
int nc() const
Definition: field_G.h:80
SU(N) gauge field.
Definition: field_G.h:36
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:82
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:98
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:93
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:45
void at_Field_G(Field_G &w, const int ex)
Base class of random number generators.
Definition: randomNumbers.h:40
int m_Ndf
Definition: field_G.h:40
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:123
void add_mat(const int site, const int mn, const Mat_SU_N &U, double prf)
Definition: field_G.h:172
Field_G(const Field &x)
Definition: field_G.h:62
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:83
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:156
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:110
void add_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:164
Field_G clone() const
Definition: field_G.h:55
void set_ri(const int cc, const int site, const int mn, const double re, const double im)
Definition: field_G.h:103
void xI()
Definition: field_G.h:180
int m_Nc
Definition: field_G.h:39