From cd85d3696be4a7ee65b0cf6669fc62dc4841aef3 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 18 Jul 2018 15:37:27 -0400 Subject: - added support for computing spatial fourier transforms - measurements now are functions passed to wolff in array --- lib/height.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lib/height.h (limited to 'lib/height.h') 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 + +#include "types.h" + +// object definition +template +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 +void init(height_t *ptr) { + ptr->x = (T)0; +} + +template +height_t copy (height_t h) { + return h; +} + +template +void add (height_t *h1, height_t h2) { + h1->x += h2.x; +} + +template +void subtract (height_t *h1, height_T h2) { + h1->x -= h2.x; +} + +template +height_t scalar_multiple(v_t a, height_t h) { + height_t hm; + hm.x = a * h.x; + + return hm; +} + +template +void free_spin (height_t h) { +} + +template +void write_magnetization(height_t M, FILE *outfile) { + fwrite(&(M.x), sizeof(T), 1, outfile); +} + +template +double correlation_component(height_t h) { + return (double)h.x; +} + +// below here are not necessary for operation + +template +T dot(height_t h1, height_t h2) { + return (h1.x - h2.x) * (h1.x - h2.x); +} + -- cgit v1.2.3-70-g09d2