summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2008-04-25 17:31:19 +0000
committerStefan van der Walt <stefan@sun.ac.za>2008-04-25 17:31:19 +0000
commitbf6e7a7edb1c5173f1a3eb343fbd9e7b25445073 (patch)
tree6732d6a0ded0f94b15f6163ef23afd215a173031 /numpy/core
parent954e1411c794fa570657f2614912468fe1eabe27 (diff)
downloadnumpy-bf6e7a7edb1c5173f1a3eb343fbd9e7b25445073.tar.gz
Revert x[0][0] hack.
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/defmatrix.py7
-rw-r--r--numpy/core/tests/test_defmatrix.py20
2 files changed, 10 insertions, 17 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py
index 77e90acbd..ca7240757 100644
--- a/numpy/core/defmatrix.py
+++ b/numpy/core/defmatrix.py
@@ -225,13 +225,6 @@ class matrix(N.ndarray):
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:
diff --git a/numpy/core/tests/test_defmatrix.py b/numpy/core/tests/test_defmatrix.py
index 7d73bbd02..19ace5c29 100644
--- a/numpy/core/tests/test_defmatrix.py
+++ b/numpy/core/tests/test_defmatrix.py
@@ -179,16 +179,16 @@ class TestIndexing(NumpyTestCase):
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))
-
- x = matrix(0)
- assert_equal(x[0,0],0)
- assert_equal(x[0],0)
- assert_equal(x[:,0].shape,x.shape)
+## 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)
if __name__ == "__main__":