16 const Real& epsilon_prec,
23 const Subset&
s= UnprecM.
subset();
27 if(
b.size() !=
N5 ) {
28 QDPIO::cerr <<
"b has wrong size in 5th dimension. N5 = " <<
N5 <<
" b.size() = " <<
b.size() << std::endl;
31 if(
x.size() !=
N5 ) {
32 QDPIO::cerr <<
"x has wrong size in 5th dimension. N5 = " <<
N5 <<
" x.size() = " <<
x.size() << std::endl;
39 for(
int n5=0; n5 <
N5; n5++ ) {
45 multi1d<multi1d<T>*>
C(MaxGMRESR);
46 multi1d<multi1d<T>*>
U(MaxGMRESR);
56 while( toBool( norm_r > terminate) && iter < MaxGMRESR ) {
58 multi1d<T>*
u =
new multi1d<T>;
68 for(
int n5=0;n5 <
N5; n5++) {
76 InvCG1(PrecMM,
tmp, *
u, epsilon_prec, MaxGMRESRPrec, prec_count);
80 multi1d<T>*
c =
new multi1d<T>;
88 for(
int i =0;
i < C_size;
i++) {
91 Complex
beta = Real(0);
92 for(
int n5=0; n5 <
N5; n5++) {
98 for(
int n5=0; n5 <
N5; n5++) {
99 (*c)[n5][
s] -=
beta*(*(
C[
i]))[n5];
100 (*u)[n5][
s] -=
beta*(*(
U[
i]))[n5];
106 Double norm_c = sqrt(norm2( *
c,
s));
109 for(
int n5=0; n5 <
N5; n5++) {
110 (*c)[n5][
s] /= norm_c;
111 (*u)[n5][
s] /= norm_c;
118 Complex
alpha = Real(0);
119 for(
int n5=0; n5 <
N5; n5++ ) {
123 for(
int n5=0; n5 <
N5; n5++) {
128 norm_r = sqrt(norm2(
r,
s));
129 QDPIO::cout <<
"Inv Rel GMRESR: iter "<< iter <<
" || r || = " << norm_r << std::endl;
133 for(
int i=0;
i < C_size;
i++) {
138 if( iter == MaxGMRESR ) {
139 QDPIO::cout <<
"Nonconvergence warning " << std::endl;
150 const multi1d<LatticeFermion>&
b,
151 multi1d<LatticeFermion>&
x,
153 const Real& epsilon_prec,
Primary include file for CHROMA library code.
Linear Operator to arrays.
virtual int size() const =0
Expected length of array index.
virtual const Subset & subset() const =0
Return the subset on which the operator acts.
SystemSolverResults_t InvCG1(const LinearOperator< LatticeFermion > &A, const LatticeFermion &chi, LatticeFermion &psi, const Real &RsdCG, int MaxCG, int MinCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
Relaxed GMRESR algorithm of the Wuppertal Group.
Conjugate-Gradient algorithm for a generic Linear Operator.
SpinMatrix C()
C = Gamma(10)
int epsilon(int i, int j, int k)
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
static const LatticeInteger & beta(const int dim)
static const LatticeInteger & alpha(const int dim)
Asqtad Staggered-Dirac operator.
void InvGMRESR_CG_a(const LinearOperatorArray< T > &PrecMM, const LinearOperatorArray< T > &PrecM, const LinearOperatorArray< T > &UnprecM, const multi1d< T > &b, multi1d< T > &x, const Real &epsilon, const Real &epsilon_prec, int MaxGMRESR, int MaxGMRESRPrec, int &n_count)
static multi1d< LatticeColorMatrix > u
void InvGMRESR_CG(const LinearOperatorArray< LatticeFermion > &PrecMM, const LinearOperatorArray< LatticeFermion > &PrecM, const LinearOperatorArray< LatticeFermion > &UnprecM, const multi1d< LatticeFermion > &b, multi1d< LatticeFermion > &x, const Real &epsilon, const Real &epsilon_prec, int MaxGMRESR, int MaxGMRESRPrec, int &n_count)
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
multi1d< LatticeColorMatrix > U