Skip to content

Commit 522a34f

Browse files
committed
skip stepsize adaptation in zero dimensions
1 parent e138b71 commit 522a34f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/stan/mcmc/hmc/base_hmc.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ class base_hmc : public base_mcmc {
8181
void init_stepsize(callbacks::logger& logger) {
8282
ps_point z_init(this->z_);
8383

84+
// step size is meaningless in zero-dimensional space
85+
if (this->z_.q.size() == 0) {
86+
this->nom_epsilon_ = std::numeric_limits<double>::quiet_NaN();
87+
return;
88+
}
89+
8490
// Skip initialization for extreme step sizes
8591
if (this->nom_epsilon_ == 0 || this->nom_epsilon_ > 1e7
8692
|| std::isnan(this->nom_epsilon_))

0 commit comments

Comments
 (0)