dimanche 7 juillet 2019

Testing if an operation has been performed correctly in python 3 numpy?

I need to calculate a Hessian (matrix of second derivatives), and modify it iff it is not positive definite. Cholesky decomposition fails if a matrix is not symmetric positive (semi)definite, and Hessians are symmetric. Therefore I can use numpy.linalg.cholesky on my matrix, and this seems to be one of the most efficient ways of checking. See this post for example.

Now I am not sure how to condition on the Cholesky decomposition being performed without error. For instance

H=hessian(X)

if np.linalg.cholesky(H) ...??? :
      'modification'

Aucun commentaire:

Enregistrer un commentaire