summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/shape_base.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py
index 13eadd988..93de19299 100644
--- a/numpy/core/shape_base.py
+++ b/numpy/core/shape_base.py
@@ -44,7 +44,12 @@ def atleast_1d(*arys):
"""
res = []
for ary in arys:
- res.append(array(ary,copy=False,subok=True,ndmin=1))
+ ary = asanyarray(ary)
+ if len(ary.shape) == 0 :
+ result = ary.reshape(1)
+ else :
+ result = ary
+ res.append(result)
if len(res) == 1:
return res[0]
else:
@@ -89,7 +94,14 @@ def atleast_2d(*arys):
"""
res = []
for ary in arys:
- res.append(array(ary,copy=False,subok=True,ndmin=2))
+ ary = asanyarray(ary)
+ if len(ary.shape) == 0 :
+ result = ary.reshape(1, 1)
+ elif len(ary.shape) == 1 :
+ result = ary[newaxis, :]
+ else :
+ result = ary
+ res.append(result)
if len(res) == 1:
return res[0]
else: