6 #include "qdp_config.h"
16 using namespace QDP::Hints;
28 void UnprecSCprecTWilsonLinOp::create(Handle< FermState<T,P,Q> > fs_,
30 const AnisoParam_t& anisoParam_)
37 QDPIO::cout <<
"This class (UnprecSCprecTWilsonLinOp) only works in 4D" << std::endl;
43 if ( anisoParam_.t_dir != 3 ) {
44 QDPIO::cout <<
"This class (UnprecSCprecTWilsonLinOp) 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 (UnprecSCprecTWilsonLinOp) needs time to be local" << std::endl;
65 Real ff = where(aniso.anisoP, aniso.nu / aniso.xi_0, Real(1));
66 fact = 1 + (
Nd-1)*ff +
Mass;
69 for(
int mu=0;
mu <
u.size(); ++
mu)
71 if (
mu != aniso.t_dir)
79 invfact = Real(1)/fact;
82 int Nx = QDP::Layout::subgridLattSize()[0];
83 int Ny = QDP::Layout::subgridLattSize()[1];
84 int Nz = QDP::Layout::subgridLattSize()[2];
85 int Nt = QDP::Layout::subgridLattSize()[3];
90 int Nspace = Nx*Ny*Nz;
91 tsite.resize(Nspace, Nt);
95 for(
int z=0;
z < Nz;
z++) {
96 for(
int y=0;
y < Ny;
y++) {
97 for(
int x=0;
x < Nx;
x++) {
103 for(
int t=0;
t < Nt;
t++) {
105 tsite(ssite,
t) = QDP::Layout::linearSiteIndex(
coords);
113 const FermBC<T,P,Q>& fbc = getFermBC();
114 if( fbc.nontrivialP() ) {
116 const SchrFermBC& schr_ref =
dynamic_cast<const SchrFermBC&
>(fbc);
117 schrTP = ( schr_ref.getDir() ==
tDir() );
119 catch(std::bad_cast) {
134 P_mat.resize(Nspace, Nt);
135 P_mat_dag.resize(Nspace, Nt);
136 Q_mat_inv.resize(Nspace);
137 Q_mat_dag_inv.resize(Nspace);
140 for(
int site=0; site < Nspace; site++) {
141 Real minvfact = Real(-1)*invfact;
144 P_mat(site,Nt-1) =
u[t_index].elem( tsite(site,Nt-1) );
145 P_mat(site,Nt-1) *= minvfact.elem();
148 for(
int t=Nt-2;
t >=0;
t--) {
149 P_mat(site,
t) =
u[t_index].elem( tsite(site,
t) ) * P_mat(site,
t+1);
150 P_mat(site,
t) *= invfact.elem();
155 P_mat_dag(site,0) = adj(
u[t_index].elem( tsite(site,Nt-1) ) );
156 P_mat_dag(site,0) *= minvfact.elem();
157 for(
int t=1;
t < Nt;
t++) {
158 P_mat_dag(site,
t) = adj(
u[t_index].elem( tsite(site,
t-1) ) )*P_mat_dag(site,
t-1) ;
159 P_mat_dag(site,
t) *= invfact.elem();
166 CMat one_plus_P0 =
one.elem() + P_mat(site,0);
167 CentralTPrecNoSpinUtils::invert3by3( Q_mat_inv(site), one_plus_P0 );
172 CMat one_plus_P0_dag =
one.elem() + P_mat_dag(site,Nt-1);
173 CentralTPrecNoSpinUtils::invert3by3( Q_mat_dag_inv(site), one_plus_P0_dag);
176 CMat prod = one_plus_P0_dag*one_plus_P0;
177 logDetTSq += CentralTPrecNoSpinUtils::logDet(prod);
189 Dw3D.create( fs_, anisoParam_);
199 void UnprecSCprecTWilsonLinOp::invCLeftLinOp(
T&
chi,
205 LatticeHalfFermion tmp_minus;
206 LatticeHalfFermion tmp_plus;
207 LatticeHalfFermion tmp_T=
zero;
212 tmp_plus = spinProjectDir3Plus(
psi);
213 chi = spinReconstructDir3Plus(tmp_plus);
216 tmp_minus = spinProjectDir3Minus(
psi);
221 CentralTPrecNoSpinUtils::TOp(tmp_T,
229 chi += spinReconstructDir3Minus(tmp_T);
232 getFermBC().modifyF(
chi);
240 void UnprecSCprecTWilsonLinOp::invCRightLinOp(
T&
chi,
247 LatticeHalfFermion tmp_minus;
248 LatticeHalfFermion tmp_plus;
249 LatticeHalfFermion tmp_T=
zero;
255 tmp_minus = spinProjectDir3Minus(
psi);
256 chi = spinReconstructDir3Minus(tmp_minus);
259 tmp_plus = spinProjectDir3Plus(
psi);
264 CentralTPrecNoSpinUtils::TOp(tmp_T,
272 chi += spinReconstructDir3Plus(tmp_T);
275 getFermBC().modifyF(
chi);
286 LatticeHalfFermion tmp_minus;
287 LatticeHalfFermion tmp_plus;
288 LatticeHalfFermion tmp_T=
zero;
291 tmp_plus = spinProjectDir3Plus(
psi);
292 chi = spinReconstructDir3Plus(tmp_plus);
295 tmp_minus = spinProjectDir3Minus(
psi);
299 CentralTPrecNoSpinUtils::invTOp( tmp_T,
313 chi += spinReconstructDir3Minus(tmp_T);
320 getFermBC().modifyF(
chi);
332 LatticeHalfFermion tmp_minus;
333 LatticeHalfFermion tmp_plus;
334 LatticeHalfFermion tmp_T =
zero;
338 tmp_minus = spinProjectDir3Minus(
psi);
339 chi = spinReconstructDir3Minus(tmp_minus);
342 tmp_plus = spinProjectDir3Plus(
psi);
346 CentralTPrecNoSpinUtils::invTOp( tmp_T,
360 chi += spinReconstructDir3Plus(tmp_T);
367 getFermBC().modifyF(
chi);
376 Real mhalf=Real(-0.5);
380 getFermBC().modifyF(
chi);
401 UnprecSCprecTWilsonLinOp::derivCLeft(
P& ds_u,
const T& X,
const T& Y,
enum PlusMinus isign)
const
404 for(
int mu=0;
mu < 3;
mu++) {
410 LatticeHalfFermion tmp1,
tmp2;
413 tmp1=spinProjectDir3Minus(Y);
414 CentralTPrecNoSpinUtils::invTOp(
tmp2,
427 T1 = spinReconstructDir3Minus(
tmp2);
429 tmp1=spinProjectDir3Minus(X);
430 CentralTPrecNoSpinUtils::invTOp(
tmp2,
447 T2 = spinReconstructDir3Minus(
tmp2);
450 LatticeFermion T3 = shift(T1,
FORWARD, 3);
455 ds_u[3] = traceSpin(outerProduct(T3, T2));
461 getFermBC().zero(ds_u);
488 UnprecSCprecTWilsonLinOp::derivCRight(
P& ds_u,
const T& X,
const T& Y,
enum PlusMinus isign)
const
491 for(
int mu=0;
mu < 3;
mu++) {
497 LatticeHalfFermion tmp1,
tmp2;
500 tmp1=spinProjectDir3Plus(Y);
501 CentralTPrecNoSpinUtils::invTOp(
tmp2,
514 T1 = spinReconstructDir3Plus(
tmp2);
516 tmp1=spinProjectDir3Plus(X);
517 CentralTPrecNoSpinUtils::invTOp(
tmp2,
534 T2 = spinReconstructDir3Plus(
tmp2);
536 LatticeFermion T3 = shift(T1,
FORWARD, 3);
541 ds_u[3] = traceSpin(outerProduct(T3, T2));
547 getFermBC().zero(ds_u);
555 UnprecSCprecTWilsonLinOp::derivSpace(
P& ds_u,
const T& X,
const T& Y,
558 Real mhalf=Real(-0.5);
561 Dw3D.deriv(ds_u, X, Y,
isign);
562 for(
int mu = 0;
mu < 3 ;
mu++) {
567 getFermBC().zero(ds_u);
593 cRightLinOp(T3, Y,
PLUS);
594 spaceLinOp(T1, T3,
PLUS);
595 derivCLeft(ds_u, X, T1,
PLUS);
599 cLeftLinOp(T2, X,
MINUS);
600 derivSpace(ds_tmp, T2, T3,
PLUS);
607 cLeftLinOp(T3, Y,
MINUS);
608 spaceLinOp(T1, T3,
MINUS);
609 derivCRight(ds_u, X, T1,
MINUS);
611 cRightLinOp(T2, X,
PLUS);
612 derivSpace(ds_tmp, T2, T3,
MINUS);
616 getFermBC().zero(ds_u);
622 UnprecSCprecTWilsonLinOp::derivLogDetTDagT(
P& ds_u,
633 CentralTPrecNoSpinUtils::derivLogDet(ds_u,
640 getFermBC().zero(ds_u);
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
multi1d< LatticeColorMatrix > P
multi1d< LatticeColorMatrix > deriv(const EvenOddPrecLinearOperator< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &AP, const LatticeFermion &chi, const LatticeFermion &psi, enum PlusMinus isign)
Apply the operator onto a source std::vector.
Unpreconditioned Wilson fermion linear operator.