summaryrefslogtreecommitdiff
path: root/scipy/base/numeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'scipy/base/numeric.py')
-rw-r--r--scipy/base/numeric.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/scipy/base/numeric.py b/scipy/base/numeric.py
index f2009b8bf..ce631e016 100644
--- a/scipy/base/numeric.py
+++ b/scipy/base/numeric.py
@@ -248,8 +248,11 @@ def ones(shape, dtype=int_, fortran=0):
"""ones(shape, dtype=int_) returns an array of the given
dimensions which is initialized to all ones.
"""
- a = empty(shape, dtype, fortran)
- a.fill(1)
+ # This appears to be slower...
+ #a = empty(shape, dtype, fortran)
+ #a.fill(1)
+ a = zeros(shape, dtype, fortran)
+ a+=1
return a
def identity(n,dtype=int_):