Find out if matrix is positive definite with numpy

后端 未结 8 2170
慢半拍i
慢半拍i 2020-12-23 13:40

I need to find out if matrix is positive definite. My matrix is numpy matrix. I was expecting to find any related method in numpy library, but no success. I appreciate any

8条回答
  •  不思量自难忘°
    2020-12-23 13:40

    I don't know why the solution of NPE is so underrated. It's the best way to do this. I've found on Wkipedia that the complexity is cubic.

    Furthermore, there it is said that it's more numerically stable than the Lu decomposition. And the Lu decomposition is more stable than the method of finding all the eigenvalues.

    And, it is a very elegant solution, because it's a fact :

    A matrix has a Cholesky decomposition if and only if it is symmetric positive.

    So why not using maths ? Maybe some people are affraid of the raise of the exception, but it'a fact too, it's quite useful to program with exceptions.

提交回复
热议问题