is_diagonal_matrix: Check if the passed entity is a diagonal matrix. Elements...

View source: R/matrix.R

is_diagonal_matrixR Documentation

Check if the passed entity is a diagonal matrix. Elements outside of the diagonal are checked against a given tolerance.

Description

Check if the passed entity is a diagonal matrix. Elements outside of the diagonal are checked against a given tolerance.

Usage

is_diagonal_matrix(
  value,
  exact_dimension = NULL,
  allow_null = FALSE,
  tol = sqrt(.Machine$double.eps)
)

Arguments

value

The value to check.

exact_dimension

If specified, the matrix must have the specified exact dimension.

allow_null

If TRUE, allow NULL as a value.

tol

The tolerance to verify if the off-diagonal elements are zero. Default is sqrt(.Machine$double.eps).

Examples

## Not run: 
# For assertion
assertthat::assert_that(qscheck::is_diagonal_matrix(value))
# For check
if (qscheck::is_diagonal_matrix(value)) {}

## End(Not run)


AstraZeneca/qscheck documentation built on Nov. 1, 2023, 4:45 a.m.