diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-30 07:41:23 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-30 07:41:23 -0400 |
commit | 95b4257a4df36516e192d72b12da8673f6af3081 (patch) | |
tree | c348429b4293758d6e96e2897e3d620e89c38d78 | |
parent | fc242f52e835be85cc6030b6cae5619d18df7670 (diff) | |
download | c++-95b4257a4df36516e192d72b12da8673f6af3081.tar.gz c++-95b4257a4df36516e192d72b12da8673f6af3081.tar.bz2 c++-95b4257a4df36516e192d72b12da8673f6af3081.zip |
everything builds with new - operators defined
-rw-r--r-- | lib/height.h | 4 | ||||
-rw-r--r-- | lib/potts.h | 10 | ||||
-rw-r--r-- | src/analyze_correlations.cpp | 10 |
3 files changed, 21 insertions, 3 deletions
diff --git a/lib/height.h b/lib/height.h index a4cbbed..d2173fe 100644 --- a/lib/height.h +++ b/lib/height.h @@ -44,6 +44,10 @@ struct height_t { inline double operator*(double a) const { return x * a; } + + inline T operator-(const height_t& h) const { + return x - h.x; + } }; template <class T> diff --git a/lib/potts.h b/lib/potts.h index e6ea636..771c8dc 100644 --- a/lib/potts.h +++ b/lib/potts.h @@ -53,6 +53,16 @@ class potts_t { return result; } + + inline vector_t<q, int> operator-(const potts_t<q> &s) const { + vector_t<q, int> result; + result.fill(0); + + result[x]++; + result[s.x]--; + + return result; + } }; template <q_t q> diff --git a/src/analyze_correlations.cpp b/src/analyze_correlations.cpp index 91c2e7f..4911008 100644 --- a/src/analyze_correlations.cpp +++ b/src/analyze_correlations.cpp @@ -78,10 +78,11 @@ int main (int argc, char *argv[]) { count_t length = (count_t)1e4; bool speedy_drop = false; bool from_stdin = false; + bool oldstyle = false; int opt; - while ((opt = getopt(argc, argv, "d:l:sp")) != -1) { + while ((opt = getopt(argc, argv, "d:l:spo")) != -1) { switch (opt) { case 'd': drop = (count_t)atof(optarg); @@ -95,6 +96,9 @@ int main (int argc, char *argv[]) { case 'p': from_stdin = true; break; + case 'o': + oldstyle = true; + break; default: exit(EXIT_FAILURE); } @@ -131,9 +135,9 @@ int main (int argc, char *argv[]) { printf("%lu: Processing...\n", id); - bool is_finite = 0 == strcmp(model, "ISING") || 0 == strcmp(model, "POTTS") || 0 == strcmp(model, "CLOCK"); +// bool is_finite = 0 == strcmp(model, "ISING") || 0 == strcmp(model, "POTTS") || 0 == strcmp(model, "CLOCK"); - if (is_finite) { + if (oldstyle) { q_t nb; double T; fscanf(metadata, "\"NB\" -> %" SCNq ", \"T\" -> %lf, \"J\" -> {", &nb, &T); |