From 29f28945a5de06d88b65865e932a0a53ada0ff2f Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 5 Jan 2021 11:41:24 +0100 Subject: Some helpful comments. --- langevin.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/langevin.cpp b/langevin.cpp index 119a64b..1a0e104 100644 --- a/langevin.cpp +++ b/langevin.cpp @@ -23,21 +23,21 @@ using Tensor = Eigen::Tensor; using Rng = randutils::random_generator; -Vector initializeVector(unsigned N, Rng& r) { +Vector initializeVector(unsigned N, double a, Rng& r) { Vector z(N); - complex_normal_distribution<> dist(0, 1, 0); + complex_normal_distribution<> dist(0, a, 0); for (unsigned i = 0; i < N; i++) { z(i) = dist(r.engine()); } - z *= sqrt(N) / sqrt(z.dot(z)); + z *= sqrt(N) / sqrt(z.dot(z)); // Normalize. return z; } std::tuple hamGradHess(const Tensor& J, const Vector& z) { - Matrix Jz = contractDown(J, z); + Matrix Jz = contractDown(J, z); // Contracts J into p - 2 copies of z. Vector Jzz = Jz * z; double f = factorial(p); @@ -145,7 +145,7 @@ int main(int argc, char* argv[]) { complex_normal_distribution<> d(0, σ, κ); Tensor J = generateCouplings(N, d, r.engine()); - Vector z = initializeVector(N, r); + Vector z = initializeVector(N, 100, r); std::function findSaddle = [δ](double W, unsigned) { std::cout << W << std::endl; @@ -161,6 +161,5 @@ int main(int argc, char* argv[]) { Vector constraint = dH - ((double)p * H / (double)N) * zm; - std::cout << std::endl << zm.dot(zm) << std::endl; - std::cout << constraint.cwiseAbs2().sum() << std::endl; + std::cout << H / (double)N << std::endl; } -- cgit v1.2.3-70-g09d2