Integrate Fortran, C++ with R -
my task rewrite r function in c++ accelerate while loops. r codes has been rewritten in of rcpp , armadillo except .fortran() . try use rinside @ first , works @ slow speed dirk indicated .(it expensive data go through r-> c++ ->r ->fortran)
since dont want rewrite fortran codes in c++ , vice versa, looks natural accelerate programs linking c++ directly fortran: r-> c++ -> fortran.
// [[rcpp::depends(rcpparmadillo)]] #include <rcpparmadillo.h> using namespace rcpp; extern "c"{ list f_(int *n,numericmatrix a, numericvector c, double* eps); }
the problem can integrate c++ fortran, , integrate r c++, cant make these 3 things work together!
i try compile c++ in linux can't find rcpparmadillo.h , namespace rcpp
error: rcpparmadillo.h: no such file or directory error: 'rcpp' not namespace-name
when call sourcecpp("test.cpp") in r directly, console display:
test.o:test.cpp:(.text+0x20b2): undefined reference `f_' collect2: ld returned 1 exit status error in sourcecpp("test.cpp") : error occurred building shared library.
i try combine these things in package rcpparmadillo::rcpparmadillo.package.skeleton("tttest")
but don't know how deal package tttest(i believe not installed) after add .cpp , .f files /src , run compileattributes
.
so, possible things imagine rcpp? or necessary convert fortran codes c/c++ codes...
Comments
Post a Comment