From 6f165f98d7ff9eeac000a507a497d469a20f0612 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Oct 2020 15:10:04 -0400 Subject: [PATCH] Fixed lint issues (Issue #2881) --- src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp | 3 ++- src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp | 5 +++-- src/stan/mcmc/hmc/nuts/adapt_dense_e_nuts.hpp | 3 ++- src/stan/mcmc/hmc/nuts/adapt_diag_e_nuts.hpp | 3 ++- .../mcmc/hmc/nuts_classic/adapt_dense_e_nuts_classic.hpp | 7 ++++--- .../mcmc/hmc/nuts_classic/adapt_diag_e_nuts_classic.hpp | 4 ++-- src/stan/mcmc/hmc/nuts_classic/diag_e_nuts_classic.hpp | 6 ++++-- src/stan/mcmc/hmc/static/adapt_dense_e_static_hmc.hpp | 3 ++- .../hmc/static_uniform/adapt_dense_e_static_uniform.hpp | 9 +++++---- .../hmc/static_uniform/adapt_diag_e_static_uniform.hpp | 9 +++++---- src/stan/mcmc/hmc/xhmc/adapt_dense_e_xhmc.hpp | 9 +++++---- src/stan/mcmc/hmc/xhmc/adapt_diag_e_xhmc.hpp | 7 ++++--- 12 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp b/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp index 24216f09c57..ab91cb56bd2 100644 --- a/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp +++ b/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp @@ -50,7 +50,8 @@ class dense_e_metric : public base_hamiltonian { for (idx_t i = 0; i < u.size(); ++i) u(i) = rand_dense_gaus(); - z.p = z.get_transpose_llt_inv_metric().triangularView().solve(u); + z.p = z.get_transpose_llt_inv_metric().triangularView() + .solve(u); } }; diff --git a/src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp b/src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp index ebe043a736a..3bfe012f322 100644 --- a/src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp +++ b/src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp @@ -35,8 +35,9 @@ class diag_e_point : public ps_point { * @param inv_e_metric initial mass matrix */ void set_inv_metric(const Eigen::VectorXd& inv_e_metric) { - math::check_size_match("set_inv_metric", "Number of rows in old inverse metric", inv_e_metric_.size(), - "number of rows in new inverse metric", inv_e_metric.size()); + math::check_size_match("set_inv_metric", + "Number of rows in old inverse metric", inv_e_metric_.size(), + "number of rows in new inverse metric", inv_e_metric.size()); inv_e_metric_ = inv_e_metric; } diff --git a/src/stan/mcmc/hmc/nuts/adapt_dense_e_nuts.hpp b/src/stan/mcmc/hmc/nuts/adapt_dense_e_nuts.hpp index fb1360a9e73..52e156915dc 100644 --- a/src/stan/mcmc/hmc/nuts/adapt_dense_e_nuts.hpp +++ b/src/stan/mcmc/hmc/nuts/adapt_dense_e_nuts.hpp @@ -31,7 +31,8 @@ class adapt_dense_e_nuts : public dense_e_nuts, Eigen::MatrixXd inv_metric; - bool update = this->covar_adaptation_.learn_covariance(inv_metric, this->z_.q); + bool update = this->covar_adaptation_.learn_covariance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); diff --git a/src/stan/mcmc/hmc/nuts/adapt_diag_e_nuts.hpp b/src/stan/mcmc/hmc/nuts/adapt_diag_e_nuts.hpp index e51449efeda..9f236009931 100644 --- a/src/stan/mcmc/hmc/nuts/adapt_diag_e_nuts.hpp +++ b/src/stan/mcmc/hmc/nuts/adapt_diag_e_nuts.hpp @@ -31,7 +31,8 @@ class adapt_diag_e_nuts : public diag_e_nuts, Eigen::VectorXd inv_metric; - bool update = this->var_adaptation_.learn_variance(inv_metric, this->z_.q); + bool update = this->var_adaptation_.learn_variance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); diff --git a/src/stan/mcmc/hmc/nuts_classic/adapt_dense_e_nuts_classic.hpp b/src/stan/mcmc/hmc/nuts_classic/adapt_dense_e_nuts_classic.hpp index 5e646b73e83..dedc6bda832 100644 --- a/src/stan/mcmc/hmc/nuts_classic/adapt_dense_e_nuts_classic.hpp +++ b/src/stan/mcmc/hmc/nuts_classic/adapt_dense_e_nuts_classic.hpp @@ -31,13 +31,14 @@ class adapt_dense_e_nuts_classic : public dense_e_nuts_classic, Eigen::MatrixXd inv_metric; - bool update = this->covar_adaptation_.learn_covariance(inv_metric, this->z_.q); + bool update = this->covar_adaptation_.learn_covariance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); - this->z_.set_inv_metric(inv_metric); - + this->z_.set_inv_metric(inv_metric); + this->stepsize_adaptation_.set_mu(log(10 * this->nom_epsilon_)); this->stepsize_adaptation_.restart(); } diff --git a/src/stan/mcmc/hmc/nuts_classic/adapt_diag_e_nuts_classic.hpp b/src/stan/mcmc/hmc/nuts_classic/adapt_diag_e_nuts_classic.hpp index 4ff3322ff79..04635b9dbe0 100644 --- a/src/stan/mcmc/hmc/nuts_classic/adapt_diag_e_nuts_classic.hpp +++ b/src/stan/mcmc/hmc/nuts_classic/adapt_diag_e_nuts_classic.hpp @@ -31,14 +31,14 @@ class adapt_diag_e_nuts_classic : public diag_e_nuts_classic, s.accept_stat()); Eigen::VectorXd inv_metric; - + bool update = this->var_adaptation_.learn_variance(inv_metric, this->z_.q); if (update) { this->init_stepsize(logger); - this->z_.set_inv_metric(inv_metric); + this->z_.set_inv_metric(inv_metric); this->stepsize_adaptation_.set_mu(log(10 * this->nom_epsilon_)); this->stepsize_adaptation_.restart(); diff --git a/src/stan/mcmc/hmc/nuts_classic/diag_e_nuts_classic.hpp b/src/stan/mcmc/hmc/nuts_classic/diag_e_nuts_classic.hpp index 64f3f82ea33..b3f4e4c48d7 100644 --- a/src/stan/mcmc/hmc/nuts_classic/diag_e_nuts_classic.hpp +++ b/src/stan/mcmc/hmc/nuts_classic/diag_e_nuts_classic.hpp @@ -22,8 +22,10 @@ class diag_e_nuts_classic // since start.get_inv_metric() = finish.get_inv_metric() bool compute_criterion(ps_point& start, diag_e_point& finish, Eigen::VectorXd& rho) { - return finish.get_inv_metric().cwiseProduct(finish.p).dot(rho - finish.p) > 0 - && finish.get_inv_metric().cwiseProduct(start.p).dot(rho - start.p) > 0; + return finish.get_inv_metric().cwiseProduct(finish.p).dot(rho - finish.p) + > 0 + && finish.get_inv_metric().cwiseProduct(start.p).dot(rho - start.p) + > 0; } }; diff --git a/src/stan/mcmc/hmc/static/adapt_dense_e_static_hmc.hpp b/src/stan/mcmc/hmc/static/adapt_dense_e_static_hmc.hpp index 091735c631a..88c26549272 100644 --- a/src/stan/mcmc/hmc/static/adapt_dense_e_static_hmc.hpp +++ b/src/stan/mcmc/hmc/static/adapt_dense_e_static_hmc.hpp @@ -34,7 +34,8 @@ class adapt_dense_e_static_hmc : public dense_e_static_hmc, Eigen::MatrixXd inv_metric; - bool update = this->covar_adaptation_.learn_covariance(inv_metric, this->z_.q); + bool update = this->covar_adaptation_.learn_covariance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); diff --git a/src/stan/mcmc/hmc/static_uniform/adapt_dense_e_static_uniform.hpp b/src/stan/mcmc/hmc/static_uniform/adapt_dense_e_static_uniform.hpp index cc64ebbb51f..07f496afbe4 100644 --- a/src/stan/mcmc/hmc/static_uniform/adapt_dense_e_static_uniform.hpp +++ b/src/stan/mcmc/hmc/static_uniform/adapt_dense_e_static_uniform.hpp @@ -32,14 +32,15 @@ class adapt_dense_e_static_uniform s.accept_stat()); Eigen::MatrixXd inv_metric; - - bool update = this->covar_adaptation_.learn_covariance(inv_metric, this->z_.q); + + bool update = this->covar_adaptation_.learn_covariance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); - this->z_.set_inv_metric(inv_metric); - + this->z_.set_inv_metric(inv_metric); + this->stepsize_adaptation_.set_mu(log(10 * this->nom_epsilon_)); this->stepsize_adaptation_.restart(); } diff --git a/src/stan/mcmc/hmc/static_uniform/adapt_diag_e_static_uniform.hpp b/src/stan/mcmc/hmc/static_uniform/adapt_diag_e_static_uniform.hpp index d8345779dd1..de29674e675 100644 --- a/src/stan/mcmc/hmc/static_uniform/adapt_diag_e_static_uniform.hpp +++ b/src/stan/mcmc/hmc/static_uniform/adapt_diag_e_static_uniform.hpp @@ -32,13 +32,14 @@ class adapt_diag_e_static_uniform s.accept_stat()); Eigen::VectorXd inv_metric; - - bool update = this->var_adaptation_.learn_variance(inv_metric, this->z_.q); + + bool update = this->var_adaptation_.learn_variance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); - this->z_.set_inv_metric(inv_metric); - + this->z_.set_inv_metric(inv_metric); + this->stepsize_adaptation_.set_mu(log(10 * this->nom_epsilon_)); this->stepsize_adaptation_.restart(); } diff --git a/src/stan/mcmc/hmc/xhmc/adapt_dense_e_xhmc.hpp b/src/stan/mcmc/hmc/xhmc/adapt_dense_e_xhmc.hpp index 1ba8654090b..1ff6f41d9fb 100644 --- a/src/stan/mcmc/hmc/xhmc/adapt_dense_e_xhmc.hpp +++ b/src/stan/mcmc/hmc/xhmc/adapt_dense_e_xhmc.hpp @@ -30,14 +30,15 @@ class adapt_dense_e_xhmc : public dense_e_xhmc, s.accept_stat()); Eigen::MatrixXd inv_metric; - - bool update = this->covar_adaptation_.learn_covariance(inv_metric, this->z_.q); + + bool update = this->covar_adaptation_.learn_covariance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); - this->z_.set_inv_metric(inv_metric); - + this->z_.set_inv_metric(inv_metric); + this->stepsize_adaptation_.set_mu(log(10 * this->nom_epsilon_)); this->stepsize_adaptation_.restart(); } diff --git a/src/stan/mcmc/hmc/xhmc/adapt_diag_e_xhmc.hpp b/src/stan/mcmc/hmc/xhmc/adapt_diag_e_xhmc.hpp index 3c7b6e75a56..7eb3d488d66 100644 --- a/src/stan/mcmc/hmc/xhmc/adapt_diag_e_xhmc.hpp +++ b/src/stan/mcmc/hmc/xhmc/adapt_diag_e_xhmc.hpp @@ -30,13 +30,14 @@ class adapt_diag_e_xhmc : public diag_e_xhmc, s.accept_stat()); Eigen::VectorXd inv_metric; - - bool update = this->var_adaptation_.learn_variance(inv_metric, this->z_.q); + + bool update = this->var_adaptation_.learn_variance(inv_metric, + this->z_.q); if (update) { this->init_stepsize(logger); - this->z_.set_inv_metric(inv_metric); + this->z_.set_inv_metric(inv_metric); this->stepsize_adaptation_.set_mu(log(10 * this->nom_epsilon_)); this->stepsize_adaptation_.restart();