|
|
@ -204,13 +204,15 @@ def piecewise(condlist, funclist, xi=None, fill_value=0.0, args=(), **kw):
|
|
|
|
if xi is None:
|
|
|
|
if xi is None:
|
|
|
|
arrays = ()
|
|
|
|
arrays = ()
|
|
|
|
dtype = np.result_type(*funclist)
|
|
|
|
dtype = np.result_type(*funclist)
|
|
|
|
|
|
|
|
shape = condlist[0].shape
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if not isinstance(xi, tuple):
|
|
|
|
if not isinstance(xi, tuple):
|
|
|
|
xi = (xi,)
|
|
|
|
xi = (xi,)
|
|
|
|
arrays = np.broadcast_arrays(*xi)
|
|
|
|
arrays = np.broadcast_arrays(*xi)
|
|
|
|
dtype = np.result_type(*arrays)
|
|
|
|
dtype = np.result_type(*arrays)
|
|
|
|
|
|
|
|
shape = arrays[0].shape
|
|
|
|
|
|
|
|
|
|
|
|
out = valarray(condlist[0].shape, fill_value, dtype)
|
|
|
|
out = valarray(shape, fill_value, dtype)
|
|
|
|
for cond, func in zip(condlist, funclist):
|
|
|
|
for cond, func in zip(condlist, funclist):
|
|
|
|
if cond.any():
|
|
|
|
if cond.any():
|
|
|
|
if isinstance(func, collections.Callable):
|
|
|
|
if isinstance(func, collections.Callable):
|
|
|
|