diff options
-rw-r--r-- | langevin.cpp | 13 |
1 files 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<Scalar, PSPIN_P>; using Rng = randutils::random_generator<pcg32>; -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<Scalar, Vector, Matrix> 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<Scalar, PSPIN_P>(N, d, r.engine()); - Vector z = initializeVector(N, r); + Vector z = initializeVector(N, 100, r); std::function<bool(double, unsigned)> 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; } |