[Scipy-tickets] [SciPy] #709: ValueError: array dimensions are not compatible for copy

SciPy scipy-tickets@scipy....
Mon Sep 8 15:09:29 CDT 2008


#709: ValueError: array dimensions are not compatible for copy
--------------------------+-------------------------------------------------
 Reporter:  nils          |        Owner:  somebody
     Type:  defect        |       Status:  new     
 Priority:  high          |    Milestone:  0.7.0   
Component:  scipy.linalg  |      Version:  devel   
 Severity:  blocker       |   Resolution:          
 Keywords:                |  
--------------------------+-------------------------------------------------
Comment (by pv):

 Triaging:

 Minimal testcase:
 {{{
 from scipy.linalg import eig

 c1 = -87584./9801
 c2 = 50./99

 A = [[1, 0,  0,  0],
      [0, 1,  0,  0],
      [0, 0,  c1, 0],
      [0, 0,  0, c1]]

 B = [[0, 0,  1,   0],
      [0, 0,  0,   1],
      [1, 0,  0, -c2],
      [0, 1, c2,   0]]

 eig(A,B)
 }}}

 The generalized eigenvalue pair (alpha, beta) as given by LAPACK GGEV are
 {{{
 alpha [ 0. +2.79469606e+00j  0. -2.79469606e+00j  0. +0.00000000e+00j 0.
 -2.18645248e-16j]
 beta  [      8.59238852e-01       8.59238852e-01       0.00000000e+00
 7.95804395e-17]
 }}}
 The actual generalized eigenvalue is lambda = alpha/beta, and here there
 is a division by zero, and a division by near zero.

 What should eig return here? I note that Octave's QZ returns here
 {{{
 octave:19> qz(A,B)
 ans =

    0.0000 + 3.2525i
    0.0000 - 3.2525i
    0.0000 - 2.7475i
 }}}
 ie. it omits the 0/0 "eigenvalues".

 OTOH, scipy's eig sometimes returns NaNs, eg. for the following ill-posed
 problem:
 {{{
 >>> eig([[1,0],[0,0]], [[1,0],[0,0]])
 (array([  1. +0.j,  NaN NaNj]), array([[ 1.+0.j,  0.+0.j],
        [ 0.+0.j,  1.+0.j]]))
 }}}

 So, I guess, this ticket amounts to a bug in _make_complex_eigvecs not
 always handling NaNs properly.

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


More information about the Scipy-tickets mailing list