[Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?

Benjamin Root ben.root at ou.edu
Mon Dec 8 09:36:17 EST 2014


I like the idea of the broadcast argument to reshape. It certainly makes
sense there, and it avoids adding a new function. Probably should add a
note to the docstring of broadcast_arrays, too.

Ben Root

On Mon, Dec 8, 2014 at 2:31 AM, Pierre Haessig <pierre.haessig at crans.org>
wrote:

> Hi,
>
> Le 07/12/2014 08:10, Stephan Hoyer a écrit :
> > In [5]: %timeit xray.core.utils.as_shape(x, y.shape)
> > 100000 loops, best of 3: 17 µs per loop
> >
> > Would this be a welcome addition to numpy's lib.stride_tricks? If so,
> > I will put together a PR.
> >
> >
>
> Instead of putting this function in stride_tricks (which is quite
> hidden), could it be added instead as a boolean flag to the existing
> `reshape` method ? Something like:
>
> x.reshape(y.shape, broadcast=True)
>
> What other people think ?
>
> best,
> Pierre
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141208/d83bafda/attachment.html>


More information about the NumPy-Discussion mailing list