-
Notifications
You must be signed in to change notification settings - Fork 31
Sparse matrix automatic conversion in RcppArmadillo
The Matrix type is one of the most important data types in the R language. In the package Matrix
, there
are several sparse matrix types such as like dgCMatrix
, ngCMatrix
, nsCMatrix
and ntCMatrix
.
When passing a sparse matrix from the R side to the C++ side, currently only dgCMatrix
is supported
in RcppArmadillo package (see related issues #17 and #114 for more details).
The purpose for this project is to develop automatic conversion in RcppArmadillo
for more sparse matrix types.
- First, evaluating which sparse matrix types can be handled by the Armadillo library.
- Second, developing different conversion functions for sparse matrix.
- Third, providing warning message when automatic conversion is not possible.
The successful completion of this project will provide a seamless integration between R matrix and Armadillo matrix library.
Qiang Kou, Dirk Eddelbuettel and other Rcpp team members
The sparsematrix in the Matrix
package was defined as a S4 class. We can print out its contents like below:
> library(Matrix)
> x = rsparsematrix(10, 10, .05)
> str(x)
Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
..@ i : int [1:5] 4 6 7 1 1
..@ p : int [1:11] 0 1 2 2 2 2 3 3 4 5 ...
..@ Dim : int [1:2] 10 10
..@ Dimnames:List of 2
.. ..$ : NULL
.. ..$ : NULL
..@ x : num [1:5] -1.3 -1.1 0.37 1.9 -1.1
..@ factors : list()
Please write a C++ function to print out the content. The expected result should be similar to
> Rcpp::sourceCpp("test.cpp")
> print_matrix_cpp(x)
Type: dgCMatrix
Dim: 10 10
length of i: 5
value of i: 4 6 7 1 1
length of p: 11
value of p: 0 1 2 2 2 2 3 3 4 5 5
length of x: 5
value of x: -1.3 -1.1 0.37 1.9 -1.1
Students, please post a link to your test results here.
- [Test Solution 1] (https://github.com/vandit15/GSoC-matrix)
- [Test Solution 2] (https://github.com/akilesh1995/R-GSoC-Matrix-Test)
- [Test Solution 3] (https://github.com/AnantGowadiya/Sparse-matrix-project-test-solution)
- [Test Solution 4] (https://github.com/Soumya-Shreya/sparse-matrix-conversion-test-solution)
- [Test Solution 5] (https://github.com/yasheel-vyas/Sparse-matrix-project-test)
- [Test Solution 6] (https://github.com/br1anu/sparse_matrix_test)
- [Test Solution 7] (https://github.com/irexyc/SpMat-test)
- [Test Solution 8] (https://github.com/Pill-GZ/Sparse-matrix-conversion-test)
- [Test Solution 9] (https://github.com/Tianyang-Yang/GSoC2017SparseMatrixConversion)
- [Test Solution 10] (https://github.com/abhinavb05/GSOCSparse/blob/master/src/test.cpp)
- [Test Solution 11] (https://github.com/Sumedh04/Sparse-Matrix)