summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2021-01-15 16:32:13 +0100
committerJaron Kent-Dobias <jaron@kent-dobias.com>2021-01-15 16:32:13 +0100
commit93f1069f382636540b64beecbe6e8f5ef27cc8fa (patch)
tree2a9d6243d033d4d19cf7f329b7e5f968d17b0b82
parent199b129c08242be6a2726aae3c9918ca2f2484f7 (diff)
downloadcode-93f1069f382636540b64beecbe6e8f5ef27cc8fa.tar.gz
code-93f1069f382636540b64beecbe6e8f5ef27cc8fa.tar.bz2
code-93f1069f382636540b64beecbe6e8f5ef27cc8fa.zip
Moved function to more appropriate header.
-rw-r--r--dynamics.hpp5
-rw-r--r--p-spin.hpp5
2 files changed, 5 insertions, 5 deletions
diff --git a/dynamics.hpp b/dynamics.hpp
index b373659..a27ccb4 100644
--- a/dynamics.hpp
+++ b/dynamics.hpp
@@ -7,6 +7,11 @@
#include "p-spin.hpp"
#include "stereographic.hpp"
+template <class Scalar>
+Vector<Scalar> normalize(const Vector<Scalar>& z) {
+ return z * sqrt((double)z.size() / (Scalar)(z.transpose() * z));
+}
+
class gradientDescentStallException: public std::exception {
virtual const char* what() const throw() {
return "Gradient descent stalled.";
diff --git a/p-spin.hpp b/p-spin.hpp
index e5d4f94..13fbd98 100644
--- a/p-spin.hpp
+++ b/p-spin.hpp
@@ -45,8 +45,3 @@ std::tuple<double, Vector<Scalar>> WdW(const Tensor<Scalar, p>& J, const Vector<
return {W, dW};
}
-
-template <class Scalar>
-Vector<Scalar> normalize(const Vector<Scalar>& z) {
- return z * sqrt((double)z.size() / (Scalar)(z.transpose() * z));
-}