Last chance! 50% off unlimited learning
Sale ends in
Eliminates an zeros in a sparse matrix.
cleanup(x, eps = .Spam$eps)
a sparse matrix of class spam
.
numeric scalar > 0. Smaller entries are coerced to zero.
A sparse matrix may still contain zeros. This function (aliased
to as.spam
) filters these values.
This often causes confusion when testing such matrices for symmetry
or comparing apparently equal matrices with all.equal
(see ‘Examples’ below.
A <- diag.spam(2)
A[1,2] <- 0
all.equal(A, t(A))
isSymmetric.spam(A)
all.equal(cleanup(A), diag.spam(2))
Run the code above in your browser using DataLab