isSymmetric.Rd
Efficient function to test if 'object' is symmetric or not.
# isSymmetric.spam(object, ...)
# S3 method for spam
isSymmetric(object, tol = 100 * .Machine$double.eps, ...)
a spam
matrix.
numeric scalar >= 0. Smaller differences are not considered,
see all.equal.spam
.
further arguments passed to all.equal.spam
.
symmetry is assessed by comparing the sparsity structure of
object
and t(object)
via the function
all.equal.spam
. If a difference is detected, the matrix is
cleaned with cleanup
and compared again.
logical indicating if object
is symmetric or not.
obj <- diag.spam(2)
isSymmetric(obj)
#> [1] TRUE
obj[1,2] <- .Machine$double.eps
isSymmetric(obj)
#> [1] TRUE
all.equal(obj, t(obj))
#> [1] "Column-sparsity structure differ (at least 1 instance(s))"
#> [2] "Row-sparsity structure differ (at least 1 instance(s))"