mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Merge branch 'feature/distil' of github.com:mmphys/Grid into feature/distil
This commit is contained in:
commit
65b3059bd7
@ -105,33 +105,24 @@ inline void RotateEigen(std::vector<LatticeColourVector> & evec)
|
||||
auto grid = evec[0].Grid();
|
||||
Coordinate siteFirst(grid->Nd(),0);
|
||||
peekSite(cv0, evec[0], siteFirst);
|
||||
Grid::Complex cplx0 = cv0()()(0);
|
||||
const std::complex<Real> cplx0{cv0()()(0).real(), cv0()()(0).imag()};
|
||||
if( cplx0.imag() == 0 )
|
||||
std::cout << GridLogMessage << "RotateEigen() : Site 0 : " << cplx0 << " => already meets phase convention" << std::endl;
|
||||
LOG(Message) << "RotateEigen() : Site 0 : " << cplx0 << " => already meets phase convention" << std::endl;
|
||||
else
|
||||
{
|
||||
const Real cplx0_mag = Grid::sqrt(cplx0.real()*cplx0.real()+cplx0.imag()*cplx0.imag());
|
||||
Grid::Complex phase{cplx0 / Grid::Complex(cplx0_mag, 0) };
|
||||
phase.imag(-phase.imag());
|
||||
#ifdef GRID_NVCC
|
||||
//const Real cplx0_mag = thrust::abs(cplx0);
|
||||
//const Grid::Complex phase = thrust::conj(cplx0 / cplx0_mag);
|
||||
const Real argphase = thrust::arg(phase);
|
||||
#else
|
||||
//const Real cplx0_mag = std::abs(cplx0);
|
||||
//const Grid::Complex phase = std::conj(cplx0 / cplx0_mag);
|
||||
const Real argphase = std::arg(phase);
|
||||
#endif
|
||||
std::cout << GridLogMessage << "RotateEigen() : Site 0 : |" << cplx0 << "|=" << cplx0_mag << " => phase=" << (argphase / M_PI) << " pi" << std::endl;
|
||||
const Real cplx0_mag{ std::abs(cplx0) };
|
||||
const std::complex<Real> std_phase{std::conj(cplx0/cplx0_mag)};
|
||||
LOG(Message) << "RotateEigen() : Site 0 : |" << cplx0 << "|=" << cplx0_mag
|
||||
<< " => phase=" << (std::arg(std_phase) / M_PI) << " pi" << std::endl;
|
||||
{
|
||||
// TODO: Only really needed on the master slice
|
||||
const Grid::Complex phase{std_phase.real(),std_phase.imag()};
|
||||
for( int k = 0 ; k < evec.size() ; k++ )
|
||||
evec[k] *= phase;
|
||||
if(grid->IsBoss()){
|
||||
for( int c = 0 ; c < Nc ; c++ )
|
||||
cv0()()(c) *= phase;
|
||||
cplx0.imag(0); // This assumes phase convention is real, positive (so I get rid of rounding error)
|
||||
//pokeSite(cv0, evec[0], siteFirst);
|
||||
// Get rid of the rounding error in imaginary phase on the very first site
|
||||
if(grid->IsBoss())
|
||||
{
|
||||
peekSite(cv0, evec[0], siteFirst);
|
||||
cv0()()(0).imag(0); // this should be zero after the phase multiply - force it to be so
|
||||
pokeLocalSite(cv0, evec[0], siteFirst);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user