Compile error with integrate_ode_rk45


#1

Any clues from this?

In file included from C:/Users/driver/Documents/R/win-library/3.5/BH/include/boost/config.hpp:39:0,
                 from C:/Users/driver/Documents/R/win-library/3.5/BH/include/boost/math/tools/config.hpp:13,
                 from C:/Users/driver/Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/core/var.hpp:7,
                 from C:/Users/driver/Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
                 from C:/Users/driver/Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/core.hpp:12,
                 from C:/Users/driver/Documents/R/win-library/3.5/StanHeaders/include/stan/math/rev/mat.hpp:4,
                 from C:/Users/driver/Documents/R/win-library/3.5/StanHeaders/include/stan/math.hpp:4,
                 from C:/Users/driver/Documents/R/win-library/3.5/StanHeaders/include/src/stan/model/model_header.hpp:4,
                 from file183061615e84.cpp:8:
C:/Users/driver/Documents/R/win-library/3.5/BH/include/boost/config/compiler/gcc.hpp:186:0: warning: "BOOST_NO_CXX11_RVALUE_REFERENCES" redefined
 #  define BOOST_NO_CXX11_RVALUE_REFERENCES
 ^
<command-line>:0:0: note: this is the location of the previous definition
file183061615e84.cpp: In member function 'T__ model1830ba7633f_ctsem_namespace::model1830ba7633f_ctsem::log_prob(std::vector<T2>&, std::vector<int>&, std::ostream*) const':
file183061615e84.cpp:3911:685: error: expected ')' before 'dTsmall'
                                 stan::math::assign(state, to_vector(stan::model::rvalue(integrate_ode_rk45(ode_functor__(), to_array_1d(state), 0.0, rep_array(get_base1(dTsmall,rowi,"dTsmall",1),2), theta, rep_array((sqrt(((((0.0 + nlatentpop) + ndiffusion) + (((2.0 / sqrt(((0.0 + nlatentpop) + ndynerror))) * 0.10000000000000001) * ((nlatentpop + ndiffusion) + 0.5))) - (nlatentpop + ndiffusion))) / sqrt(get_base1(dT,rowi,"dT",1))),1), xi, pstream__), stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(1), stan::model::nil_index_list())), "integrate_ode_rk45(ode_functor__(), to_array_1d(state), 0.0, rep_array(get_base1(dTsmall,rowi,"dTsmall",1),2), theta, rep_array((sqrt(((((0.0 + nlatentpop) + ndiffusion) + (((2.0 / sqrt(((0.0 + nlatentpop) + ndynerror))) * 0.10000000000000001) * ((nlatentpop + ndiffusion) + 0.5))) - (nlatentpop + ndiffusion))) / sqrt(get_base1(dT,rowi,"dT",1))),1), xi, pstream__)")));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^
file183061615e84.cpp: In member function 'void model1830ba7633f_ctsem_namespace::model1830ba7633f_ctsem::write_array(RNG&, std::vector<double>&, std::vector<int>&, std::vector<double>&, bool, bool, std::ostream*) const':
file183061615e84.cpp:5963:685: error: expected ')' before 'dTsmall'
                                 stan::math::assign(state, to_vector(stan::model::rvalue(integrate_ode_rk45(ode_functor__(), to_array_1d(state), 0.0, rep_array(get_base1(dTsmall,rowi,"dTsmall",1),2), theta, rep_array((sqrt(((((0.0 + nlatentpop) + ndiffusion) + (((2.0 / sqrt(((0.0 + nlatentpop) + ndynerror))) * 0.10000000000000001) * ((nlatentpop + ndiffusion) + 0.5))) - (nlatentpop + ndiffusion))) / sqrt(get_base1(dT,rowi,"dT",1))),1), xi, pstream__), stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(1), stan::model::nil_index_list())), "integrate_ode_rk45(ode_functor__(), to_array_1d(state), 0.0, rep_array(get_base1(dTsmall,rowi,"dTsmall",1),2), theta, rep_array((sqrt(((((0.0 + nlatentpop) + ndiffusion) + (((2.0 / sqrt(((0.0 + nlatentpop) + ndynerror))) * 0.10000000000000001) * ((nlatentpop + ndiffusion) + 0.5))) - (nlatentpop + ndiffusion))) / sqrt(get_base1(dT,rowi,"dT",1))),1), xi, pstream__)")));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^
file183061615e84.cpp:7711:693: error: expected ')' before 'dTsmall'
                                         stan::math::assign(state, to_vector(stan::model::rvalue(integrate_ode_rk45(ode_functor__(), to_array_1d(state), 0.0, rep_array(get_base1(dTsmall,rowi,"dTsmall",1),2), theta, rep_array((sqrt(((((0.0 + nlatentpop) + ndiffusion) + (((2.0 / sqrt(((0.0 + nlatentpop) + ndynerror))) * 0.10000000000000001) * ((nlatentpop + ndiffusion) + 0.5))) - (nlatentpop + ndiffusion))) / sqrt(get_base1(dT,rowi,"dT",1))),1), xi, pstream__), stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(1), stan::model::nil_index_list())), "integrate_ode_rk45(ode_functor__(), to_array_1d(state), 0.0, rep_array(get_base1(dTsmall,rowi,"dTsmall",1),2), theta, rep_array((sqrt(((((0.0 + nlatentpop) + ndiffusion) + (((2.0 / sqrt(((0.0 + nlatentpop) + ndynerror))) * 0.10000000000000001) * ((nlatentpop + ndiffusion) + 0.5))) - (nlatentpop + ndiffusion))) / sqrt(get_base1(dT,rowi,"dT",1))),1), xi, pstream__)")));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^
make: *** [C:/PROGRA~1/R/R-35~1.0/etc/x64/Makeconf:215: file183061615e84.o] Error 1

ERROR(s) during compilation: source code errors or compiler configuration errors!

#2

@Charles_Driver, thanks for posting. Can you also post your Stan program? It’s not enough just seeing the compiler error.

I’ve seen stuff like this and I’ve been meaning to invest time in creating minimal examples to file a bug report. Hopefully your Stan program will trigger my memory or it’ll show a different issue that should be fixed.


#3

The program is rather complex, but a MWE using rstan was easy to construct. replacing the two calls to data in the ode with numeric values like 1.0 avoids the compile error. I submitted an issue to github here: https://github.com/stan-dev/stan/issues/2605

sm<-c('
functions{
  real[] ode(real time, real[] state, real[] theta, real[] xr, int[] xi){
    return state;
  }
}
data{
  int ndatapoints;
  real dT[ndatapoints]; // time intervals
  real dTsmall[ndatapoints];
}
model{
  vector[2] state;
  real theta[1];
  state=to_vector(integrate_ode_rk45(ode, to_array_1d(state), 0.0, rep_array(dTsmall[1],1 ), 
    theta, rep_array(dT[1],1), rep_array(1,1))[1,]); 
}
')

library(rstan)

stan_model(model_code = sm)