summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 9a51229a1..aa7d2c29b 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -1956,9 +1956,8 @@ def identity(n, dtype=None, maskna=False):
[ 0., 0., 1.]])
"""
- a = zeros((n,n), dtype=dtype, maskna=maskna)
- a.diagonal()[...] = 1
- return a
+ from numpy import eye
+ return eye(n, dtype=dtype, maskna=maskna)
def allclose(a, b, rtol=1.e-5, atol=1.e-8):
"""