From a43ff1f98e9b9814f858bccb11c174b418458491 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 10 Oct 2018 21:45:32 -0400 Subject: big rearrangement of files to make libraries and example (research) files clearer, and changed to c++ std lib random numbers --- lib/torus.h | 64 ------------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 lib/torus.h (limited to 'lib/torus.h') diff --git a/lib/torus.h b/lib/torus.h deleted file mode 100644 index 2aead52..0000000 --- a/lib/torus.h +++ /dev/null @@ -1,64 +0,0 @@ - -#pragma once - -#include -#include -#include "types.h" - -template -class torus_t : public std::array { - public: - typedef std::array M_t; - typedef std::array F_t; - - torus_t() { - this->fill(0); - } - - inline torus_t operator*(v_t a) const { - torus_t x; - for (q_t i = 0; i < n; i++) { - x[i] = a * (*this)[i]; - } - - return x; - } - - inline torus_t operator*(double a) const { - torus_t x; - for (q_t i = 0; i < n; i++) { - x[i] = a * (*this)[i]; - } - - return x; - } - - inline torus_t& operator+=(const torus_t& x) { - for (q_t i = 0; i < n; i++) { - (*this)[i] += x[i]; - } - } - - inline torus_t& operator-=(const torus_t& x) { - for (q_t i = 0; i < n; i++) { - (*this)[i] -= x[i]; - } - } -}; - -template -double norm_squared(const torus_t& x) { - double tmp = 0; - for (const double& xi : x) { - tmp += pow(xi, 2); - } - return tmp; -} - -void write_magnetization(const torus_t& x, FILE *outfile) { - for (const double& xi : x) { - float tmp_xi = (float)xi; - fwrite(&tmp_xi, sizeof(float), 1, outfile); - } -} - -- cgit v1.2.3-70-g09d2