summaryrefslogtreecommitdiff
path: root/src/wolff_potts.c
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-03-27 16:12:20 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-03-27 16:12:20 -0400
commit9dcc45d90b09d75d053ebb2d4e33a71a9fb2d069 (patch)
tree87e10b12c3ba1c31c3d744cd15ca1fc0ef786837 /src/wolff_potts.c
parent0793838129e228d92ba4d4e2c0f95946e2e6a0f7 (diff)
downloadc++-9dcc45d90b09d75d053ebb2d4e33a71a9fb2d069.tar.gz
c++-9dcc45d90b09d75d053ebb2d4e33a71a9fb2d069.tar.bz2
c++-9dcc45d90b09d75d053ebb2d4e33a71a9fb2d069.zip
some optimizations
Diffstat (limited to 'src/wolff_potts.c')
-rw-r--r--src/wolff_potts.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/wolff_potts.c b/src/wolff_potts.c
index eea9ed7..1d2d6bf 100644
--- a/src/wolff_potts.c
+++ b/src/wolff_potts.c
@@ -180,7 +180,7 @@ int main(int argc, char *argv[]) {
while (((diff > eps || diff != diff) && n_runs < N) || n_runs < min_runs) {
if (!silent) printf("\033[F\033[JWOLFF: sweep %" PRIu64
", dH/H = %.4f, dM/M = %.4f, dC/C = %.4f, dX/X = %.4f, cps: %.1f\n",
- n_runs, fabs(E->dx / E->x), M[0]->dx / M[0]->x, E->dc / E->c, M[0]->dc / M[0]->c, h->nv / clust->x);
+ n_runs, fabs(meas_dx(E) / E->x), meas_dx(M[0]) / M[0]->x, meas_dc(E) / meas_c(E), meas_dc(M[0]) / meas_c(M[0]), h->nv / clust->x);
count_t n_flips = 0;
@@ -220,21 +220,21 @@ int main(int argc, char *argv[]) {
lifetime_n++;
} else {
if (cur_M != MAX_Q) {
- update_meas(lifetimes[cur_M], lifetime_n);
+ meas_update(lifetimes[cur_M], lifetime_n);
}
lifetime_n = 0;
cur_M = max_M_i;
}
} else {
if (cur_M != MAX_Q) {
- update_meas(lifetimes[cur_M], lifetime_n);
+ meas_update(lifetimes[cur_M], lifetime_n);
cur_M = MAX_Q;
}
}
if (n_runs > 0) {
n_steps++;
- update_meas(clust, (double)tmp_flips);
+ meas_update(clust, (double)tmp_flips);
}
if (record_autocorrelation && n_runs > 0) {
@@ -245,19 +245,19 @@ int main(int argc, char *argv[]) {
}
for (q_t i = 0; i < q; i++) {
- update_meas(M[i], s->M[i]);
+ meas_update(M[i], s->M[i]);
}
- update_meas(E, s->E);
+ meas_update(E, s->E);
if (n_at_max == 1) {
for (q_t i = 0; i < q; i++) {
- update_meas(sM[max_M_i][i], s->M[i]);
+ meas_update(sM[max_M_i][i], s->M[i]);
}
- update_meas(sE[max_M_i], s->E);
+ meas_update(sE[max_M_i], s->E);
freqs[max_M_i]++;
}
- diff = fabs(sM[0][0]->dc / sM[0][0]->c);
+ diff = fabs(meas_dc(sM[0][0]) / meas_c(sM[0][0]));
n_runs++;
}
@@ -266,7 +266,7 @@ int main(int argc, char *argv[]) {
}
printf("WOLFF: sweep %" PRIu64
", dH/H = %.4f, dM/M = %.4f, dC/C = %.4f, dX/X = %.4f, cps: %.1f\n",
- n_runs, fabs(E->dx / E->x), M[0]->dx / M[0]->x, E->dc / E->c, M[0]->dc / M[0]->c, h->nv / clust->x);
+ n_runs, fabs(meas_dx(E) / E->x), meas_dx(M[0]) / M[0]->x, meas_dc(E) / meas_c(E), meas_dc(M[0]) / meas_c(M[0]), h->nv / clust->x);
if (snapshots) {
FILE *snapfile = fopen("snapshots.m", "a");
@@ -359,7 +359,7 @@ int main(int argc, char *argv[]) {
fprintf(outfile, ",");
}
}
- fprintf(outfile, "},E->%.15f,\\[Delta]E->%.15f,C->%.15f,\\[Delta]C->%.15f,M->{", E->x / h->nv, E->dx / h->nv, E->c / h->nv, E->dc / h->nv);
+ fprintf(outfile, "},E->%.15f,\\[Delta]E->%.15f,C->%.15f,\\[Delta]C->%.15f,M->{", E->x / h->nv, meas_dx(E) / h->nv, meas_c(E) / h->nv, meas_dc(E) / h->nv);
for (q_t i = 0; i < q; i++) {
fprintf(outfile, "%.15f", M[i]->x / h->nv);
if (i != q-1) {
@@ -368,27 +368,27 @@ int main(int argc, char *argv[]) {
}
fprintf(outfile, "},\\[Delta]M->{");
for (q_t i = 0; i < q; i++) {
- fprintf(outfile, "%.15f", M[i]->dx / h->nv);
+ fprintf(outfile, "%.15f", meas_dx(M[i]) / h->nv);
if (i != q-1) {
fprintf(outfile, ",");
}
}
fprintf(outfile, "},\\[Chi]->{");
for (q_t i = 0; i < q; i++) {
- fprintf(outfile, "%.15f", M[i]->c / h->nv);
+ fprintf(outfile, "%.15f", meas_c(M[i]) / h->nv);
if (i != q-1) {
fprintf(outfile, ",");
}
}
fprintf(outfile, "},\\[Delta]\\[Chi]->{");
for (q_t i = 0; i < q; i++) {
- fprintf(outfile, "%.15f", M[i]->dc / h->nv);
+ fprintf(outfile, "%.15f", meas_dc(M[i]) / h->nv);
if (i != q-1) {
fprintf(outfile, ",");
}
}
for (q_t i = 0; i < q; i++) {
- fprintf(outfile, "},Subscript[E,%" PRIq "]->%.15f,Subscript[\\[Delta]E,%" PRIq "]->%.15f,Subscript[C,%" PRIq "]->%.15f,Subscript[\\[Delta]C,%" PRIq "]->%.15f,Subscript[M,%" PRIq "]->{", i, sE[i]->x / h->nv, i, sE[i]->dx / h->nv, i, sE[i]->c / h->nv, i, sE[i]->dc / h->nv, i);
+ fprintf(outfile, "},Subscript[E,%" PRIq "]->%.15f,Subscript[\\[Delta]E,%" PRIq "]->%.15f,Subscript[C,%" PRIq "]->%.15f,Subscript[\\[Delta]C,%" PRIq "]->%.15f,Subscript[M,%" PRIq "]->{", i, sE[i]->x / h->nv, i, meas_dx(sE[i]) / h->nv, i, meas_c(sE[i]) / h->nv, i, meas_dc(sE[i]) / h->nv, i);
for (q_t j = 0; j < q; j++) {
fprintf(outfile, "%.15f", sM[i][j]->x / h->nv);
if (j != q-1) {
@@ -397,21 +397,21 @@ int main(int argc, char *argv[]) {
}
fprintf(outfile, "},Subscript[\\[Delta]M,%" PRIq "]->{", i);
for (q_t j = 0; j < q; j++) {
- fprintf(outfile, "%.15f", sM[i][j]->dx / h->nv);
+ fprintf(outfile, "%.15f", meas_dx(sM[i][j]) / h->nv);
if (j != q-1) {
fprintf(outfile, ",");
}
}
fprintf(outfile, "},Subscript[\\[Chi],%" PRIq "]->{", i);
for (q_t j = 0; j < q; j++) {
- fprintf(outfile, "%.15f", sM[i][j]->c / h->nv);
+ fprintf(outfile, "%.15f", meas_c(sM[i][j]) / h->nv);
if (j != q-1) {
fprintf(outfile, ",");
}
}
fprintf(outfile, "},Subscript[\\[Delta]\\[Chi],%" PRIq "]->{", i);
for (q_t j = 0; j < q; j++) {
- fprintf(outfile, "%.15f", sM[i][j]->dc / h->nv);
+ fprintf(outfile, "%.15f", meas_dc(sM[i][j]) / h->nv);
if (j != q-1) {
fprintf(outfile, ",");
}
@@ -422,9 +422,9 @@ int main(int argc, char *argv[]) {
fprintf(outfile, ",Subscript[f,%" PRIq "]->%.15f,Subscript[\\[Delta]f,%" PRIq "]->%.15f", i, (double)freqs[i] / (double)n_runs, i, sqrt(freqs[i]) / (double)n_runs);
}
for (q_t i = 0; i < q; i++) {
- fprintf(outfile, ",Subscript[t,%" PRIq "]->%.15f,Subscript[\\[Delta]t,%" PRIq "]->%.15f", i, lifetimes[i]->x, i, lifetimes[i]->dx);
+ fprintf(outfile, ",Subscript[t,%" PRIq "]->%.15f,Subscript[\\[Delta]t,%" PRIq "]->%.15f", i, lifetimes[i]->x, i, meas_dx(lifetimes[i]));
}
- fprintf(outfile, ",Subscript[n,\"clust\"]->%.15f,Subscript[\\[Delta]n,\"clust\"]->%.15f,Subscript[m,\"clust\"]->%.15f,Subscript[\\[Delta]m,\"clust\"]->%.15f,\\[Tau]->%.15f|>\n", clust->x / h->nv, clust->dx / h->nv, clust->c / h->nv, clust->dc / h->nv,tau);
+ fprintf(outfile, ",Subscript[n,\"clust\"]->%.15f,Subscript[\\[Delta]n,\"clust\"]->%.15f,Subscript[m,\"clust\"]->%.15f,Subscript[\\[Delta]m,\"clust\"]->%.15f,\\[Tau]->%.15f|>\n", clust->x / h->nv, meas_dx(clust) / h->nv, meas_c(clust) / h->nv, meas_dc(clust) / h->nv,tau);
fclose(outfile);