Exemplo n.º 1
0
void reunitarize() {
  register su3_matrix *mat;
  register int i,dir;
  register site *s;
  int errcount = 0;
  int errors;

  max_deviation = 0.;
  av_deviation = 0.;
  
  FORALLSITES(i,s){
#ifdef SCHROED_FUN
  for(dir=XUP; dir<=TUP; dir++ ) if(dir==TUP || s->t>0 ){
#else
    for(dir=XUP; dir<=TUP; dir++ ){
#endif
      mat = (su3_matrix *)&(s->link[dir]);
      errors = reunit_su3( mat );
      errcount += errors;
      if(errors)reunit_report_problem_matrix(mat,i,dir);
      if(errcount > MAXERRCOUNT)
	{
	  printf("Unitarity error count exceeded.\n");
	  terminate(1);
	}
    }
  }

#ifdef UNIDEBUG
  printf("Deviation from unitarity on node %d: max %.3e, avrg %.3e\n",
	 mynode(), max_deviation, av_deviation);
#endif
  if(max_deviation> TOLERANCE) 
    {
      printf("reunitarize: Node %d unitarity problem, maximum deviation=%e\n",
	     mynode(),max_deviation);
      errcount++;
      if(errcount > MAXERRCOUNT)
	{
	  printf("Unitarity error count exceeded.\n");
	  terminate(1);
	}
    }

}  /* reunitarize2 */
Exemplo n.º 2
0
void reunitarize() {
  register su3_matrix *mat;
  register int i,dir;
  register site *s;
  int errcount = 0;
  int errors;

  max_deviation = 0.;
  av_deviation = 0.;
  
  FORALLSITES(i,s){
#ifdef SCHROED_FUN
  for(dir=XUP; dir<=TUP; dir++ ) if(dir==TUP || s->t>0 ){
#else
    for(dir=XUP; dir<=TUP; dir++ ){
#endif
      mat = (su3_matrix *)&(s->link[dir]);
      errors = reunit_su3( mat );
      errcount += errors;
      if(errors)reunit_report_problem_matrix(mat,i,dir);
      if(errcount > MAXERRCOUNT)
	{
	  printf("Unitarity error count exceeded.\n");
	  terminate(1);
	}
    }
  }

#ifdef UNIDEBUG
  printf("Deviation from unitarity on node %d: max %.3e, avrg %.3e\n",
	 mynode(), max_deviation, av_deviation);
#endif
  if(max_deviation> TOLERANCE) 
    {
      printf("reunitarize: Node %d unitarity problem, maximum deviation=%e\n",
	     mynode(),max_deviation);
      errcount++;
      if(errcount > MAXERRCOUNT)
	{
	  printf("Unitarity error count exceeded.\n");
	  terminate(1);
	}
    }

}  /* reunitarize2 */

void reunitarize_u1() {
  register complex *mat;
  register int i,dir;
  register site *s;
  double norm;
  double deviation;

  int errcount = 0;
  int errors;

  max_deviation = 0.;
  av_deviation = 0.;

  FORALLSITES(i,s){
#ifdef SCHROED_FUN
  for(dir=XUP; dir<=TUP; dir++ ) if(dir==TUP || s->t>0 ){
#else
    for(dir=XUP; dir<=TUP; dir++ ){
#endif
      mat = (complex *)&(s->link[dir]);
      //reunitarize link
      norm = (double)cabs( mat );
      CMULREAL( *mat, 1./norm, *mat );
      //deviation = fabs(norm - 1.);
      deviation = fabs(norm*norm - 1.);
      errors = check_deviation(deviation);
      errcount += errors;
      if(errors){
	reunit_report_problem_u1(mat,i,dir);
	printf("deviation = %e, tol = %e\n", deviation, TOLERANCE);
      }
      if(errcount > MAXERRCOUNT)
	{
	  printf("Unitarity error count exceeded.\n");
	  terminate(1);
	}
    }
  }

#ifdef UNIDEBUG
  printf("Deviation from unitarity on node %d: max %.3e, avrg %.3e\n",
	 mynode(), max_deviation, av_deviation);
#endif
  if(max_deviation> TOLERANCE) 
    {
      printf("reunitarize: Node %d unitarity problem, maximum deviation=%e\n",
	     mynode(),max_deviation);
      errcount++;
      if(errcount > MAXERRCOUNT)
	{
	  printf("Unitarity error count exceeded.\n");
	  terminate(1);
	}
    }

}  /* reunitarize_u1 */