test_positive_definite: Test for a Positive Definite Matrix

Description Usage Arguments Details Value Author(s) References Examples

View source: R/linearAlgebra-positive_definite-test.R

Description

Returns TRUE if input is a positive definite matrix, and FALSE otherwise.

Usage

1
test_positive_definite(x, tol = 1e-06)

Arguments

x

Numeric matrix.

tol

Numeric. Tolerance.

Details

A k \times k symmetric matrix \mathbf{A} is positive definite if all of its eigenvalues are positive.

A is considered to be a positive definite matrix if NONE of its eigenvalues are less than or equal to a tolerance value.

Value

Logical.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Wikipedia: Definite matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# TRUE
test_positive_definite(diag(2))

# FALSE
test_positive_definite(
  matrix(
    data = c(1, 2, 3, 2, 4, 5, 3, 5, 6),
    ncol = 3
  )
)

jeksterslab/linearAlgebra documentation built on Dec. 20, 2021, 10:10 p.m.