11 using namespace BiCGStabKernels;
13 template<
typename T,
typename CR>
18 const Real& RsdBiCGStab,
26 FlopCounter flopcount;
28 const Subset& sub =
A.subset();
36 flopcount.addSiteFlops(4*Nc*Ns,sub);
52 ComplexD rhon, rhon_1;
53 ComplexD alphan, alphan_1;
59 ComplexD sigman_2, sigman_1;
69 flopcount.addFlops(
A.nFlops());
70 flopcount.addSiteFlops(2*Nc*Ns,sub);
80 flopcount.addFlops(
A.nFlops());
89 flopcount.addFlops(
A.nFlops());
117 flopcount.addSiteFlops(16*Nc*Ns,sub);
121 for(
int n = 1;
n <= MaxBiCGStab && !convP ;
n++) {
130 rhon =
phi -
omega*(sigman_2 - alphan_1*pi_c);
133 if( toBool( real(rhon) == 0 ) && toBool( imag(rhon) == 0 ) ) {
134 QDPIO::cout <<
"BiCGStab breakdown: rho = 0" << std::endl;
148 delta =( rhon / rhon_1 ) * alphan_1;
154 taun = sigman_1 +
beta*(taun_1-
omega*pi_c);
156 if( toBool( real(taun) == 0 ) && toBool( imag(taun) == 0 ) ) {
157 QDPIO::cout <<
"BiCGStab breakdown: <r_0|v> = 0" << std::endl;
162 alphan = rhon / taun;
180 ComplexD bar =
beta*alphan/alphan_1;
181 ComplexD alphadelta = alphan*delta;
185 z[sub] = alphan*
r+
tmp;
186 z[sub] -= alphadelta*v;
194 ibicgstab_zvupdates(
r,
z,v,
u,
q,alphan, bar, alphadelta,
beta, delta, sub);
203 t[sub] =
u - alphan *
q;
206 s[sub] =
r - alphan*v;
217 rnorm_prev = norm2(
r,sub);
244 flopcount.addFlops(
A.nFlops() + 86);
245 flopcount.addSiteFlops(102*Nc*Ns, sub);
250 if( toBool(rnorm_prev <
rsd_sq ) ) {
253 ret.
resid = sqrt(rnorm_prev);
263 if( toBool(
kappa == 0) ) {
264 QDPIO::cerr <<
"Breakdown || Ms || = || t || = 0 " << std::endl;
305 flopcount.addFlops(
A.nFlops()+17);
306 flopcount.addSiteFlops(18*Nc*Ns,sub);
314 QDPIO::cout <<
"InvIBiCGStab: n = " << ret.
n_count <<
" resid = " << ret.
resid << std::endl;
315 flopcount.report(
"invibicgstab", swatch.getTimeInSeconds());
317 if ( ret.
n_count == MaxBiCGStab ) {
318 QDPIO::cerr <<
"Nonconvergence of IBiCGStab. MaxIters reached " << std::endl;
327 SystemSolverResults_t
329 const LatticeFermionF&
chi,
330 LatticeFermionF&
psi,
331 const Real& RsdBiCGStab,
336 return InvIBiCGStab_a<LatticeFermionF, ComplexF>(
A,
chi,
psi, RsdBiCGStab, MaxBiCGStab,
isign);
340 SystemSolverResults_t
342 const LatticeFermionD&
chi,
343 LatticeFermionD&
psi,
344 const Real& RsdBiCGStab,
349 return InvIBiCGStab_a<LatticeFermionD, ComplexD>(
A,
chi,
psi, RsdBiCGStab, MaxBiCGStab,
isign);
354 SystemSolverResults_t
356 const LatticeStaggeredFermion&
chi,
357 LatticeStaggeredFermion&
psi,
358 const Real& RsdBiCGStab,
363 return InvIBiCGStab_a<LatticeStaggeredFermion, Complex>(
A,
chi,
psi, RsdBiCGStab, MaxBiCGStab,
isign);
Primary include file for CHROMA library code.
Conjugate-Gradient algorithm for a generic Linear Operator.
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)
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
SystemSolverResults_t InvIBiCGStab(const LinearOperator< LatticeFermionF > &A, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdBiCGStab, int MaxBiCGStab, enum PlusMinus isign)
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
SystemSolverResults_t InvIBiCGStab_a(const LinearOperator< T > &A, const T &chi, T &psi, const Real &RsdBiCGStab, int MaxBiCGStab, enum PlusMinus isign)
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Holds return info from SystemSolver call.