diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-02-17 15:46:00 +0100 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-02-17 15:46:00 +0100 |
commit | 95df02c90a455c2e539e795acb1921b688e8bc66 (patch) | |
tree | 7af564d926b6d233432029c030f25f605c144f68 /dynamics.hpp | |
parent | 81cc0094a2c7478144702e1532bcb067faaebf26 (diff) | |
download | code-95df02c90a455c2e539e795acb1921b688e8bc66.tar.gz code-95df02c90a455c2e539e795acb1921b688e8bc66.tar.bz2 code-95df02c90a455c2e539e795acb1921b688e8bc66.zip |
Algorithmic tweaks to rope relaxation now suceeds in finding Stokes lines relatively quickly.
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(); } } |