Description Usage Arguments Details Value See Also Examples
Generic function to test if object
is symmetric or not.
Currently only a matrix method is implemented.
1 2 3 | isSymmetric(object, ...)
## S3 method for class 'matrix'
isSymmetric(object, tol = 100 * .Machine$double.eps, ...)
|
object |
any R object; a |
tol |
numeric scalar >= 0. Smaller differences are not
considered, see |
... |
further arguments passed to methods; the matrix method
passes these to |
The matrix
method is used inside eigen
by
default to test symmetry of matrices up to rounding error, using
all.equal
. It might not be appropriate in all
situations.
Note that a matrix m
is only symmetric if its rownames
and
colnames
are identical. Consider using unname(m)
.
logical indicating if object
is symmetric or not.
eigen
which calls isSymmetric
when its
symmetric
argument is missing.
1 2 3 4 5 6 | isSymmetric(D3 <- diag(3)) # -> TRUE
D3[2, 1] <- 1e-100
D3
isSymmetric(D3) # TRUE
isSymmetric(D3, tol = 0) # FALSE for zero-tolerance
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.