[Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?
shoyer at gmail.com
Thu Dec 11 13:53:36 EST 2014
On Thu, Dec 11, 2014 at 8:17 AM, Sebastian Berg <sebastian at sipsolutions.net>
> 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.
It looks like np.broadcast let's us write the common_shape function very
And it's also very fast:
1000000 loops, best of 3: 1.04 µs per loop
So that does seem like a feasible refactor/simplification for
Sebastian -- if you're up for writing np.broadcast_to in C, that's great!
If you're not sure if you'll be able to get around to that in the near
future, I'll submit my PR with a Python implementation (which will have
tests that will be useful in any case).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion