Go to the documentation of this file.
10 #ifndef QXS_AFIELD_INCLUDED
11 #define QXS_AFIELD_INCLUDED
31 #include "lib_alt_QXS/inline/define_params.h"
34 template<
typename REALTYPE>
57 std::vector<real_t, aligned_allocator<real_t> >
m_field;
62 std::vector<real_t, aligned_allocator<real_t> >
m_reduce;
69 AField(
const int nin,
const int nvol,
const int nex,
71 { init(nin, nvol, nex, cmpl); }
76 init(w.nin(), w.nvol(), w.nex(), w.field_element_type());
92 void init(
const int nin,
const int nvol,
const int nex,
93 const element_type cmpl);
100 void reset(
const int nin,
const int nvol,
const int nex,
103 if (check_size(nin, nvol, nex) && (m_element_type == cmpl))
return;
105 init(nin, nvol, nex, cmpl);
109 int nin()
const {
return m_nin; }
112 int nvol()
const {
return m_nvol; }
115 int nex()
const {
return m_nex; }
121 bool check_size(
const int nin,
const int nvol,
const int nex)
const
124 if ((m_nin != nin) || (m_nvol != nvol) || (m_nex != nex)) chk =
false;
131 if ((m_nin != w.
nin()) || (m_nvol != w.
nvol()) || (m_nex != w.
nex()))
138 {
return m_field[m_offset + index]; }
141 inline int size(
void)
const {
return m_nsize; }
144 inline int ntot(
void)
const {
return m_nsize; }
148 const real_t *
ptr(
int i)
const {
return &m_field[m_offset + i]; }
151 {
return (
complex_t *)&m_field[m_offset + 2 * i]; }
154 {
return (
const complex_t *)&m_field[m_offset + 2 * i]; }
158 {
return m_field[m_offset + index]; }
161 { m_field[m_offset + index] = a; }
169 void copy(
const int ex,
int nex() const
returning size of extra d.o.f.
const real_t * ptr(int i) const
std::size_t m_size_quot
nsize/m_size_unit
ComplexTraits< REALTYPE >::complex_t complex_t
int nvol() const
returning size of site d.o.f.
int size(void) const
return the array size
Element_type::type element_type
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
element_type m_element_type
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
double dot(const Field &y, const Field &x)
const complex_t * ptr_complex(int i) const
void dotc_and_norm2(dcomplex &yx, double &y2, double &x2, const Field &y, const Field &x)
REALTYPE norm2(const AField< REALTYPE, QXS > &v)
void copy(Field &y, const Field &x)
copy(y, x): y = x
AField(const Field &w)
copy constructor
AField(const AField< real_t, QXS > &w)
copy constructor
real_t & e(const int index)
reference of data element. to be discarded.
AField(const int nin, const int nvol, const int nex, const element_type cmpl=Element_type::COMPLEX)
constructor
element_type field_element_type() const
returning element_type (real or complex).
dcomplex dotc(const Field &y, const Field &x)
std::vector< real_t, aligned_allocator< real_t > > m_field
bool check_size(const int nin, const int nvol, const int nex) const
checking size parameters.
element_type field_element_type() const
void reset(const int nin, const int nvol, const int nex, const element_type cmpl=Element_type::COMPLEX)
std::vector< real_t, aligned_allocator< real_t > > m_reduce
array for reduction
int m_size_unit
unit of reduction
int m_size_rem
nsize % m_size_unit
complex_t * ptr_complex(int i)
AField()
constructor without argument
void set(const int index, const real_t a)
void scal(Field &x, const double a)
scal(x, a): x = a * x
ComplexTraits< double >::complex_t complex_t
bool check_size(const AField< REALTYPE, QXS > &w) const
int ntot(void) const
return the array size
Container of Field-type object.
Bridge::VerboseLevel m_vl
int nin() const
returning size of inner (on site) d.o.f.
real_t cmp(const int index) const
reference of data element
static const std::string class_name