summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/arrayobject.c2
-rw-r--r--numpy/core/tests/test_defmatrix.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index eec1a4d00..c719cbc4c 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -3273,7 +3273,7 @@ _check_axis(PyArrayObject *arr, int *axis, int flags)
if ((*axis >= MAX_DIMS) || (n==0)) {
temp = PyArray_Ravel(arr,0);
- *axis = 0;
+ *axis = PyArray_NDIM(temp)-1;
return temp;
}
else {
diff --git a/numpy/core/tests/test_defmatrix.py b/numpy/core/tests/test_defmatrix.py
index 0fd60c6bd..e77cac073 100644
--- a/numpy/core/tests/test_defmatrix.py
+++ b/numpy/core/tests/test_defmatrix.py
@@ -74,6 +74,11 @@ class test_properties(ScipyTestCase):
assert A[0,0] == mA[0,0]
assert A[0,0] != mB[0,0]
+ def check_noaxis(self):
+ A = matrix([[1,0],[0,1]])
+ assert A.sum() == matrix(2)
+ assert A.mean() == matrix(0.5)
+
class test_autocasting(ScipyTestCase):
def check_basic(self):
A = arange(100).reshape(10,10)