summaryrefslogtreecommitdiff
path: root/lib/height.h
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-18 15:37:27 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-18 15:37:27 -0400
commitcd85d3696be4a7ee65b0cf6669fc62dc4841aef3 (patch)
tree6429963091115b7b1ff0a0684ff8f01274a32042 /lib/height.h
parent722bc71ed8d4e1ae5616c5c8284fbffe21c4ffa4 (diff)
downloadc++-cd85d3696be4a7ee65b0cf6669fc62dc4841aef3.tar.gz
c++-cd85d3696be4a7ee65b0cf6669fc62dc4841aef3.tar.bz2
c++-cd85d3696be4a7ee65b0cf6669fc62dc4841aef3.zip
- added support for computing spatial fourier transforms
- measurements now are functions passed to wolff in array
Diffstat (limited to 'lib/height.h')
-rw-r--r--lib/height.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/height.h b/lib/height.h
new file mode 100644
index 0000000..16c4dc5
--- /dev/null
+++ b/lib/height.h
@@ -0,0 +1,62 @@
+
+#pragma once
+
+#include <cmath>
+
+#include "types.h"
+
+// object definition
+template <class T>
+struct height_t { T x; };
+
+// init, copy, add, subtract, scalar_multiple, free_spin, and
+// write_magnetization are necessary for the operation of wolff.h
+template <class T>
+void init(height_t *ptr) {
+ ptr->x = (T)0;
+}
+
+template <class T>
+height_t <T> copy (height_t h) {
+ return h;
+}
+
+template <class T>
+void add (height_t <T> *h1, height_t <T> h2) {
+ h1->x += h2.x;
+}
+
+template <class T>
+void subtract (height_t <T> *h1, height_T <T> h2) {
+ h1->x -= h2.x;
+}
+
+template <class T>
+height_t <T> scalar_multiple(v_t a, height_t <T> h) {
+ height_t <T> hm;
+ hm.x = a * h.x;
+
+ return hm;
+}
+
+template <class T>
+void free_spin (height_t <T> h) {
+}
+
+template <class T>
+void write_magnetization(height_t <T> M, FILE *outfile) {
+ fwrite(&(M.x), sizeof(T), 1, outfile);
+}
+
+template <class T>
+double correlation_component(height_t <T> h) {
+ return (double)h.x;
+}
+
+// below here are not necessary for operation
+
+template <class T>
+T dot(height_t <T> h1, height_t <T> h2) {
+ return (h1.x - h2.x) * (h1.x - h2.x);
+}
+