コード例 #1
0
ファイル: d_action_u1.c プロジェクト: winterowd/MILC_graphene
/* fermion contribution to the action */
double fermion_action_u1() {
register int i;
register site *s;
register complex cc;
double sum;
    sum=0.0;
    FORMYEVENSITES(i,s){
	/* phi is defined on even sites only */
#ifdef ONEMASS
      CMULJ_( s->phi, s->xxx, cc );
      sum += (double)cc.real;
#else
      CMULJ_( s->phi1, s->xxx1, cc );
      sum += (double)cc.real;
      CMULJ_( s->phi2, s->xxx2, cc );
      sum += (double)cc.real;
#endif
    }
コード例 #2
0
ファイル: llfat_reference.cpp プロジェクト: azrael417/quda
void
llfat_mult_su3_an( su3_matrix *a, su3_matrix *b, su3_matrix *c )
{
    int i,j,k;
    typeof(a->e[0][0]) x,y;
    for(i=0; i<3; i++)for(j=0; j<3; j++) {
            x.real=x.imag=0.0;
            for(k=0; k<3; k++) {
                CMULJ_( a->e[k][i] , b->e[k][j], y );
                CSUM( x , y );
            }
            c->e[i][j] = x;
        }
}
コード例 #3
0
ファイル: twopt.c プロジェクト: erinaldi/milc_qcd
static complex meson_nr(pauli_propagator * antiquark, 
			pauli_propagator * quark, 
			int i1, int i2, int j1, int j2)
{
  
  complex x, y, z;
  
  complex result;
  int c0,c1;

  result.real = 0.;
  result.imag = 0.;

  for(c1=0; c1<3; c1++) for(c0=0; c0<3; c0++){
    x = antiquark -> c[c1].d[i1].d[j1].c[c0];
    y = quark -> c[c1].d[i2].d[j2].c[c0];
    CMULJ_(x,y,z);
    /* debug */
    result.real += z.real;
    result.imag += z.imag;
  }
  return(result);
}
コード例 #4
0
ファイル: w_meson_mom.c プロジェクト: erinaldi/milc_qcd
static dirac_matrix mult_swv_an( spin_wilson_vector *a, 
				 spin_wilson_vector *b )
{
  
  dirac_matrix c;
  
#ifndef INLINE
  complex temp1,temp2;
  register int si,sf,s;
  for(si=0;si<4;si++)for(sf=0;sf<4;sf++) {
    temp1.real = temp1.imag = 0.0;
    for(s=0;s<4;s++){
      CMULJ_(a->d[s].d[si].c[0],b->d[s].d[sf].c[0],temp2); CSUM(temp1,temp2);
      CMULJ_(a->d[s].d[si].c[1],b->d[s].d[sf].c[1],temp2); CSUM(temp1,temp2);
      CMULJ_(a->d[s].d[si].c[2],b->d[s].d[sf].c[2],temp2); CSUM(temp1,temp2);
    }
    c.d[si].d[sf] = temp1;
  }
  
  return c;

#else
  
#ifdef NATIVEDOUBLE
  register double ar,ai,br,bi,cr,ci;
#else
  register Real ar,ai,br,bi,cr,ci;
#endif

  register int si,sf;
  for(si=0;si<4;si++)for(sf=0;sf<4;sf++) {
    ar=a->d[0].d[si].c[0].real;  ai=a->d[0].d[si].c[0].imag;
    br=b->d[0].d[sf].c[0].real;  bi=b->d[0].d[sf].c[0].imag;
    cr = ar*br + ai*bi;
    ci = ar*bi - ai*br;
    ar=a->d[0].d[si].c[1].real;  ai=a->d[0].d[si].c[1].imag;
    br=b->d[0].d[sf].c[1].real;  bi=b->d[0].d[sf].c[1].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    ar=a->d[0].d[si].c[2].real;  ai=a->d[0].d[si].c[2].imag;
    br=b->d[0].d[sf].c[2].real;  bi=b->d[0].d[sf].c[2].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    
    ar=a->d[1].d[si].c[0].real;  ai=a->d[1].d[si].c[0].imag;
    br=b->d[1].d[sf].c[0].real;  bi=b->d[1].d[sf].c[0].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    ar=a->d[1].d[si].c[1].real;  ai=a->d[1].d[si].c[1].imag;
    br=b->d[1].d[sf].c[1].real;  bi=b->d[1].d[sf].c[1].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    ar=a->d[1].d[si].c[2].real;  ai=a->d[1].d[si].c[2].imag;
    br=b->d[1].d[sf].c[2].real;  bi=b->d[1].d[sf].c[2].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    
    ar=a->d[2].d[si].c[0].real;  ai=a->d[2].d[si].c[0].imag;
    br=b->d[2].d[sf].c[0].real;  bi=b->d[2].d[sf].c[0].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    ar=a->d[2].d[si].c[1].real;  ai=a->d[2].d[si].c[1].imag;
    br=b->d[2].d[sf].c[1].real;  bi=b->d[2].d[sf].c[1].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    ar=a->d[2].d[si].c[2].real;  ai=a->d[2].d[si].c[2].imag;
    br=b->d[2].d[sf].c[2].real;  bi=b->d[2].d[sf].c[2].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    
    ar=a->d[3].d[si].c[0].real;  ai=a->d[3].d[si].c[0].imag;
    br=b->d[3].d[sf].c[0].real;  bi=b->d[3].d[sf].c[0].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    ar=a->d[3].d[si].c[1].real;  ai=a->d[3].d[si].c[1].imag;
    br=b->d[3].d[sf].c[1].real;  bi=b->d[3].d[sf].c[1].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    ar=a->d[3].d[si].c[2].real;  ai=a->d[3].d[si].c[2].imag;
    br=b->d[3].d[sf].c[2].real;  bi=b->d[3].d[sf].c[2].imag;
    cr += ar*br + ai*bi;
    ci += ar*bi - ai*br;
    
    c.d[si].d[sf].real = cr;
    c.d[si].d[sf].imag = ci;
  }

  return c;
  
#endif
}
コード例 #5
0
ファイル: wvec_dot.c プロジェクト: erinaldi/milc_qcd
complex wvec_dot( wilson_vector *a, wilson_vector *b ){

#ifndef FAST
  complex temp1,temp2;
  register int i;
  temp1.real = temp1.imag = 0.0;
  for(i=0;i<4;i++){
    CMULJ_(a->d[i].c[0],b->d[i].c[0],temp2); CSUM(temp1,temp2);
    CMULJ_(a->d[i].c[1],b->d[i].c[1],temp2); CSUM(temp1,temp2);
    CMULJ_(a->d[i].c[2],b->d[i].c[2],temp2); CSUM(temp1,temp2);
  }
  return(temp1);

#else

#ifdef NATIVEDOUBLE
  register double ar,ai,br,bi,cr,ci;
#else
  register Real ar,ai,br,bi,cr,ci;
#endif
  register complex cc;


  ar=a->d[0].c[0].real;  ai=a->d[0].c[0].imag;
  br=b->d[0].c[0].real;  bi=b->d[0].c[0].imag;
  cr = ar*br + ai*bi;
  ci = ar*bi - ai*br;
  ar=a->d[0].c[1].real;  ai=a->d[0].c[1].imag;
  br=b->d[0].c[1].real;  bi=b->d[0].c[1].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;
  ar=a->d[0].c[2].real;  ai=a->d[0].c[2].imag;
  br=b->d[0].c[2].real;  bi=b->d[0].c[2].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;

  ar=a->d[1].c[0].real;  ai=a->d[1].c[0].imag;
  br=b->d[1].c[0].real;  bi=b->d[1].c[0].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;
  ar=a->d[1].c[1].real;  ai=a->d[1].c[1].imag;
  br=b->d[1].c[1].real;  bi=b->d[1].c[1].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;
  ar=a->d[1].c[2].real;  ai=a->d[1].c[2].imag;
  br=b->d[1].c[2].real;  bi=b->d[1].c[2].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;

  ar=a->d[2].c[0].real;  ai=a->d[2].c[0].imag;
  br=b->d[2].c[0].real;  bi=b->d[2].c[0].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;
  ar=a->d[2].c[1].real;  ai=a->d[2].c[1].imag;
  br=b->d[2].c[1].real;  bi=b->d[2].c[1].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;
  ar=a->d[2].c[2].real;  ai=a->d[2].c[2].imag;
  br=b->d[2].c[2].real;  bi=b->d[2].c[2].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;

  ar=a->d[3].c[0].real;  ai=a->d[3].c[0].imag;
  br=b->d[3].c[0].real;  bi=b->d[3].c[0].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;
  ar=a->d[3].c[1].real;  ai=a->d[3].c[1].imag;
  br=b->d[3].c[1].real;  bi=b->d[3].c[1].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;
  ar=a->d[3].c[2].real;  ai=a->d[3].c[2].imag;
  br=b->d[3].c[2].real;  bi=b->d[3].c[2].imag;
  cr += ar*br + ai*bi;
  ci += ar*bi - ai*br;

  cc.real = cr;
  cc.imag = ci;
  return(cc);

#endif
}