From 81140fe52e67f15614a735420c3fe0f592e17ab4 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Thu, 18 Mar 2010 21:43:07 +0000 Subject: BUG: lib: fix #1435, np.gradient should use zeros_like Thanks to Ryan May for the patch. --- numpy/lib/function_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 17b254d82..82503a54e 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -808,7 +808,7 @@ def gradient(f, *varargs): for axis in range(N): # select out appropriate parts for this dimension - out = zeros(f.shape, f.dtype.char) + out = np.zeros_like(f).astype(otype) slice1[axis] = slice(1, -1) slice2[axis] = slice(2, None) slice3[axis] = slice(None, -2) -- cgit v1.2.1