Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
field_G.cpp
Go to the documentation of this file.
1 
14 #include "Field/field_G.h"
15 
16 #include "IO/bridgeIO.h"
17 using Bridge::vout;
18 
19 //====================================================================
20 void Field_G::check()
21 {
22  // int Nthread = ThreadManager_OpenMP::get_num_threads();
23  // int i_thread = ThreadManager_OpenMP::get_thread_id();
24  // assert(Nthread == 1);
25  // assert(i_thread == 0);
26  // Org-version only support single thread environment.
27 }
28 
29 
30 //====================================================================
31 void Field_G::set_unit()
32 {
33  Mat_SU_N ut(m_Nc);
34 
35  ut.unit();
36 
37  for (int mu = 0; mu < m_Nex; ++mu) {
38  for (int site = 0; site < m_Nvol; ++site) {
39  set_mat(site, mu, ut);
40  }
41  }
42 }
43 
44 
45 //====================================================================
47 {
48  rand->gauss_lex_global(*this);
49 
50  Mat_SU_N ut(m_Nc);
51 
52  for (int mu = 0; mu < m_Nex; ++mu) {
53  for (int site = 0; site < m_Nvol; ++site) {
54  this->mat(ut, site, mu);
55  ut.reunit();
56  this->set_mat(site, mu, ut);
57  }
58  }
59 }
60 
61 
62 //====================================================================
64 {
65  set_random(rand.get());
66 }
67 
68 
69 //====================================================================
70 void Field_G::reunit()
71 {
72  Mat_SU_N ut(m_Nc);
73 
74  for (int mu = 0; mu < m_Nex; ++mu) {
75  for (int site = 0; site < m_Nvol; ++site) {
76  mat(ut, site, mu);
77  ut.reunit();
78  set_mat(site, mu, ut);
79  }
80  }
81 }
82 
83 
84 //====================================================================
85 void mult_Field_Gnn(Field_G& W, const int ex,
86  const Field_G& U1, const int ex1,
87  const Field_G& U2, const int ex2)
88 {
89  assert(ex < W.nex());
90  assert(ex1 < U1.nex());
91  assert(ex2 < U2.nex());
92  assert(U1.nvol() == W.nvol());
93  assert(U2.nvol() == W.nvol());
94 
95  const int Nvol = W.nvol();
96 
97  for (int site = 0; site < Nvol; ++site) {
98  W.set_mat(site, ex, U1.mat(site, ex1) * U2.mat(site, ex2));
99  }
100 }
101 
102 
103 //====================================================================
104 void mult_Field_Gdn(Field_G& W, const int ex,
105  const Field_G& U1, const int ex1,
106  const Field_G& U2, const int ex2)
107 {
108  assert(ex < W.nex());
109  assert(ex1 < U1.nex());
110  assert(ex2 < U2.nex());
111  assert(U1.nvol() == W.nvol());
112  assert(U2.nvol() == W.nvol());
113 
114  const int Nvol = W.nvol();
115 
116  for (int site = 0; site < Nvol; ++site) {
117  W.set_mat(site, ex, U1.mat_dag(site, ex1) * U2.mat(site, ex2));
118  }
119 }
120 
121 
122 //====================================================================
123 void mult_Field_Gnd(Field_G& W, const int ex,
124  const Field_G& U1, const int ex1,
125  const Field_G& U2, const int ex2)
126 {
127  assert(ex < W.nex());
128  assert(ex1 < U1.nex());
129  assert(ex2 < U2.nex());
130  assert(U1.nvol() == W.nvol());
131  assert(U2.nvol() == W.nvol());
132 
133  const int Nvol = W.nvol();
134 
135  for (int site = 0; site < Nvol; ++site) {
136  W.set_mat(site, ex, U1.mat(site, ex1) * U2.mat_dag(site, ex2));
137  }
138 }
139 
140 
141 //====================================================================
142 void mult_Field_Gdd(Field_G& W, const int ex,
143  const Field_G& U1, const int ex1,
144  const Field_G& U2, const int ex2)
145 {
146  assert(ex < W.nex());
147  assert(ex1 < U1.nex());
148  assert(ex2 < U2.nex());
149  assert(U1.nvol() == W.nvol());
150  assert(U2.nvol() == W.nvol());
151 
152  const int Nvol = W.nvol();
153 
154  for (int site = 0; site < Nvol; ++site) {
155  W.set_mat(site, ex, U1.mat_dag(site, ex1) * U2.mat_dag(site, ex2));
156  }
157 }
158 
159 
160 //====================================================================
161 void multadd_Field_Gnn(Field_G& W, const int ex,
162  const Field_G& U1, const int ex1,
163  const Field_G& U2, const int ex2,
164  const double ff)
165 {
166  assert(ex < W.nex());
167  assert(ex1 < U1.nex());
168  assert(ex2 < U2.nex());
169  assert(U1.nvol() == W.nvol());
170  assert(U2.nvol() == W.nvol());
171 
172  const int Nvol = W.nvol();
173 
174  for (int site = 0; site < Nvol; ++site) {
175  W.add_mat(site, ex, U1.mat(site, ex1) * U2.mat(site, ex2) * ff);
176  }
177 }
178 
179 
180 //====================================================================
181 void multadd_Field_Gdn(Field_G& W, const int ex,
182  const Field_G& U1, const int ex1,
183  const Field_G& U2, const int ex2,
184  const double ff)
185 {
186  assert(ex < W.nex());
187  assert(ex1 < U1.nex());
188  assert(ex2 < U2.nex());
189  assert(U1.nvol() == W.nvol());
190  assert(U2.nvol() == W.nvol());
191 
192  const int Nvol = W.nvol();
193 
194  for (int site = 0; site < Nvol; ++site) {
195  W.add_mat(site, ex, U1.mat_dag(site, ex1) * U2.mat(site, ex2) * ff);
196  }
197 }
198 
199 
200 //====================================================================
201 void multadd_Field_Gnd(Field_G& W, const int ex,
202  const Field_G& U1, const int ex1,
203  const Field_G& U2, const int ex2,
204  const double ff)
205 {
206  assert(ex < W.nex());
207  assert(ex1 < U1.nex());
208  assert(ex2 < U2.nex());
209  assert(U1.nvol() == W.nvol());
210  assert(U2.nvol() == W.nvol());
211 
212  const int Nvol = W.nvol();
213 
214  for (int site = 0; site < Nvol; ++site) {
215  W.add_mat(site, ex, U1.mat(site, ex1) * U2.mat_dag(site, ex2) * ff);
216  }
217 }
218 
219 
220 //====================================================================
221 void multadd_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  const double ff)
225 {
226  assert(ex < W.nex());
227  assert(ex1 < U1.nex());
228  assert(ex2 < U2.nex());
229  assert(U1.nvol() == W.nvol());
230  assert(U2.nvol() == W.nvol());
231 
232  const int Nvol = W.nvol();
233 
234  for (int site = 0; site < Nvol; ++site) {
235  W.add_mat(site, ex, U1.mat_dag(site, ex1) * U2.mat_dag(site, ex2) * ff);
236  }
237 }
238 
239 
240 //====================================================================
241 void at_Field_G(Field_G& W, const int ex)
242 {
243  assert(ex < W.nex());
244 
245  const int Nvol = W.nvol();
246 
247  for (int site = 0; site < Nvol; ++site) {
248  W.set_mat(site, ex, W.mat(site, ex).at());
249  }
250 }
251 
252 
253 //====================================================================
254 void ah_Field_G(Field_G& W, const int ex)
255 {
256  assert(ex < W.nex());
257 
258  const int Nvol = W.nvol();
259 
260  for (int site = 0; site < Nvol; ++site) {
261  W.set_mat(site, ex, W.mat(site, ex).ah());
262  }
263 }
264 
265 
266 //====================================================================
268  const double alpha, const Field_G& iP, const Field_G& U, const int Nprec)
269 {
270  // W = exp(alpha * iP) * U
271  // = (U + alpha * iP * (U + alpha/2 * iP * ( ... (U+ alpha/n * iP * U) ...
272  const int Nvol = U.nvol();
273  const int Nex = U.nex();
274  const int Nc = CommonParameters::Nc();
275 
276  Mat_SU_N u0(Nc), v0(Nc), w0(Nc);
277 
278  for (int ex = 0; ex < Nex; ++ex) {
279  for (int site = 0; site < Nvol; ++site) {
280  u0 = U.mat(site, ex);
281  v0 = iP.mat(site, ex);
282 
283  w0 = SU_N::mat_exp(alpha, v0, u0, Nprec);
284 
285  W.set_mat(site, ex, w0);
286  }
287  }
288 }
289 
290 
291 //====================================================================
292 //============================================================END=====
void ah_Field_G(Field_G &W, const int ex)
Definition: field_G.cpp:254
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.cpp:123
BridgeIO vout
Definition: bridgeIO.cpp:503
int m_Nex
Definition: field.h:55
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.cpp:161
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.cpp:104
int m_Nvol
Definition: field.h:54
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.cpp:85
int nvol() const
Definition: field.h:127
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.cpp:267
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.cpp:221
void check()
check of assumptions for performance implementation.
Definition: field_G_imp.cpp:28
Mat_SU_N & at()
antihermitian traceless
Definition: mat_SU_N.h:329
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.cpp:142
virtual void gauss_lex_global(Field &)
gaussian random number defined on global lattice.
void set_random(RandomNumbers *rand)
Definition: field_G_imp.cpp:60
void set_unit()
Definition: field_G_imp.cpp:37
SU(N) gauge field.
Definition: field_G.h:38
Mat_SU_N & ah()
antihermitian
Definition: mat_SU_N.h:357
pointer get() const
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.cpp:181
int nex() const
Definition: field.h:128
void reunit()
Definition: field_G_imp.cpp:84
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.cpp:201
void at_Field_G(Field_G &W, const int ex)
Definition: field_G.cpp:241
Base class of random number generators.
Definition: randomNumbers.h:43
Mat_SU_N mat_exp(const double alpha, const Mat_SU_N &iv, const Mat_SU_N &u, const int Nprec)
Definition: mat_SU_N.h:577
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
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
int m_Nc
Definition: field_G.h:41