whichNonZero {scuttle} | R Documentation |
Finds the non-zero entries of a matrix in the most efficient manner. Not sure there's much more to say here.
whichNonZero(x, ...) ## S4 method for signature 'dgTMatrix' whichNonZero(x, ...) ## S4 method for signature 'dgCMatrix' whichNonZero(x, ...) ## S4 method for signature 'ANY' whichNonZero(x, BPPARAM = SerialParam(), ...)
x |
A numeric matrix-like object, usually sparse in content if not in representation. |
... |
For the generic, additional arguments to pass to the specific methods. For the methods, additional arguments that are currently ignored. |
BPPARAM |
A BiocParallelParam object controlling how parallelization should be performed.
only used when |
A list containing i
, an integer vector of the row indices of all non-zero entries;
j
, an integer vector of the column indices of all non-zero entries;
and x
, a numeric vector of the values of the non-zero entries.
Aaron Lun
which
, obviously.
x <- Matrix::rsparsematrix(1e6, 1e6, 0.000001) out <- whichNonZero(x) str(out)