[Rcpp-devel] Using sparse matrices from the Matrix package in Rcpp

Andreas Alfons andreas.alfons at kuleuven.be
Tue Jun 26 01:27:58 CEST 2012


> To me it seems that I can not acces entries (i,j) using A(i,j) when A is a sparse matrix. Is that so? - and if yes, any suggestions on what I can do alternatively?

Take a look at the coeff() method, e.g., A.coeff(i,j)

See also its documentation:
http://eigen.tuxfamily.org/dox-devel/classEigen_1_1SparseMatrix.html#afacbe8d905dd8b00eb52e72c2e938aed

- Andreas


More information about the Rcpp-devel mailing list