Thank you, this makes more sense now. I do like the succinct, "show-off"
style; it seems to convey the meaning better.
On Fri, Feb 10, 2012 at 4:47 PM, Douglas Bates wrote:
> On Fri, Feb 10, 2012 at 3:30 PM, Dirk Eddelbuettel wrote:
> >
> > On 10 February 2012 at 15:05, Douglas Bates wrote:
> >
On Fri, Feb 10, 2012 at 3:30 PM, Dirk Eddelbuettel wrote:
>
> On 10 February 2012 at 15:05, Douglas Bates wrote:
> | Or if you want to show off you could collapse it to
> |
> | > src <- "
> | + NumericMatrix tmpMatrix(as(List(L)[0]));
> | + return wrap(tmpMatrix.ncol());
> | + "
> | > f <- cxx
On 10 February 2012 at 15:05, Douglas Bates wrote:
| Or if you want to show off you could collapse it to
|
| > src <- "
| + NumericMatrix tmpMatrix(as(List(L)[0]));
| + return wrap(tmpMatrix.ncol());
| + "
| > f <- cxxfunction(signature(L="list"), src, plugin = "Rcpp" )
| > f(list(matrix(1:9,
Or if you want to show off you could collapse it to
> src <- "
+ NumericMatrix tmpMatrix(as(List(L)[0]));
+ return wrap(tmpMatrix.ncol());
+ "
> f <- cxxfunction(signature(L="list"), src, plugin = "Rcpp" )
> f(list(matrix(1:9,3,3)))
[1] 3
On Fri, Feb 10, 2012 at 3:01 PM, Douglas Bates wrote:
Another approach is to force the evaluation of the list element with as
> src <- "
+ List inputList(L) ;
+ NumericMatrix tmpMatrix(as(inputList[0])) ;
+
+ return wrap(tmpMatrix.ncol());
+ "
> f <- cxxfunction(signature(L="list"), src, plugin = "Rcpp" )
> f(list(matrix(1:9,3,3)))
[1] 3
In an
I am not exactly sure why that works, but it does! Why doesn't it directly
see the NumericMatrix(SEXP)?
Thank you, Dirk!
On Fri, Feb 10, 2012 at 3:10 PM, Dirk Eddelbuettel wrote:
>
> On 10 February 2012 at 14:49, Sameer Soi wrote:
> | Hello Rcpp'ers,
> |
> | I want to access a List of matrices
On 10 February 2012 at 14:49, Sameer Soi wrote:
| Hello Rcpp'ers,
|
| I want to access a List of matrices in an Rcpp/C++ function that will passed
to
| me via R...
|
| src <- "
| using namespace Rcpp ;
| List inputList(L) ;
| NumericMatrix tmpMatrix ;
|
| tmpMatrix = NumericMatrix(inpu