From dd2c47db3512658858685c83dd772603203aaab1 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Sun, 22 Jul 2018 01:20:29 -0400 Subject: potts now fully functional --- lib/potts.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'lib/potts.h') diff --git a/lib/potts.h b/lib/potts.h index e7f0899..e411ddb 100644 --- a/lib/potts.h +++ b/lib/potts.h @@ -44,13 +44,11 @@ void free_spin(potts_t s) { // do nothing! } -template -void free_spin(typename potts_t::M_t s) { +void free_spin(int *s) { free(s); } -template -void free_spin(typename potts_t::F_t s) { +void free_spin(double *s) { free(s); } @@ -60,13 +58,13 @@ potts_t copy(potts_t s) { } template -void add(typename potts_t::M_t s1, int a, potts_t s2) { - s1[s2.x] += a; +void add(typename potts_t::M_t *s1, int a, potts_t s2) { + (*s1)[s2.x] += a; } template -void add(typename potts_t::F_t s1, double a, potts_t s2) { - s1[s2.x] += a; +void add(typename potts_t::F_t *s1, double a, potts_t s2) { + (*s1)[s2.x] += a; } template @@ -78,13 +76,13 @@ typename potts_t::M_t scalar_multiple(int factor, potts_t s) { template typename potts_t::F_t scalar_multiple(double factor, potts_t s) { - int *F = (double *)calloc(q, sizeof(double)); - M[s.x] += factor; - return M; + double *F = (double *)calloc(q, sizeof(double)); + F[s.x] += factor; + return F; } template -double norm_squared(typename potts::F_t s) { +double norm_squared(typename potts_t::F_t s) { double total = 0; for (q_t i = 0; i < q; i++) { total += pow(s[i], 2); -- cgit v1.2.3-70-g09d2