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.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index a28b6f3c4..80db6573e 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -114,7 +114,7 @@ def zeros_like(a, dtype=None, order='K', subok=True):
"""
res = empty_like(a, dtype=dtype, order=order, subok=subok)
- res.fill(0)
+ multiarray.copyto(res, 0, casting='unsafe')
return res
# end Fernando's utilities
@@ -1818,14 +1818,7 @@ def ones(shape, dtype=None, order='C'):
"""
a = empty(shape, dtype, order)
- try:
- a.fill(1)
- # Above is faster now after addition of fast loops.
- #a = zeros(shape, dtype, order)
- #a+=1
- except TypeError:
- obj = _maketup(dtype, 1)
- a.fill(obj)
+ multiarray.copyto(a, 1, casting='unsafe')
return a
def identity(n, dtype=None):