Go to the documentation of this file.
10 #ifndef ACCEL_AFIELD_INC_INCLUDED
11 #define ACCEL_AFIELD_INC_INCLUDED
22 #include "lib_alt_Accel/BridgeACC/bridgeACC_AField.h"
25 template <
typename REALTYPE>
32 template <
typename REALTYPE>
39 template <
typename REALTYPE>
46 template <
typename REALTYPE>
54 template <
typename REALTYPE>
62 template <
typename REALTYPE>
71 template <
typename REALTYPE>
76 v.
axpy(ex, a, w, ex_w);
80 template <
typename REALTYPE>
88 template <
typename REALTYPE>
97 template <
typename REALTYPE>
104 template <
typename REALTYPE>
112 template <
typename REALTYPE>
119 template <
typename REALTYPE>
125 v.
dotc(vw_r, vw_i, w);
126 return cmplx(vw_r, vw_i);
130 template <
typename REALTYPE>
137 template <
typename REALTYPE>
144 template <
typename REALTYPE>
151 template <
class INDEX,
class AFIELD>
162 vout.
paranoiac(
" Nin = %d Nvol = %d Nex = %d\n", Nin, Nvol, Nex);
167 int Nvol_pad = v.nvol_pad();
168 if(Nvol_pad != index.nvol_pad()){
169 vout.
crucial(
"convert: inconsistent Nvol_pad in AField and AIndex");
173 int ith, nth, is, ns;
174 set_threadtask(ith, nth, is, ns, Nvol_pad);
176 for(
int ex = 0; ex < Nex; ++ex){
177 for(
int site = is; site < ns; ++site){
180 for(
int in = 0; in < Nin; ++in){
181 int iw = in + Nin * (site + Nvol * ex);
182 int iv = index.idx(in, Nin, site, ex);
186 for(
int in = 0; in < Nin; ++in){
187 int iv = index.idx(in, Nin, site, ex);
198 size_t nv = Nin * Nvol_pad * Nex;
209 template <
class INDEX,
class AFIELD>
214 assert(w.
nin() == 2*Nc*Nd);
215 assert(v.
nin() == 2*Nc*Nd);
222 template <
class INDEX,
class AFIELD>
226 assert(w.
nin() == 2*Nc*Nc);
227 assert(v.
nin() == 2*Nc*Nc);
234 template<
class INDEX2,
class AFIELD2,
class INDEX1,
class AFIELD1>
236 const INDEX1& index1,
const AFIELD1& v1)
239 int Nvol = v1.nvol();
245 int ith, nth, is, ns;
246 set_threadtask(ith, nth, is, ns, Nvol);
251 int nv = Nin * Nvol * Nex;
259 for(
int ex = 0; ex < Nex; ++ex){
260 for(
int site = is; site < ns; ++site){
261 for(
int in = 0; in < Nin; ++in){
262 int iv1 = index1.idx(in, Nin, site, ex);
263 int iv2 = index2.idx(in, Nin, site, ex);
272 int nv = Nin * Nvol * Nex;
288 int Nvol = v1.nvol();
293 double *v2p = v2.ptr(0);
297 set_thread(ith, nth);
302 int nvx = Nvol_pad * Nex;
318 int Nvol = v1.nvol();
324 float *v2p = v2.ptr(0);
328 set_thread(ith, nth);
333 int nvx = Nvol_pad * Nex;
342 template <
class INDEX2,
class AFIELD2,
class INDEX1,
class AFIELD1>
344 const INDEX1& index1,
const AFIELD1& v1)
347 int Nvol = v1.nvol();
352 int ith, nth, is, ns;
353 set_threadtask(ith, nth, is, ns, Nvol);
360 int nv = Nin * Nvol * Nex;
368 for(
int ex = 0; ex < Nex; ++ex){
369 for(
int site = is; site < ns; ++site){
370 for(
int in = 0; in < Nin; ++in){
371 int iv1 = index1.idxh(in, Nin, site, ex);
372 int iv2 = index2.idxh(in, Nin, site, ex);
381 int nv = Nin * Nvol * Nex;
398 int Nvol = v1.nvol();
403 double *v2p = v2.ptr(0);
407 set_thread(ith, nth);
412 int nvx = Nvol_pad * Nex;
428 int Nvol = v1.nvol();
433 float *v2p = v2.ptr(0);
437 set_thread(ith, nth);
442 int nvx = Nvol_pad * Nex;
451 template <
class INDEX,
class AFIELD>
462 int Nvol_pad = w.nvol_pad();
463 if(Nvol_pad != index.nvol_pad()){
464 vout.
crucial(
"reverse: inconsistent Nvol_pad in AField and AIndex");
468 int ith, nth, is, ns;
469 set_threadtask(ith, nth, is, ns, Nvol);
475 int nv = Nin * Nvol_pad * Nex;
481 for(
int ex = 0; ex < Nex; ++ex){
482 for(
int site = is; site < ns; ++site){
483 for(
int in = 0; in < Nin; ++in){
484 int iv = in + Nin * (site + Nvol * ex);
485 int iw = index.idx(in, Nin, site, ex);
486 v.
set(iv,
double(wp[iw]));
498 template <
class AFIELD>
511 double *vp = v.
ptr(0);
514 int Nvol_pad = w.nvol_pad();
515 if(Nvol_pad != index.nvol_pad()){
516 vout.
crucial(
"reverse: inconsistent Nvol_pad in AField and AIndex");
521 set_thread(ith, nth);
524 for(
int ex = 0; ex < Nex; ++ex){
525 double *vp2 = &vp[Nin * Nvol * ex];
526 real_t *wp2 = &wp[Nin * Nvol_pad * ex];
538 template <
class INDEX,
class AFIELD>
543 assert(w.
nin() == 2*Nc*Nd);
544 assert(v.
nin() == 2*Nc*Nd);
551 template <
class INDEX,
class AFIELD>
555 assert(w.
nin() == 2*Nc*Nc);
556 assert(v.
nin() == 2*Nc*Nc);
void xI()
multiplying imaginary unit.
void convert_gauge(INDEX &index, AFIELD &v, const Field &w)
void aypx(const real_t, const AField< real_t, ACCEL > &)
REALTYPE norm2(const AField< REALTYPE, ACCEL > &v)
void set(const int jin, const int site, const int jex, double v)
void copy(double *v, double *w, int nin, int nvol)
void update_device(AField< REALTYPE, ACCEL > &v)
void dotc(real_t &, real_t &, const AField< real_t, ACCEL > &) const
complex inner-product: real and imaginary parts in order.
void copy_from_device(double *v, int nv)
void update_host(AField< REALTYPE, ACCEL > &v)
void reverse(INDEX &index, Field &v, const AFIELD &w)
void axpy(const real_t, const AField< real_t, ACCEL > &)
void paranoiac(const char *format,...)
void copy(const Field &w)
void aypx(const REALTYPE a, AField< REALTYPE, ACCEL > &v, const AField< REALTYPE, ACCEL > &w)
void conjg()
taking complex conjugate.
void reverse_gauge(INDEX &index, Field &v, const AFIELD &w)
ComplexTraits< REALTYPE >::complex_t dotc(const AField< REALTYPE, ACCEL > &v, const AField< REALTYPE, ACCEL > &w)
void convert(INDEX &index, AFIELD &v, const Field &w)
void reverse_spinor(INDEX &index, Field &v, const AFIELD &w)
static const std::string class_name
real_t norm2(void) const
square norm squared (|v|^2).
void copy(AField< REALTYPE, ACCEL > &v, const AField< REALTYPE, ACCEL > &w)
void conjg(AField< REALTYPE, ACCEL > &v)
double cmp(const int jin, const int site, const int jex) const
const double * ptr(const int jin, const int site, const int jex) const
real_t dot(const AField< real_t, ACCEL > &)
REALTYPE dot(AField< REALTYPE, ACCEL > &v, AField< REALTYPE, ACCEL > &w)
void xI(AField< REALTYPE, ACCEL > &v)
void convert_h(INDEX2 &index2, AFIELD2 &v2, const INDEX1 &index1, const AFIELD1 &v1)
void crucial(const char *format,...)
Container of Field-type object.
void scal(AField< REALTYPE, ACCEL > &v, const REALTYPE a)
void convert_spinor(INDEX &index, AFIELD &v, const Field &w)
void copy_to_device(double *v, int nv)
void axpy(AField< REALTYPE, ACCEL > &v, const REALTYPE a, const AField< REALTYPE, ACCEL > &w)
void reverse(double *v, double *w, int nin, int nvol, int nvol_pad)