From 93f1069f382636540b64beecbe6e8f5ef27cc8fa Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 15 Jan 2021 16:32:13 +0100 Subject: Moved function to more appropriate header. --- dynamics.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dynamics.hpp') 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 +Vector normalize(const Vector& 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."; -- cgit v1.2.3-54-g00ecf