diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-25 18:14:55 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-25 18:14:55 -0400 |
commit | 9be622f7703193cde9955b9663cea1259ac48efc (patch) | |
tree | acd44702cfd8e52306c0a524cce8885c7a78eb80 /lib/cluster.h | |
parent | a3162d7baf9096df1e5d88edfd9dcd79cf81dff0 (diff) | |
download | c++-9be622f7703193cde9955b9663cea1259ac48efc.tar.gz c++-9be622f7703193cde9955b9663cea1259ac48efc.tar.bz2 c++-9be622f7703193cde9955b9663cea1259ac48efc.zip |
trying some new c++ things, starting with graph
Diffstat (limited to 'lib/cluster.h')
-rw-r--r-- | lib/cluster.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/cluster.h b/lib/cluster.h index 3261969..03b0ac0 100644 --- a/lib/cluster.h +++ b/lib/cluster.h @@ -36,11 +36,7 @@ void flip_cluster(state_t <R_t, X_t> *state, v_t v0, R_t r, gsl_rng *rand) { si_new = act (r, si_old); } - v_t nn = state->g->v_i[v + 1] - state->g->v_i[v]; - - for (v_t i = 0; i < nn; i++) { - v_t vn = state->g->v_adj[state->g->v_i[v] + i]; - + for (v_t vn : state->g.v_adj[v]) { X_t sj; if (vn != state->nv) { @@ -101,7 +97,7 @@ void flip_cluster(state_t <R_t, X_t> *state, v_t v0, R_t r, gsl_rng *rand) { } } - if (v == state->g->nv - 1) { + if (v == state->nv) { free_spin(state->R); state->R = R_new; } else { @@ -109,7 +105,7 @@ void flip_cluster(state_t <R_t, X_t> *state, v_t v0, R_t r, gsl_rng *rand) { state->spins[v] = si_new; } - if (v != state->g->nv - 1) { // count the number of non-external sites that flip + if (v != state->nv) { // count the number of non-external sites that flip nv++; } } |