symmetrize: Symmetrize square matrix

Description Usage Arguments Value Examples

View source: R/network_utils.R

Description

Symmetrize square matrix

Usage

1
symmetrize(x, upper_to_lower = TRUE)

Arguments

x

a square matrix

upper_to_lower

if TRUE, copies the upper triangle into the lower triangle; copies the lower triangle into the upper triangle otherwise. Defaults to TRUE.

Value

returns symmetrized version of x

Examples

1
2
3
A = matrix(rnorm(9), nrow = 3)
A_sym = symmetrize(A, upper_to_lower = FALSE)
isSymmetric(A_sym)

baruuum/btoolbox documentation built on Aug. 17, 2020, 1:29 a.m.