cleanup: Cleaning up sparse matrices

Description Usage Arguments Details Author(s) See Also Examples

Description

Eliminates an zeros in a sparse matrix.

Usage

1
cleanup(x, eps = getOption("spam.eps"))

Arguments

x

a sparse matrix of class spam.

eps

numeric scalar > 0. Smaller entries are coerced to zero.

Details

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.

Author(s)

Reinhard Furrer

See Also

isSymmetric.spam and all.equal.spam.

Examples

1
2
3
4
5
6
A <- diag.spam(2)
A[1,2] <- 0

all.equal(A, t(A))
isSymmetric.spam(A)
all.equal(cleanup(A), diag.spam(2))

spam documentation built on June 24, 2018, 5:05 p.m.