View source: R/is_square_matrix.r
is_diagonal | R Documentation |
Test if an object is a diagonal matrix (or not) (i.e. square matrix with zeros above and below the diagonal)
is_diagonal(x)
x |
an R object |
is_matrix
, is_square_matrix
m1 = diag(1:3, 3, 3)
m2 = matrix(1:9, 3, 3)
is_diagonal(m1) # TRUE
is_diagonal(m2) # FALSE
is_not_diagonal(m2) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.