cleanup | R Documentation |
Eliminates an zeros in a sparse matrix.
cleanup(x, eps = getOption("spam.eps"))
x |
a sparse matrix of class |
eps |
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.
Reinhard Furrer
isSymmetric.spam
and all.equal.spam
.
A <- diag.spam(2)
A[1,2] <- 0
all.equal(A, t(A))
isSymmetric.spam(A)
all.equal(cleanup(A), diag.spam(2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.