IsIdempotent: Test for an Idempotent Matrix

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

View source: R/IsIdempotent.R

Description

IsIdempotent() returns TRUE if A is an idempotent matrix, and FALSE otherwise.

Usage

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

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

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

Arguments

A

Input.

...

...

tol

Numeric. Tolerance.

Details

An m \times m matrix \mathbf{A} is idempotent if

\mathbf{A}^2 = \mathbf{A} .

A is considered to be an idempotent matrix if all(abs(A %*% A - A) <= tol) returns TRUE.

Value

Logical.

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

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

Examples

1
2
3
4
5
# TRUE
IsIdempotent(matrix(data = c(1, 0, 0, 1), ncol = 2))

# FALSE
IsIdempotent(matrix(data = 1, nrow = 2, ncol = 2))

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