semidefiniteness {miscTools} | R Documentation |
Check whether a symmetric matrix is positive or negative semidefinite.
semidefiniteness( m, positive = TRUE, tol = .Machine$double.eps, method = "det" )
m |
a quadratic matrix or a list containing quadratic matrices. |
positive |
logical. Check for positive ( |
tol |
tolerance level (values between |
method |
method to test for semidefiniteness, either "det" (the textbook method: checking for the signs of the determinants of sub-matrices) or "eigen" (checking for the signs of the eigen values). |
Please note that a matrix can be neither positive nor negative semidefinite or positive and negative semidefinite at the same time.
semidefiniteness
returns a locigal value
or a logical vector (if argument m
is a list)
indicating whether the matrix (or each of the matrices)
is positive/negative (depending on argument positive
)
semidefinite.
Arne Henningsen
Chiang, A.C. (1984) Fundamental Methods of Mathematical Economics, 3rd ed., McGraw-Hill.
# a positive semidefinite matrix semidefiniteness( matrix( 1, 3, 3 )) # a negative semidefinite matrix semidefiniteness( matrix(-1, 3, 3 ), positive = FALSE ) # a matrix that is positive and negative semidefinite semidefiniteness( matrix( 0, 3, 3 )) semidefiniteness( matrix( 0, 3, 3 ), positive = FALSE ) # a matrix that is neither positive nor negative semidefinite semidefiniteness( matrix( 1:9, 3, 3 )) semidefiniteness( matrix( 1:9, 3, 3 ), positive = FALSE )