summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-09-27 01:37:34 -0700
committerEric Wieser <wieser.eric@gmail.com>2017-09-27 01:39:04 -0700
commitf01d1a6a5c381a4406d92db2993bf01b8e849b8c (patch)
treebb09941ffbcae53d40009e182dd7846865606dd1 /numpy/core/fromnumeric.py
parent7666d14a5b5c2d94ddb064db83e85d8b8656c7d5 (diff)
downloadnumpy-f01d1a6a5c381a4406d92db2993bf01b8e849b8c.tar.gz
BUG: np.ma.trace gives the wrong result on ND arrays
Fixes #5560
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 6f7c45859..a94be7b4d 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1245,13 +1245,13 @@ def diagonal(a, offset=0, axis1=0, axis2=1):
Returns
-------
array_of_diagonals : ndarray
- If `a` is 2-D and not a matrix, a 1-D array of the same type as `a`
- containing the diagonal is returned. If `a` is a matrix, a 1-D
+ If `a` is 2-D and not a `matrix`, a 1-D array of the same type as `a`
+ containing the diagonal is returned. If `a` is a `matrix`, a 1-D
array containing the diagonal is returned in order to maintain
- backward compatibility. If the dimension of `a` is greater than
- two, then an array of diagonals is returned, "packed" from
- left-most dimension to right-most (e.g., if `a` is 3-D, then the
- diagonals are "packed" along rows).
+ backward compatibility.
+ If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2`
+ are removed, and a new axis inserted at the end corresponding to the
+ diagonal.
Raises
------