[Numpy-discussion] eigenvectors() hangs on nan's
Norbert Nemec
Norbert.Nemec.list at gmx.de
Thu Mar 23 15:04:04 CST 2006
The current SVN version of numpy.linalg does not contain "eigenvectors"
any more (since the cleanup - patches I submitted last week), so you are
obviously using something older.
In any case, numpy.linalg.eig (and eigvals) do not seem to contain any
check against NaNs, which probably is a bad idea. scipy.linalg.eig does
contain such a check, but that module is internally very different to
that in numpy.
numpy.linalg certainly needs more cleanup. In that course, adding
safety-checks certainly is one task.
Chris Fonnesbeck wrote:
> If linalg.eigenvectors is called on a matrix that contains nan values,
> it hangs, quickly consuming system resources. Here is the matrix:
>
> matrix = [[ 0. 0. 0. 0.
> 0.36658624 0. 0.
> 0. 0. 0. ]
> [ 0.89827259 0. 0. 0. 0.
> 0. 0.
> 0. 0. 0. ]
> [ 0. 0.92510948 0. 0. 0.
> 0. 0.
> 0. 0. 0. ]
> [ 0. 0. nan nan 0.
> 0. 0.
> 0. 0. 0. ]
> [ 0. 0. nan nan 0. nan
> 0. 0. 0. 0. ]
> [ 0. 0. 0. 0. 0.93319244 nan
> 0. 0. 0. 0. ]
> [ 0. 0. 0. 0. 0.36658624
> 0. 0.
> 0. 0. 0. ]
> [ 0. 0. 0. 0. 0. 0.
> 0.89827259 0. 0. 0. ]
> [ 0. 0. 0. 0. 0.
> 0. 0.
> 0.92510948 0. 0. ]
> [ 0. 0. 0. 0. 0.
> 0. 0.
> 0. 0.92510948 0.93319244]]
>
> I would expect an exception, but I get none.
>
> Using a recent cvs build of numpy.
>
> C.
>
> --
> Chris Fonnesbeck + Atlanta, GA + http://trichech.us
More information about the Numpy-discussion
mailing list