Hi,
I’m trying to develop an ODE model which will eventually use values from an external C++ library to inform the derivatives (and gradients of this function). Hence, I’ve started by writing a very simple ODE model with the derivative function defined in an external C++ function.
I’ve successfully gotten the model to compile with gradients computed with autodiff, and have am now attempting to also manually specify the gradients in the C++ function using make_callback_var
. However I’m a bit unsure how to assign the gradients of a vector-valued function wrt the vector input and have gotten the following error related to could not convert ‘stan::math::make_callback_var<Eigen::Matrix<double, -1, 1>& ... from ‘stan::math::var_value<Eigen::Matrix<double, -1, 1> >’ to ‘Eigen::Matrix<stan::math::var_value<double>, -1, 1>’
.
Full error log is below, with Stan model and C++ header.
Any ideas what I might be doing wrong?
Thanks,
Alex
--- Compiling, linking C++ code ---
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I stan/lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.4.0 -I stan/lib/stan_math/lib/boost_1.78.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials -DBOOST_DISABLE_ASSERTS -c -Wno-ignored-attributes -include /home/alecks/git/MinimalODEExample/odefunc.hpp -x c++ -o /home/alecks/git/MinimalODEExample/minimalODEExampleExternal.o /home/alecks/git/MinimalODEExample/minimalODEExampleExternal.hpp
In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/multi_array/multi_array_ref.hpp:32,
from stan/lib/stan_math/lib/boost_1.78.0/boost/multi_array.hpp:34,
from stan/lib/stan_math/lib/boost_1.78.0/boost/numeric/odeint/algebra/multi_array_algebra.hpp:22,
from stan/lib/stan_math/lib/boost_1.78.0/boost/numeric/odeint.hpp:63,
from stan/lib/stan_math/stan/math/prim/functor/ode_rk45.hpp:9,
from stan/lib/stan_math/stan/math/prim/functor/integrate_ode_rk45.hpp:6,
from stan/lib/stan_math/stan/math/prim/functor.hpp:15,
from stan/lib/stan_math/stan/math/rev/fun.hpp:198,
from stan/lib/stan_math/stan/math/rev.hpp:10,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4,
from /home/alecks/git/MinimalODEExample/odefunc.hpp:3,
from <command-line>:
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:180:45: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
180 | : public boost::functional::detail::unary_function<typename unary_traits<Predicate>::argument_type,bool>
| ^~~~~~~~~~~~~~
In file included from /usr/include/c++/13.1.1/string:49,
from /usr/include/c++/13.1.1/bits/locale_classes.h:40,
from /usr/include/c++/13.1.1/bits/ios_base.h:41,
from /usr/include/c++/13.1.1/ios:44,
from /usr/include/c++/13.1.1/istream:40,
from /usr/include/c++/13.1.1/sstream:40,
from /usr/include/c++/13.1.1/complex:45,
from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:50,
from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Dense:1,
from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22,
from stan/lib/stan_math/stan/math/rev.hpp:4:
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:214:45: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
214 | : public boost::functional::detail::binary_function<
| ^~~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:252:45: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
252 | : public boost::functional::detail::unary_function<
| ^~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:299:45: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
299 | : public boost::functional::detail::unary_function<
| ^~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:345:57: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
345 | class mem_fun_t : public boost::functional::detail::unary_function<T*, S>
| ^~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:361:58: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
361 | class mem_fun1_t : public boost::functional::detail::binary_function<T*, A, S>
| ^~~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:377:63: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
377 | class const_mem_fun_t : public boost::functional::detail::unary_function<const T*, S>
| ^~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:393:64: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
393 | class const_mem_fun1_t : public boost::functional::detail::binary_function<const T*, A, S>
| ^~~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:438:61: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
438 | class mem_fun_ref_t : public boost::functional::detail::unary_function<T&, S>
| ^~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:454:62: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
454 | class mem_fun1_ref_t : public boost::functional::detail::binary_function<T&, A, S>
| ^~~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:470:67: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
470 | class const_mem_fun_ref_t : public boost::functional::detail::unary_function<const T&, S>
| ^~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:487:68: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
487 | class const_mem_fun1_ref_t : public boost::functional::detail::binary_function<const T&, A, S>
| ^~~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:533:73: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
533 | class pointer_to_unary_function : public boost::functional::detail::unary_function<Arg,Result>
| ^~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:117:12: note: declared here
117 | struct unary_function
| ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:557:74: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
557 | class pointer_to_binary_function : public boost::functional::detail::binary_function<Arg1,Arg2,Result>
| ^~~~~~~~~~~~~~~
/usr/include/c++/13.1.1/bits/stl_function.h:131:12: note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
/home/alecks/git/MinimalODEExample/odefunc.hpp: In instantiation of ‘Eigen::Matrix<typename boost::math::tools::promote_args<typename stan::base_type<T>::type>::type, -1, 1> minimalODEExampleExternal_model_namespace::odefunc(const double&, const T1__&, const double&, std::ostream*) [with T1__ = Eigen::Matrix<stan::math::var_value<double>, -1, 1>; stan::require_all_t<stan::is_col_vector<T>, stan::is_vt_not_complex<T1__> >* <anonymous> = 0; typename boost::math::tools::promote_args<typename stan::base_type<T>::type>::type = stan::math::var_value<double>; typename stan::base_type<T>::type = stan::math::var_value<double>; std::ostream = std::basic_ostream<char>]’:
/home/alecks/git/MinimalODEExample/minimalODEExampleExternal.hpp:38:0: required from ‘Eigen::Matrix<typename boost::math::tools::promote_args<T0__, typename stan::base_type<T1__, void>::type, T2__>::type, -1, 1> minimalODEExampleExternal_model_namespace::odefunc_variadic2_functor__::operator()(const T0__&, const T1__&, std::ostream*, const T2__&) const [with T0__ = double; T1__ = Eigen::Matrix<stan::math::var_value<double>, -1, 1>; T2__ = double; stan::require_all_t<stan::is_stan_scalar<Var1>, stan::is_col_vector<Col>, stan::is_vt_not_complex<T1__>, stan::is_stan_scalar<T2__> >* <anonymous> = 0; typename boost::math::tools::promote_args<T0__, typename stan::base_type<T1__, void>::type, T2__>::type = stan::math::var_value<double>; typename stan::base_type<T1__, void>::type = stan::math::var_value<double>; std::ostream = std::basic_ostream<char>]’
stan/lib/stan_math/stan/math/rev/functor/coupled_ode_system.hpp:130:40: required from ‘stan::math::coupled_ode_system_impl<false, minimalODEExampleExternal_model_namespace::odefunc_variadic2_functor__, stan::math::var_value<double>, const double&>::operator()(const std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, double)::<lambda(auto:616&& ...)> [with auto:616 = {const double&}]’
stan/lib/stan_math/stan/math/prim/functor/apply.hpp:26:11: required from ‘constexpr decltype(auto) stan::math::internal::apply_impl(F&&, Tuple&&, std::index_sequence<I ...>) [with F = stan::math::coupled_ode_system_impl<false, minimalODEExampleExternal_model_namespace::odefunc_variadic2_functor__, stan::math::var_value<double>, const double&>::operator()(const std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, double)::<lambda(auto:616&& ...)>; Tuple = std::tuple<const double&>&; long unsigned int ...I = {0}; std::index_sequence<I ...> = std::integer_sequence<long unsigned int, 0>]’
stan/lib/stan_math/stan/math/prim/functor/apply.hpp:44:30: required from ‘constexpr decltype(auto) stan::math::apply(F&&, Tuple&&) [with F = coupled_ode_system_impl<false, minimalODEExampleExternal_model_namespace::odefunc_variadic2_functor__, var_value<double>, const double&>::operator()(const std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, double)::<lambda(auto:616&& ...)>; Tuple = std::tuple<const double&>&]’
stan/lib/stan_math/stan/math/rev/functor/coupled_ode_system.hpp:129:67: required from ‘void stan::math::coupled_ode_system_impl<false, F, T_y0, Args ...>::operator()(const std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, double) [with F = minimalODEExampleExternal_model_namespace::odefunc_variadic2_functor__; T_y0 = stan::math::var_value<double>; Args = {const double&}]’
stan/lib/stan_math/lib/boost_1.78.0/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp:329:16: [ skipping 4 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
stan/lib/stan_math/stan/math/prim/functor/ode_rk45.hpp:145:20: required from ‘std::vector<Eigen::Matrix<typename stan::return_type<T_y0, T_t0, T_ts, Args ...>::type, -1, 1> > stan::math::ode_rk45_tol_impl(const char*, const F&, const T_y0&, T_t0, const std::vector<T_l>&, double, double, long int, std::ostream*, const Args& ...) [with F = minimalODEExampleExternal_model_namespace::odefunc_variadic2_functor__; T_y0 = Eigen::Matrix<var_value<double>, -1, 1>; T_t0 = double; T_ts = double; Args = {double}; stan::require_eigen_vector_t<T_CPCs>* <anonymous> = 0; typename stan::return_type<T_y0, T_t0, T_ts, Args ...>::type = var_value<double>; std::ostream = std::basic_ostream<char>]’
stan/lib/stan_math/stan/math/prim/functor/ode_rk45.hpp:253:27: required from ‘std::vector<Eigen::Matrix<typename stan::return_type<T_y0, T_t0, T_ts, Args ...>::type, -1, 1> > stan::math::ode_rk45(const F&, const T_y0&, T_t0, const std::vector<T_l>&, std::ostream*, const Args& ...) [with F = minimalODEExampleExternal_model_namespace::odefunc_variadic2_functor__; T_y0 = Eigen::Matrix<var_value<double>, -1, 1>; T_t0 = double; T_ts = double; Args = {double}; stan::require_eigen_vector_t<T_CPCs>* <anonymous> = 0; typename stan::return_type<T_y0, T_t0, T_ts, Args ...>::type = var_value<double>; std::ostream = std::basic_ostream<char>]’
/home/alecks/git/MinimalODEExample/minimalODEExampleExternal.hpp:297:0: required from ‘stan::scalar_type_t<T2> minimalODEExampleExternal_model_namespace::minimalODEExampleExternal_model::log_prob_impl(VecR&, VecI&, std::ostream*) const [with bool propto__ = false; bool jacobian__ = false; VecR = Eigen::Matrix<stan::math::var_value<double>, -1, 1>; VecI = Eigen::Matrix<int, -1, 1>; stan::require_vector_like_t<VecR>* <anonymous> = 0; stan::require_vector_like_vt<std::is_integral, VecI>* <anonymous> = 0; stan::require_st_var<VecR>* <anonymous> = 0; stan::scalar_type_t<T2> = stan::math::var_value<double>; std::ostream = std::basic_ostream<char>]’
/home/alecks/git/MinimalODEExample/minimalODEExampleExternal.hpp:543:0: required from ‘T_ minimalODEExampleExternal_model_namespace::minimalODEExampleExternal_model::log_prob(Eigen::Matrix<T_job_param, -1, 1>&, std::ostream*) const [with bool propto__ = false; bool jacobian__ = false; T_ = stan::math::var_value<double>; std::ostream = std::basic_ostream<char>]’
stan/src/stan/model/model_base_crtp.hpp:98:0: required from ‘stan::math::var stan::model::model_base_crtp<M>::log_prob(Eigen::Matrix<stan::math::var_value<double>, -1, 1>&, std::ostream*) const [with M = minimalODEExampleExternal_model_namespace::minimalODEExampleExternal_model; stan::math::var = stan::math::var_value<double>; std::ostream = std::basic_ostream<char>]’
stan/src/stan/model/model_base_crtp.hpp:96:0: required from here
/home/alecks/git/MinimalODEExample/odefunc.hpp:38: error: could not convert ‘stan::math::make_callback_var<Eigen::Matrix<double, -1, 1>&, minimalODEExampleExternal_model_namespace::odefunc<Eigen::Matrix<stan::math::var_value<double>, -1, 1> >(const double&, const Eigen::Matrix<stan::math::var_value<double>, -1, 1>&, const double&, std::ostream*)::<lambda(auto:660&)> >(dydt, <lambda closure object>minimalODEExampleExternal_model_namespace::odefunc<Eigen::Matrix<stan::math::var_value<double>, -1, 1> >(const double&, const Eigen::Matrix<stan::math::var_value<double>, -1, 1>&, const double&, std::ostream*)::<lambda(auto:660&)>{stan::math::arena_matrix<Eigen::Matrix<stan::math::var_value<double>, -1, 1> >(y_arena), Eigen::Matrix<double, -1, 1>(jacobian)})’ from ‘stan::math::var_value<Eigen::Matrix<double, -1, 1> >’ to ‘Eigen::Matrix<stan::math::var_value<double>, -1, 1>’
38 | return stan::math::make_callback_var(dydt, [y_arena, jacobian](auto& res){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 | y_arena.adj() += jacobian.transpose() * res.adj();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40 | });
|
/home/alecks/git/MinimalODEExample/odefunc.hpp: In instantiation of ‘minimalODEExampleExternal_model_namespace::odefunc<Eigen::Matrix<stan::math::var_value<double>, -1, 1> >(const double&, const Eigen::Matrix<stan::math::var_value<double>, -1, 1>&, const double&, std::ostream*)::<lambda(auto:660&)> [with auto:660 = stan::math::internal::callback_vari<Eigen::Matrix<double, -1, 1>, minimalODEExampleExternal_model_namespace::odefunc<Eigen::Matrix<stan::math::var_value<double>, -1, 1> >(const double&, const Eigen::Matrix<stan::math::var_value<double>, -1, 1>&, const double&, std::ostream*)::<lambda(auto:660&)> >]’:
stan/lib/stan_math/stan/math/rev/core/callback_vari.hpp:21:43: required from ‘void stan::math::internal::callback_vari<T, F>::chain() [with T = Eigen::Matrix<double, -1, 1>; F = minimalODEExampleExternal_model_namespace::odefunc<Eigen::Matrix<stan::math::var_value<double>, -1, 1> >(const double&, const Eigen::Matrix<stan::math::var_value<double>, -1, 1>&, const double&, std::ostream*)::<lambda(auto:660&)>]’
stan/lib/stan_math/stan/math/rev/core/callback_vari.hpp:21:15: required from here
/home/alecks/git/MinimalODEExample/odefunc.hpp:39: error: no match for ‘operator+=’ (operand types are ‘const Eigen::CwiseUnaryOp<Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >::adj_Op, const Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >’ and ‘const Eigen::Product<Eigen::Transpose<const Eigen::Matrix<double, -1, 1> >, Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >, 0>’)
39 | y_arena.adj() += jacobian.transpose() * res.adj();
|
In file included from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:274:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/MatrixBase.h:493:46: note: candidate: ‘template<class OtherDerived> Derived& Eigen::MatrixBase<Derived>::operator+=(const Eigen::ArrayBase<OtherDerived>&) [with Derived = Eigen::CwiseUnaryOp<Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >::adj_Op, const Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >]’
493 | template<typename OtherDerived> Derived& operator+=(const ArrayBase<OtherDerived>& )
| ^~~~~~~~
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/MatrixBase.h:493:46: note: template argument deduction/substitution failed:
/home/alecks/git/MinimalODEExample/odefunc.hpp:39: note: ‘const Eigen::Product<Eigen::Transpose<const Eigen::Matrix<double, -1, 1> >, Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >, 0>’ is not derived from ‘const Eigen::ArrayBase<Derived>’
39 | y_arena.adj() += jacobian.transpose() * res.adj();
|
In file included from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:299:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/CwiseBinaryOp.h:175:1: note: candidate: ‘Derived& Eigen::MatrixBase<Derived>::operator+=(const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = Eigen::Product<Eigen::Transpose<const Eigen::Matrix<double, -1, 1> >, Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >, 0>; Derived = Eigen::CwiseUnaryOp<Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >::adj_Op, const Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >]’ (near match)
175 | MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
| ^~~~~~~~~~~~~~~~~~~
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/CwiseBinaryOp.h:175:1: note: passing ‘const Eigen::CwiseUnaryOp<Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >::adj_Op, const Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >*’ as ‘this’ argument discards qualifiers
In file included from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:275:
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/EigenBase.h:143:10: note: candidate: ‘Derived& Eigen::DenseBase<Derived>::operator+=(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived = Eigen::Product<Eigen::Transpose<const Eigen::Matrix<double, -1, 1> >, Eigen::Map<Eigen::Matrix<double, -1, 1>, 0, Eigen::Stride<0, 0> >, 0>; Derived = Eigen::CwiseUnaryOp<Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >::adj_Op, const Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >]’ (near match)
143 | Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived> &other)
| ^~~~~~~~~~~~~~~~~~
stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/EigenBase.h:143:10: note: passing ‘const Eigen::CwiseUnaryOp<Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >::adj_Op, const Eigen::Map<Eigen::Matrix<stan::math::var_value<double>, -1, 1>, 0, Eigen::Stride<0, 0> > >*’ as ‘this’ argument discards qualifiers
make: *** [make/program:58: /home/alecks/git/MinimalODEExample/minimalODEExampleExternal] Error 1
minimalODEExampleExternal.stan (559 Bytes)
odefunc.hpp (2.3 KB)