From 3223b527890e3090184384374f45a964cffa254a Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 26 Jul 2018 19:32:34 -0400 Subject: fixed several bugs --- lib/orthogonal.h | 2 ++ lib/vector.h | 17 ----------------- src/analyze_correlations.cpp | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/orthogonal.h b/lib/orthogonal.h index 34cd44e..85d0e11 100644 --- a/lib/orthogonal.h +++ b/lib/orthogonal.h @@ -24,6 +24,7 @@ class orthogonal_t : public std::array, q> { vector_t act(const vector_t & v) const { vector_t v_rot; + v_rot.fill(0); if (is_reflection) { double prod = 0; @@ -80,6 +81,7 @@ class orthogonal_t : public std::array, q> { return this->act(v); // reflections are their own inverse } else { vector_t v_rot; + v_rot.fill(0); for (q_t i = 0; i < q; i++) { for (q_t j = 0; j < q; j++) { diff --git a/lib/vector.h b/lib/vector.h index 2f4077a..72633a8 100644 --- a/lib/vector.h +++ b/lib/vector.h @@ -7,23 +7,6 @@ #include "types.h" -/* The following is the minimum definition of a spin class. - * - * The class must contain an M_t and an F_t for holding the sum of an - * integer number of spins and a double-weighted number of spins, - * respectively. - * - * void init(X_t *p); - * void free_spin(X_t p); - * X_t copy(X_t x); - * void add(M_t *x1, int factor, X_t x2); - * void add(F_t *x1, double factor, X_t x2); - * M_t scalar_multiple(int factor, X_t x); - * double norm_squared(F_t x); - * void write_magnetization(M_t M, FILE *outfile); - * - */ - template class vector_t : public std::array { public: diff --git a/src/analyze_correlations.cpp b/src/analyze_correlations.cpp index 5f3dda0..91c2e7f 100644 --- a/src/analyze_correlations.cpp +++ b/src/analyze_correlations.cpp @@ -20,7 +20,7 @@ double mean(int N, T *data) { double squared_mean(int N, double *data) { double total = 0; for (int i = 0; i < N; i++) { - total += data[i]; + total += pow(data[i], 2); } return total / N; -- cgit v1.2.3-70-g09d2