summaryrefslogtreecommitdiff
path: root/numpy/matrixlib/defmatrix.py
diff options
context:
space:
mode:
authorseberg <sebastian@sipsolutions.net>2015-12-18 13:21:03 +0100
committerseberg <sebastian@sipsolutions.net>2015-12-18 13:21:03 +0100
commit3af5f0574740611076df9dc905330defab70a6dc (patch)
tree918a324b3ffb9b1abff63ee7c35d668783667cbc /numpy/matrixlib/defmatrix.py
parentf7b07521ca811baa2fcc649a6dc5cf56f5c65fd0 (diff)
parent088e20e272389395fb3fd24fed144ed19bae8cdb (diff)
downloadnumpy-3af5f0574740611076df9dc905330defab70a6dc.tar.gz
Merge pull request #6823 from gfyoung/order_arg_validate
Stricter Argument Checking for Flatten Methods
Diffstat (limited to 'numpy/matrixlib/defmatrix.py')
-rw-r--r--numpy/matrixlib/defmatrix.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py
index ffd4578ba..170db87c8 100644
--- a/numpy/matrixlib/defmatrix.py
+++ b/numpy/matrixlib/defmatrix.py
@@ -277,9 +277,9 @@ class matrix(N.ndarray):
elif ndim == 1:
shape = (1, shape[0])
- order = False
+ order = 'C'
if (ndim == 2) and arr.flags.fortran:
- order = True
+ order = 'F'
if not (order or arr.flags.contiguous):
arr = arr.copy()
@@ -519,10 +519,12 @@ class matrix(N.ndarray):
Parameters
----------
- order : {'C', 'F', 'A'}, optional
- Whether to flatten in C (row-major), Fortran (column-major) order,
- or preserve the C/Fortran ordering from `m`.
- The default is 'C'.
+ order : {'C', 'F', 'A', 'K'}, optional
+ 'C' means to flatten in row-major (C-style) order. 'F' means to
+ flatten in column-major (Fortran-style) order. 'A' means to
+ flatten in column-major order if `m` is Fortran *contiguous* in
+ memory, row-major order otherwise. 'K' means to flatten `m` in
+ the order the elements occur in memory. The default is 'C'.
Returns
-------