RcppSparse.Rd
An Rcpp sparse matrix class header file for iterator-based read-only access to Matrix::`dgCMatrix-class`
objects in R.
The RcppSparse class is a zero-copy by-reference object constructed from Rcpp::IntegerVector
and Rcpp::NumericVector
that is to objects of class dgCMatrix
as Rcpp::NumericMatrix
is to objects of class "matrix"
.
The class is equipped with iterators that allow for efficient marginal traversal of values in columns, rows, or ranges of a column.
Performance of the iterators exceeds that of RcppArmadillo::SpMat
and approaches that of Eigen::SparseMatrix
.
The class iterators and member functions in RcppSparse::Matrix
align with method counterparts in the Eigen::SparseMatrix<double>
, such
that templated functions accepting either class can be used without further specialization.
Note: This class is read-only. While access to the i
, p
, Dim
, and x
vectors is public, there are no methods
for inserting or erasing values.
See code for example columnSums
to get started, and the package vignette for documentation.
Zach DeBruine