I have worked on a generalized piecewise function (genpiecewise) that are
simpler and more general than the current numpy.piecewise implementation. The
new generalized piecewise function allows functions of the type f(x0, x1,.. ,
xn) i.e. to have arbitrary number of input arguments that are eval
Ok, I will open a pull request. But before I do so, I would like to know what
kind of pull request to make.
Ideally I think the call signature for piecewise should be like this:
def piecewise(condlist, funclist, xi=None, fillvalue=numpy.nan, args=(), **kw):
or this:
def piecewise(condlist, fun
Hi, Juan.
Meshgrid can actually give what you want, but you must use the options:
copy=False and indexing=’ij’.
In [7]: %timeit np.meshgrid(np.arange(512), np.arange(512))
1000 loops, best of 3: 1.24 ms per loop
In [8]: %timeit np.meshgrid(np.arange(512), np.arange(512), copy=False)
1 loop
The reason for returning copies from meshgrid as default instead of views into
to input arrays, was to not break backwards compatibility.
The old meshgrid returned copied arrays, which is safe if you need to write to
those arrays.
If you use copy=False, a view into the original arrays are returne