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 /p-spin.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 'p-spin.hpp')
-rw-r--r-- | p-spin.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -21,6 +21,11 @@ std::tuple<Scalar, Vector<Scalar>, Matrix<Scalar>> hamGradHess(const Tensor<Scal } template <class Scalar> +Vector<Scalar> normalize(const Vector<Scalar>& z) { + return z * sqrt((double)z.size() / (Scalar)(z.transpose() * z)); +} + +template <class Scalar> Vector<Scalar> project(const Vector<Scalar>& z, const Vector<Scalar>& x) { Scalar xz = x.transpose() * z; return x - (xz / z.squaredNorm()) * z.conjugate(); |