Bridge++  Ver. 2.0.2
field_F_1spinor.h
Go to the documentation of this file.
1 
15 #ifndef FIELD_F_1SPINOR_INCLUDED
16 #define FIELD_F_1SPINOR_INCLUDED
17 
18 #include "field_G.h"
19 
20 #include "Tools/vec_SU_N.h"
21 using namespace SU_N;
22 #include "IO/bridgeIO.h"
23 using Bridge::vout;
24 
26 
38 class Field_F_1spinor : public Field
39 {
40  private:
41  int m_Nc; // num of the color elements
42  int m_Nc2; // num of the double color elements
43 
44  inline
45  int myindex(const int c2, const int site, const int ex) const
46  {
47  return Field::myindex(c2, site, ex);
48  }
49 
50  public:
51 
52  explicit
53  Field_F_1spinor(const int Nvol = CommonParameters::Nvol(), const int Nex = 1) :
54  Field(2 * CommonParameters::Nc(), Nvol, Nex),
55  m_Nc(CommonParameters::Nc()),
56  m_Nc2(2 * CommonParameters::Nc())
57  {
58  }
59 
60  // conversion from Field
61  Field_F_1spinor(const Field& x) :
62  Field(x),
63  m_Nc(CommonParameters::Nc()),
64  m_Nc2(2 * CommonParameters::Nc())
65  {
66  }
67 
68  // assignment
69  //Field_F_1spinor& operator=(const double a) { field = a; return *this; }
71  {
72  copy(*this, v);
73  return *this;
74  }
75 
76  void reset(int Nvol, int Nex) { Field::reset(m_Nc2, Nvol, Nex); }
77 
78  // accessor
79  double cmp_r(const int cc, const int site, const int e = 0) const
80  {
81  return field[myindex(2 * cc, site, e)];
82  }
83 
84  double cmp_i(const int cc, const int site, const int e = 0) const
85  {
86  return field[myindex(2 * cc + 1, site, e)];
87  }
88 
89  void set_r(const int cc, const int site, const int e, const double re)
90  {
91  field[myindex(2 * cc, site, e)] = re;
92  }
93 
94  void set_i(const int cc, const int site, const int e, const double im)
95  {
96  field[myindex(2 * cc + 1, site, e)] = im;
97  }
98 
99  void set_ri(const int cc, const int site, const int e, const double re, const double im)
100  {
101  field[myindex(2 * cc, site, e)] = re;
102  field[myindex(2 * cc + 1, site, e)] = im;
103  }
104 
105  Vec_SU_N vec(const int site, const int e = 0) const
106  {
107  Vec_SU_N Tmp;
108 
109  for (int cc = 0; cc < m_Nc; ++cc) {
110  Tmp.set(cc,
111  field[myindex(2 * cc, site, e)],
112  field[myindex(2 * cc + 1, site, e)]);
113  }
114  return Tmp;
115  }
116 
117  void set_vec(const int site, const int e, const Vec_SU_N& F)
118  {
119  for (int cc = 0; cc < m_Nc; ++cc) {
120  field[myindex(2 * cc, site, e)] = F.r(cc);
121  field[myindex(2 * cc + 1, site, e)] = F.i(cc);
122  }
123  }
124 
125  void add_vec(const int site, const int e, const Vec_SU_N& F)
126  {
127  for (int cc = 0; cc < m_Nc; ++cc) {
128  field[myindex(2 * cc, site, e)] += F.r(cc);
129  field[myindex(2 * cc + 1, site, e)] += F.i(cc);
130  }
131  }
132 
133  void clear_vec(const int site, const int e)
134  {
135  for (int cc = 0; cc < m_Nc2; ++cc) {
136  field[myindex(cc, site, e)] = 0.0;
137  }
138  }
139 };
140 
141 // defined as separate functions
143 void mult_Field_Gn(Field_F_1spinor& y, const int ex,
144  const Field_G& u, int ex1,
145  const Field_F_1spinor& x, int ex2);
146 
148 void mult_Field_Gd(Field_F_1spinor& y, const int ex,
149  const Field_G& u, int ex1,
150  const Field_F_1spinor& x, int ex2);
151 
152 #endif
Field::myindex
size_t myindex(const int jin, const int site, const int jex) const
Definition: field.h:64
Field_F_1spinor::set_i
void set_i(const int cc, const int site, const int e, const double im)
Definition: field_F_1spinor.h:94
bridgeIO.h
Field_F_1spinor::clear_vec
void clear_vec(const int site, const int e)
Definition: field_F_1spinor.h:133
field_G.h
CommonParameters
Common parameter class: provides parameters as singleton.
Definition: commonParameters.h:42
Field_F_1spinor::cmp_r
double cmp_r(const int cc, const int site, const int e=0) const
Definition: field_F_1spinor.h:79
vec_SU_N.h
Field_F_1spinor::reset
void reset(int Nvol, int Nex)
Definition: field_F_1spinor.h:76
Field_F_1spinor::set_ri
void set_ri(const int cc, const int site, const int e, const double re, const double im)
Definition: field_F_1spinor.h:99
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Field_F_1spinor::m_Nc2
int m_Nc2
Definition: field_F_1spinor.h:42
Field_F_1spinor::set_r
void set_r(const int cc, const int site, const int e, const double re)
Definition: field_F_1spinor.h:89
SU_N::Vec_SU_N::set
void set(const int c, const double re, const double im)
Definition: vec_SU_N.h:74
SU_N::Vec_SU_N::i
double i(const int c) const
Definition: vec_SU_N.h:67
Field_F_1spinor::Field_F_1spinor
Field_F_1spinor(const int Nvol=CommonParameters::Nvol(), const int Nex=1)
Definition: field_F_1spinor.h:53
SU_N
Definition: mat_SU_N.h:28
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
Field_F_1spinor::Field_F_1spinor
Field_F_1spinor(const Field &x)
Definition: field_F_1spinor.h:61
mult_Field_Gd
void mult_Field_Gd(Field_F_1spinor &y, const int ex, const Field_G &u, int ex1, const Field_F_1spinor &x, int ex2)
y=U^\dagger*x
Definition: field_F_1spinor.cpp:67
Field_F_1spinor::vec
Vec_SU_N vec(const int site, const int e=0) const
Definition: field_F_1spinor.h:105
Field_F_1spinor::operator=
Field_F_1spinor & operator=(const Field_F_1spinor &v)
Definition: field_F_1spinor.h:70
mult_Field_Gn
void mult_Field_Gn(Field_F_1spinor &y, const int ex, const Field_G &u, int ex1, const Field_F_1spinor &x, int ex2)
y=U*x
Definition: field_F_1spinor.cpp:27
Field_F_1spinor::add_vec
void add_vec(const int site, const int e, const Vec_SU_N &F)
Definition: field_F_1spinor.h:125
Field_F_1spinor::cmp_i
double cmp_i(const int cc, const int site, const int e=0) const
Definition: field_F_1spinor.h:84
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_F_1spinor::myindex
int myindex(const int c2, const int site, const int ex) const
Definition: field_F_1spinor.h:45
Field_F_1spinor
Staggered-type fermion field.
Definition: field_F_1spinor.h:38
Field_F_1spinor::set_vec
void set_vec(const int site, const int e, const Vec_SU_N &F)
Definition: field_F_1spinor.h:117
Field_F_1spinor::m_Nc
int m_Nc
Definition: field_F_1spinor.h:41
Field
Container of Field-type object.
Definition: field.h:46
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
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512