From f01d1a6a5c381a4406d92db2993bf01b8e849b8c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 27 Sep 2017 01:37:34 -0700 Subject: BUG: np.ma.trace gives the wrong result on ND arrays Fixes #5560 --- numpy/core/fromnumeric.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'numpy/core/fromnumeric.py') 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 ------ -- cgit v1.2.1