isSymmetric-methods: Methods for Function isSymmetric in Package 'Matrix'

Description See Also Examples

Description

isSymmetric(M) returns a logical indicating if M is a symmetric matrix. This (now) is a base function with a default method for the traditional matrices of class "matrix". Methods here are defined for virtual Matrix classes such that it works for all objects inheriting from class Matrix.

See Also

forceSymmetric, symmpart, and the formal class (and subclasses) "symmetricMatrix".

Examples

1
2
3
4
5
6
7
8
isSymmetric(Diagonal(4)) # TRUE of course
M <- Matrix(c(1,2,2,1), 2,2)
isSymmetric(M) # TRUE (*and* of formal class "dsyMatrix")
isSymmetric(as(M, "dgeMatrix")) # still symmetric, even if not "formally"
isSymmetric(triu(M)) # FALSE

## Look at implementations:
showMethods("isSymmetric", includeDefs=TRUE)# "ANY": base's S3 generic; 6 more

Matrix documentation built on May 31, 2017, 1:41 a.m.

Search within the Matrix package
Search all R packages, documentation and source code