[Numpy-svn] r5136 - in branches/1.1.x/numpy/core: . tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed May 7 11:05:47 EDT 2008
Author: peridot
Date: 2008-05-07 10:05:45 -0500 (Wed, 07 May 2008)
New Revision: 5136
Modified:
branches/1.1.x/numpy/core/defmatrix.py
branches/1.1.x/numpy/core/tests/test_defmatrix.py
Log:
Matrix indexing fix as discussed on the list and described in ticket #760;closes #760.
Modified: branches/1.1.x/numpy/core/defmatrix.py
===================================================================
--- branches/1.1.x/numpy/core/defmatrix.py 2008-05-07 06:10:11 UTC (rev 5135)
+++ branches/1.1.x/numpy/core/defmatrix.py 2008-05-07 15:05:45 UTC (rev 5136)
@@ -223,6 +223,8 @@
return
def __getitem__(self, index):
+ if isscalar(index):
+ return self.__array__()[index]
self._getitem = True
try:
Modified: branches/1.1.x/numpy/core/tests/test_defmatrix.py
===================================================================
--- branches/1.1.x/numpy/core/tests/test_defmatrix.py 2008-05-07 06:10:11 UTC (rev 5135)
+++ branches/1.1.x/numpy/core/tests/test_defmatrix.py 2008-05-07 15:05:45 UTC (rev 5136)
@@ -190,6 +190,9 @@
## assert_equal(x[0],0)
## assert_equal(x[:,0].shape,x.shape)
+ def check_scalar_indexing(self):
+ x = asmatrix(zeros((3,2),float))
+ assert_equal(x[0,0],x[0][0])
if __name__ == "__main__":
NumpyTest().run()
More information about the Numpy-svn
mailing list