Matrix.to.Coord | R Documentation |
Utility function to extract row and column indices of the non-zero elements of a sparse matrix.
Matrix.to.Coord(M, index1 = TRUE)
M |
A matrix that is a subclass of sparseMatrix, as defined in the Matrix package. |
index1 |
TRUE if the index of the first element should be 1, and FALSE if 0. |
A wrapper to Matrix.to.Pointers for order='triplet'
and values=FALSE
, for extracting the row and column indices
of a sparsity pattern from a matrix that has that same pattern.
A list with two named elements.
Integer vector containing row indices of non-zero elements
Integer vector containing column indices of non-zero elements
M1 <- as(kronecker(diag(3), matrix(TRUE,2,2)),"sparseMatrix") C <- Matrix.to.Coord(M1) M2 <- Matrix::sparseMatrix(i=C$rows, j=C$cols) all.equal(M1,M2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.