void bj_to_weyl(wilson_vector * src, wilson_vector * dest) { register int i; /* color */ complex z1, z2; Real sqrt2inv; sqrt2inv = (Real) (1./ (sqrt(2.))); for (i = 0; i < 3; i++) { CSUB(src->d[3].c[i], src->d[1].c[i], z1); TIMESPLUSI(z1, z2); CMULREAL(z2, sqrt2inv, dest->d[0].c[i]); CSUB(src->d[0].c[i], src->d[2].c[i], z1); TIMESPLUSI(z1, z2); CMULREAL(z2, sqrt2inv, dest->d[1].c[i]); CADD(src->d[3].c[i], src->d[1].c[i], z1); TIMESMINUSI(z1, z2); CMULREAL(z2, sqrt2inv, dest->d[2].c[i]); CADD(src->d[0].c[i], src->d[2].c[i], z1); TIMESPLUSI(z1, z2); CMULREAL(z2, sqrt2inv, dest->d[3].c[i]); } }
void mult_su2_mat_vec_elem_a(su2_matrix *u, complex *x0, complex *x1) { complex z0, z1, t0 = *x0, t1 = *x1; CMUL_J(t0, u->e[0][0], z0); CMUL_J(t1, u->e[0][1], z1); CADD(z0, z1, *x0); CMUL_J(t0, u->e[1][0], z0); CMUL_J(t1, u->e[1][1], z1); CADD(z0, z1, *x1); }
struct cnum FMANDEL( struct cnum z, struct cnum c) { struct cnum value; value = CPROD(z,z); value = CADD(value,c); // z = z^2 + c return value; }
void llfat_add_su3_matrix( su3_matrix *a, su3_matrix *b, su3_matrix *c ) { int i,j; for(i=0; i<3; i++)for(j=0; j<3; j++) { CADD( a->e[i][j], b->e[i][j], c->e[i][j] ); } }
void mult_su2_mat_vec_elem_a(su2_matrix *u,complex *x0,complex *x1) { /* Multiplies the complex row spinor (x0, x1) by the adjoint of the */ /* SU(2) matrix u and puts the result in (x0,x1). */ /* Thus x <- x * u-adj */ /* C. DeTar 3 Oct 1990 */ complex z0, z1, t0, t1; t0 = *x0; t1 = *x1; CMUL_J(t0, u->e[0][0], z0); CMUL_J(t1, u->e[0][1], z1); CADD(z0, z1, *x0); CMUL_J(t0, u->e[1][0], z0); CMUL_J(t1, u->e[1][1], z1); CADD(z0, z1, *x1); } /* m_su2_mat_vec_a.c */
struct cnum FJULIA( struct cnum c1 ) { struct cnum C; //define constant C C.cx = 0.0; C.cy = 1.0; struct cnum value; value = CPROD(c1,c1); value = CADD(value,C); return value; }
/* FIX THIS - more efficient to take cross product of first two rows, dot with third. */ complex det_su3( su3_matrix *a ) { register complex cc,dd,sum; CMUL(a->e[0][0],a->e[1][1],cc); CMUL(cc,a->e[2][2],sum); CMUL(a->e[0][0],a->e[1][2],cc); CMUL(cc,a->e[2][1],dd); CSUB(sum,dd,sum); CMUL(a->e[0][1],a->e[1][2],cc); CMUL(cc,a->e[2][0],dd); CADD(sum,dd,sum); CMUL(a->e[0][1],a->e[1][0],cc); CMUL(cc,a->e[2][2],dd); CSUB(sum,dd,sum); CMUL(a->e[0][2],a->e[1][0],cc); CMUL(cc,a->e[2][1],dd); CADD(sum,dd,sum); CMUL(a->e[0][2],a->e[1][1],cc); CMUL(cc,a->e[2][0],dd); CSUB(sum,dd,sum); return(sum); }
struct cnum FJULIA( struct cnum z1 ) { struct cnum C; //define constant C C.cx = 0.5; C.cy = -0.1; struct cnum value; value = CPROD(z1,z1); value = CPROD(value,z1); //z = z^3 +c value = CADD(value,C); return value; //some good c values: // (0.5,-0.1) , }
// CAdds data to a at indices specified in ind. Assumes arrays are safe. static int caddloop(PyArrayObject *a, PyArrayObject *ind, PyArrayObject *data) { char *index = NULL; int v; for (int i=0; i < DIM(ind,0); i++) { index = a->data; for (int j=0; j < RANK(a); j++) { v = IND2(ind,i,j,long); if (v < 0) v += DIM(a,j); if (v < 0 || v >= DIM(a,j)) return -1; index += v * a->strides[j]; } CADD(index,PNT1(data,i),T); } return 0; }
void qpb_delta_3o2_2pt(qpb_complex **corr_x, qpb_spinor_field *spinor) { int lvol = problem_params.l_vol; int lt = problem_params.l_dim[0]; int lvol3d = lvol/lt; #ifdef OPENMP # pragma omp parallel for #endif for(int t=0; t<lt; t++) { for(int lv=0; lv<lvol3d; lv++) { int v = blk_to_ext[lv+t*lvol3d]; qpb_complex q[NS*NC][NS*NC]; for(int cs0=0; cs0<NC*NS; cs0++) for(int cs1=0; cs1<NC*NS; cs1++) q[cs0][cs1] = ((qpb_complex *)(spinor[cs1].index[v]))[cs0]; for(int k=0; k<4; k++) { qpb_complex CgkqCgk[NS*NC][NS*NC]; qpb_complex Cgkq[NS*NC][NS*NC]; qpb_complex qCgk[NS*NC][NS*NC]; switch(k) { case 0: prop_Cgx_G(Cgkq, q); prop_G_Cgx(qCgk, q); prop_G_Cgx(CgkqCgk, Cgkq); break; case 1: prop_Cgy_G(Cgkq, q); prop_G_Cgy(qCgk, q); prop_G_Cgy(CgkqCgk, Cgkq); break; case 2: prop_Cgz_G(Cgkq, q); prop_G_Cgz(qCgk, q); prop_G_Cgz(CgkqCgk, Cgkq); break; case 3: prop_Cgt_G(Cgkq, q); prop_G_Cgt(qCgk, q); prop_G_Cgt(CgkqCgk, Cgkq); break; default: /* to suppress "may be used uninitialized" compiler warning */ prop_Cgt_G(Cgkq, q); prop_G_Cgt(qCgk, q); prop_G_Cgt(CgkqCgk, Cgkq); break; } qpb_complex ContrA[NS*NC][NS*NC]; qpb_complex ContrB[NS*NC][NS*NC]; qpb_complex ContrC[NS*NC][NS*NC]; prop_contract_02(ContrA, CgkqCgk, q); prop_contract_02(ContrB, Cgkq, qCgk); prop_contract_02(ContrC, Cgkq, q); qpb_complex A[NS][NS], B[NS][NS], C[NS][NS], D[NS][NS], E[NS][NS], F[NS][NS]; for(int mu=0; mu<NS; mu++) for(int nu=0; nu<NS; nu++) { A[mu][nu] = (qpb_complex){0., 0.}; B[mu][nu] = (qpb_complex){0., 0.}; C[mu][nu] = (qpb_complex){0., 0.}; D[mu][nu] = (qpb_complex){0., 0.}; E[mu][nu] = (qpb_complex){0., 0.}; F[mu][nu] = (qpb_complex){0., 0.}; } for(int a0=0; a0<NC; a0++) for(int a1=0; a1<NC; a1++) for(int mu=0; mu<NS; mu++) for(int nu=0; nu<NS; nu++) for(int ku=0; ku<NS; ku++) { A[mu][nu].re += CMULR(q[IDX(a0, mu)][IDX(a1, nu)], ContrA[IDX(a1, ku)][IDX(a0, ku)]); A[mu][nu].im += CMULI(q[IDX(a0, mu)][IDX(a1, nu)], ContrA[IDX(a1, ku)][IDX(a0, ku)]); B[mu][nu].re += CMULR(q[IDX(a0, mu)][IDX(a1, nu)], ContrB[IDX(a1, ku)][IDX(a0, ku)]); B[mu][nu].im += CMULI(q[IDX(a0, mu)][IDX(a1, nu)], ContrB[IDX(a1, ku)][IDX(a0, ku)]); C[mu][nu].re += CMULR(qCgk[IDX(a0, mu)][IDX(a1, ku)], ContrC[IDX(a1, ku)][IDX(a0, nu)]); C[mu][nu].im += CMULI(qCgk[IDX(a0, mu)][IDX(a1, ku)], ContrC[IDX(a1, ku)][IDX(a0, nu)]); D[mu][nu].re += CMULR(qCgk[IDX(a0, mu)][IDX(a1, ku)], ContrC[IDX(a1, nu)][IDX(a0, ku)]); D[mu][nu].im += CMULI(qCgk[IDX(a0, mu)][IDX(a1, ku)], ContrC[IDX(a1, nu)][IDX(a0, ku)]); E[mu][nu].re += CMULR(q[IDX(a0, mu)][IDX(a1, ku)], ContrB[IDX(a1, nu)][IDX(a0, ku)]); E[mu][nu].im += CMULI(q[IDX(a0, mu)][IDX(a1, ku)], ContrB[IDX(a1, nu)][IDX(a0, ku)]); F[mu][nu].re += CMULR(q[IDX(a0, mu)][IDX(a1, ku)], ContrA[IDX(a1, ku)][IDX(a0, nu)]); F[mu][nu].im += CMULI(q[IDX(a0, mu)][IDX(a1, ku)], ContrA[IDX(a1, ku)][IDX(a0, nu)]); } for(int mu=0; mu<NS; mu++) for(int nu=0; nu<NS; nu++) { A[mu][nu] = CADD(A[mu][nu], B[mu][nu]); C[mu][nu] = CADD(C[mu][nu], D[mu][nu]); E[mu][nu] = CADD(E[mu][nu], F[mu][nu]); corr_x[k*NS*NS*lt + (mu*NS+nu)*lt + t][lv] = CADD(CADD(A[mu][nu], C[mu][nu]), E[mu][nu]); } } } } return; }
complex trace(matrix *m) { register complex tc; CADD(m->e[0][0], m->e[1][1], tc); CSUM(tc, m->e[2][2]); return tc; }
void calc_smeared_meson(complex *meson, field_offset quark,field_offset quark_smear, int colour, int spin) { int ismear ; wilson_vector prod ; int ic,ispin ; int i ; int t; register site *s ; wilson_vector *smear_qrk_origin ; Real ts,te ; /****..................................................**/ ts = dclock(); if( (smear_qrk_origin = (wilson_vector *) calloc( (size_t) nt, sizeof(wilson_vector) ) ) == NULL ) { printf("ERROR: could not reserve space in calc_smeared_meson\n"); terminate(1); } /**** complex conjugate the quark propagator ****/ dagger_quark_prop(quark_smear , quark); for(ismear=0 ; ismear < nosmear ; ++ismear) { /*** smear the light quark *************/ for(t=0 ;t < nt ;++t) clear_wvec(&smear_qrk_origin[t]); FORALLSITES(i,s) { c_scalar_mult_add_wvec(&smear_qrk_origin[s->t], (wilson_vector *)F_PT(s,quark_smear) , &s->smear_func[ismear] ,&smear_qrk_origin[s->t]) ; } /*** sum up the smeared quark propagator at the origin over all the nodes *******/ g_veccomplexsum(&(smear_qrk_origin[0].d[0].c[0]), nt*12 ); /** calculate the smeared meson operator ****/ FORALLSITES(i,s) { if( s->x == 0 && s->y == 0 && s->z == 0 ) { mult_wilson_vec_matdag(&prod,&smear_qrk_origin[s->t],&(s->w_line)); t = s->t ; for(ispin = 0 ; ispin < 4 ;++ispin) for(ic=0 ; ic < 3 ;++ic) { CADD(*(meson + MESON_WHERE ),prod.d[ispin].c[ic] , *(meson + MESON_WHERE )); } } /** end the loop over the spatial origin ***/ } /** end the loop over sites *****/ } /** end of the loop over the smearing functions ***/
void add_su3_matrix( su3_matrix *a, su3_matrix *b, su3_matrix *c ) { register int i,j; for(i=0;i<3;i++)for(j=0;j<3;j++){ CADD( a->e[i][j], b->e[i][j], c->e[i][j] ); } }