the recommended way to check if a matrix is symmetric positive definite is to first check if it's symmetric (...) and then run Cholesky on it. Run Cholesky means perform a Cholesky factorization of the matrix, and to do so you can use dpotrf
. If the factorization fails (a_ii <= 0
) then the matrix is not positive definite, if the factorization sucesses then the matrix is positive definite (INFO=0
The implementation of Cholesky in LAPACK is the left-looking variant. This choice has been made on the assumption that the general case is that the factorization would not fail. Another variant ("bordered" variant of Cholesky) can be implemented, this implemetation will fail faster
. So if the failure mode is the general expected case, that's the one you might want to use. (See Cholesky Decomposition
for more information.)
So now, if your problem is to find the minimum eigenvalue (and thus consequently solving the symmetric-definiteness question). You'll go with dsyevx
. We do not provide error bounds though, and I can not really tell what NAG routine f02bff was returning. You can certainly post-process the minimum eigenvalue and the associated eigenvector to compute some backward error ...