Skip to content
Back to formatted view

Raw Message

Message-ID: <7E8037094A0C2146AA3E6F94DAE621C3444AC9E6@AD-EXCHMBX2-1.aau.dk>
Date: 2012-12-08T08:45:56Z
From: Søren Højsgaard
Subject: [Rcpp-devel] Sparse matrices with RcppArmadillo

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<double> X = as<SpMat<double> >(XX_);
'
foo <- cxxfunction(signature(XX_=""), body=src, plugin="RcppArmadillo")

- but this fails. It seems to me (browsing the web) that SpMat are supported, but I might be wrong here. I have no indication that dgCMatrix matrices can be "converted" to SpMat's. I know that I can work with dgCMatrix matrices with RcppEigen, but what I need is to extract submatrices and that is very easy to do with RcppArmadillo.

Any thoughts? Thanks in advance.
Regards
S?ren