R: Force a matrix to be symmetric

asSymmetric {fastmatrix} | R Documentation

## Force a matrix to be symmetric

### Description

Force a square matrix `x` to be symmetric

### Usage

    asSymmetric(x, lower = TRUE)

### Arguments

`x` | a square matrix to be forced to be symmetric.
`lower` | logical, should the upper (lower) triangle be replaced with the lower (upper) triangle?

### Value

a square symmetric matrix.

### Examples

    a <- matrix(1:16, ncol = 4)
    isSymmetric(a) # FALSE
    a <- asSymmetric(a) # copy lower triangle into upper triangle

[Package fastmatrix version 0.4-1 Index]