-
-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
Description
Initially reported stan-dev/cmdstan#1299
This stan code:
parameters {
vector[1] x;
}
transformed parameters {
vector[1] theta = 1 * x;
}
model {
target += theta[1]; # using theta here seems necessary for the bug
}When compiled with --Oexperimental, creates this C++:
double lcm_sym8__;
Eigen::Matrix<local_scalar_t__,-1,1> lcm_sym7__;
current_statement__ = 1;
auto x =
in__.template read<
stan::math::var_value<Eigen::Matrix<double,-1,1>>>(1);
stan::math::var_value<Eigen::Matrix<double,-1,1>> theta =
stan::math::var_value<Eigen::Matrix<double,-1,1>>(Eigen::Matrix<double,-1,1>::Constant(1,
std::numeric_limits<double>::quiet_NaN(
)));
stan::model::assign(lcm_sym7__, stan::math::multiply(1, x),
"assigning variable lcm_sym7__");The assign here fails because lcm_sym7__ is AoS, but x (and therefor the return of multiply) is SoA.