summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--p-spin.hpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/p-spin.hpp b/p-spin.hpp
index a522aee..b90d80b 100644
--- a/p-spin.hpp
+++ b/p-spin.hpp
@@ -34,7 +34,7 @@ std::tuple<double, Vector> WdW(const Tensor& J, const Vector& z) {
Matrix hessian;
std::tie(std::ignore, gradient, hessian) = hamGradHess(J, z);
- Vector projectedGradient = (gradient - ((Scalar)(gradient.transpose() * z) / (double)z.size()) * z).conjugate();
+ Vector projectedGradient = (gradient - ((gradient.transpose() * z) * z / (double)z.size())).conjugate();
double W = projectedGradient.cwiseAbs2().sum();
Vector dW = hessian * projectedGradient - ((z.transpose() * gradient) * projectedGradient + (z.transpose() * projectedGradient) * (gradient + hessian * z)) / (double)z.size();