diff options
author | alex <argriffi@ncsu.edu> | 2014-07-31 17:24:30 -0400 |
---|---|---|
committer | alex <argriffi@ncsu.edu> | 2014-07-31 17:24:30 -0400 |
commit | 75f302e79cd421a591805bab143b8f4474b66313 (patch) | |
tree | f92e6c8aebb4f7c44dff1a71e99f4ef89d40f2dd /numpy/matrixlib/defmatrix.py | |
parent | ae7c942ced535fb39384aefeb8d32df92fb15988 (diff) | |
download | numpy-75f302e79cd421a591805bab143b8f4474b66313.tar.gz |
DOC: matrix flatten docstring
Diffstat (limited to 'numpy/matrixlib/defmatrix.py')
-rw-r--r-- | numpy/matrixlib/defmatrix.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py index 0fd5db66a..a345a7b44 100644 --- a/numpy/matrixlib/defmatrix.py +++ b/numpy/matrixlib/defmatrix.py @@ -454,6 +454,39 @@ class matrix(N.ndarray): """ return N.ndarray.sum(self, axis, dtype, out, keepdims=True)._collapse(axis) + # To update docstring from array to matrix... + def flatten(self, order='C'): + """ + Return a copy of the matrix collapsed into one dimension. + + Parameters + ---------- + order : {'C', 'F', 'A'}, optional + Whether to flatten in C (row-major), Fortran (column-major) order, + or preserve the C/Fortran ordering from `a`. + The default is 'C'. + + Returns + ------- + y : matrix + A copy of the input matrix, flattened to one dimension. + + See Also + -------- + ravel : Return a flattened array. + flat : A 1-D flat iterator over the matrix. + + Examples + -------- + >>> a = np.matrix([[1,2], [3,4]]) + >>> a.flatten() + matrix([[1, 2, 3, 4]]) + >>> a.flatten('F') + matrix([[1, 3, 2, 4]]) + + """ + return N.ndarray.flatten(self, order=order) + def mean(self, axis=None, dtype=None, out=None): """ Returns the average of the matrix elements along the given axis. |