Skip to content

Commit

Permalink
Clean up further instances of awkward struct-complex to C99-complex c…
Browse files Browse the repository at this point in the history
…onversion.
  • Loading branch information
Albert Deuzeman committed Feb 14, 2012
1 parent 8d287f4 commit 1e3bb87
Show file tree
Hide file tree
Showing 20 changed files with 251 additions and 304 deletions.
26 changes: 7 additions & 19 deletions D_psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,8 @@ void D_psi(spinor * const P, spinor * const Q){
xchange_lexicfield(Q);
# endif

fact1 = (1.) + cimag(fact1) * I;
fact1 = creal(fact1) + (g_mu) * I;
fact2 = (1.) + cimag(fact2) * I;
fact2 = creal(fact2) + (-g_mu) * I;
fact1 = 1. + g_mu * I;
fact2 = conj(fact1);

iy=g_iup[0][0];
sp=(spinor *) Q + iy;
Expand Down Expand Up @@ -909,8 +907,7 @@ void D_psi(spinor * const P, spinor * const Q){
xchange_lexicfield(Q);
# endif

fact1 = (1.) + cimag(fact1) * I;
fact1 = creal(fact1) + (g_mu) * I;
fact1 = 1.0 + g_mu * I;

iy=g_iup[0][0];
sp=(spinor *) Q + iy;
Expand Down Expand Up @@ -1232,18 +1229,11 @@ void D_psi_prec(spinor * const P, spinor * const Q){
spinorPrecWS *ws=(spinorPrecWS*)g_precWS;
static _Complex double alpha = -1.0;

alpha = (-.5) + cimag(alpha) * I;
alpha = -0.5;
spinorPrecondition(P,Q,ws,T,L,alpha,0,1);
D_psi(g_spinor_field[DUM_MATRIX],P);
alpha = (-.5) + cimag(alpha) * I;
alpha = -0.5;
spinorPrecondition(P,g_spinor_field[DUM_MATRIX],ws,T,L,alpha,0,1);

/* D_psi(P,Q); */
/* alpha = (-1.) + cimag(alpha) * I; */
/* alpha = creal(alpha); */
/* spinorPrecondition(P,P,ws,T,L,alpha,0,1); */


}

/* apply the Dirac operator to the block local spinor field s */
Expand All @@ -1266,10 +1256,8 @@ void Block_D_psi(block * blk, spinor * const rr, spinor * const s) {
if(blk_gauge_eo) {
init_blocks_gaugefield();
}
rhoa = (1.) + cimag(rhoa) * I;
rhoa = creal(rhoa) + (g_mu) * I;
rhob = (1.) + cimag(rhob) * I;
rhob = creal(rhob) + (-g_mu) * I;
rhoa = 1.0 + g_mu * I;
rhob = conj(rhoa);

/* set the boundary term to zero */
_spinor_null(rr[blk->volume]);
Expand Down
11 changes: 5 additions & 6 deletions Dov_psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ void Dov_psi_prec(spinor * const P, spinor * const S) {
spinorPrecWS *ws=(spinorPrecWS*)g_precWS;
static _Complex double alpha;
Dov_psi(P,S);
alpha = (-1.) + cimag(alpha) * I;
alpha = creal(alpha);
alpha = -1.0;
spinorPrecondition(P,P,ws,T,L,alpha,0,1);

}
Expand Down Expand Up @@ -217,22 +216,22 @@ void Qov_sq_psi_prec(spinor * const P, spinor * const S) {


spinorPrecWS *ws=(spinorPrecWS*)g_precWS;
static _Complex double alpha={0,0};
static _Complex double alpha = 0.0;

alpha = (ws->precExpo[0]) + cimag(alpha) * I;
alpha = ws->precExpo[0];
spinorPrecondition(P,S,ws,T,L,alpha,0,1);


Dov_psi(g_spinor_field[DUM_MATRIX], P);
gamma5(P, g_spinor_field[DUM_MATRIX], VOLUME);

alpha = (ws->precExpo[1]) + cimag(alpha) * I;
alpha = ws->precExpo[1];
spinorPrecondition(P,P,ws,T,L,alpha,0,1);

Dov_psi(g_spinor_field[DUM_MATRIX], P);
gamma5(P, g_spinor_field[DUM_MATRIX], VOLUME);

alpha = (ws->precExpo[2]) + cimag(alpha) * I;
alpha = ws->precExpo[2];
spinorPrecondition(P,P,ws,T,L,alpha,0,1);

return;
Expand Down
7 changes: 4 additions & 3 deletions clover_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ void sw_term(su3 ** const gf, const double kappa, const double c_sw) {
!______________________________________________________________!
*/
#define nm1 5
int six_invert(_Complex double a[6][6]) {
int six_invert(_Complex double a[6][6])
{
static _Complex double d[nm1+1],u[nm1+1];
static _Complex double sigma,z;
static double p[nm1+1];
Expand Down Expand Up @@ -221,10 +222,10 @@ int six_invert(_Complex double a[6][6]) {

/* inversion of upper triangular matrix in place
(diagonal elements done already): */

for(k = nm1; k >= 0; k--) {
for(i = k-1; i >= 0;i--) {
z = (0.) + cimag(z) * I; z = creal(z);
z = 0.0;
for(j = i+1; j < k; j++)
z += a[i][j] * a[j][k];
z += a[i][k] * d[k];
Expand Down
9 changes: 3 additions & 6 deletions expo.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,9 @@ su3 exposu3(su3adj p)
+creal(v.c20)*cimag(v2.c02)+cimag(v.c20)*creal(v2.c02)
+creal(v.c21)*cimag(v2.c12)+cimag(v.c21)*creal(v2.c12)
+creal(v.c22)*cimag(v2.c22)+cimag(v.c22)*creal(v2.c22));
a0 = (0.16059043836821615e-9) + cimag(a0) * I; /* 1/13! */
a0 = creal(a0);
a1 = (0.11470745597729725e-10) + cimag(a1) * I; /* 1/14! */
a1 = creal(a1);
a2 = (0.76471637318198165e-12) + cimag(a2) * I; /* 1/15! */
a2 = creal(a2);
a0 = (0.16059043836821615e-9);
a1 = (0.11470745597729725e-10);
a2 = (0.76471637318198165e-12);
fac=0.20876756987868099e-8; /* 1/12! */
r=12.0;
for(i = 3; i <= 15; i++)
Expand Down
6 changes: 3 additions & 3 deletions invert_eo.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,15 @@ int invert_eo(spinor * const Even_new, spinor * const Odd_new,
if(g_proc_id==0) {printf("# Using preconditioning (which one?)!\n");}

if(g_prec_sequence_d_dagger_d[2] != 0.0){
alpha = (g_prec_sequence_d_dagger_d[2]) + cimag(alpha) * I;
alpha = g_prec_sequence_d_dagger_d[2];
spinorPrecondition(g_spinor_field[DUM_DERI+1],g_spinor_field[DUM_DERI+1],ws,T,L,alpha,0,1);
}

iter = cg_her(g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+1], max_iter, precision,
rel_prec, VOLUME, &Q_pm_psi_prec);

if(g_prec_sequence_d_dagger_d[0] != 0.0){
alpha = (g_prec_sequence_d_dagger_d[0]) + cimag(alpha) * I;
alpha = g_prec_sequence_d_dagger_d[0];
spinorPrecondition(g_spinor_field[DUM_DERI],g_spinor_field[DUM_DERI],ws,T,L,alpha,0,1);
}

Expand All @@ -418,7 +418,7 @@ int invert_eo(spinor * const Even_new, spinor * const Odd_new,
spinorPrecWS *ws=(spinorPrecWS*)g_precWS;
static _Complex double alpha = 0.0;
if(g_prec_sequence_d_dagger_d[1] != 0.0){
alpha = (g_prec_sequence_d_dagger_d[1]) + cimag(alpha) * I;
alpha = g_prec_sequence_d_dagger_d[1];
spinorPrecondition(g_spinor_field[DUM_DERI+1],g_spinor_field[DUM_DERI+1],ws,T,L,alpha,0,1);
}
}
Expand Down
6 changes: 3 additions & 3 deletions invert_overlap.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ void invert_overlap(const int op_id, const int index_start) {
ws=(spinorPrecWS*)g_precWS;
printf("# Using preconditioning (which one?)!\n");

alpha = (ws->precExpo[2]) + cimag(alpha) * I;
alpha = ws->precExpo[2];
spinorPrecondition(g_spinor_field[DUM_DERI+1],g_spinor_field[DUM_DERI+1],ws,T,L,alpha,0,1);

/* iter = cg_her(g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+1], max_iter, precision, */
/* rel_prec, VOLUME, &Q_pm_psi_prec); */
optr->iterations = cg_her(g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+1], optr->maxiter, optr->eps_sq,
optr->rel_prec, VOLUME, &Qov_sq_psi_prec);

alpha = (ws->precExpo[0]) + cimag(alpha) * I;
alpha = ws->precExpo[0];
spinorPrecondition(g_spinor_field[DUM_DERI],g_spinor_field[DUM_DERI],ws,T,L,alpha,0,1);

}
Expand All @@ -86,7 +86,7 @@ void invert_overlap(const int op_id, const int index_start) {

if(use_preconditioning == 1 && g_precWS!=NULL){
ws=(spinorPrecWS*)g_precWS;
alpha = (ws->precExpo[1]) + cimag(alpha) * I;
alpha = ws->precExpo[1];
spinorPrecondition(g_spinor_field[DUM_DERI+1],g_spinor_field[DUM_DERI+1],ws,T,L,alpha,0,1);
}

Expand Down
72 changes: 36 additions & 36 deletions io/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,45 +46,45 @@ void write_su3(su3 * up, FILE * f) {


void single2double_cm(spinor * const R, float * const S) {
R->s0.c0 = ((double) S[0]) + ((double) S[1]) * I;
R->s0.c1 = ((double) S[2]) + ((double) S[3]) * I;
R->s0.c2 = ((double) S[4]) + ((double) S[5]) * I;
R->s1.c0 = ((double) S[6]) + ((double) S[7]) * I;
R->s1.c1 = ((double) S[8]) + ((double) S[9]) * I;
R->s1.c2 = ((double) S[10]) + ((double) S[11]) * I;
R->s2.c0 = ((double) S[12]) + ((double) S[13]) * I;
R->s2.c1 = ((double) S[14]) + ((double) S[15]) * I;
R->s2.c2 = ((double) S[16]) + ((double) S[17]) * I;
R->s3.c0 = ((double) S[18]) + ((double) S[19]) * I;
R->s3.c1 = ((double) S[20]) + ((double) S[21]) * I;
R->s3.c2 = ((double) S[22]) + ((double) S[23]) * I;
R->s0.c0 = S[ 0] + S[ 1] * I;
R->s0.c1 = S[ 2] + S[ 3] * I;
R->s0.c2 = S[ 4] + S[ 5] * I;
R->s1.c0 = S[ 6] + S[ 7] * I;
R->s1.c1 = S[ 8] + S[ 9] * I;
R->s1.c2 = S[10] + S[11] * I;
R->s2.c0 = S[12] + S[13] * I;
R->s2.c1 = S[14] + S[15] * I;
R->s2.c2 = S[16] + S[17] * I;
R->s3.c0 = S[18] + S[19] * I;
R->s3.c1 = S[20] + S[21] * I;
R->s3.c2 = S[22] + S[23] * I;
}

void double2single_cm(float * const S, spinor * const R) {
S[0] = (float) creal(R->s0.c0) ;
S[1] = (float) cimag(R->s0.c0) ;
S[2] = (float) creal(R->s0.c1) ;
S[3] = (float) cimag(R->s0.c1) ;
S[4] = (float) creal(R->s0.c2) ;
S[5] = (float) cimag(R->s0.c2) ;
S[6] = (float) creal(R->s1.c0) ;
S[7] = (float) cimag(R->s1.c0) ;
S[8] = (float) creal(R->s1.c1) ;
S[9] = (float) cimag(R->s1.c1) ;
S[10] = (float) creal(R->s1.c2) ;
S[11] = (float) cimag(R->s1.c2) ;
S[12] = (float) creal(R->s2.c0) ;
S[13] = (float) cimag(R->s2.c0) ;
S[14] = (float) creal(R->s2.c1) ;
S[15] = (float) cimag(R->s2.c1) ;
S[16] = (float) creal(R->s2.c2) ;
S[17] = (float) cimag(R->s2.c2) ;
S[18] = (float) creal(R->s3.c0) ;
S[19] = (float) cimag(R->s3.c0) ;
S[20] = (float) creal(R->s3.c1) ;
S[21] = (float) cimag(R->s3.c1) ;
S[22] = (float) creal(R->s3.c2) ;
S[23] = (float) cimag(R->s3.c2) ;
S[ 0] = creal(R->s0.c0);
S[ 1] = cimag(R->s0.c0);
S[ 2] = creal(R->s0.c1);
S[ 3] = cimag(R->s0.c1);
S[ 4] = creal(R->s0.c2);
S[ 5] = cimag(R->s0.c2);
S[ 6] = creal(R->s1.c0);
S[ 7] = cimag(R->s1.c0);
S[ 8] = creal(R->s1.c1);
S[ 9] = cimag(R->s1.c1);
S[10] = creal(R->s1.c2);
S[11] = cimag(R->s1.c2);
S[12] = creal(R->s2.c0);
S[13] = cimag(R->s2.c0);
S[14] = creal(R->s2.c1);
S[15] = cimag(R->s2.c1);
S[16] = creal(R->s2.c2);
S[17] = cimag(R->s2.c2);
S[18] = creal(R->s3.c0);
S[19] = cimag(R->s3.c0);
S[20] = creal(R->s3.c1);
S[21] = cimag(R->s3.c1);
S[22] = creal(R->s3.c2);
S[23] = cimag(R->s3.c2);
}

void zero_spinor(spinor * const R) {
Expand Down
38 changes: 14 additions & 24 deletions little_D.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,9 @@ void little_field_gather_eo(int eo, _Complex double * w) {

void little_D(_Complex double * v, _Complex double *w) {
int i, j, sq = g_N_s*g_N_s;
CONE = (1.) + cimag(CONE) * I;
CONE = creal(CONE);
CMONE = (-1.) + cimag(CMONE) * I;
CMONE = creal(CMONE);
CZERO = (0.) + cimag(CZERO) * I;
CZERO = creal(CZERO);
CONE = 1.0;
CMONE = -1.0;
CZERO = 0.0;

if(dfl_subspace_updated) {
compute_little_D();
Expand Down Expand Up @@ -703,12 +700,9 @@ void little_D_sym(_Complex double * v, _Complex double *w) {

void little_D_ee_inv(_Complex double * v, _Complex double *w) {
int i;
CONE = (1.) + cimag(CONE) * I;
CONE = creal(CONE);
CMONE = (-1.) + cimag(CMONE) * I;
CMONE = creal(CMONE);
CZERO = (0.) + cimag(CZERO) * I;
CZERO = creal(CZERO);
CONE = 1.0;
CMONE = -1.0;
CZERO = 0.0;

for(i = 0; i < nb_blocks/2; i++) {
_FT(zgemv)("N", &g_N_s, &g_N_s, &CONE, block_list[i].little_dirac_operator_eo,
Expand All @@ -720,12 +714,10 @@ void little_D_ee_inv(_Complex double * v, _Complex double *w) {

void little_D_hop(int eo,_Complex double * v, _Complex double *w) {
int i, j, i_eo,sq = g_N_s*g_N_s;
CONE = (1.) + cimag(CONE) * I;
CONE = creal(CONE);
CMONE = (-1.) + cimag(CMONE) * I;
CMONE = creal(CMONE);
CZERO = (0.) + cimag(CZERO) * I;
CZERO = creal(CZERO);
CONE = 1.0;
CMONE = -1.0;
CZERO = 0.0;

i_eo=(eo+1)%2;

#ifdef MPI
Expand All @@ -744,12 +736,10 @@ void little_D_hop(int eo,_Complex double * v, _Complex double *w) {

void little_Dhat_lhs(_Complex double * v, _Complex double *w, _Complex double *u) {
int i,j;
CONE = (1.) + cimag(CONE) * I;
CONE = creal(CONE);
CMONE = (-1.) + cimag(CMONE) * I;
CMONE = creal(CMONE);
CZERO = (0.) + cimag(CZERO) * I;
CZERO = creal(CZERO);
CONE = 1.0;
CMONE = -1.0;
CZERO = 0.0;


for(i = nb_blocks/2; i < nb_blocks; i++) {
_FT(zgemv)("N", &g_N_s, &g_N_s, &CONE, block_list[i].little_dirac_operator_eo,
Expand Down
3 changes: 1 addition & 2 deletions polyakov_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ int polyakov_loop_dir(
return(-1);
}

pl = (0.) + cimag(pl) * I;
pl = creal(pl);
pl = 0.0;

/********************************************************************************/

Expand Down
Loading

0 comments on commit 1e3bb87

Please sign in to comment.