[Numpy-tickets] [NumPy] #731: numpy.linalg.eigvals can't take nested lists while numpy.linalg.eig can
NumPy
numpy-tickets@scipy....
Wed Apr 9 14:34:15 CDT 2008
#731: numpy.linalg.eigvals can't take nested lists while numpy.linalg.eig can
--------------------+-------------------------------------------------------
Reporter: nmb | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 1.0.5
Component: Other | Version: none
Severity: normal | Keywords:
--------------------+-------------------------------------------------------
I was a bit surprised by the following this afternoon:
{{{
>>> import numpy
>>> numpy.linalg.eig([[1,2],[3,4]])
(array([-0.37228132, 5.37228132]), array([[-0.82456484, -0.41597356],
[ 0.56576746, -0.90937671]]))
>>> numpy.linalg.eigvals([[1,2],[3,4]])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
/site-packages/numpy/linalg/linalg.py", line 548, in eigvals
_assertRank2(a)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
/site-packages/numpy/linalg/linalg.py", line 120, in _assertRank2
if len(a.shape) != 2:
AttributeError: 'list' object has no attribute 'shape'
>>>
}}}
The attached patch solves the problem for all of the functions in linalg
and adds tests to that effect.
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/731>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list