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