Bridge++  Version 1.5.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(),
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 xI()
185  {
186  for (int i = 0, n = field.size(); i < n; i += 2) {
187  double real = field[i];
188  field[i] = -field[i + 1];
189  field[i + 1] = real;
190  }
191  }
192 
193  void set_unit();
194 
195  void set_random(RandomNumbers *rand);
196  void set_random(unique_ptr<RandomNumbers>& rand);
197 
198  void reunit();
199 
200 
201  private:
203  void check();
204 };
205 
206 //----------------------------------------------------------------
207 // function style
208 
209 void 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 mult_Field_Gdn(Field_G& W, const int ex,
214  const Field_G& U1, const int ex1,
215  const Field_G& U2, const int ex2);
216 
217 void mult_Field_Gnd(Field_G& W, const int ex,
218  const Field_G& U1, const int ex1,
219  const Field_G& U2, const int ex2);
220 
221 void mult_Field_Gdd(Field_G& W, const int ex,
222  const Field_G& U1, const int ex1,
223  const Field_G& U2, const int ex2);
224 
225 void 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 multadd_Field_Gdn(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 multadd_Field_Gnd(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 multadd_Field_Gdd(Field_G& W, const int ex,
241  const Field_G& U1, const int ex1,
242  const Field_G& U2, const int ex2,
243  const double ff);
244 
245 void at_Field_G(Field_G& W, const int ex);
246 void ah_Field_G(Field_G& W, const int ex);
247 
248 // W = exp(alpha * iP) * U
249 // = (U + alpha * iP * (U + alpha/2 * iP * ( ... (U+ alpha/n * iP * U) ...
250 void mult_exp_Field_G(Field_G& W, const double alpha, const Field_G& iP, const Field_G& U, const int Nprec);
251 
252 #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:149
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:79
Mat_SU_N & dag()
Definition: mat_SU_N.h:283
Container of Field-type object.
Definition: field.h:45
double cmp_i(const int cc, const int site, const int mn=0) const
Definition: field_G.h:92
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:532
Field_G & operator=(const Field_G &v)
Definition: field_G.h:76
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:140
int nc() const
Definition: field_G.h:84
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 set_i(const int cc, const int site, const int mn, const double im)
Definition: field_G.h:102
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:97
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
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:43
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:127
void add_mat(const int site, const int mn, const Mat_SU_N &U, double prf)
Definition: field_G.h:176
Field_G(const Field &x)
Definition: field_G.h:65
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:87
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:160
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
void add_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:168
Field_G clone() const
Definition: field_G.h:58
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:107
void xI()
Definition: field_G.h:184
int m_Nc
Definition: field_G.h:41