summaryrefslogtreecommitdiff
path: root/lib/ising.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ising.h')
-rw-r--r--lib/ising.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ising.h b/lib/ising.h
index 4ad88f4..b4856c3 100644
--- a/lib/ising.h
+++ b/lib/ising.h
@@ -76,6 +76,14 @@ int scalar_multiple(int factor, ising_t s) {
}
}
+double scalar_multiple(double factor, ising_t s) {
+ if (s.x) {
+ return -factor;
+ } else {
+ return factor;
+ }
+}
+
double norm_squared(double s) {
return pow(s, 2);
}