[Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?
robert.kern at gmail.com
Thu Dec 11 11:20:34 EST 2014
On Thu, Dec 11, 2014 at 4:17 PM, Sebastian Berg <sebastian at sipsolutions.net>
> On Do, 2014-12-11 at 16:56 +0100, Pierre Haessig wrote:
> > Le 11/12/2014 16:52, Robert Kern a écrit :
> > >
> > > And we already have a numpy.broadcast() function.
> > >
> > >
> > True, I once read the docstring of this function. but never used it
> I am not sure it is really the right thing for most things since it
> returns an old style iterator.
Indeed. That's why I wrote broadcast_arrays().
> On the other hand arrays with 0-strides
> need a bit more care (if we add this top level, one might have copy=True
> as a default or so?).
> Also because of that it is currently limited to NPY_MAXARGS (32).
> Personally, I would like to see this type of functionality implemented
> in C, and may be willing to help with it. This kind of code exists in
> enough places in numpy so it can be stolen pretty readily. One option
> would also be to have something like:
> np.broadcast_to(array, shape)
> # (though I would like many arrays too)
> and then broadcast_ar rays could be implemented in terms of these two.
Why? What benefit does broadcast_arrays() get from being reimplemented in C?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion