Learn R Programming

assertive (version 0.2-6)

assert_is_symmetric_matrix: Is the input a symmetric matrix?

Description

Checks that the input is a symmetric matrix.

Usage

assert_is_symmetric_matrix(x, tol = 100 * .Machine$double.eps, ...)

is_symmetric_matrix(x, tol = 100 * .Machine$double.eps,
  .xname = get_name_in_parent(x), ...)

Arguments

x
Input to check.
tol
Differences smaller than tol are not considered.
...
Passed to all.equal.
.xname
Not intended to be used directly.

Value

  • TRUE if the input is symmetrix (after coersion to be a matrix).

Examples

Run this code
m <- diag(3); m[3, 1] <- 1e-100
assert_is_symmetric_matrix(m)
#These examples should fail.
dont_stop(assert_is_symmetric_matrix(m, tol = 0))

Run the code above in your browser using DataLab