Bridge++  Ver. 2.0.2
field_F.h
Go to the documentation of this file.
1 
14 #ifndef FIELD_F_INCLUDED
15 #define FIELD_F_INCLUDED
16 
17 #include "field_G.h"
18 #include "Tools/vec_SU_N.h"
19 #include "Tools/gammaMatrix.h"
21 
22 #include "IO/bridgeIO.h"
23 using Bridge::vout;
24 
26 
37 class Field_F : public Field
38 {
39  private:
40  int m_Nc; // num of the color elements
41  int m_Nc2; // num of the double color elements
42  int m_Nd; // num of the spinor elements
43 
44  inline
45  int myindex(const int c2, const int s, const int site, const int ex)
46  const
47  {
48  return Field::myindex(c2 + m_Nc2 * s, site, ex);
49  }
50 
51  public:
52 
53  explicit
54  Field_F(const int Nvol = CommonParameters::Nvol(), const int Nex = 1) :
55  Field(2 * CommonParameters::Nc() * CommonParameters::Nd(),
56  Nvol, Nex, Element_type::COMPLEX),
57  m_Nc(CommonParameters::Nc()),
58  m_Nc2(2 * CommonParameters::Nc()),
59  m_Nd(CommonParameters::Nd())
60  {
61  check();
62  }
63 
64  Field_F clone() const
65  {
66  return Field_F(nvol(), nex());
67  }
68 
69  // conversion from Field type
70 
71  Field_F(const Field& x) :
72  Field(x),
73  m_Nc(CommonParameters::Nc()),
74  m_Nc2(2 * CommonParameters::Nc()),
75  m_Nd(CommonParameters::Nd())
76  {
77  check();
78  }
79 
80  void reset(int Nvol, int Nex)
81  {
82  Field::reset(m_Nc2 * m_Nd, Nvol, Nex);
83  }
84 
85  // assignment
86  //Field_F& operator=(const double a) { field = a; return *this; }
87  Field_F& operator=(const Field_F& v) { copy(*this, v); return *this; }
88 
89  int nc() const { return m_Nc; }
90  int nc2() const { return m_Nc2; }
91  int nd() const { return m_Nd; }
92 
93  // accessors
94  double cmp_r(const int cc, const int s, const int site, const int e = 0)
95  const
96  {
97  return field[myindex(2 * cc, s, site, e)];
98  }
99 
100  double cmp_i(const int cc, const int s, const int site, const int e = 0)
101  const
102  {
103  return field[myindex(2 * cc + 1, s, site, e)];
104  }
105 
106  void set_r(const int cc, const int s, const int site, const int e, const double re)
107  {
108  field[myindex(2 * cc, s, site, e)] = re;
109  }
110 
111  void set_i(const int cc, const int s, const int site, const int e, const double im)
112  {
113  field[myindex(2 * cc + 1, s, site, e)] = im;
114  }
115 
116  void set_ri(const int cc, const int s, const int site, const int e, const double re, const double im)
117  {
118  field[myindex(2 * cc, s, site, e)] = re;
119  field[myindex(2 * cc + 1, s, site, e)] = im;
120  }
121 
122  Vec_SU_N vec(const int s, const int site, const int e = 0) const
123  {
124  Vec_SU_N Tmp;
125 
126  for (int cc = 0; cc < m_Nc; ++cc) {
127  Tmp.set(cc,
128  field[myindex(2 * cc, s, site, e)],
129  field[myindex(2 * cc + 1, s, site, e)]);
130  }
131  return Tmp;
132  }
133 
134  void set_vec(const int s, const int site, const int e, const Vec_SU_N& F)
135  {
136  for (int cc = 0; cc < m_Nc; ++cc) {
137  field[myindex(2 * cc, s, site, e)] = F.r(cc);
138  field[myindex(2 * cc + 1, s, site, e)] = F.i(cc);
139  }
140  }
141 
142  void add_vec(const int s, const int site, const int e, const Vec_SU_N& F)
143  {
144  for (int cc = 0; cc < m_Nc; ++cc) {
145  field[myindex(2 * cc, s, site, e)] += F.r(cc);
146  field[myindex(2 * cc + 1, s, site, e)] += F.i(cc);
147  }
148  }
149 
150  void clear_vec(const int s, const int site, const int e)
151  {
152  for (int cc = 0; cc < m_Nc2; ++cc) {
153  field[myindex(cc, s, site, e)] = 0.0;
154  }
155  }
156 
157  private:
158 
160  void check();
161 };
162 
163 
164 //- function style
165 void mult_Field_Gn(Field_F& y, const int ex,
166  const Field_G& u, int ex1,
167  const Field_F& x, int ex2);
168 
169 void mult_Field_Gd(Field_F& y, const int ex,
170  const Field_G& u, int ex1,
171  const Field_F& x, int ex2);
172 
173 void multadd_Field_Gn(Field_F& y, const int ex,
174  const Field_G& u, int ex1,
175  const Field_F& x, int ex2,
176  const double a);
177 
178 void multadd_Field_Gd(Field_F& y, const int ex,
179  const Field_G& u, int ex1,
180  const Field_F& x, int ex2,
181  const double a);
182 
184 void mult_GM(Field_F& y,
185  const GammaMatrix& gm,
186  const Field_F& x);
187 
189 void mult_iGM(Field_F& y,
190  const GammaMatrix& gm,
191  const Field_F& x);
192 
194 void mult_GMproj(Field_F& y,
195  const int pm, const GammaMatrix& gm,
196  const Field_F& x);
197 
199 void mult_GMproj2(Field_F& y,
200  const int pm, const GammaMatrix& gm,
201  const Field_F& x);
202 
204 void mult_GMproj2(Field_F& y,
205  const double nu_s,
206  const int pm,
207  const double r_s,
208  const GammaMatrix& gm,
209  const Field_F& x);
210 
211 #endif
mult_GMproj
void mult_GMproj(Field_F &y, const int pm, const GammaMatrix &gm, const Field_F &x)
projection with gamma matrix: (1 \pm gamma)/2
Definition: field_F_imp.cpp:301
Element_type
Definition: bridge_defs.h:39
Field_F::set_i
void set_i(const int cc, const int s, const int site, const int e, const double im)
Definition: field_F.h:111
COMPLEX
#define COMPLEX
Definition: eigensolver_IRArnoldi.cpp:21
Field::myindex
size_t myindex(const int jin, const int site, const int jex) const
Definition: field.h:64
bridgeIO.h
field_G.h
Field_F::Field_F
Field_F(const Field &x)
Definition: field_F.h:71
Field_F::set_vec
void set_vec(const int s, const int site, const int e, const Vec_SU_N &F)
Definition: field_F.h:134
CommonParameters
Common parameter class: provides parameters as singleton.
Definition: commonParameters.h:42
Field_F::m_Nc2
int m_Nc2
Definition: field_F.h:41
Field_F::cmp_i
double cmp_i(const int cc, const int s, const int site, const int e=0) const
Definition: field_F.h:100
vec_SU_N.h
mult_GM
void mult_GM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication
Definition: field_F_imp.cpp:198
Field_F::vec
Vec_SU_N vec(const int s, const int site, const int e=0) const
Definition: field_F.h:122
gammaMatrix.h
GammaMatrix
Gamma Matrix class.
Definition: gammaMatrix.h:44
Field_F::operator=
Field_F & operator=(const Field_F &v)
Definition: field_F.h:87
Field_F::m_Nc
int m_Nc
Definition: field_F.h:40
Field::nex
int nex() const
Definition: field.h:128
Field_F::nc
int nc() const
Definition: field_F.h:89
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Field_F::set_ri
void set_ri(const int cc, const int s, const int site, const int e, const double re, const double im)
Definition: field_F.h:116
Field::copy
friend void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
Field_F::add_vec
void add_vec(const int s, const int site, const int e, const Vec_SU_N &F)
Definition: field_F.h:142
Field_F::nc2
int nc2() const
Definition: field_F.h:90
SU_N::Vec_SU_N::set
void set(const int c, const double re, const double im)
Definition: vec_SU_N.h:74
mult_Field_Gd
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
Definition: field_F_imp.cpp:76
SU_N::Vec_SU_N::i
double i(const int c) const
Definition: vec_SU_N.h:67
Field_F::check
void check()
check several assumptions for performance implementation.
Definition: field_F_imp.cpp:26
Field_F::myindex
int myindex(const int c2, const int s, const int site, const int ex) const
Definition: field_F.h:45
mult_GMproj2
void mult_GMproj2(Field_F &y, const int pm, const GammaMatrix &gm, const Field_F &x)
projection with gamma matrix: (1 \pm gamma)
Definition: field_F_imp.cpp:324
multadd_Field_Gn
void multadd_Field_Gn(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2, const double a)
Definition: field_F_imp.cpp:116
mult_iGM
void mult_iGM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication (i is multiplied)
Definition: field_F_imp.cpp:250
Field_F::m_Nd
int m_Nd
Definition: field_F.h:42
Field_F::cmp_r
double cmp_r(const int cc, const int s, const int site, const int e=0) const
Definition: field_F.h:94
threadManager.h
Field_F::Field_F
Field_F(const int Nvol=CommonParameters::Nvol(), const int Nex=1)
Definition: field_F.h:54
Field::nvol
int nvol() const
Definition: field.h:127
SU_N::Vec_SU_N
Definition: vec_SU_N.h:24
Field::reset
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
Field::field
std::valarray< double > field
Definition: field.h:60
mult_Field_Gn
void mult_Field_Gn(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2)
Definition: field_F_imp.cpp:36
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
multadd_Field_Gd
void multadd_Field_Gd(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2, const double a)
Definition: field_F_imp.cpp:157
Field_F::set_r
void set_r(const int cc, const int s, const int site, const int e, const double re)
Definition: field_F.h:106
Field
Container of Field-type object.
Definition: field.h:46
Field_F::clear_vec
void clear_vec(const int s, const int site, const int e)
Definition: field_F.h:150
Field_G
SU(N) gauge field.
Definition: field_G.h:38
SU_N::Vec_SU_N::r
double r(const int c) const
Definition: vec_SU_N.h:65
Field_F::reset
void reset(int Nvol, int Nex)
Definition: field_F.h:80
Field_F::nd
int nd() const
Definition: field_F.h:91
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Field_F::clone
Field_F clone() const
Definition: field_F.h:64