I think this is a non-trivial problem to do this effectively. The Cholesky algorithm will fail if the matrix is not positive definite, so it’s best to realize yourself, which will also have the advantage of controlling what to do when the algorithms fail because the input is not positive definite. I use C # instead of Matlab for my mathematical programming, and my Cholesky implementation is just a few lines, so it is not complicated. If you use some other algorithm, then depending on how it is implemented, if you use an asymmetric matrix, you may get misleading results, because some implementations assume that the matrix is symmetric. The only quick preliminary test I can think of is to check the matrix trace , which will be positive if the matrix is SPD.
source share