drop0 {Matrix}R Documentation

Drop "Explicit Zeroes" from a Sparse Matrix

Description

Returns a sparse matrix with no “explicit zeroes”, i.e., all zero or FALSE entries are dropped from the explicitly indexed matrix entries.

Usage

drop0(x, clx = c(class(x)))

Arguments

x a Matrix, typically sparse, i.e., inheriting from sparseMatrix.
clx [optional:] the class or “class definition” (see getClassDef; it is of class classRepresentation) of x.
This argument just exists for the possibility of speedup.

Value

a Matrix like x but with no explicit zeros, i.e., !any(x@x == 0), always inheriting from CsparseMatrix.

See Also

spMatrix, class sparseMatrix

Examples

m <- spMatrix(10,20, i= 1:8, j=2:9,
              x = c(0:2,3:-1))
m
drop0(m)

[Package Matrix version 0.999375-4 Index]