isSymmetric {base} | R Documentation

## Test if a Matrix or other Object is Symmetric

### Description

Generic function to test if `object` is symmetric or not. Currently only a matrix method is implemented.

### Usage

    isSymmetric(object, ...)
    ## S3 method for class 'matrix':
    isSymmetric(object, tol = 100 * .Machine$double.eps, ...)

### Arguments

`object` | any R object; a `matrix` for the matrix method.
`tol` | numeric scalar >= 0. Smaller differences are not considered, see `all.equal.numeric`.
`...` | further arguments passed to methods; the matrix method passes these to `all.equal`.

### Details

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.

### Value

logical indicating if `object` is symmetric or not.

### See Also

`eigen` which calls `isSymmetric` when its `symmetric` argument is missing, as per default.

### Examples

    isSymmetric(D3 <- diag(3)) # -> TRUE

    D3[2,1] <- 1e-100
    D3
    isSymmetric(D3) # TRUE
    isSymmetric(D3, tol = 0) # FALSE for zero-tolerance

[Package base version 2.3.1 Index]