From c0cbb233d16306fec19c7c4325d61ae4b1248c1c Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 5 Jan 2021 11:20:03 +0100 Subject: Ran clang-format. --- langevin.cpp | 19 ++++++++++--------- stereographic.hpp | 10 ++++++---- tensor.hpp | 22 ++++++++++++++-------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/langevin.cpp b/langevin.cpp index dcf8c68..d704266 100644 --- a/langevin.cpp +++ b/langevin.cpp @@ -1,8 +1,8 @@ -#include -#include -#include #include +#include #include +#include +#include #include #include @@ -60,7 +60,8 @@ std::tuple WdW(const Tensor& J, const Vector& z) { return {W, dW}; } -Vector langevin(const Tensor& J, const Vector& z0, double T, double γ0, std::function quit, Rng& r) { +Vector langevin(const Tensor& J, const Vector& z0, double T, double γ0, + std::function quit, Rng& r) { Vector z = z0; double W; @@ -97,13 +98,13 @@ Vector langevin(const Tensor& J, const Vector& z0, double T, double γ0, std::fu int main(int argc, char* argv[]) { // model parameters unsigned N = 10; // number of spins - double T = 1; // temperature - double Rκ = 1; // real part of distribution parameter - double Iκ = 0; // imaginary part of distribution parameter + double T = 1; // temperature + double Rκ = 1; // real part of distribution parameter + double Iκ = 0; // imaginary part of distribution parameter // simulation parameters - double δ = 1e-2; // threshold for determining saddle - double γ = 1e-2; // step size + double δ = 1e-2; // threshold for determining saddle + double γ = 1e-2; // step size unsigned t = 1000; // number of Langevin steps int opt; diff --git a/stereographic.hpp b/stereographic.hpp index 7a6b411..7dd871c 100644 --- a/stereographic.hpp +++ b/stereographic.hpp @@ -17,7 +17,7 @@ Vector stereographicToEuclidean(const Vector& ζ) { Vector euclideanToStereographic(const Vector& z) { unsigned N = z.size(); Vector ζ(N - 1); - + for (unsigned i = 0; i < N - 1; i++) { ζ(i) = z(i) / (sqrt(N) - z(N - 1)); } @@ -33,7 +33,7 @@ Matrix stereographicJacobian(const Vector& ζ) { for (unsigned i = 0; i < N - 1; i++) { for (unsigned j = 0; j < N - 1; j++) { - J(i, j) = - 4.0 * ζ(i) * ζ(j); + J(i, j) = -4.0 * ζ(i) * ζ(j); if (i == j) { J(i, j) += 2.0 * (1.0 + b); } @@ -55,7 +55,8 @@ Matrix stereographicMetric(const Vector& ζ) { for (unsigned i = 0; i < N; i++) { for (unsigned j = 0; j < N; j++) { - g(i, j) = 16.0 * (std::conj(ζ(i)) * ζ(j) * (1.0 + a) - std::real(std::conj(ζ(i) * ζ(j)) * (1.0 + b))); + g(i, j) = 16.0 * (std::conj(ζ(i)) * ζ(j) * (1.0 + a) - + std::real(std::conj(ζ(i) * ζ(j)) * (1.0 + b))); if (i == j) { g(i, j) += 4.0 * std::abs(1.0 + b); } @@ -66,7 +67,8 @@ Matrix stereographicMetric(const Vector& ζ) { return g; } -std::tuple, Vector, Matrix> stereographicHamGradHess(const Tensor3& J, const Vector& ζ) { +std::tuple, Vector, Matrix> stereographicHamGradHess(const Tensor3& J, + const Vector& ζ) { Vector grad; Matrix hess; diff --git a/tensor.hpp b/tensor.hpp index 8345d83..9e860d9 100644 --- a/tensor.hpp +++ b/tensor.hpp @@ -2,13 +2,14 @@ #include #include -#include #include +#include #include "factorial.hpp" template -void setJ(Scalar z, Eigen::Tensor& J, const std::array& is, std::index_sequence) { +void setJ(Scalar z, Eigen::Tensor& J, const std::array& is, + std::index_sequence) { J(std::get(is)...) = z; } @@ -20,7 +21,8 @@ Eigen::Tensor initializeJ(unsigned N, std::index_sequence } template -void populateCouplings(Eigen::Tensor& J, unsigned N, unsigned l, std::array is, Distribution d, Generator& r) { +void populateCouplings(Eigen::Tensor& J, unsigned N, unsigned l, + std::array is, Distribution d, Generator& r) { if (l == 0) { Scalar z = d(r); do { @@ -52,14 +54,18 @@ Eigen::Tensor generateCouplings(unsigned N, Distribution d, Generator } template -Eigen::Matrix contractDown(const Eigen::Tensor& J, const Eigen::Matrix& z) { - return Eigen::Map>(J.data(), z.size(), z.size()); +Eigen::Matrix +contractDown(const Eigen::Tensor& J, const Eigen::Matrix& z) { + return Eigen::Map>(J.data(), z.size(), + z.size()); } template -Eigen::Matrix contractDown(const Eigen::Tensor& J, const Eigen::Matrix& z) { - Eigen::Tensor zT = Eigen::TensorMap>(z.data(), {z.size()}); - std::array, 1> ip = {Eigen::IndexPair(0,0)}; +Eigen::Matrix +contractDown(const Eigen::Tensor& J, const Eigen::Matrix& z) { + Eigen::Tensor zT = + Eigen::TensorMap>(z.data(), {z.size()}); + std::array, 1> ip = {Eigen::IndexPair(0, 0)}; Eigen::Tensor Jz = J.contract(zT, ip); return contractDown(Jz, z); } -- cgit v1.2.3-70-g09d2