Here’s what CmdStan does, still an error (and warning about integer division), but there’s a helpful set of messages… I can’t look at them now but maybe it helps someone. Definitely a bug if it translates but does not compile.
SPH-KSakrejdaL:l1 krzysztof$ make -C ~/packages/cmdstan-develop ~/Downloads/aslanidi
--- Translating Stan model to C++ code ---
bin/stanc /Users/krzysztof/Downloads/aslanidi.stan --o=/Users/krzysztof/Downloads/aslanidi.hpp
Model name=aslanidi_model
Input file=/Users/krzysztof/Downloads/aslanidi.stan
Output file=/Users/krzysztof/Downloads/aslanidi.hpp
DIAGNOSTIC(S) FROM PARSER:
Warning: integer division implicitly rounds to integer. Found int division: (left_ind + right_ind) / 2
Positive values rounded down, negative values rounded up or down in platform-dependent way.
--- Linking C++ model ---
g++ -I src -I stan/src -isystem stan/lib/stan_math/ -isystem stan/lib/stan_math/lib/eigen_3.2.9 -isystem stan/lib/stan_math/lib/boost_1.62.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -Wall -DEIGEN_NO_DEBUG -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DFUSION_MAX_VECTOR_SIZE=12 -DNO_FPRINTF_OUTPUT -pipe -Wno-unused-function -ftemplate-depth-256 -O3 -o /Users/krzysztof/Downloads/aslanidi src/cmdstan/main.cpp -include /Users/krzysztof/Downloads/aslanidi.hpp stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_cvodes.a
In file included from <built-in>:336:
In file included from <command line>:7:
In file included from /Users/krzysztof/Downloads/aslanidi.hpp:3:
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/mat.hpp:56:
stan/lib/stan_math/stan/math/rev/mat/functor/ode_system.hpp:53:15: error: no viable overloaded '='
dy_dt = f_(t, y, theta_, x_, x_int_, msgs_);
~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:96:9: note: in instantiation of member function
'stan::math::ode_system<aslanidi_model_namespace::deriv_aslanidi_functor__>::operator()' requested here
ode_system_(t, y_vec, dy_dt_vec);
^
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:68:23: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, double, double>::rhs' requested here
explicit_ode->rhs(NV_DATA_S(y), NV_DATA_S(ydot), t);
^
stan/lib/stan_math/stan/math/rev/mat/functor/integrate_ode_bdf.hpp:140:60: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, double, double>::ode_rhs' requested here
cvodes_check_flag(CVodeInit(cvodes_mem, &ode_data::ode_rhs,
^
/Users/krzysztof/Downloads/aslanidi.hpp:300:80: note: in instantiation of function template specialization
'stan::math::integrate_ode_bdf<aslanidi_model_namespace::deriv_aslanidi_functor__, double, double>' requested here
return stan::math::promote_scalar<fun_return_scalar_t__>(to_matrix(integrate_ode_bdf(deriv_aslanidi_functor__(...
^
/Users/krzysztof/Downloads/aslanidi.hpp:724:44: note: in instantiation of function template specialization
'aslanidi_model_namespace::solve_aslanidi_forced_ode<double, double, double, double>' requested here
stan::math::assign(I_temp, solve_aslanidi_forced_ode(ts,X0,theta,V, pstream__));
^
stan/src/stan/services/util/initialize.hpp:103:39: note: in instantiation of function template specialization
'aslanidi_model_namespace::aslanidi_model::log_prob<false, true, double>' requested here
log_prob = model.template log_prob<false, true>
^
stan/src/stan/services/diagnose/diagnose.hpp:54:19: note: in instantiation of function template specialization
'stan::services::util::initialize<aslanidi_model_namespace::aslanidi_model,
boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>,
boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
= util::initialize(model, init, rng, init_radius,
^
src/cmdstan/command.hpp:132:49: note: in instantiation of function template specialization
'stan::services::diagnose::diagnose<aslanidi_model_namespace::aslanidi_model>' requested here
return_code = stan::services::diagnose::diagnose(model,
^
src/cmdstan/main.cpp:8:21: note: in instantiation of function template specialization
'cmdstan::command<aslanidi_model_namespace::aslanidi_model>' requested here
return cmdstan::command<stan_model>(argc,argv);
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:552:13: note: candidate function not viable: no known
conversion from 'typename boost::math::tools::promote_args<double, double, double, double>::type' (aka 'double') to 'const
std::__1::vector<double, std::__1::allocator<double> >' for 1st argument
vector& operator=(const vector& __x);
^
In file included from <built-in>:336:
In file included from <command line>:7:
In file included from /Users/krzysztof/Downloads/aslanidi.hpp:3:
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/mat.hpp:56:
stan/lib/stan_math/stan/math/rev/mat/functor/ode_system.hpp:79:23: error: no viable conversion from 'typename
boost::math::tools::promote_args<double, var, double, double>::type' (aka 'stan::math::var') to 'vector<stan::math::var>'
vector<var> dy_dt_var = f_(t, y_var, theta_, x_, x_int_, msgs_);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:104:21: note: in instantiation of function template
specialization 'stan::math::ode_system<aslanidi_model_namespace::deriv_aslanidi_functor__>::jacobian<Eigen::Matrix<double,
-1, 1, 0, -1, 1>, Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0> > >' requested here
ode_system_.jacobian(t, y_vec, fy, Jy_map);
^
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:89:30: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, double, double>::dense_jacobian' requested
here
return explicit_ode->dense_jacobian(NV_DATA_S(y), J, t);
^
stan/lib/stan_math/stan/math/rev/mat/functor/integrate_ode_bdf.hpp:157:57: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, double, double>::dense_jacobian' requested
here
&ode_data::dense_jacobian),
^
/Users/krzysztof/Downloads/aslanidi.hpp:300:80: note: in instantiation of function template specialization
'stan::math::integrate_ode_bdf<aslanidi_model_namespace::deriv_aslanidi_functor__, double, double>' requested here
return stan::math::promote_scalar<fun_return_scalar_t__>(to_matrix(integrate_ode_bdf(deriv_aslanidi_functor__(...
^
/Users/krzysztof/Downloads/aslanidi.hpp:724:44: note: in instantiation of function template specialization
'aslanidi_model_namespace::solve_aslanidi_forced_ode<double, double, double, double>' requested here
stan::math::assign(I_temp, solve_aslanidi_forced_ode(ts,X0,theta,V, pstream__));
^
stan/src/stan/services/util/initialize.hpp:103:39: note: in instantiation of function template specialization
'aslanidi_model_namespace::aslanidi_model::log_prob<false, true, double>' requested here
log_prob = model.template log_prob<false, true>
^
stan/src/stan/services/diagnose/diagnose.hpp:54:19: note: in instantiation of function template specialization
'stan::services::util::initialize<aslanidi_model_namespace::aslanidi_model,
boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>,
boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
= util::initialize(model, init, rng, init_radius,
^
src/cmdstan/command.hpp:132:49: note: in instantiation of function template specialization
'stan::services::diagnose::diagnose<aslanidi_model_namespace::aslanidi_model>' requested here
return_code = stan::services::diagnose::diagnose(model,
^
src/cmdstan/main.cpp:8:21: note: in instantiation of function template specialization
'cmdstan::command<aslanidi_model_namespace::aslanidi_model>' requested here
return cmdstan::command<stan_model>(argc,argv);
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:549:5: note: candidate constructor not viable: no known
conversion from 'typename boost::math::tools::promote_args<double, var, double, double>::type' (aka 'stan::math::var') to
'const std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> > &' for 1st argument
vector(const vector& __x);
^
In file included from <built-in>:336:
In file included from <command line>:7:
In file included from /Users/krzysztof/Downloads/aslanidi.hpp:3:
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/mat.hpp:58:
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:104:21: error: no matching member function for call to 'jacobian'
ode_system_.jacobian(t, y_vec, fy, Jy_map);
~~~~~~~~~~~~^~~~~~~~
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:89:30: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, stan::math::var,
stan::math::var>::dense_jacobian' requested here
return explicit_ode->dense_jacobian(NV_DATA_S(y), J, t);
^
stan/lib/stan_math/stan/math/rev/mat/functor/integrate_ode_bdf.hpp:157:57: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, stan::math::var,
stan::math::var>::dense_jacobian' requested here
&ode_data::dense_jacobian),
^
/Users/krzysztof/Downloads/aslanidi.hpp:300:80: note: in instantiation of function template specialization
'stan::math::integrate_ode_bdf<aslanidi_model_namespace::deriv_aslanidi_functor__, stan::math::var, stan::math::var>'
requested here
return stan::math::promote_scalar<fun_return_scalar_t__>(to_matrix(integrate_ode_bdf(deriv_aslanidi_functor__(...
^
/Users/krzysztof/Downloads/aslanidi.hpp:724:44: note: in instantiation of function template specialization
'aslanidi_model_namespace::solve_aslanidi_forced_ode<double, stan::math::var, stan::math::var, double>' requested here
stan::math::assign(I_temp, solve_aslanidi_forced_ode(ts,X0,theta,V, pstream__));
^
stan/src/stan/model/log_prob_grad.hpp:44:28: note: in instantiation of function template specialization
'aslanidi_model_namespace::aslanidi_model::log_prob<true, true, stan::math::var>' requested here
= model.template log_prob<propto, jacobian_adjust_transform>
^
stan/src/stan/services/util/initialize.hpp:126:35: note: in instantiation of function template specialization
'stan::model::log_prob_grad<true, true, aslanidi_model_namespace::aslanidi_model>' requested here
log_prob = stan::model::log_prob_grad<true, true>
^
stan/src/stan/services/diagnose/diagnose.hpp:54:19: note: in instantiation of function template specialization
'stan::services::util::initialize<aslanidi_model_namespace::aslanidi_model,
boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>,
boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
= util::initialize(model, init, rng, init_radius,
^
src/cmdstan/command.hpp:132:49: note: in instantiation of function template specialization
'stan::services::diagnose::diagnose<aslanidi_model_namespace::aslanidi_model>' requested here
return_code = stan::services::diagnose::diagnose(model,
^
src/cmdstan/main.cpp:8:21: note: in instantiation of function template specialization
'cmdstan::command<aslanidi_model_namespace::aslanidi_model>' requested here
return cmdstan::command<stan_model>(argc,argv);
^
stan/lib/stan_math/stan/math/rev/mat/functor/ode_system.hpp:67:12: note: candidate template ignored: substitution failure [with
Derived1 = Eigen::Matrix<double, -1, 1, 0, -1, 1>, Derived2 = Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0,
Eigen::Stride<0, 0> >]
void jacobian(double t, const std::vector<double>& y,
^
stan/lib/stan_math/stan/math/rev/mat/functor/ode_system.hpp:106:12: note: candidate function template not viable: requires 5
arguments, but 4 were provided
void jacobian(double t, const std::vector<double>& y,
^
stan/lib/stan_math/stan/math/rev/mat/functor/ode_system.hpp:125:23: error: no viable conversion from 'typename
boost::math::tools::promote_args<double, var, var, double>::type' (aka 'stan::math::var') to 'vector<stan::math::var>'
vector<var> dy_dt_var = f_(t, y_var, theta_var, x_, x_int_, msgs_);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:147:21: note: in instantiation of function template
specialization 'stan::math::ode_system<aslanidi_model_namespace::deriv_aslanidi_functor__>::jacobian<Eigen::Matrix<double,
-1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >' requested here
ode_system_.jacobian(t, y, dy_dt, Jy, Jtheta);
^
stan/lib/stan_math/stan/math/rev/mat/functor/cvodes_ode_data.hpp:79:23: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, stan::math::var,
stan::math::var>::rhs_sens' requested here
explicit_ode->rhs_sens(explicit_ode->y0_, explicit_ode->theta_,
^
stan/lib/stan_math/stan/math/rev/mat/functor/integrate_ode_bdf.hpp:174:54: note: in instantiation of member function
'stan::math::cvodes_ode_data<aslanidi_model_namespace::deriv_aslanidi_functor__, stan::math::var,
stan::math::var>::ode_rhs_sens' requested here
&ode_data::ode_rhs_sens,
^
/Users/krzysztof/Downloads/aslanidi.hpp:300:80: note: in instantiation of function template specialization
'stan::math::integrate_ode_bdf<aslanidi_model_namespace::deriv_aslanidi_functor__, stan::math::var, stan::math::var>'
requested here
return stan::math::promote_scalar<fun_return_scalar_t__>(to_matrix(integrate_ode_bdf(deriv_aslanidi_functor__(...
^
/Users/krzysztof/Downloads/aslanidi.hpp:724:44: note: in instantiation of function template specialization
'aslanidi_model_namespace::solve_aslanidi_forced_ode<double, stan::math::var, stan::math::var, double>' requested here
stan::math::assign(I_temp, solve_aslanidi_forced_ode(ts,X0,theta,V, pstream__));
^
stan/src/stan/model/log_prob_grad.hpp:44:28: note: in instantiation of function template specialization
'aslanidi_model_namespace::aslanidi_model::log_prob<true, true, stan::math::var>' requested here
= model.template log_prob<propto, jacobian_adjust_transform>
^
stan/src/stan/services/util/initialize.hpp:126:35: note: in instantiation of function template specialization
'stan::model::log_prob_grad<true, true, aslanidi_model_namespace::aslanidi_model>' requested here
log_prob = stan::model::log_prob_grad<true, true>
^
stan/src/stan/services/diagnose/diagnose.hpp:54:19: note: in instantiation of function template specialization
'stan::services::util::initialize<aslanidi_model_namespace::aslanidi_model,
boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>,
boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
= util::initialize(model, init, rng, init_radius,
^
src/cmdstan/command.hpp:132:49: note: in instantiation of function template specialization
'stan::services::diagnose::diagnose<aslanidi_model_namespace::aslanidi_model>' requested here
return_code = stan::services::diagnose::diagnose(model,
^
src/cmdstan/main.cpp:8:21: note: in instantiation of function template specialization
'cmdstan::command<aslanidi_model_namespace::aslanidi_model>' requested here
return cmdstan::command<stan_model>(argc,argv);
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:549:5: note: candidate constructor not viable: no known
conversion from 'typename boost::math::tools::promote_args<double, var, var, double>::type' (aka 'stan::math::var') to
'const std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> > &' for 1st argument
vector(const vector& __x);
^
4 errors generated.
make: *** [/Users/krzysztof/Downloads/aslanidi] Error 1