diff options
author | Danny Hermes <daniel.j.hermes@gmail.com> | 2017-11-12 11:17:12 -0800 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-11-12 11:17:12 -0800 |
commit | a4e47e0205b78eb96248e71918c2558e25a9d3c7 (patch) | |
tree | 85f60a4994556e0eaf8e2fd0d4d72e2cf66ea5b7 /numpy/matlib.py | |
parent | d87c4197c358a898372c178f6c24f00d54eff745 (diff) | |
download | numpy-a4e47e0205b78eb96248e71918c2558e25a9d3c7.tar.gz |
ENH: Add `order=` keyword to `np.eye()` (#9996)
Fixes #9995
Diffstat (limited to 'numpy/matlib.py')
-rw-r--r-- | numpy/matlib.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/numpy/matlib.py b/numpy/matlib.py index 656ca3458..004e5f0c8 100644 --- a/numpy/matlib.py +++ b/numpy/matlib.py @@ -173,7 +173,7 @@ def identity(n,dtype=None): b.flat = a return b -def eye(n,M=None, k=0, dtype=float): +def eye(n,M=None, k=0, dtype=float, order='C'): """ Return a matrix with ones on the diagonal and zeros elsewhere. @@ -189,6 +189,11 @@ def eye(n,M=None, k=0, dtype=float): and a negative value to a lower diagonal. dtype : dtype, optional Data-type of the returned matrix. + order : {'C', 'F'}, optional + Whether the output should be stored in row-major (C-style) or + column-major (Fortran-style) order in memory. + + .. versionadded:: 1.14.0 Returns ------- @@ -210,7 +215,7 @@ def eye(n,M=None, k=0, dtype=float): [ 0., 0., 0.]]) """ - return asmatrix(np.eye(n, M, k, dtype)) + return asmatrix(np.eye(n, M=M, k=k, dtype=dtype, order=order)) def rand(*args): """ |