[Scipy-tickets] [SciPy] #1118: scipy.lingalg.eig giving flipped values for complex numbers for the eigenvalues

SciPy Trac scipy-tickets@scipy....
Wed Feb 17 08:37:23 CST 2010


#1118: scipy.lingalg.eig giving flipped values for complex numbers for the
eigenvalues
----------------------------+-----------------------------------------------
 Reporter:  abhijitbendale  |       Owner:  somebody
     Type:  defect          |      Status:  new     
 Priority:  normal          |   Milestone:  0.8.0   
Component:  Other           |     Version:  0.7.0   
 Keywords:                  |  
----------------------------+-----------------------------------------------
 Here's example
 terminology
 d = eigenvalues,
 c = eigenvectors


 My Matrix:
 rand_mat =
 array([[ 0.23477991,  0.64911547,  0.74469281,  0.78022744,  0.44678375,
          0.64431813],
        [ 0.35315857,  0.73172239,  0.18895502,  0.08112577,  0.30634947,
          0.37860938],
        [ 0.82119404,  0.64774596,  0.68677543,  0.92938597,  0.50850866,
          0.81158046],
        [ 0.01540344,  0.45092371,  0.18351116,  0.77571268,  0.51077156,
          0.53282559],
        [ 0.0430238 ,  0.54700889,  0.3684846 ,  0.48679163,  0.81762771,
          0.3507271 ],
        [ 0.16899003,  0.29632081,  0.62561856,  0.43585859,  0.79483142,
          0.93900156]])

 When I use it with matlab eig function i get:
 [c,d] = eig(rand_mat);
 d = diag(d)';
 c =
   -0.4609            -0.6988            -0.2305 + 0.1380i  -0.2305 -
 0.1380i   0.0378 + 0.2205i   0.0378 - 0.2205i
   -0.2529             0.2221             0.0908 - 0.2693i   0.0908 +
 0.2693i   0.5657             0.5657
   -0.5871             0.6292            -0.2792 + 0.3202i  -0.2792 -
 0.3202i  -0.0172 + 0.3984i  -0.0172 - 0.3984i
   -0.2877            -0.0234            -0.3193 - 0.2990i  -0.3193 +
 0.2990i  -0.2817 - 0.2738i  -0.2817 + 0.2738i
   -0.3140            -0.2302            -0.1341 + 0.2288i  -0.1341 -
 0.2288i   0.0197 - 0.4117i   0.0197 + 0.4117i
   -0.4446            -0.1137             0.6363             0.6363
 -0.2698 + 0.2720i  -0.2698 - 0.2720i

 d =
 2.9524            -0.3639             0.2593 - 0.3071i   0.2593 + 0.3071i
 0.5392 - 0.1905i   0.5392 + 0.1905i

 whereas when I use scipy with following command
 "d,c = scipy.linalg.eig(rand_mat) "
 (Note the return values for matlab and scipy are in diff order)
 I get the same c
 but d i get is
 d = array([ 2.95242735+0.j        , -0.36389729+0.j        ,
         0.25933878+0.30708462j,  0.25933878-0.30708462j,
         0.53920604+0.19047221j,  0.53920604-0.19047221j])

 Note that the negative sign is flipped for complex values.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1118>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list