check whether matrix is diagonal

is.diagonal(A, epsilon = 0)

Arguments

A

symmetric matrix

epsilon

tolerance, default is 0.

Value

logical, TRUE/FALSE, TRUE for diagonal matrices

Details

check whether matrix is diagonal

Examples

A <- matrix(c(2, 1, 1, 2), nrow = 2) sym_inv(A)
#> [,1] [,2] #> [1,] 0.6666667 -0.3333333 #> [2,] -0.3333333 0.6666667