#include namespace Grid { namespace QCD { const std::vector WilsonMatrix::directions ({0,1,2,3, 0, 1, 2, 3,0}); const std::vector WilsonMatrix::displacements({1,1,1,1,-1,-1,-1,-1,0}); // Should be in header? const int WilsonMatrix::Xp = 0; const int WilsonMatrix::Yp = 1; const int WilsonMatrix::Zp = 2; const int WilsonMatrix::Tp = 3; const int WilsonMatrix::Xm = 4; const int WilsonMatrix::Ym = 5; const int WilsonMatrix::Zm = 6; const int WilsonMatrix::Tm = 7; //const int WilsonMatrix::X0 = 8; class WilsonCompressor { public: int mu; void Point(int p) { mu=p; std::cout << "WilsonCompressor.Point " << mu<(Umu,mu); pokeIndex(Uds,U,mu); U = adj(Cshift(U,mu,-1)); pokeIndex(Uds,U,mu+4); } } void WilsonMatrix::multiply(const LatticeFermion &in, LatticeFermion &out) { Dhop(in,out); return; } void WilsonMatrix::Dhop(const LatticeFermion &in, LatticeFermion &out) { WilsonCompressor compressor; Stencil.HaloExchange(in,comm_buf,compressor); for(int ss=0;ssoSites();ss++){ int offset,local,perm, ptype; vSpinColourVector result; vHalfSpinColourVector chi; vHalfSpinColourVector tmp; vHalfSpinColourVector Uchi; vHalfSpinColourVector *chi_p; result=zero; // Xp offset = Stencil._offsets [Xp][ss]; local = Stencil._is_local[Xp][ss]; perm = Stencil._permute[Xp][ss]; ptype = Stencil._permute_type[Xp]; chi_p = &comm_buf[offset]; if ( local ) { chi_p = χ spProjXp(chi,in._odata[offset]); if ( perm ) { permute(tmp,chi,ptype); chi_p = &tmp; } } mult(&(Uchi()),&(Umu._odata[ss](Xp)),&(*chi_p)()); spReconXp(result,Uchi); // Yp offset = Stencil._offsets [Yp][ss]; local = Stencil._is_local[Yp][ss]; perm = Stencil._permute[Yp][ss]; ptype = Stencil._permute_type[Yp]; chi_p = &comm_buf[offset]; if ( local ) { chi_p = χ spProjYp(chi,in._odata[offset]); if ( perm ) { permute(tmp,chi,ptype); chi_p = &tmp; } } mult(&(Uchi()),&(Umu._odata[ss](Yp)),&(*chi_p)()); accumReconYp(result,Uchi); // Zp offset = Stencil._offsets [Zp][ss]; local = Stencil._is_local[Zp][ss]; perm = Stencil._permute[Zp][ss]; ptype = Stencil._permute_type[Zp]; chi_p = &comm_buf[offset]; if ( local ) { chi_p = χ spProjZp(chi,in._odata[offset]); if ( perm ) { permute(tmp,chi,ptype); chi_p = &tmp; } } mult(&(Uchi()),&(Umu._odata[ss](Zp)),&(*chi_p)()); accumReconZp(result,Uchi); // Tp offset = Stencil._offsets [Tp][ss]; local = Stencil._is_local[Tp][ss]; perm = Stencil._permute[Tp][ss]; ptype = Stencil._permute_type[Tp]; chi_p = &comm_buf[offset]; if ( local ) { chi_p = χ spProjTp(chi,in._odata[offset]); if ( perm ) { permute(tmp,chi,ptype); chi_p = &tmp; } } mult(&(Uchi()),&(Umu._odata[ss](Tp)),&(*chi_p)()); accumReconTp(result,Uchi); // Xm offset = Stencil._offsets [Xm][ss]; local = Stencil._is_local[Xm][ss]; perm = Stencil._permute[Xm][ss]; ptype = Stencil._permute_type[Xm]; chi_p = &comm_buf[offset]; if ( local ) { chi_p = χ spProjXm(chi,in._odata[offset]); if ( perm ) { permute(tmp,chi,ptype); chi_p = &tmp; } } std::cout<<"Xm for site "<