12 using namespace BiCGStabKernels;
14 template<
typename T,
typename TF,
typename CF>
20 const Real& RsdBiCGStab,
29 FlopCounter flopcount;
31 const Subset& sub =
A.subset();
54 ComplexD rhon, rhon_1;
55 ComplexD alphan, alphan_1;
56 ComplexD omegan, omegan_1;
61 ComplexD sigman_2, sigman_1;
62 ComplexD phin, phin_1;
71 flopcount.addSiteFlops(4*Nc*Ns,sub);
87 QDPIO::cout <<
"r0 = " << b_sq << std::endl;;
89 flopcount.addFlops(
A.nFlops());
90 flopcount.addSiteFlops(2*Nc*Ns,sub);
91 flopcount.addSiteFlops(4*Nc*Ns,sub);
109 flopcount.addFlops(
A.nFlops());
114 flopcount.addFlops(
A.nFlops());
142 flopcount.addSiteFlops(16*Nc*Ns,sub);
147 for(
int n = 1;
n <= MaxBiCGStab && !convP ;
n++) {
156 rhon = phin_1 - omegan_1*(sigman_2 - alphan_1*pin_1);
159 if( toBool( real(rhon) == 0 ) && toBool( imag(rhon) == 0 ) ) {
160 QDPIO::cout <<
"BiCGStab breakdown: rho = 0" << std::endl;
174 delta =( rhon / rhon_1 ) * alphan_1;
175 beta = delta/omegan_1;
180 taun = sigman_1 +
beta*(taun_1- omegan_1*pin_1);
182 if( toBool( real(taun) == 0 ) && toBool( imag(taun) == 0 ) ) {
183 QDPIO::cout <<
"BiCGStab breakdown: n="<<
n<<
" <r_0|v> = 0" << std::endl;
184 QDPIO::cout <<
"sigman_1 = " << sigman_1 << std::endl;
185 QDPIO::cout <<
"beta= " <<
beta << std::endl;
186 QDPIO::cout <<
"taun_1 = " << taun_1 << std::endl;
187 QDPIO::cout <<
"ometan_1 = " << omegan_1 << std::endl;
188 QDPIO::cout <<
"pin_1 = " << pin_1 << std::endl;
194 alphan = rhon / taun;
212 ComplexD bar =
beta*alphan/alphan_1;
213 ComplexD alphadelta = alphan*delta;
216 z[sub] = alphan*
r+
tmp;
217 z[sub] -= alphadelta*vn_1;
223 v[sub] -= delta*qn_1;
228 ibicgstab_zvupdates(
r,
z,v,
u,qn_1,alphan, bar, alphadelta,
beta, delta, sub);
236 t[sub] =
u - alphan *
q;
239 s[sub] =
r - alphan*v;
252 rnorm_prev = norm2(
r,sub);
279 flopcount.addFlops(
A.nFlops() + 86);
280 flopcount.addSiteFlops(102*Nc*Ns, sub);
286 if( toBool(rnorm_prev <
rsd_sq ) ) {
295 flopcount.addSiteFlops(2*Nc*Ns,sub);
296 ret.
resid = sqrt(rnorm_prev);
304 rNorm = sqrt(rnorm_prev);
305 if( toBool( rNorm > maxrx) ) maxrx = rNorm;
306 if( toBool( rNorm > maxrr) ) maxrr = rNorm;
308 updateX = toBool ( rNorm < Delta*r0Norm && r0Norm <= maxrx );
309 updateR = toBool ( rNorm < Delta*maxrr && r0Norm <= maxrr ) || updateX;
323 flopcount.addFlops(
A.nFlops());
324 flopcount.addSiteFlops(6*Nc*Ns,sub);
333 flopcount.addFlops(
A.nFlops());
334 flopcount.addSiteFlops(8*Nc*Ns,sub);
337 rNorm = sqrt(rnorm_prev);
343 if( ! updateR ) { x_dble[sub]=
x; }
345 flopcount.addSiteFlops(2*Nc*Ns,sub);
362 if( toBool(
kappa == 0) ) {
363 QDPIO::cerr <<
"Breakdown || Ms || = || t || = 0 " << std::endl;
368 omegan = theta/
kappa;
375 r[sub] =
s - omegan*
t;
378 tmp[sub] =
x + omegan*
s;
393 sigman_1 = gamma - omegan*
eta;
411 flopcount.addFlops(
A.nFlops()+17);
412 flopcount.addSiteFlops(18*Nc*Ns,sub);
418 QDPIO::cout <<
"InvIBiCGStabReliable: n = " << ret.
n_count <<
" r-updates: " << rupdates <<
" xr-updates: " << xupdates << std::endl;
420 flopcount.report(
"reliable_invibicgstab", swatch.getTimeInSeconds());
422 if ( ret.
n_count == MaxBiCGStab ) {
423 QDPIO::cerr <<
"Nonconvergence of IBiCGStab. MaxIters reached " << std::endl;
436 SystemSolverResults_t
438 const LatticeFermionF&
chi,
439 LatticeFermionF&
psi,
440 const Real& RsdBiCGStab,
446 return RelInvIBiCGStab_a<LatticeFermionF,LatticeFermionF, ComplexF>(
A,
A,
chi,
psi, RsdBiCGStab, Delta, MaxBiCGStab,
isign);
450 SystemSolverResults_t
452 const LatticeFermionD&
chi,
453 LatticeFermionD&
psi,
454 const Real& RsdBiCGStab,
460 return RelInvIBiCGStab_a<LatticeFermionD, LatticeFermionD, ComplexD>(
A,
A,
chi,
psi, RsdBiCGStab, Delta, MaxBiCGStab,
isign);
464 SystemSolverResults_t
467 const LatticeFermionD&
chi,
468 LatticeFermionD&
psi,
469 const Real& RsdBiCGStab,
475 return RelInvIBiCGStab_a<LatticeFermionD, LatticeFermionF, ComplexF>(
A,AF,
chi,
psi, RsdBiCGStab, Delta, MaxBiCGStab,
isign);
Primary include file for CHROMA library code.
SystemSolverResults_t InvIBiCGStabReliable(const LinearOperator< LatticeFermionF > &A, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdBiCGStab, const Real &Delta, int MaxBiCGStab, enum PlusMinus isign)
Bi-CG stabilized.
void xymz_normx(T &x, const T &y, const T &z, Double &x_norm, 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)
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > chi(Ncb)
SystemSolverResults_t RelInvIBiCGStab_a(const LinearOperator< T > &A, const LinearOperator< TF > &AF, const T &chi, T &psi, const Real &RsdBiCGStab, const Real &Delta, int MaxBiCGStab, enum PlusMinus isign)
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
BiCGStab Solver with reliable updates.
Holds return info from SystemSolver call.