diff options
Diffstat (limited to 'dynamics.hpp')
-rw-r--r-- | dynamics.hpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/dynamics.hpp b/dynamics.hpp index a27ccb4..22d590a 100644 --- a/dynamics.hpp +++ b/dynamics.hpp @@ -7,16 +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."; } -} gradientDescentStall; +}; template <class Scalar, int p> std::tuple<double, Vector<Scalar>> gradientDescent(const Tensor<Scalar, p>& J, const Vector<Scalar>& z0, double ε, double γ0 = 1, double δγ = 2) { @@ -41,7 +36,7 @@ std::tuple<double, Vector<Scalar>> gradientDescent(const Tensor<Scalar, p>& J, c } if (γ < 1e-50) { - throw gradientDescentStall; + throw gradientDescentStallException(); } } |