Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-23 Thread Dirk Eddelbuettel
On 9 December 2012 at 14:56, Romain Francois wrote: | Thanks for the valuable information. | | I will look into it more seriously at some point when I have some more | time. I have a minor improvement now, based on poking around in SpMat_meat.hpp and the previous discussion, particularly Conrad

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-09 Thread Romain Francois
Thanks for the valuable information. I will look into it more seriously at some point when I have some more time. Romain Le 09/12/12 14:40, c s a écrit : Hi Romain & Doug, Two points to note: (1) When poking around internal Armadillo pointers and arrays for sparse matrices, please take int

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-09 Thread c s
Hi Romain & Doug, Two points to note: (1) When poking around internal Armadillo pointers and arrays for sparse matrices, please take into account that the col_ptrs array is slightly longer than specified by the Compressed Sparse Column (CSC) format. However, this should not cause any problems wh

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
Le 08/12/12 19:54, Douglas Bates a écrit : On Sat, Dec 8, 2012 at 10:35 AM, c s mailto:conradsand.a...@gmail.com>> wrote: Armadillo sparse matrices are stored in Compressed Sparse Column format: http://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29 T

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Douglas Bates
On Sat, Dec 8, 2012 at 10:35 AM, c s wrote: > Armadillo sparse matrices are stored in Compressed Sparse Column format: > > > http://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29 > > This layout is used by a majority of external solvers. > > It would be far more eff

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
Ah. One thing I could do is leverage this: #ifdef ARMA_EXTRA_SPMAT_PROTO #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPMAT_PROTO) #endif Not sure how yet. Le 08/12/12 19:17, Romain Francois a écrit : That looks very similar, if not identical to what dgCMatrix uses. Can you direct me to a construct

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
That looks very similar, if not identical to what dgCMatrix uses. Can you direct me to a constructor where I could feed such information ? Romain Le 08/12/12 17:35, c s a écrit : Armadillo sparse matrices are stored in Compressed Sparse Column format: http://en.wikipedia.org/wiki/Sparse_matri

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread c s
Armadillo sparse matrices are stored in Compressed Sparse Column format: http://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29 This layout is used by a majority of external solvers. It would be far more efficient to take this layout into account when copying matric

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
Le 08/12/12 09:45, Søren Højsgaard a écrit : Dear all, I want to use a matrix (of type "dgCMatrix" from the Matrix package) in RcppArmadillo, so I do: library(inline) src <- ' using namespace arma; using namespace Rcpp; SpMat X = as >(XX_); ' foo <- cxxfunction(signature(XX_=""), body=src, plu

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Dirk Eddelbuettel
Hi Søren, On 8 December 2012 at 08:45, Søren Højsgaard wrote: | I want to use a matrix (of type "dgCMatrix" from the Matrix package) in RcppArmadillo, so I do: | | library(inline) | src <- ' | using namespace arma; | using namespace Rcpp; | SpMat X = as >(XX_); | ' | foo <- cxxfunction(signatur

[Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Søren Højsgaard
Dear all, I want to use a matrix (of type "dgCMatrix" from the Matrix package) in RcppArmadillo, so I do: library(inline) src <- ' using namespace arma; using namespace Rcpp; SpMat X = as >(XX_); ' foo <- cxxfunction(signature(XX_=""), body=src, plugin="RcppArmadillo") - but this fails. It seem