Scipy.linalg.eig() giving different eigenvectors from GNU Octave's eig()
Question: I want to compute the eigenvalues for a generalized eigenvalue problem with
lambda * M * v = K * v, where lambda is the eigenvalue, v is an eigenvector,
and M and K are matrices. Let's say we have

    
    
    K =
    
       1.8000 + 0.0000i  -1.0970 + 0.9550i
      -1.0970 - 0.9550i   1.8000 + 0.0000i
    
    M = 
    
       209     0
         0   209
    

In Octave, if I do `[V,D]=eig(K,M)`, I get:

    
    
    V =
    
       0.53332 - 0.46429i  -0.53332 + 0.46429i
       0.70711 + 0.00000i   0.70711 + 0.00000i
    
    D =
    
    Diagonal Matrix
    
       0.34555         0
             0   3.25445
    

However, if I do scipy.linalg.eig(K, b=M) using Scipy in python, I get a
different result:

    
    
    >>> import numpy as np
    >>> import scipy as sp
    >>> import scipy.linalg
    >>> K = np.mat([[1.8, -1.097+0.995j], [-1.097-0.955j, 1.8]])
    >>> M = np.mat([[209., 0.], [0., 209.]])
    >>> M
    matrix([[ 209.,    0.],
            [   0.,  209.]])
    >>> K
    matrix([[ 1.800+0.j   , -1.097+0.955j],
            [-1.097-0.955j,  1.800+0.j   ]])
    >>> D, V = sp.linalg.eig(K, b=M)
    >>> D
    array([ 0.00165333 -1.99202696e-19j,  0.01557155 +0.00000000e+00j])
    >>> V
    array([[ 0.70710678 +0.00000000e+00j, -0.53332494 +4.64289256e-01j],
           [ 0.53332494 +4.64289256e-01j,  0.70710678 -8.38231384e-18j]])
    

The eigenvalues should be the ones in the D array.

Why are the eigenvalues different in these two examples? Am I misunderstanding
something?

edit: corrected typo and redid calculation.

edit: I used Octave 3.8.2. in Mac OS X 10.10.3.


Answer: I think I understand what's going on. Scipy is probably providing the correct
eigenvalues. Octave [accepts a second matrix in its eig()
function](http://octave.sourceforge.net/octave/function/eig.html) but doesn't
specify what it does. [Matlab's
documentation](http://www.mathworks.com/help/matlab/ref/eig.html#bti99bb-1)
does say it's for a generalized eigenvalue problem, but in Octave adding the
second matrix appears to have no affect on the eigenvalues. This looks like a
bug in Octave.

