Re: [Rcpp-devel] Mimicing of X[ X[,col]==val, ] with RcppArmadillo

2012-05-31 Thread c s
On Thu, May 31, 2012 at 11:07 PM, Søren Højsgaard wrote: > I would expect that there is a way of doing this without having > to jump "into" armadillo "back" to Rcpp and "into" Armadillo again. > I just can't spot an easier way. If a simpler solution exists I would > be interested to know... Perha

Re: [Rcpp-devel] Mimicing of X[ X[, col]==val, ] with RcppArmadillo

2012-05-31 Thread Dirk Eddelbuettel
Hi, On 31 May 2012 at 13:07, Søren Højsgaard wrote: | Dear List | | I've tried to make an Rcpp version of X[ X[,col]==val, ] and came up with the following: | | sqbr <- cxxfunction(signature(r_X='float', r_col='int', r_val='double'), body = | ' | using namespace arma; | using namespace Rc

Re: [Rcpp-devel] wrapping a class having a method returning an object of class-type

2012-05-31 Thread Dirk Eddelbuettel
Hi James, On 31 May 2012 at 09:42, James Simone wrote: | I have a C++ class that has a "clone" method which returns a distinct copy of the object. | I want to expose the clone method in R and my question is how this is best done using Rcpp? | | My first attempt to expose "clone" results in a c

[Rcpp-devel] wrapping a class having a method returning an object of class-type

2012-05-31 Thread James Simone
I have a C++ class that has a "clone" method which returns a distinct copy of the object. I want to expose the clone method in R and my question is how this is best done using Rcpp? My first attempt to expose "clone" results in a compile error since Rcpp cannot automatically handle the returne

[Rcpp-devel] Mimicing of X[ X[,col]==val, ] with RcppArmadillo

2012-05-31 Thread Søren Højsgaard
Dear List I've tried to make an Rcpp version of X[ X[,col]==val, ] and came up with the following: sqbr <- cxxfunction(signature(r_X='float', r_col='int', r_val='double'), body = ' using namespace arma; using namespace Rcpp; using namespace std; mat XX = as(r_X); double val = as