Re: [Rcpp-devel] Initiate NumericMatrix in class constructor from S4 slot

2013-03-05 Thread Simon Zehnder
Hi Romain, first let me thank you for the very fast and informative answer! I suppose, as SEXP is a pointer, that these attempts reuse the memory allocated in R, right? Further, I presume, that I proceed in the same way for lists from R to Rcpp, don't I? In regard to the initialisation list:

Re: [Rcpp-devel] Initiate NumericMatrix in class constructor from S4 slot

2013-03-05 Thread Romain Francois
There is no constructor of Matrix tht takes a SlotProxy. You can do it in two steps perhaps. SEXP tmp = classS4.slot("M_R") ; M = tmp ; Or use a specific cast: > M((SEXP)classS4.slot("M_R")); In any case, you should use an initialisation list in your constructor anyway, something like: >

[Rcpp-devel] Initiate NumericMatrix in class constructor from S4 slot

2013-03-05 Thread Simon Zehnder
Dear Rcpp-Devels, I am a little confused right now with the following setting: I have a C++ class with for example the following header #include class FirstClass { public: Rcpp::NumericMatrix M; FirstClass(Rcpp::S4& classS4); ~F

Re: [Rcpp-devel] RCPP_EXPORT_CLASS(std::vector)

2013-03-05 Thread romain
Thanks. I'll have a look. Romain Le mer 6/03/13 00:45 , Greg Minshall a écrit:: hi. this is just me reporting on a learning exercise, in case it might be of help to someone else. the summary is that one might need to expose the types of member classes (in particular, *vector* types) of c

Re: [Rcpp-devel] Working with arma::cube

2013-03-05 Thread Dirk Eddelbuettel
On 6 March 2013 at 03:22, alexios ghalanos wrote: | Try this: | | library(RcppArmadillo) | library(inline) | if( require( RcppArmadillo ) ){ | fx <- cxxfunction( signature(x = "vector", n = "integer") , ' | Rcpp::NumericVector XX(x); | Rcpp::IntegerVector dim(n);

Re: [Rcpp-devel] Working with arma::cube

2013-03-05 Thread alexios ghalanos
Try this: library(RcppArmadillo) library(inline) if( require( RcppArmadillo ) ){ fx <- cxxfunction( signature(x = "vector", n = "integer") , ' Rcpp::NumericVector XX(x); Rcpp::IntegerVector dim(n); arma::cube AY(XX.begin(), dim[0], dim[1], d

Re: [Rcpp-devel] Working with arma::cube

2013-03-05 Thread Dirk Eddelbuettel
On 6 March 2013 at 00:50, Silkworth,David J. wrote: | I am helping a student build some R code in Rcpp for his first time. He is | working with 3-dimensional arrays, so I am hopeful to be working with | arma::cube objects. | | When I simply try to bring the array in as an argument I can?t seem

[Rcpp-devel] Working with arma::cube

2013-03-05 Thread Silkworth,David J.
I am helping a student build some R code in Rcpp for his first time. He is working with 3-dimensional arrays, so I am hopeful to be working with arma::cube objects. When I simply try to bring the array in as an argument I can't seem to use the same as<[TEMPLATE]> construction as other objects.

[Rcpp-devel] RCPP_EXPORT_CLASS(std::vector)

2013-03-05 Thread Greg Minshall
hi. this is just me reporting on a learning exercise, in case it might be of help to someone else. the summary is that one might need to expose the types of member classes (in particular, *vector* types) of classes that are being exported with the RCPP_EXPOSED_CLASS directive. in compiling the f

Re: [Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Dirk Eddelbuettel
On 5 March 2013 at 16:06, Richard Downe wrote: | On http://cran.r-project.org/doc/manuals/R-exts.html, a configure script seems | to be described as an equally respectable alternative to Makevars -- it sounds No. configure determines compile-time _values_ which are then inserted into a Makevars.i

Re: [Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Richard Downe
One other detail: cmake by default names all library outputs "lib[TARGET]". (e.g., there *is* no my_package.so, but possibly a libmy_package.so) If you add the line SET_TARGET_PROPERTIES(fusionIndices PROPERTIES PREFIX "") you'll have better luck as well. -rd On 03/05/2013 04:00 PM, Richard

Re: [Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Richard Downe
I must admit, it's been awhile since I cobbled together my solution; I know it's worked seamlessly on 2 or 3 linux variants, but hasn't been tested beyond that. I do recall getting frustrated with making cmake interact with Makevars; On http://cran.r-project.org/doc/manuals/R-exts.html, a conf

Re: [Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Richard Downe
Also, you're failing to tell CMake to build a shared library. You need SET(CMAKE_C++_CREATE_SHARED_LIBRARY 1) And if you're using Rcpp, also need to explicitly add Rcpp link flags (Rscript -e Rcpp:::LdFlags()) -rd On 03/05/2013 03:44 PM, Richard Downe wrote: What I've been doing the past coupl

Re: [Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Dirk Eddelbuettel
On 5 March 2013 at 15:44, Richard Downe wrote: | What I've been doing the past couple years, which has worked extremely | well, is to use a configure script (I've used perl because it allows me | to do a bunch of other build-time processing that's specific to my | package, but bash would work f

Re: [Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Richard Downe
What I've been doing the past couple years, which has worked extremely well, is to use a configure script (I've used perl because it allows me to do a bunch of other build-time processing that's specific to my package, but bash would work fine as well). All you need (for perl) is: #!/usr/bin/

Re: [Rcpp-devel] Maximum Columns in Rcpp DataFrame

2013-03-05 Thread Dirk Eddelbuettel
On 5 March 2013 at 19:09, Bierbryer, Andrew wrote: | Hi ? | | | | I am trying to create an rcpp data frame with more than 20 columns. I get a | compile error that it cannot find the matching function for call to | Rcpp::DataFrame::create. | | When I try to create it for 20 columns, it works f

Re: [Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Dirk Eddelbuettel
On 5 March 2013 at 12:21, Etienne B. Racine wrote: | I'd like to use a PCL algorithm inside R and they provide a CMakeLists.txt for | configuration. I haven't found how to directly use the CMakeLists.txt in | building R package, however when I run `make .` form src, I can generate a | Makefile  th

[Rcpp-devel] Maximum Columns in Rcpp DataFrame

2013-03-05 Thread Bierbryer, Andrew
Hi - I am trying to create an rcpp data frame with more than 20 columns. I get a compile error that it cannot find the matching function for call to Rcpp::DataFrame::create. When I try to create it for 20 columns, it works fine. Is 20 columns the maximum number that you can use in the Rcpp::Dat

[Rcpp-devel] Using CMakeLists.txt

2013-03-05 Thread Etienne B. Racine
I'd like to use a PCL algorithm inside R and they provide a CMakeLists.txt for configuration. I haven't found how to directly use the CMakeLists.txt in building R package, however when I run `make .` form src, I can generate a Makefile that nearly works with `R CMD INSTALL --no-multiarch`. It doe

Re: [Rcpp-devel] Regular Expressions

2013-03-05 Thread Dirk Eddelbuettel
On 5 March 2013 at 07:25, Gabor Grothendieck wrote: | I did rebuild boost from source as part of this since I also figured | that might be a problem. On Windows there is a tool that is used in | rebuilding the source (presumably similar to configure on UNIX) and I | rebuilt that tool from source

Re: [Rcpp-devel] Regular Expressions

2013-03-05 Thread Gabor Grothendieck
On Mon, Mar 4, 2013 at 9:09 PM, Dirk Eddelbuettel wrote: > > On 4 March 2013 at 20:18, Gabor Grothendieck wrote: > | I had no luck with sourceCpp or inline on Windows but did manage to > | use R CMD SHLIB to build a dll which loads into 32-bit R (it does not > | currently load in 64-bit R - haven'