pd_check {optimx} | R Documentation |
Check Hessian matrix is positive definite by attempting a Cholesky decomposition.
Description
We desire that Hessian matrices of objective functions for optimization are symmetric and positive definite. Symmetry is easy to check, but we caution that evaluation or approximation of a Hessian often gives a slightly asymmetric, and we commonly average the elements that are supposed to be equal, thereby symmetrizing the proposed Hessian.
The Cholesky decomposition will fail for a symmetric matrix which is NOT positive definite.
Usage
pd_check(A, pivot=TRUE, tol=1.e-07)
Arguments
A |
A symmetric matrix |
pivot |
Use pivoting in the Cholesky decomposition attempt |
tol |
A tolerance for zero |
Value
The function returns a logical TRUE if the decomposition can be carried out, FALSE otherwise.
Examples
n <- 10
A <- pracma::moler(n)
system.time(print(pd_check(A))) # returns FALSE
system.time(print(eigen(A)$value))
n <- 100
A <- pracma::moler(n)
system.time(print(pd_check(A))) # returns FALSE
system.time(print(eigen(A)$value))
[Package optimx version 2025-4.9 Index]