is_identity_matrix: Is the matrix an identity matrix?

Description Usage Arguments Value Examples

Description

Checks that the input is an identity matrix.

Usage

1
2
3
4
5
assert_is_identity_matrix(x, tol = 100 * .Machine$double.eps,
  severity = getOption("assertive.severity", "stop"))

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

Arguments

x

Input to check.

tol

Abolute deviations from the expected values smaller than tol are not considered.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

.xname

Not intended to be used directly.

Value

TRUE if the input is all zeroes (after coercion to be a matrix).

Examples

1
2
3
4
5
6
x <- diag(3)
is_identity_matrix(x)
x[1, 2] <- 100 * .Machine$double.eps
is_identity_matrix(x)
x[2, 3] <- 101 * .Machine$double.eps
is_identity_matrix(x)

assertive.matrices documentation built on May 1, 2019, 10:11 p.m.