mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01: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();
|
auto grid = evec[0].Grid();
|
||||||
Coordinate siteFirst(grid->Nd(),0);
|
Coordinate siteFirst(grid->Nd(),0);
|
||||||
peekSite(cv0, evec[0], siteFirst);
|
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 )
|
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
|
else
|
||||||
{
|
{
|
||||||
const Real cplx0_mag = Grid::sqrt(cplx0.real()*cplx0.real()+cplx0.imag()*cplx0.imag());
|
const Real cplx0_mag{ std::abs(cplx0) };
|
||||||
Grid::Complex phase{cplx0 / Grid::Complex(cplx0_mag, 0) };
|
const std::complex<Real> std_phase{std::conj(cplx0/cplx0_mag)};
|
||||||
phase.imag(-phase.imag());
|
LOG(Message) << "RotateEigen() : Site 0 : |" << cplx0 << "|=" << cplx0_mag
|
||||||
#ifdef GRID_NVCC
|
<< " => phase=" << (std::arg(std_phase) / M_PI) << " pi" << std::endl;
|
||||||
//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;
|
|
||||||
{
|
{
|
||||||
// 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++ )
|
for( int k = 0 ; k < evec.size() ; k++ )
|
||||||
evec[k] *= phase;
|
evec[k] *= phase;
|
||||||
if(grid->IsBoss()){
|
// Get rid of the rounding error in imaginary phase on the very first site
|
||||||
for( int c = 0 ; c < Nc ; c++ )
|
if(grid->IsBoss())
|
||||||
cv0()()(c) *= phase;
|
{
|
||||||
cplx0.imag(0); // This assumes phase convention is real, positive (so I get rid of rounding error)
|
peekSite(cv0, evec[0], siteFirst);
|
||||||
//pokeSite(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);
|
pokeLocalSite(cv0, evec[0], siteFirst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user