left hand side eigenvector in python?
Question: How do calculate the left hand side eigenvector in python?

    
    
        >>> import from numpy as np
        >>> from scipy.linalg import eig
        >>> np.set_printoptions(precision=4)
        >>> T = np.mat("0.2 0.4 0.4;0.8 0.2 0.0;0.8 0.0 0.2")
        >>> print "T\n", T
        T
        [[ 0.2  0.4  0.4]
         [ 0.8  0.2  0. ]
         [ 0.8  0.   0.2]]
        >>> w, vl, vr = eig(T, left=True)
        >>> vl
        array([[ 0.8165,  0.8165,  0.    ],
               [ 0.4082, -0.4082, -0.7071],
               [ 0.4082, -0.4082,  0.7071]])
    

This does not seem correct, google has not been kind on this!


Answer: Your result is correct to my understanding.

However, you might be misinterpreting it. The [numpy
docs](http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.eig.html)
are a bit clearer on what the left eigenvectors should be.

> Finally, it is emphasized that v consists of the right (as in right-hand
> side) eigenvectors of a. A vector y satisfying dot(y.T, a) = z * y.T for
> some number z is called a left eigenvector of a, and, in general, the left
> and right eigenvectors of a matrix are not necessarily the (perhaps
> conjugate) transposes of each other.

I.e. you need to transpose the vectors in `vl`. `vl[:,i].T` is the i-th left
eigenvector. If I test this, I get, that the results are correct.

    
    
    >>> import numpy as np
    >>> from scipy.linalg import eig
    >>> np.set_printoptions(precision=4)
    >>> T = np.mat("0.2 0.4 0.4;0.8 0.2 0.0;0.8 0.0 0.2")
    >>> print "T\n", T
    T
    [[ 0.2  0.4  0.4]
     [ 0.8  0.2  0. ]
     [ 0.8  0.   0.2]]
    >>> w, vl, vr = eig(T, left=True)
    >>> vl
    array([[ 0.8165,  0.8165,  0.    ],
           [ 0.4082, -0.4082, -0.7071],
           [ 0.4082, -0.4082,  0.7071]])
    >>> [ np.allclose(np.dot(vl[:,i].T, T), w[i]*vl[:,i].T) for i in range(3) ]
    [True, True, True]
    

