Determine the sparsity of a matrix, distributed, dense, or otherwise.
# S4 method for matrix
sparsity(x, count = "zero", out = "count",
tol = .Machine$double.eps)# S4 method for vector
sparsity(x, count = "zero", out = "count",
tol = .Machine$double.eps)
# S4 method for dmat
sparsity(x, count = "zero", out = "count",
tol = .Machine$double.eps)
numeric matrix
character; options are "zero" and "other". The former counts the number of zeros, while the latter counts the number of non-zeros ('other' elements).
character; options are "count", "proportion", and "percent". This
determines whether a pure count, proportion of count
elements in the
matrix, or percentage of count
elements in the matrix.
numeric; the tolerance for numerical zero. This is ignored if the input data is integer/logical.
The sparsity count of a matrix is returned.