From ed7f5a872db4e5fa9f115e4d196567678fcb6711 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 2 Apr 2024 17:55:02 +0200 Subject: Changed convention to match Fyodorov. --- least_squares.cpp | 4 ++-- tensor.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/least_squares.cpp b/least_squares.cpp index 28397ec..f667e28 100644 --- a/least_squares.cpp +++ b/least_squares.cpp @@ -97,7 +97,7 @@ public: std::tuple hamGradHess(const Vector& x) const { auto [H, dH, ddH] = HdHddH(x); - Vector gradH = dH - dH.dot(x) * x / N; + Vector gradH = dH - dH.dot(x) * x / (Real)N; Matrix hessH = ddH - (dH * x.transpose() + x.dot(dH) * Matrix::Identity(N, N) + (ddH * x) * x.transpose()) / (Real)N + 2.0 * x * x.transpose(); return {H, gradH, hessH}; @@ -171,7 +171,7 @@ int main(int argc, char* argv[]) { Rng r; - Model<1, 2> leastSquares(N, M, r.engine(), sqrt(2) * pow(σ, 2), sqrt(2)); + Model<1, 2> leastSquares(N, M, r.engine(), σ, 1); Vector x = Vector::Zero(N); x(0) = sqrt(N); diff --git a/tensor.hpp b/tensor.hpp index 58c2434..7f98d02 100644 --- a/tensor.hpp +++ b/tensor.hpp @@ -88,7 +88,7 @@ Tensor

generateCouplings(unsigned N, unsigned M, Distribution d, Generator& r template Tensor

generateRealPSpinCouplings(unsigned N, unsigned M, Generator& r) { - Real σp = sqrt(factorial(p-1) / ((Real)2 * pow(N, p - 1))); + Real σp = sqrt(factorial(p-1) / ((Real)pow(N, p - 1))); return generateCouplings

(N, M, std::normal_distribution(0, σp), r); } -- cgit v1.2.3-70-g09d2