search for: sourcecpp

Displaying 18 results from an estimated 18 matches for "sourcecpp".

Did you mean: sourcecon
2018 Dec 21
2
Bug report: R.home() cause package Rcpp failed executing sourceCpp, similar bug are labeled "BUG 16660" since 2016 and here I could provide a solution that tested in my laptop.
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16660 Here is the bug, which R.home may generate a path contains a whitespace. this will cause Rcpp failed executing sourceCpp > sourceCpp("b:/2018-12-14/src/18020/MCMC.cpp") Error in system(cmd, intern = !showOutput) : 'D:/Program' not found Error in system(cmd, ignore.stderr = TRUE, intern = TRUE) : 'D:/Program' not found Code is tested in both R 3.5.1 and Microsoft R Open 3.5.1. I f...
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
...ws, as does the (newer) Rcpp Introduction vignette. More crazy, your file was actually 100% correct. I just added three lines to _also_ execute R code (and I indented just for clarity) /*** R res <- compute_values_cpp() str(res) */ Then in R: R> library(Rcpp) R> sourceCpp("/tmp/mmsp.cpp") R> res <- compute_values_cpp() R> str(res) List of 2 $ x: num [1:100000] 199 362 118 302 262 ... $ y: num [1:100000] 20 40 14.3 39.5 36.9 ... R> _One call_ of sourceCpp() compiles AND links AND loads AND runs the exam...
2017 Dec 03
1
Rcpp, dyn.load and C++ problems
...t was a developers of the rcpp-package. So it is ok to post beginners questions to rcpp-devel? > > 6) Call me crazy but maybe the nine vignettes included with the package? > OK. I will print them and read them. [...] > > Then in R: > > R> library(Rcpp) > R> sourceCpp("/tmp/mmsp.cpp") > > [...] > > _One call_ of sourceCpp() compiles AND links AND loads AND runs the example R > code (which is optional). Basically I was searching for ways to compile to C++ code a single time and not everything the R code runs. Like I don't recomp...
2012 Dec 08
2
C function, double problem
Hi everybody, here's my problem: i call a C function which calculates a large number of double values and puts them into an array which is passed from R as a parameter in the function (like .C("function", other parameters, result = as.double( c ( 1 : quantity ) ). When the values come back to R in the result array, they are all truncated to their integer value (i.e. I lose the
2014 Jul 01
0
USE_CXX1X, Snow Leopard R binaries + Mavericks
Hi R-devel, I'm noticing the following behaviour: writeLines("#include <Rcpp.h>", file = "test.cpp") Rcpp::sourceCpp("~/test.cpp") ## succeeds at trivial compile Sys.setenv("USE_CXX1X" = "yes") Rcpp::sourceCpp("~/test.cpp") ## fails; CXX nor CXX1X properly set (?) IIUC, R is not propagating CXX nor CXX1X when USE_CXX1X is set on a Snow Leopard CRAN build of R. Is t...
2017 Dec 03
5
Rcpp, dyn.load and C++ problems
Hi, I have written a small C++ function and compile it. However in R I can't see the function I have defined in C++. I have read some web-pages about Rcpp and C++ but it is a bit confusion for me. Anyway, This is the C++-code: #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] List compute_values_cpp(int totalPoints = 1e5, double angle_increment = 0.01, int radius =
2018 Aug 06
2
SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp
Hi all, I'm not sure if I'm not supposed to do the following (the dyn.unload part, I mean) or this could be a bug (in R or Rcpp): ``` Rcpp::sourceCpp(code=' #include <Rcpp.h> class Object {}; //[[Rcpp::export]] SEXP new_object() { return Rcpp::XPtr<Object>(new Object()); }' ) new_object() dyn.unload(list.files(tempdir(), ".(so|dll)$", recursive=TRUE, full.names=TRUE)) gc() # segfault in R_RunWeakRefFi...
2012 Nov 14
0
Rcpp 0.10.0
...converters can already be used for a wide variety of standard C and C++ types, and can also be adapted to other C++ types and libraries as described in the Rcpp-extending vignette. Rcpp attributes and their supporting functions include: - Rcpp::export attribute to export a C++ function to R - sourceCpp function to source exported functions from a file - cppFunction and evalCpp functions for inline declarations and execution - Rcpp::depends attribute for specifying additional build dependencies for sourceCpp Attributes can also be used for package development via the `compileAttributes` func...
2012 Nov 14
0
Rcpp 0.10.0
...converters can already be used for a wide variety of standard C and C++ types, and can also be adapted to other C++ types and libraries as described in the Rcpp-extending vignette. Rcpp attributes and their supporting functions include: - Rcpp::export attribute to export a C++ function to R - sourceCpp function to source exported functions from a file - cppFunction and evalCpp functions for inline declarations and execution - Rcpp::depends attribute for specifying additional build dependencies for sourceCpp Attributes can also be used for package development via the `compileAttributes` func...
2014 Sep 30
1
Package Rcpp: Question conerning source code of cpp files and related question
Dear all, I am trying to use Rcpp to write some files in C++ for use in R. Below is an example for a cpp-file (crossp.cpp). Then I use >sourceCpp("crossp.cpp") in R and the corresponding function is availabe in R. Now I have to question related to this worklfow: 1) Is there a way to see the source file of the "final" cpp-file? (I mean is it possible to see how the //-lines are replaced and what soureCpp does?) 2) (Conn...
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
I would go to the source, in this case Dirk Eddelbuettel's (I hope I spelled it correctly) documentation for Rcpp: http://dirk.eddelbuettel.com/code/rcpp/Rcpp-attributes.pdf Note that you need to do sourceCpp("logistic_map.cpp") in R instead of building and dyn.load()-ing the object. HTH, Peter On Sun, Dec 3, 2017 at 11:04 AM, Martin M?ller Skarbiniks Pedersen <traxplayer at gmail.com> wrote: > On 3 December 2017 at 05:23, Eric Berger <ericjberger at gmail.com> wrote: > &...
2017 Dec 03
2
Rcpp, dyn.load and C++ problems
On 3 December 2017 at 05:23, Eric Berger <ericjberger at gmail.com> wrote: > > Do a search on "Rcpp calling C++ functions from R" > Thanks. However search for "Rcpp calling C++ functions from R" gives a lot of result but I think some of them are outdated and others don't agree with each other. Can you point to a specific good on-line guide for me? Regards
2018 Aug 09
0
SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp
...oad() in the first place. This problem may be just one of many. Best Tomas On 6.8.2018 17:35, I?aki ?car wrote: > Hi all, > > I'm not sure if I'm not supposed to do the following (the dyn.unload > part, I mean) or this could be a bug (in R or Rcpp): > > ``` > Rcpp::sourceCpp(code=' > #include <Rcpp.h> > class Object {}; > //[[Rcpp::export]] > SEXP new_object() { > return Rcpp::XPtr<Object>(new Object()); > }' > ) > > new_object() > dyn.unload(list.files(tempdir(), ".(so|dll)$", recursive=TR...
2023 Jan 21
2
Object are not destroy while using error (Rf_error)
Dear all, I try to understand why on my computer I do not clear all data with this code: #include <R.h> static int count = 0; class A { public: A(){ printf("c %d\n", count); count++; } ~A(){count--; printf("d %d\n", count); } }; extern "C" { void testAL(){ A a; { A b; } error("does not write [d 0]"); } }
2018 Sep 20
4
Bias in R's random integers?
Hello, On Thursday, September 20, 2018 11:15:04 AM EDT Duncan Murdoch wrote: > On 20/09/2018 6:59 AM, Ralf Stubner wrote: > > On 9/20/18 1:43 AM, Carl Boettiger wrote: > >> For a well-tested C algorithm, based on my reading of Lemire, the > >> unbiased "algorithm 3" in https://arxiv.org/abs/1805.10941 is part > >> already of the C standard library in
2013 May 24
0
Rcpp with OpenMP - Need example Makevars
Dear R experts, recently I started developing a Rcpp package "OpenMPTest". Within that package I want to use OpenMP, as in the following code example: // header file #include <omp.h> using namespace Rcpp ; RcppExport SEXP testOpenMP( SEXP nThreads ) ; // cpp file SEXP testOpenMP( SEXP nThreads ) { BEGIN_RCPP NumericVector numberThreads = NumericVector( nThreads );
2013 Jun 19
3
Calling an array in a struct in C to R
Hi there, Although I'm a quite experienced R user and know my ways in C, I stumbled upon a problem I don't know how to solve. Therefore, I hope someone can provide me with the information or pointers I need in order to understand the way in which the communication between R and C occurs. I have the following C code which basicallly reflects what I want: typedef struct { float
2018 Aug 16
3
Package compiler - efficiency problem
Dear Thomas, thank you for prompt response and taking interest in this issue. I really appreciate your compiler project and efficiency gains in usual case. I am aware of limitations of interpreted languages too and because of that even when writing my first mail I had a hunch that it is not that easy to address this problem. As you mentioned optimisation of compiler for handling non-standard