summaryrefslogtreecommitdiff
path: root/examples/src/models/ising/ising.hpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-10-17 19:33:25 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-10-17 19:33:25 -0400
commitf2f7a072216dfafab89851e4ff3e0b2c3eb16663 (patch)
treef9c7e1e4e91ce8b0ec9cef9f2423029fe7b7f049 /examples/src/models/ising/ising.hpp
parent1343a3fe6bd17a2487f12a0d61be8dc83cd722a0 (diff)
downloadc++-f2f7a072216dfafab89851e4ff3e0b2c3eb16663.tar.gz
c++-f2f7a072216dfafab89851e4ff3e0b2c3eb16663.tar.bz2
c++-f2f7a072216dfafab89851e4ff3e0b2c3eb16663.zip
removed a lot of research code to simplify library and examples for publication
Diffstat (limited to 'examples/src/models/ising/ising.hpp')
-rw-r--r--examples/src/models/ising/ising.hpp84
1 files changed, 0 insertions, 84 deletions
diff --git a/examples/src/models/ising/ising.hpp b/examples/src/models/ising/ising.hpp
deleted file mode 100644
index 73b06ed..0000000
--- a/examples/src/models/ising/ising.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#pragma once
-
-#include <cmath>
-#include <stdio.h>
-
-#include <wolff/types.h>
-
-// all that is required to use wolff.hpp is a default constructor
-class ising_t {
- public:
- bool x;
-
- ising_t() : x(false) {}
-
- // optional constructors for syntactic sugar
- ising_t(bool x) : x(x) {}
- ising_t(int x) : x((bool)x) {}
-
- /* below this comment is code required only for using measure.hpp in the
- * examples folder, which provides an interface for measuring several
- * generic features of models. these require
- *
- * - an M_t, representing the magnetization or sum of all spins
- * - an F_t, representing a double-weighted version of the magnetization
- * - the overloaded operator *, which takes a v_t (unsigned int) and returns an M_t
- * - the overloaded operator *, which takes a double and returns an F_t
- * - the overloaded operator -, which takes another X_t and returns an M_t
- */
-
- typedef int M_t;
- typedef double F_t;
-
- inline int operator*(v_t a) const {
- if (x) {
- return -(int)a;
- } else {
- return (int)a;
- }
- }
-
- inline double operator*(double a) const {
- if (x) {
- return -a;
- } else {
- return a;
- }
- }
-
- inline int operator-(const ising_t &s) const {
- if (x == s.x) {
- return 0;
- } else {
- if (x) {
- return -2;
- } else {
- return 2;
- }
- }
- }
-};
-
-/* using measure.hpp additionally requires a norm_squared function which takes
- * an F_t to a double, and a write_magnetization function, which takes an M_t
- * and a FILE pointer and appropriately records the contents of the former to
- * the latter.
- */
-
-double norm_squared(double s) {
- return pow(s, 2);
-}
-
-void write_magnetization(int M, FILE *outfile) {
- fwrite(&M, sizeof(int), 1, outfile);
-}
-
-/* these definitions allow wolff/finite_states.hpp to be invoked and provide
- * much faster performance for models whose number of possible spin
- * configurations is finite.
- */
-
-#define N_STATES 2
-const ising_t states[2] = {ising_t(0), ising_t(1)};
-q_t state_to_ind(ising_t state) { return (q_t)state.x; }
-