summaryrefslogtreecommitdiff
path: root/dynamics.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'dynamics.hpp')
-rw-r--r--dynamics.hpp5
1 files changed, 5 insertions, 0 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.";