[Numpy-discussion] why does eigvalsh return a complex array?

Charles R Harris charlesr.harris at gmail.com
Fri Apr 6 22:04:02 EDT 2012


On Fri, Apr 6, 2012 at 1:56 AM, Christoph Groth <cwg at falma.de> wrote:

> I noticed that numpy.linalg.eigvalsh returns a complex array, even
> though mathematically the resulting eigenvalues are guaranteed to be
> real.
>
> Looking at the source code, the underlying zheevd routine of LAPACK
> indeed returns an array of real numbers which is than converted to
> complex in the numpy wrapper.
>
> Does numpy policy require the type of the result to be the same as the
> type of input?  Copying an array twice to arrive at the original result
> seems pointless to me.
>
>
I think this should be fixed, the problem is the wrapper from a complex
array. Not sure what the easiest fix is. I expect eigh is similar in
behavior.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120406/28dd3dd7/attachment.html>


More information about the NumPy-Discussion mailing list