IsDiagonal: Test for a Diagonal Matrix

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/IsDiagonal.R

Description

IsDiagonal() returns TRUE if A is a diagonal matrix, and FALSE otherwise.

Usage

1
2
3
4
5
6
7
IsDiagonal(A, ...)

## Default S3 method:
IsDiagonal(A, tol = 1e-08, ...)

## S3 method for class 'yac_symbol'
IsDiagonal(A, ...)

Arguments

A

Input.

...

...

tol

Numeric. Tolerance.

Details

An m \times m matrix \mathbf{A} is diagonal if all off-diagonal elements are zero.

A is considered to be a diagonal matrix if the absolute value of all off-diagonal elements is less than or equal to a tolerance value.

Value

Logical.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Wikipedia: Diagonal matrix

See Also

Other predicate functions: IsIdempotent(), IsInvertible(), IsMatrix(), IsNilpotent(), IsOrthogonal(), IsPositiveDefinite(), IsScalar(), IsSingular(), IsSquareMatrix(), IsSymmetric(), IsVector(), MatrixCheck()

Examples

1
2
3
4
5
# TRUE
IsDiagonal(diag(2))

# FALSE
IsDiagonal(matrix(1:9, ncol = 3))

jeksterslab/matrixR documentation built on Feb. 22, 2021, 8:10 a.m.