summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorElliott M Forney <elliott.forney@gmail.com>2014-11-20 15:09:35 -0700
committerElliott M Forney <elliott.forney@gmail.com>2014-11-20 15:09:35 -0700
commit3811083eee8d61548587f0d52286a08a7744d88f (patch)
treece3d5b46cd958ef2807a4e4b7837d408e244f043 /numpy/lib/function_base.py
parent31b94e85a99db998bd6156d2b800386973fef3e1 (diff)
downloadnumpy-3811083eee8d61548587f0d52286a08a7744d88f.tar.gz
Fixed meshgrid to return arrays with same dtype as arguments.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 36ce94bad..bbd5eb984 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -3458,18 +3458,14 @@ def meshgrid(*xi, **kwargs):
output[1].shape = (-1, 1) + (1,)*(ndim - 2)
shape[0], shape[1] = shape[1], shape[0]
- if sparse:
- if copy_:
- return [x.copy() for x in output]
- else:
- return output
- else:
+ if copy_:
+ output = [x.copy() for x in output]
+
+ if not sparse and len(output) > 0:
# Return the full N-D matrix (not only the 1-D vector)
- if copy_:
- mult_fact = np.ones(shape, dtype=int)
- return [x * mult_fact for x in output]
- else:
- return np.broadcast_arrays(*output)
+ output = np.broadcast_arrays(*output)
+
+ return output
def delete(arr, obj, axis=None):