8 using namespace QDP::Hints;
70 template<
typename T,
typename RT>
83 T mp; moveToFastMemoryHint(
mp);
84 T mmp; moveToFastMemoryHint(mmp);
85 T p; moveToFastMemoryHint(
p);
86 moveToFastMemoryHint(
psi,
true);
87 T r; moveToFastMemoryHint(
r);
88 T chi_internal; moveToFastMemoryHint(chi_internal);
90 chi_internal[
s] =
chi;
92 QDPIO::cout <<
"InvCG2: starting" << std::endl;
93 FlopCounter flopcount;
100 Double chi_sq = norm2(chi_internal,
s);
101 flopcount.addSiteFlops(4*Nc*Ns,
s);
104 QDPIO::cout <<
"chi_norm = " << sqrt(chi_sq) << std::endl;
116 flopcount.addFlops(2*M.
nFlops());
118 r[
s] = chi_internal - mmp;
119 flopcount.addSiteFlops(2*Nc*Ns,
s);
122 flopcount.addSiteFlops(4*Nc*Ns,
s);
126 QDPIO::cout <<
"InvCG: k = 0 || r ||= " <<sqrt(
cp) << std::endl;
141 flopcount.report(
"invcg2", swatch.getTimeInSeconds());
142 revertFromFastMemoryHint(
psi,
true);
165 d = norm2(
mp,
s); flopcount.addSiteFlops(4*Nc*Ns,
s);
171 flopcount.addFlops(M.
nFlops());
179 flopcount.addSiteFlops(4*Nc*Ns,
s);
182 cp = norm2(
r,
s); flopcount.addSiteFlops(4*Nc*Ns,
s);
185 psi[
s] += ar *
p; flopcount.addSiteFlops(4*Nc*Ns,
s);
200 flopcount.report(
"invcg2", swatch.getTimeInSeconds());
201 revertFromFastMemoryHint(
psi,
true);
208 res.
resid = sqrt(actual_res);
220 p[
s] =
r + br*
p; flopcount.addSiteFlops(4*Nc*Ns,
s);
225 QDPIO::cerr <<
"Nonconvergence Warning" << std::endl;
226 flopcount.report(
"invcg2", swatch.getTimeInSeconds());
227 revertFromFastMemoryHint(
psi,
true);
228 QDPIO::cerr <<
"too many CG iterations: count =" << res.
n_count <<
" rsd^2= " <<
cp << std::endl <<std::flush;
239 SystemSolverResults_t
241 const LatticeFermionF&
chi,
242 LatticeFermionF&
psi,
247 int ierr = PAT_region_begin(20,
"InvCG2Single");
251 ierr = PAT_region_end(20);
257 SystemSolverResults_t
259 const LatticeFermionD&
chi,
260 LatticeFermionD&
psi,
265 int ierr=PAT_region_begin(21,
"InvCG2Double");
269 ierr= PAT_region_end(21);
274 SystemSolverResults_t
276 const LatticeStaggeredFermionF&
chi,
277 LatticeStaggeredFermionF&
psi,
285 SystemSolverResults_t
287 const LatticeStaggeredFermionD&
chi,
288 LatticeStaggeredFermionD&
psi,
Primary include file for CHROMA library code.
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
virtual unsigned long nFlops() const
SystemSolverResults_t InvCG2_a(const LinearOperator< T > &M, const T &chi, T &psi, const RT &RsdCG, int MaxCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
SystemSolverResults_t InvCG2(const LinearOperator< LatticeStaggeredFermionD > &M, const LatticeStaggeredFermionD &chi, LatticeStaggeredFermionD &psi, const Real &RsdCG, int MaxCG)
Conjugate-Gradient algorithm for a generic Linear Operator.
Asqtad Staggered-Dirac operator.
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > enum InvType invType const multi1d< Real > & RsdCG
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > mp(Ncb)
FloatingPoint< double > Double
multi1d< LatticeFermion > r(Ncb)
Holds return info from SystemSolver call.