As mentioned at the last Stan meeting, this is the error that did not quite get caught by the unit test:
line 86 of algebra_solver.hpp
:
theta_(i) = var(new vari(theta_d(i), false));
If the second argument is true instead of false, the unit test sometimes passes and sometimes fails (with no informative error – usually happens when the C++ code breaks, a typical example being a segmentation fault). The non-systematic nature of the error leads me to think there is something off with memory allocation.
Here’s the vari constructor:
vari(double x, bool stacked):
val_(x),
adj_(0.0) {
if (stacked)
ChainableStack::var_stack_.push_back(this);
else
ChainableStack::var_nochain_stack_.push_back(this);
}
The code works fine when stacked = false, so no action required, but I wanted to present an error a unit test may fail to pick up on.