CHROMA
bicgstab_kernels_naive.h
Go to the documentation of this file.
1 #ifndef BICGSTAB_KERNELS_NAIVE_H
2 #define BICGSTAB_KERNELS_NAIVE_H
3 #include "chromabase.h"
4 
5 
6 /* The funky kernels used by BiCGStab.
7  These versions should always work... */
8 
9 namespace Chroma {
10 
11  namespace BiCGStabKernels {
12 
13 
14  template<typename T>
15  void xymz_normx(T& x, const T& y, const T& z, Double& x_norm,
16  const Subset& s)
17  {
18  x[s] = y-z;
19  x_norm = norm2(x,s);
20  }
21 
22  template<typename T, typename C>
23  void yxpaymabz(T& x, T&y, T&z, const C& a, const C& b, const Subset& s)
24  {
25  T tmp;
26  tmp[s] = y - b*z;
27  y[s] = x + a*tmp;
28  }
29 
30  template<typename T>
31  void norm2x_cdotxy(const T&x, const T&y, Double& norm2x, DComplex& cdotxy, const Subset& s)
32  {
33  norm2x = norm2(x,s);
34  cdotxy = innerProduct(x,y,s);
35  }
36 
37  template<typename T, typename C>
38  void xpaypbz(T& x, T& y, T&z, C& a, C& b, const Subset& s)
39  {
40  T tmp;
41  tmp[s] = x + a*y;
42  x[s] = tmp + b*z;
43  }
44 
45  template<typename T, typename C>
46  void xmay_normx_cdotzx(T& x,const T& y, const T& z, C& a, Double& normx, DComplex& cdotzx, const Subset& s)
47  {
48  x[s] -= a*y;
49  normx = norm2(x,s);
50  cdotzx = innerProduct(z,x,s);
51  }
52 
53 
54  template<typename T, typename C>
55  void cxmay(T& x, const T& y, const C& a, const Subset& s)
56  {
57  x[s] -= a*y;
58  }
59 
60 
61 
62  template<typename T, typename C>
63  inline
64  void ibicgstab_zvupdates(const T& r, T& z, T &v,
65  const T& u, const T& q,
66  const C& alpha,
67  const C& alpha_rat_beta,
68  const C& alpha_delta,
69  const C& beta,
70  const C& delta,
71  const Subset& s)
72  {
73  T tmp;
74  tmp[s] = alpha_rat_beta*z;
75  z[s] = tmp + alpha*r ;
76  z[s] -= alpha_delta*v;
77 
78  tmp = v;
79  v[s] = u+beta*tmp;
80  v[s]-= delta*q;
81  }
82 
83  template<typename T, typename C, typename F>
85  const T& r,
86  const T& u,
87  const T& v,
88  const T& q,
89  const T& r0,
90  const T& f0,
91  T& s,
92  T& t,
93  C& phi,
94  C& pi,
95  C& gamma,
96  C& eta,
97  C& theta,
98  F& kappa,
99  F& rnorm,
100  const Subset& sub)
101  {
102  s[sub] = r - alpha*v;
103  t[sub] = u - alpha*q;
104 
105  phi = innerProduct(r0,s,sub);
106  gamma = innerProduct(f0,s,sub);
107  pi = innerProduct(r0,q,sub);
108  eta = innerProduct(f0,t,sub);
109  theta = innerProduct(t,s,sub);
110  kappa=norm2(t,sub);
111  rnorm = norm2(r,sub);
112  }
113 
114  template<typename T, typename C>
116  const T& s,
117  const T& t,
118  const T& z,
119  T& r,
120  T& x,
121  const Subset& sub)
122  {
123  r[sub] = s - omega*t;
124  x[sub] += omega*s;
125  x[sub] += z;
126  }
127 
128  }
129 
130 
131 
132 }
133 
134 
135 
136 #endif
Primary include file for CHROMA library code.
int y
Definition: meslate.cc:35
int z
Definition: meslate.cc:36
int x
Definition: meslate.cc:34
int t
Definition: meslate.cc:37
Double q
Definition: mesq.cc:17
LatticeReal phi
Definition: mesq.cc:27
SpinMatrix C()
C = Gamma(10)
Definition: barspinmat_w.cc:29
void xpaypbz(T &x, T &y, T &z, C &a, C &b, const Subset &s)
void xmay_normx_cdotzx(T &x, const T &y, const T &z, C &a, Double &normx, DComplex &cdotzx, const Subset &s)
void xymz_normx(T &x, const T &y, const T &z, Double &x_norm, const Subset &s)
void norm2x_cdotxy(const T &x, const T &y, Double &norm2x, DComplex &cdotxy, const Subset &s)
void cxmay(T &x, const T &y, const C &a, const Subset &s)
void yxpaymabz(T &x, T &y, T &z, const C &a, const C &b, const Subset &s)
void ibicgstab_rxupdate(const C &omega, const T &s, const T &t, const T &z, T &r, T &x, const Subset &sub)
void ibicgstab_zvupdates(const T &r, T &z, T &v, const T &u, const T &q, const C &alpha, const C &alpha_rat_beta, const C &alpha_delta, const C &beta, const C &delta, const Subset &s)
void ibicgstab_stupdates_reduces(const C &alpha, const T &r, const T &u, const T &v, const T &q, const T &r0, const T &f0, T &s, T &t, C &phi, C &pi, C &gamma, C &eta, C &theta, F &kappa, F &rnorm, const Subset &sub)
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
static const LatticeInteger & beta(const int dim)
Definition: stag_phases_s.h:47
static const LatticeInteger & alpha(const int dim)
Definition: stag_phases_s.h:43
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
LinOpSysSolverMGProtoClover::T T
Complex a
Definition: invbicg.cc:95
Complex omega
Definition: invbicg.cc:97
LatticeFermion eta
Definition: mespbg5p_w.cc:37
Complex b
Definition: invbicg.cc:96
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Definition: gtest.h:7351
int kappa
Definition: pade_trln_w.cc:112
int r0
Definition: qtopcor.cc:41
static INTERNAL_PRECISION F