6 #include "qdp_config.h"
15 using namespace QDP::Hints;
27 void ILU2PrecSCprecTCloverLinOp::create(Handle< FermState<T,P,Q> > fs_,
28 const CloverFermActParams& param_)
38 QDPIO::cout <<
"This class (ILU2PrecSCprecTCloverLinOp) only works in 4D" << std::endl;
43 if ( param.anisoParam.anisoP==
true && param.anisoParam.t_dir != 3 ) {
44 QDPIO::cout <<
"This class (ILU2PrecSCprecTCloverLinOp) is hardwired for t_dir=3"<< std::endl;
49 const multi1d<int>& s_size = QDP::Layout::subgridLattSize();
50 const multi1d<int>& t_size = QDP::Layout::lattSize();
51 if( t_size[3] != s_size[3] ) {
52 QDPIO::cout <<
"This class (ILU2PrecSCprecTCloverLinOp) needs time to be local" << std::endl;
60 Real ff = where(param.anisoParam.anisoP, param.anisoParam.nu / param.anisoParam.xi_0, Real(1));
61 fact = 1 + (
Nd-1)*ff + param.Mass;
62 QDPIO::cout <<
"Factor=" << fact <<
" log10(Factor)="<< log10(fact) << std::endl;
64 invfact = Real(1)/fact;
68 if (param.anisoParam.anisoP)
71 for(
int mu=0;
mu <
u.size(); ++
mu)
73 if (
mu != param.anisoParam.t_dir)
80 int Nx = QDP::Layout::subgridLattSize()[0];
81 int Ny = QDP::Layout::subgridLattSize()[1];
82 int Nz = QDP::Layout::subgridLattSize()[2];
83 int Nt = QDP::Layout::subgridLattSize()[3];
88 int Nspaceby2 = Nx*Ny*Nz/2;
90 tsite.resize(2, Nspaceby2, Nt);
100 for(
int z=0;
z < Nz;
z++) {
101 for(
int y=0;
y < Ny;
y++) {
102 for(
int x=0;
x < Nx;
x++) {
109 color = (
x +
y +
z) & 1;
112 for(
int t=0;
t < Nt;
t++) {
114 tsite(0,ssite_even,
t) = QDP::Layout::linearSiteIndex(
coords);
120 for(
int t=0;
t < Nt;
t++) {
122 tsite(1,ssite_odd,
t) = QDP::Layout::linearSiteIndex(
coords);
133 const FermBC<T,P,Q>& fbc = getFermBC();
134 if( fbc.nontrivialP() ) {
136 const SchrFermBC& schr_ref =
dynamic_cast<const SchrFermBC&
>(fbc);
137 schrTP = ( schr_ref.getDir() ==
tDir() );
139 catch(std::bad_cast) {
149 QDPIO::cout <<
"Got here " << std::endl << std::flush;
153 if( param.max_norm_usedP) {
154 Real tmp1=param.max_norm/sqrt(Real(3));
155 Real
t = -( log(tmp1)/log(fact));
156 QDPIO::cout <<
"Cutoff t is " <<
t<< std::endl;
157 t_max=(int)toDouble(ceil(
t));
158 QDPIO::cout <<
"T_max="<<t_max << std::endl;
162 QDPIO::cout <<
"Not using cutoff trick. Setting T_max="<<t_max<<std::endl;
166 P_mat.resize(2, Nspaceby2, Nt);
167 P_mat_dag.resize(2, Nspaceby2, Nt);
169 Q_mat_inv.resize(2,Nspaceby2);
170 Q_mat_dag_inv.resize(2,Nspaceby2);
173 for(
int cb3=0; cb3 < 2; cb3++) {
174 for(
int site=0; site < Nspaceby2; site++) {
177 Real minvfact = Real(-1)*invfact;
180 P_mat(cb3, site, Nt-1) =
u[t_index].elem( tsite(cb3,site,Nt-1) );
181 P_mat(cb3, site, Nt-1) *= minvfact.elem();
184 for(
int t=Nt-2;
t >=0;
t--) {
185 if(
t > Nt-1-t_max) {
186 P_mat(cb3, site,
t) =
u[t_index].elem( tsite(cb3, site,
t) ) * P_mat(cb3, site,
t+1);
187 P_mat(cb3, site,
t) *= invfact.elem();
190 zero_rep(P_mat(cb3, site,
t));
195 P_mat_dag(cb3, site, 0) = adj(
u[t_index].elem( tsite(cb3, site, Nt-1) ) );
196 P_mat_dag(cb3, site, 0) *= minvfact.elem();
198 for(
int t=1;
t < Nt;
t++) {
200 P_mat_dag(cb3, site,
t) = adj(
u[t_index].elem( tsite(cb3, site,
t-1) ) )*P_mat_dag(cb3,site,
t-1) ;
201 P_mat_dag(cb3, site,
t) *= invfact.elem();
204 zero_rep(P_mat_dag(cb3, site,
t));
213 CMat one_plus_P0 =
one.elem() + P_mat(cb3, site,0);
214 CentralTPrecNoSpinUtils::invert3by3( Q_mat_inv(cb3, site), one_plus_P0 );
219 CMat one_plus_P0_dag =
one.elem() + P_mat_dag(cb3, site,Nt-1);
220 CentralTPrecNoSpinUtils::invert3by3( Q_mat_dag_inv(cb3, site), one_plus_P0_dag);
222 CMat prod = one_plus_P0_dag*one_plus_P0;
223 logDetTSq += CentralTPrecNoSpinUtils::logDet(prod);
232 APlusFact.create(fs, param);
233 Dw3D.create(fs_, param_.anisoParam);
236 QDPIO::cout <<
"schrTP is " << schrTP << std::endl;
239 for(
int i=0;
i < Nt;
i++) {
243 OScalar<CMat> f; f.elem() = P_mat(0,0,
i);
244 fnorm=sqrt(norm2(f));
245 OScalar<CMat>
f2;
f2.elem() = P_mat_dag(0,0,
i);
246 fnorm2=sqrt(norm2(
f2));
248 QDPIO::cout <<
"cb=0 x=0 t="<<
i<<
" normP="<<fnorm<<
" normPdag="<<fnorm2 << std::endl;
Support for time preconditioning.
Primary include file for CHROMA library code.
multi1d< int > coords(const int x, const int y, const int z, const int t)
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
FloatingPoint< double > Double