rev/fun/orderec_constrain.hpp
is failing header tests on my machine. I can’t tell why because everyting involved in the function is a double
value where the test is failing with this error:
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -I lib/tbb_2019_U8/include -O0 -I . -I lib/eigen_3.3.3 -I lib/boost_1.69.0 -I lib/sundials_4.1.0/include -DBOOST_DISABLE_ASSERTS -c -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -I lib/tbb_2019_U8/include -O0 -I . -I lib/eigen_3.3.3 -I lib/boost_1.69.0 -I lib/sundials_4.1.0/include -O0 -include stan/math/rev/mat/fun/cholesky_decompose.hpp test/dummy.cpp -o /dev/null
In file included from <built-in>:1:
./stan/math/rev/mat/fun/ordered_constrain.hpp:44:23: error: assigning to 'double' from incompatible type
'stan::math::var'
exp_x_[n - 1] = exp(x[n]);
^~~~~~~~~
1 error generated.
The function hwere it’ breaking is here, with the relevant line highlighted:
template <std::size_t size>
Eigen::VectorXd operator()(const std::array<bool, size>& needs_adj,
const Eigen::VectorXd& x) {
N_ = x.size();
Eigen::Matrix<double, Eigen::Dynamic, 1> y(N_);
if (N_ == 0) {
return y;
}
exp_x_ = ChainableStack::instance_->memalloc_.alloc_array<double>(N_ - 1);
y[0] = x[0];
for (int n = 1; n < N_; ++n) {
exp_x_[n - 1] = exp(x[n]); // ***** error is here on line 44 *****
y[n] = y[n - 1] + exp_x_[n - 1];
}
return y;
}
Given everythnig here is double
, where is the error coming from?
I’m pinging the devs who’ve touched this recently—it’s compltely different than when I originally wrote it: @bbbales2, @seantalts, @syclik, and @andrjohns and @stevebronder . It now involves a class and some complicated interaction with template parameters.