[Numpy-svn] r5084 - in trunk/numpy/core: . tests

numpy-svn@scip... numpy-svn@scip...
Fri Apr 25 12:31:31 CDT 2008


Author: stefan
Date: 2008-04-25 12:31:19 -0500 (Fri, 25 Apr 2008)
New Revision: 5084

Modified:
   trunk/numpy/core/defmatrix.py
   trunk/numpy/core/tests/test_defmatrix.py
Log:
Revert x[0][0] hack.


Modified: trunk/numpy/core/defmatrix.py
===================================================================
--- trunk/numpy/core/defmatrix.py	2008-04-25 07:24:51 UTC (rev 5083)
+++ trunk/numpy/core/defmatrix.py	2008-04-25 17:31:19 UTC (rev 5084)
@@ -225,13 +225,6 @@
     def __getitem__(self, index):
         self._getitem = True
 
-        # If indexing by scalar, check whether we are indexing into
-        # a vector, and then return the corresponding element
-        if N.isscalar(index) and (1 in self.shape):
-            index = [index,index]
-            index[list(self.shape).index(1)] = 0
-            index = tuple(index)
-
         try:
             out = N.ndarray.__getitem__(self, index)
         finally:

Modified: trunk/numpy/core/tests/test_defmatrix.py
===================================================================
--- trunk/numpy/core/tests/test_defmatrix.py	2008-04-25 07:24:51 UTC (rev 5083)
+++ trunk/numpy/core/tests/test_defmatrix.py	2008-04-25 17:31:19 UTC (rev 5084)
@@ -179,16 +179,16 @@
         x[:,1] = y>0.5
         assert_equal(x, [[0,1],[0,0],[0,0]])
 
-    def check_vector_element(self):
-        x = matrix([[1,2,3],[4,5,6]])
-        assert_equal(x[0][0],1)
-        assert_equal(x[0].shape,(1,3))
-        assert_equal(x[:,0].shape,(2,1))
+##     def check_vector_element(self):
+##         x = matrix([[1,2,3],[4,5,6]])
+##         assert_equal(x[0][0],1)
+##         assert_equal(x[0].shape,(1,3))
+##         assert_equal(x[:,0].shape,(2,1))
 
-        x = matrix(0)
-        assert_equal(x[0,0],0)
-        assert_equal(x[0],0)
-        assert_equal(x[:,0].shape,x.shape)
+##         x = matrix(0)
+##         assert_equal(x[0,0],0)
+##         assert_equal(x[0],0)
+##         assert_equal(x[:,0].shape,x.shape)
 
 
 if __name__ == "__main__":



More information about the Numpy-svn mailing list