[R-sig-dyn-mod] deSolve with compiled code and varying size of parms

Rampal S. Etienne rampaletienne at gmail.com
Wed Mar 29 10:14:34 CEST 2017


Thanks for the quick reply. However, when I run this code, I get loads
of errors. See below. Similar errors are obtained when running the
examples in the odeintr documentation (e.g. logistic). I updated R,
RStudio and Rtools, but to no avail.

Also, how does the parameter N in sys get specified?

RSE


g++ -m64 -std=c++0x -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG     -I"C:/PROGRA~1/R/R-devel/library/Rcpp/include" -I"C:/PROGRA~1/R/R-devel/library/odeintr/include" -I"C:/PROGRA~1/R/R-devel/library/BH/include" -I"C:/Users/p223208/AppData/Local/Temp/RtmpCsE4eO"  -I"d:/RCompile/r-compiling/local/local320/include"     -O2 -Wall  -mtune=core2 -c file3670a102674.cpp -o file3670a102674.o
In file included from C:/PROGRA~1/R/R-devel/library/BH/include/boost/fusion/view/zip_view/zip_view.hpp:13:0,
                 from C:/PROGRA~1/R/R-devel/library/BH/include/boost/fusion/view/zip_view.hpp:12,
                 from C:/PROGRA~1/R/R-devel/library/BH/include/boost/fusion/include/zip_view.hpp:11,
                 from C:/PROGRA~1/R/R-devel/library/BH/include/boost/numeric/odeint/util/resize.hpp:26,
                 from C:/PROGRA~1/R/R-devel/library/BH/include/boost/numeric/odeint/util/state_wrapper.hpp:26,
                 from C:/PROGRA~1/R/R-devel/library/BH/include/boost/numeric/odeint/util/ublas_wrapper.hpp:33,
                 from C:/PROGRA~1/R/R-devel/library/BH/include/boost/numeric/odeint.hpp:25,
                 from file3670a102674.cpp:10:
C:/PROGRA~1/R/R-devel/library/BH/include/boost/fusion/support/unused.hpp: In member function 'const boost::fusion::unused_type& boost::fusion::unused_type::operator=(const boost::fusion::unused_type&) const':
C:/PROGRA~1/R/R-devel/library/BH/include/boost/fusion/support/unused.hpp:57:9: error: 'this' is not a potential constant expression
C:/PROGRA~1/R/R-devel/library/BH/include/boost/fusion/support/unused.hpp: At global scope:
C:/PROGRA~1/R/R-devel/library/BH/include/boost/fusion/support/unused.hpp:67:39: error: both 'const' and 'constexpr' cannot be used here
file3670a102674.cpp: In function 'void odeintr::sys(odeintr::state_type, odeintr::state_type&, double)':
file3670a102674.cpp:39:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
file3670a102674.cpp:42:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
file3670a102674.cpp: In function 'void odeintr::obs(odeintr::state_type, double)':
file3670a102674.cpp:51:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
file3670a102674.cpp: In function 'Rcpp::List test_get_output()':
file3670a102674.cpp:70:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
file3670a102674.cpp:72:36: error: 'to_string' is not a member of 'std'
file3670a102674.cpp:72:36: note: suggested alternative:
C:/PROGRA~1/R/R-devel/library/BH/include/boost/units/units_fwd.hpp:61:31: note:   'boost::units::to_string'
file3670a102674.cpp:72:56: error: unable to deduce 'auto' from '<expression error>'
file3670a102674.cpp: In function 'void test_set_state(Rcpp::NumericVector)':
file3670a102674.cpp:85:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
C:/PROGRA~1/R/R-devel/library/odeintr/include/utils.h: At global scope:
C:/PROGRA~1/R/R-devel/library/odeintr/include/utils.h:30:1: warning: 'double odeintr::laplace2D(const state_type&, int, int)' defined but not used [-Wunused-function]
make: *** [file3670a102674.o] Error 1
Warning message:
running command 'make -f "C:/PROGRA~1/R/R-devel/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-devel/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="sourceCpp_1.dll" WIN=64 TCLBIN=64 OBJECTS="file3670a102674.o"' had status 2 
Error in Rcpp::sourceCpp(code = code, env = env, ...) : Error 1 occurred
building shared library. > test_set_params(rnorm(10)) Error: could not
find function "test_set_params" > x0 = rep(1, 10) > res = test(x0, 5)
Error: could not find function "test"


On 28-3-2017 22:37, Tim Keitt wrote:
> On Tue, Mar 28, 2017 at 3:14 PM, Daniel Kaschek <
> daniel.kaschek at physik.uni-freiburg.de> wrote:
>
>> By the way, there are some packages around working with deSolve and
>> autogenerating C code or FORTRAN code, e.g., cOde and rodeo.
>>
> Here's an example in odeintr:
>
> library(odeintr)
>> sys = '
>>   for (int i = 0; i != N; ++i)
>>   {
>>     dxdt[i] = 0;
>>     for (int j = 0; j != N; ++j)
>>       dxdt[i] += pars[j] * x[j];
>>   }
>> '
>> n_pars = 10
>> compile_sys("test", sys, n_pars, sys_dim = n_pars)
>> test_set_params(rnorm(10))
>> x0 = rep(1, 10)
>> res = test(x0, 5)
>
> The dimension is currently set at compile time, but that would be easy to
> change.
>
> THK
>
> http://www.keittlab.org/
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-dynamic-models mailing list
> R-sig-dynamic-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models


	[[alternative HTML version deleted]]



More information about the R-sig-dynamic-models mailing list