[SciPy-dev] [SciPy-user] scipy.linalg.eig() returns transposed eigenvector matrix
Travis Oliphant
oliphant at ee.byu.edu
Sun Nov 13 22:29:09 CST 2005
Robert Dick wrote:
>scipy.linalg.eig() returns transposed eigenvector matrix
>
>Results with old Numeric:
>
>
>>>>import LinearAlgebra as la
>>>>from Numeric import *
>>>>la.eigenvectors(array([[1.0, 1.0], [1.0, 1.0]]))
>>>>
>>>>
>(array([ 2., 0.]), array([[ 0.70710678, 0.70710678],
> [-0.70710678, 0.70710678]]))
>
>Results with svn current SciPy linked against AMD ACML BLAS/LAPACK.
>
>
>>>>import scipy.linalg as la
>>>>from scipy import *
>>>>la.eig(array([[1.0, 1.0], [1.0, 1.0]]))
>>>>
>>>>
>(array([ 2.+0.j, 0.+0.j]), array([[ 0.70710678, -0.70710678],
> [ 0.70710678, 0.70710678]]))
>
>
>>>>la.eig(array([[1.0, 1.0], [1.0, 1.0]]))[1].transpose()
>>>>
>>>>
>array([[ 0.70710678, 0.70710678],
> [-0.70710678, 0.70710678]])
>
>Can somebody else reproduce this?
>
>
I can cofirm this. Notice that scipy_core basic eigenvalues work fine.
I'm surprised this isn't being picked up by a test, though.
import scipy.basic.linalg as sbl
sbl.eig([[1.0,1.0],[1.0,1.0]])
(array([ 2., 0.]), array([[ 0.70710678, 0.70710678],
[-0.70710678, 0.70710678]]))
import scipy.linalg as sl
sl.eig([[1.0,1.0],[1.0,1.0]])
(array([ 2.+0.j, 0.+0.j]), array([[ 0.70710678, -0.70710678],
[ 0.70710678, 0.70710678]]))
It may be an issue with f2py and the new FORTRAN style arrays that can
be created, because both functions return exactly the same data. It's
just that the hand-written routine in scipy_core (which is correct) has
the CONTIGUOUS flag set, while the advanced routine generated
automatically by f2py has the FORTRAN flag set.
-Travis
More information about the Scipy-dev
mailing list