Skip to content

Commit

Permalink
Fixed lint issues (Issue #2881)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbales2 committed Oct 29, 2020
1 parent a182f78 commit 6f165f9
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 28 deletions.
3 changes: 2 additions & 1 deletion src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class dense_e_metric : public base_hamiltonian<Model, dense_e_point, BaseRNG> {
for (idx_t i = 0; i < u.size(); ++i)
u(i) = rand_dense_gaus();

z.p = z.get_transpose_llt_inv_metric().triangularView<Eigen::Upper>().solve(u);
z.p = z.get_transpose_llt_inv_metric().triangularView<Eigen::Upper>()
.solve(u);
}
};

Expand Down
5 changes: 3 additions & 2 deletions src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion src/stan/mcmc/hmc/nuts/adapt_dense_e_nuts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class adapt_dense_e_nuts : public dense_e_nuts<Model, BaseRNG>,

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);
Expand Down
3 changes: 2 additions & 1 deletion src/stan/mcmc/hmc/nuts/adapt_diag_e_nuts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class adapt_diag_e_nuts : public diag_e_nuts<Model, BaseRNG>,

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);
Expand Down
7 changes: 4 additions & 3 deletions src/stan/mcmc/hmc/nuts_classic/adapt_dense_e_nuts_classic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ class adapt_dense_e_nuts_classic : public dense_e_nuts_classic<Model, BaseRNG>,

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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/stan/mcmc/hmc/nuts_classic/adapt_diag_e_nuts_classic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class adapt_diag_e_nuts_classic : public diag_e_nuts_classic<Model, BaseRNG>,
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();
Expand Down
6 changes: 4 additions & 2 deletions src/stan/mcmc/hmc/nuts_classic/diag_e_nuts_classic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/stan/mcmc/hmc/static/adapt_dense_e_static_hmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class adapt_dense_e_static_hmc : public dense_e_static_hmc<Model, BaseRNG>,

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
9 changes: 5 additions & 4 deletions src/stan/mcmc/hmc/xhmc/adapt_dense_e_xhmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ class adapt_dense_e_xhmc : public dense_e_xhmc<Model, BaseRNG>,
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();
}
Expand Down
7 changes: 4 additions & 3 deletions src/stan/mcmc/hmc/xhmc/adapt_diag_e_xhmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ class adapt_diag_e_xhmc : public diag_e_xhmc<Model, BaseRNG>,
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();
Expand Down

0 comments on commit 6f165f9

Please sign in to comment.