mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	Updating to fix peek poke to checkerboarded arrays since Chulwoo needs this.
This commit is contained in:
		
							
								
								
									
										2
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								TODO
									
									
									
									
									
								
							@@ -17,6 +17,8 @@ Policies:
 | 
			
		||||
 | 
			
		||||
- Lanczos
 | 
			
		||||
 | 
			
		||||
- Audit oIndex usage for cb behaviour
 | 
			
		||||
 | 
			
		||||
- Rectangle gauge actions.
 | 
			
		||||
  Iwasaki,
 | 
			
		||||
  Symanzik,
 | 
			
		||||
 
 | 
			
		||||
@@ -166,8 +166,9 @@ public:
 | 
			
		||||
      pcoor.resize(_ndimension);
 | 
			
		||||
      lcoor.resize(_ndimension);
 | 
			
		||||
      for(int mu=0;mu<_ndimension;mu++){
 | 
			
		||||
	pcoor[mu] = gcoor[mu]/_ldimensions[mu];
 | 
			
		||||
	lcoor[mu] = gcoor[mu]%_ldimensions[mu];
 | 
			
		||||
	int _fld  = _fdimensions[mu]/_processors[mu];
 | 
			
		||||
	pcoor[mu] = gcoor[mu]/_fld;
 | 
			
		||||
	lcoor[mu] = gcoor[mu]%_fld;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    void GlobalCoorToRankIndex(int &rank, int &o_idx, int &i_idx ,const std::vector<int> &gcoor)
 | 
			
		||||
@@ -176,8 +177,16 @@ public:
 | 
			
		||||
      std::vector<int> lcoor;
 | 
			
		||||
      GlobalCoorToProcessorCoorLocalCoor(pcoor,lcoor,gcoor);
 | 
			
		||||
      rank = RankFromProcessorCoor(pcoor);
 | 
			
		||||
      i_idx= iIndex(lcoor);
 | 
			
		||||
      o_idx= oIndex(lcoor);
 | 
			
		||||
 | 
			
		||||
      std::vector<int> cblcoor(lcoor);
 | 
			
		||||
      for(int d=0;d<cblcoor.size();d++){
 | 
			
		||||
	if( this->CheckerBoarded(d) ) {
 | 
			
		||||
	  cblcoor[d] = lcoor[d]/2;
 | 
			
		||||
	}
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      i_idx= iIndex(cblcoor);// this does not imply divide by 2 on checker dim
 | 
			
		||||
      o_idx= oIndex(lcoor);// this implies divide by 2 on checkerdim
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void RankIndexToGlobalCoor(int rank, int o_idx, int i_idx , std::vector<int> &gcoor)
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  TComplex cm;
 | 
			
		||||
  TComplex cmeo;
 | 
			
		||||
  for(int dir=0;dir<Nd;dir++){
 | 
			
		||||
    //    if ( dir!=1 ) continue;
 | 
			
		||||
    for(int shift=0;shift<latt_size[dir];shift++){
 | 
			
		||||
@@ -125,7 +126,17 @@ int main (int argc, char ** argv)
 | 
			
		||||
	  
 | 
			
		||||
	  peekSite(cm,rbShiftU,coor);
 | 
			
		||||
 | 
			
		||||
	  double nrm=norm2(U);
 | 
			
		||||
	  Integer checkerboard = RBFine.CheckerBoard(coor);
 | 
			
		||||
 | 
			
		||||
	  //	  std::cout << " coor "<<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] \n ";
 | 
			
		||||
	  //	  std::cout << "shift "<< shift <<" dir "<<dir<< " checker board "<< checkerboard << " ";
 | 
			
		||||
	  //	  std::cout << "Uo "   << ShiftUo.checkerboard << " Ue "<<ShiftUe.checkerboard<<std::endl;
 | 
			
		||||
	  if ( checkerboard == ShiftUo.checkerboard ) {
 | 
			
		||||
	    peekSite(cmeo,ShiftUo,coor);
 | 
			
		||||
	  } else { 
 | 
			
		||||
	    peekSite(cmeo,ShiftUe,coor);
 | 
			
		||||
	  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	  std::vector<int> scoor(coor);
 | 
			
		||||
	  scoor[dir] = (scoor[dir]+shift)%latt_size[dir];
 | 
			
		||||
@@ -137,12 +148,28 @@ int main (int argc, char ** argv)
 | 
			
		||||
 | 
			
		||||
	  Complex scm(slex);
 | 
			
		||||
 | 
			
		||||
	  nrm = abs(scm-cm()()());
 | 
			
		||||
	  std::vector<int> peer(4);
 | 
			
		||||
	  Complex ctmp=cm;
 | 
			
		||||
	  Complex ctmp=cmeo;
 | 
			
		||||
	  Integer index=real(ctmp);
 | 
			
		||||
	  Fine.CoorFromIndex(peer,index,latt_size);
 | 
			
		||||
 | 
			
		||||
	  double nrm = abs(cmeo()()()-scm);
 | 
			
		||||
	  if (nrm != 0) {
 | 
			
		||||
	    std::cout<<"EOFAIL shift "<< shift<<" in dir "<< dir
 | 
			
		||||
		     <<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] = "
 | 
			
		||||
		     << cmeo()()()<<" expect "<<scm<<"  "<<nrm<<std::endl;
 | 
			
		||||
	    std::cout<<"Got    "<<index<<" " << peer[0]<<","<<peer[1]<<","<<peer[2]<<","<<peer[3]<<std::endl;
 | 
			
		||||
	    index=real(scm);
 | 
			
		||||
	    Fine.CoorFromIndex(peer,index,latt_size);
 | 
			
		||||
	    std::cout<<"Expect "<<index<<" " << peer[0]<<","<<peer[1]<<","<<peer[2]<<","<<peer[3]<<std::endl;
 | 
			
		||||
	    exx=1;
 | 
			
		||||
 | 
			
		||||
	  }
 | 
			
		||||
 | 
			
		||||
	  ctmp=cm;
 | 
			
		||||
	  index=real(ctmp);
 | 
			
		||||
	  nrm = abs(scm-cm()()());
 | 
			
		||||
 | 
			
		||||
	  if (nrm > 0){
 | 
			
		||||
	    std::cout<<"FAIL shift "<< shift<<" in dir "<< dir
 | 
			
		||||
		     <<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] = "
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user