コード例 #1
0
void AlgFourierProp::calcmom(const FourMom& p)
{
  char *fname="calcmom(const FourMom&)";
  VRB.Func(cname,fname);

  Float   p1( p.x() + 0.5*bc[0] );
  Float   p2( p.y() + 0.5*bc[1] );
  Float   p3( p.z() + 0.5*bc[2] );
  Float   p4( p.t() + 0.5*bc[3] );
 
  const Float PI(3.141592654);
 
  p1 *= 2.0*PI/(GJP.XnodeSites()*GJP.Xnodes());
  p2 *= 2.0*PI/(GJP.YnodeSites()*GJP.Ynodes());
  p3 *= 2.0*PI/(GJP.ZnodeSites()*GJP.Znodes());
  p4 *= 2.0*PI/(GJP.TnodeSites()*GJP.Tnodes());

  Site site;

  while ( site.LoopsOverNode() )
    {
      const Float px( site.physX()*p1 );
      const Float py( site.physY()*p2 );
      const Float pz( site.physZ()*p3 );
      const Float pt( site.physT()*p4 );
      
      const Float pdotx( px + py + pz + pt );


      Rcomplex fact( cos(pdotx), -sin(pdotx) );

      //--------------------------------------------
      //  Using AddMult is logically equivalent to
      //     momprop += fact * (*prop)[i]; ,
      //  but cuts down on the number of loops over
      //  the data. The time taken is reduced by
      //  a factor of two.
      //--------------------------------------------
      
      momprop.AddMult(fact,(*prop)[site.Index()]);
      
    }
}
コード例 #2
0
ファイル: alg_tcharge.C プロジェクト: DeanHowarth/QUDA-CPS
void AlgTcharge::run()
{
  Lattice& lattice( AlgLattice() );  

  Float tmat[nfunc][nfunc];
  for (int f1(0);f1<nfunc;f1++)
    for (int f2(0);f2<nfunc;f2++)
      tmat[f1][f2] = 0;

  // sum over lattice
  Site nloop;
  
  while ( nloop.LoopsOverNode() )
    {
      // Array of imaginary parts of the plaquettes
      // at a given site
      
      // plaqs[0]  = F_01
      // plaqs[1]  = F_02
      // plaqs[2]  = F_03
      // plaqs[3]  = F_12
      // plaqs[4]  = F_13
      // plaqs[5]  = F_23

      Matrix plaqs[nfunc][6];
      //
      // fill plaqs with the full plaquettes
      // - then zero the real parts
      //

      int mu;
      int nu;
      int index(0);

      for (mu=0;mu<3;++mu)
        {
          for (nu=mu+1;nu<4;nu++)
            { 
	      for (int f(0);f<nfunc;f++)
		{
		  (*(leaf_map[f]))( lattice, plaqs[f][index], nloop.pos(), mu, nu );
		  ZeroReal(plaqs[f][index]);
		}
	      index++;
            }
        }
      for (int f1(0);f1<nfunc;f1++)
	{
	  for (int f2(f1);f2<nfunc;f2++)
	    {
	      tmat[f1][f2] += MkTop(plaqs[f1],plaqs[f2]).real();
	    }
	}
    }
  
  // global sum the approximations
  for (int f1(0);f1<nfunc;f1++)
    {
      for (int f2(f1);f2<nfunc;f2++)
	{
	  glb_sum( &tmat[f1][f2] );
	}
    }
  
  // Print out results
  //----------------------------------------------------------------

  if(common_arg->filename != 0)
    {
      char *fname = "alg_tcharge()";
      FILE *fp;
      if( (fp = Fopen(common_arg->filename, "a")) == NULL ) {
        ERR.FileA(cname,fname,common_arg->filename);
      }
      Fprintf(fp,"AlgTcharge:\n");
      Fprintf(fp,"nleaf : %i\n",nfunc);
      for (int f(0);f<nfunc;f++)
	Fprintf(fp,"   %i : %s\n",f,names[f]);
      for (int f1(0);f1<nfunc;f1++)
	{
	  for (int f2(f1);f2<nfunc;f2++)
	    {
	      Fprintf(fp,"%i %i : %15e\n",f1,f2,tmat[f1][f2]);
	    }
	}
      Fclose(fp);
    }

}