| Matrix.to.Coord {sparseHessianFD} | R Documentation | 
Row and column indices from sparse matrix.
Description
Utility function to extract row and column indices of the non-zero elements of a sparse matrix.
Usage
Matrix.to.Coord(M, index1 = TRUE)
Arguments
| 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. | 
Details
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.
Value
A list with two named elements.
- rows
- Integer vector containing row indices of non-zero elements 
- cols
- Integer vector containing column indices of non-zero elements 
Examples
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)
[Package sparseHessianFD version 0.3.3.7 Index]