[SciPy-user] most negative eigenvalue
Tue Aug 28 11:23:16 CDT 2007
On 28/08/07, dmitrey <firstname.lastname@example.org> wrote:
> Yes, I already use
> but it makes impossible to use debugger, that is very bad.
This is a general python question. You should almost never use a bare
"except", for the reason you discovered. What you should do is find
out what exception cholesky (or cho_factor) throws (it's not in the
documentation, though it really should be, but a quick test shows it
throws LinAlgError) and catch only that one:
# something went wrong.
You can go a step further and check the extra information returned by
the exception, but in this case you want to investigate further
anyway, so I recommend simply using eigvalsh() and looking at the
eigenvalues. If any of them are too close to zero (say 10**-14 times
the largest) the matrix is indefinite, at least numerically.
For more on dealing with exceptions, see
http://docs.python.org/tut/node10.html and maybe also
More information about the SciPy-user