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

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

[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; SpMatdouble X = asSpMatdouble (XX_); ' foo - cxxfunction(signature(XX_=), body=src, plugin=RcppArmadillo) - but this

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; SpMatdouble X = asSpMatdouble (XX_); ' foo - cxxfunction(signature(XX_=),

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:

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

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Douglas Bates
On Sat, Dec 8, 2012 at 10:35 AM, c s 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 This layout is used by a majority of external solvers. It

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 conradsand.a...@gmail.com mailto:conradsand.a...@gmail.com wrote: Armadillo sparse matrices are stored in Compressed Sparse Column format: