8 using namespace QDP::Hints;
64 template<
typename T,
typename C>
76 const Subset&
s = M.subset();
79 moveToFastMemoryHint(
psi,
true);
80 T Mr; moveToFastMemoryHint(Mr);
81 T chi_internal; moveToFastMemoryHint(chi_internal);
83 chi_internal[
s] =
chi;
90 QDPIO::cout <<
"InvMR: starting" << std::endl;
91 FlopCounter flopcount;
98 flopcount.addSiteFlops(4*Nc*Ns,
s);
103 flopcount.addFlops(M.nFlops());
105 T r; moveToFastMemoryHint(
r);
106 r[
s] = chi_internal - Mr;
107 flopcount.addSiteFlops(2*Nc*Ns,
s);
111 flopcount.addSiteFlops(4*Nc*Ns,
s);
121 flopcount.report(
"invMR", swatch.getTimeInSeconds());
122 revertFromFastMemoryHint(
psi,
true);
129 while( (
k < MaxMR) && (toBool(
cp >
rsd_sq)) )
135 M(Mr,
r,
isign); flopcount.addFlops(M.nFlops());
141 d = norm2(Mr,
s); flopcount.addSiteFlops(4*Nc*Ns,
s);
150 psi[
s] +=
r *
a; flopcount.addSiteFlops(4*Nc*Ns,
s);
153 r[
s] -= Mr *
a; flopcount.addSiteFlops(4*Nc*Ns,
s);
156 cp = norm2(
r,
s); flopcount.addSiteFlops(4*Nc*Ns,
s);
163 QDPIO::cout <<
"InvMR: k = " <<
k <<
" cp = " <<
cp << std::endl;
164 flopcount.report(
"invmr", swatch.getTimeInSeconds());
165 revertFromFastMemoryHint(
psi,
true);
170 Double actual_res = norm2(chi_internal - Mr,
s);
171 res.
resid = sqrt(actual_res);
175 QDPIO::cerr <<
"Nonconvergence Warning" << std::endl;
184 SystemSolverResults_t
186 const LatticeFermion&
chi,
199 SystemSolverResults_t
201 const LatticeStaggeredFermion&
chi,
202 LatticeStaggeredFermion&
psi,
Primary include file for CHROMA library code.
SystemSolverResults_t InvMR(const LinearOperator< LatticeStaggeredFermion > &M, const LatticeStaggeredFermion &chi, LatticeStaggeredFermion &psi, const Real &MRovpar, const Real &RsdMR, int MaxMR, enum PlusMinus isign)
SystemSolverResults_t InvMR_a(const C &M, const T &chi, T &psi, const Real &MRovpar, const Real &RsdMR, int MaxMR, enum PlusMinus isign)
Minimal-residual (MR) algorithm for a generic Linear Operator.
Minimal-Residual (MR) for a generic fermion Linear Operator.
SpinMatrix C()
C = Gamma(10)
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
Asqtad Staggered-Dirac operator.
LinOpSysSolverMGProtoClover::T T
FloatingPoint< double > Double
multi1d< LatticeFermion > r(Ncb)
Holds return info from SystemSolver call.