[Numpy-discussion] One question about the numpy.linalg.eig() routine

Val Kalatsky kalatsky at gmail.com
Mon Apr 2 20:38:54 EDT 2012


Both results are correct.
There are 2 factors that make the results look different:
1) The order: the 2nd eigenvector of the numpy solution corresponds to the
1st eigenvector of your solution,
note that the vectors are written in columns.
2) The phase: an eigenvector can be multiplied by an arbitrary phase factor
with absolute value = 1.
As you can see this factor is -1 for the 2nd eigenvector
and -0.99887305445887753-0.047461785427773337j for the other one.
Val

2012/4/2 Hongbin Zhang <hongbin_zhang82 at hotmail.com>

>  Dear Python-users,
>
> I am currently very confused about the Scipy routine to obtain the
> eigenvectors of a complex matrix.
> In attached you find two files to diagonalize a 2X2 complex Hermitian
> matrix, however, on my computer,
>
> If I run python, I got:
>
> [[ 0.80322132+0.j          0.59500941+0.02827207j]
>  [-0.59500941+0.02827207j  0.80322132+0.j        ]]
>
> If I compile the fortran code, I got:
>
>  ( -0.595009410289, -0.028272068905) (  0.802316135182,  0.038122316497)
>  ( -0.803221321796,  0.000000000000) ( -0.595680709955,  0.000000000000)
>
> From the scipy webpage, it is said that numpy.linalg.eig() provides
> nothing but
> an interface to lapack zheevd subroutine, which is used in my fortran code.
>
> < /div>
> Would somebody be kind to tell me how to get consistent results?
>
> Many thanks in advance.
>
> Best wishes,
>
> Hongbin
>
>
>
>
>                                                         Ad hoc, ad loc
> and quid pro quo
>
>
>                                     ---   Jeremy Hilary Boob
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120402/ef537364/attachment.html>


More information about the NumPy-Discussion mailing list