8 using namespace QDP::Hints;
68 const multi1d<T> &
chi,
76 const int N =
psi.size();
77 const Subset&
s =
A.subset();
79 multi1d<T> Ap(N); moveToFastMemoryHint(Ap);
81 moveToFastMemoryHint(
psi,
true);
83 multi1d<T>
r(N); moveToFastMemoryHint(
r);
84 multi1d<T>
p(N); moveToFastMemoryHint(
p);
85 multi1d<T> chi_internal(N); moveToFastMemoryHint(chi_internal);
87 for(
int i=0;
i < N;
i++) {
88 chi_internal[
i][
s] =
chi[
i];
92 Real chi_sq = Real(norm2(chi_internal,
s));
94 QDPIO::cout <<
"chi_norm = " << sqrt(chi_sq) << std::endl;
104 for(
int n=0;
n < N; ++
n)
107 #ifdef PRINT_5D_RESID
108 for(
int n=0;
n < N;
n++) {
110 if( toBool( norm_r >
Double(1.0e-20)) ) {
111 QDPIO::cout <<
"Iteration 0 r[" <<
n <<
"] = " << norm_r << std::endl;
118 for(
int n=0;
n < N; ++
n) {
125 QDPIO::cout <<
"InvCG: k = 0 cp = " <<
cp <<
" rsd_sq = " <<
rsd_sq << std::endl;
131 revertFromFastMemoryHint(
psi,
true);
155 d = innerProductReal(
p, Ap,
s);
160 for(
int n=0;
n < N; ++
n) {
166 for(
int n=0;
n < N; ++
n) {
167 r[
n][
s] -=
a * Ap[
n];
170 #ifdef PRINT_5D_RESID
171 for(
int n=0;
n < N;
n++) {
173 if( toBool( norm_r >
Double(1.0e-20)) )
174 QDPIO::cout <<
"Iteration " <<
k <<
" r[" <<
n <<
"] = " << norm_r << std::endl;
183 QDPIO::cout <<
"InvCG: k = " <<
k <<
" cp = " <<
cp << std::endl;
188 revertFromFastMemoryHint(
psi,
true);
194 b = Real(
cp) / Real(
c);
196 QDPIO::cout <<
"InvCGev: k = " <<
k <<
" alpha = " <<
a <<
" beta = " <<
b << std::endl;
200 for(
int n=0;
n < N; ++
n)
204 QDPIO::cerr <<
"Nonconvergence Warning" << std::endl;
205 revertFromFastMemoryHint(
psi,
true);
217 const multi1d<LatticeFermion>&
chi,
218 multi1d<LatticeFermion>&
psi,
Primary include file for CHROMA library code.
Linear Operator to arrays.
void InvCG1(const LinearOperatorArray< LatticeFermion > &A, const multi1d< LatticeFermion > &chi, multi1d< LatticeFermion > &psi, const Real &RsdCG, int MaxCG, int &n_count)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
void InvCG1_a(const LinearOperatorArray< T > &A, const multi1d< T > &chi, multi1d< T > &psi, const Real &RsdCG, int MaxCG, int &n_count)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
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
FloatingPoint< double > Double
multi1d< LatticeFermion > r(Ncb)