Here is an update on a new function for broadcasting arrays to a given
shape (now named np.broadcast_to).
I have a pull request up for review, which has received some feedback now:
https://github.com/numpy/numpy/pull/5371
There is still at least one design decision to settle: should we expose
On Thu, Dec 11, 2014 at 10:53 AM, Stephan Hoyer sho...@gmail.com wrote:
On Thu, Dec 11, 2014 at 8:17 AM, Sebastian Berg
sebast...@sipsolutions.net wrote:
One option
would also be to have something like:
np.common_shape(*arrays)
np.broadcast_to(array, shape)
# (though I would like many
On Fr, 2014-12-12 at 05:48 -0800, Jaime Fernández del Río wrote:
On Thu, Dec 11, 2014 at 10:53 AM, Stephan Hoyer sho...@gmail.com
wrote:
On Thu, Dec 11, 2014 at 8:17 AM, Sebastian Berg
sebast...@sipsolutions.net wrote:
One option
would also be
On Fri, Dec 12, 2014 at 5:57 AM, Sebastian Berg sebast...@sipsolutions.net
wrote:
On Fr, 2014-12-12 at 05:48 -0800, Jaime Fernández del Río wrote:
On Thu, Dec 11, 2014 at 10:53 AM, Stephan Hoyer sho...@gmail.com
wrote:
On Thu, Dec 11, 2014 at 8:17 AM, Sebastian Berg
On Fr, 2014-12-12 at 06:25 -0800, Jaime Fernández del Río wrote:
On Fri, Dec 12, 2014 at 5:57 AM, Sebastian Berg
sebast...@sipsolutions.net wrote:
On Fr, 2014-12-12 at 05:48 -0800, Jaime Fernández del Río
wrote:
On Thu, Dec 11, 2014 at 10:53 AM, Stephan Hoyer
On Fri, Dec 12, 2014 at 5:48 AM, Jaime Fernández del Río
jaime.f...@gmail.com wrote:
np.broadcast is the Python object of the old iterator. It may be a better
idea to write all of these functions using the new one, np.nditer:
def common_shape(*args):
return np.nditer(args).shape[::-1]
On Fri, Dec 12, 2014 at 6:25 AM, Jaime Fernández del Río
jaime.f...@gmail.com wrote:
it seems that all the functionality that has been discussed are one-liners
using nditer: do we need new functions, or better documentation?
I think there is utility to adding a new function or two (my
On Fri, Dec 12, 2014 at 11:28 AM, Stephan Hoyer sho...@gmail.com wrote:
On Fri, Dec 12, 2014 at 5:48 AM, Jaime Fernández del Río
jaime.f...@gmail.com wrote:
np.broadcast is the Python object of the old iterator. It may be a better
idea to write all of these functions using the new one,
On 12 Dec 2014 19:29, Stephan Hoyer sho...@gmail.com wrote:
def common_shape(*args):
Nitpick: let's call this broadcast_shape, not common_shape; it's as-or-more
clear and clearly groups the related functions together.
-n
___
NumPy-Discussion mailing
Le 11/12/2014 01:00, Nathaniel Smith a écrit :
Seems like a useful addition to me -- I've definitely wanted this in
the past. I agree with Stephan that reshape() might not be the best
place, though; I wouldn't think to look for it there.
Two API ideas, which are not mutually exclusive:
On 11 Dec 2014 14:31, Pierre Haessig pierre.haes...@crans.org wrote:
Le 11/12/2014 01:00, Nathaniel Smith a écrit :
Seems like a useful addition to me -- I've definitely wanted this in
the past. I agree with Stephan that reshape() might not be the best
place, though; I wouldn't think to
On Thu, Dec 11, 2014 at 2:47 PM, Nathaniel Smith n...@pobox.com wrote:
On 11 Dec 2014 14:31, Pierre Haessig pierre.haes...@crans.org wrote:
Le 11/12/2014 01:00, Nathaniel Smith a écrit :
Seems like a useful addition to me -- I've definitely wanted this in
the past. I agree with
Le 11/12/2014 16:52, Robert Kern a écrit :
And we already have a numpy.broadcast() function.
http://docs.scipy.org/doc/numpy/reference/generated/numpy.broadcast.html
True, I once read the docstring of this function. but never used it though.
Pierre
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.
http://docs.scipy.org/doc/numpy/reference/generated/numpy.broadcast.html
True, I once read the docstring of this function. but never used
On Thu, Dec 11, 2014 at 4:17 PM, Sebastian Berg sebast...@sipsolutions.net
wrote:
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.
On Sunday, December 7, 2014, Stephan Hoyer sho...@gmail.com wrote:
I recently wrote function to manually broadcast an ndarray to a given
shape according to numpy's broadcasting rules (using strides):
https://github.com/xray/xray/commit/7aee4a3ed2dfd3b9aff7f3c5c6c68d51df2e3ff3
The same
Hi,
On Monday, December 8, 2014, Pierre Haessig pierre.haes...@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)
10 loops, best of 3: 17 µs per loop
Would this be a welcome addition to numpy's lib.stride_tricks?
On Thu, Dec 11, 2014 at 8:17 AM, Sebastian Berg sebast...@sipsolutions.net
wrote:
One option
would also be to have something like:
np.common_shape(*arrays)
np.broadcast_to(array, shape)
# (though I would like many arrays too)
and then broadcast_ar rays could be implemented in terms of
On Sun, Dec 7, 2014 at 11:31 PM, Pierre Haessig pierre.haes...@crans.org
wrote:
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
On Sun, Dec 7, 2014 at 7:10 AM, Stephan Hoyer sho...@gmail.com wrote:
I recently wrote function to manually broadcast an ndarray to a given shape
according to numpy's broadcasting rules (using strides):
https://github.com/xray/xray/commit/7aee4a3ed2dfd3b9aff7f3c5c6c68d51df2e3ff3
The same
On Wed, Dec 10, 2014 at 4:00 PM, Nathaniel Smith n...@pobox.com wrote:
2) Add a broadcast_to(arr, shape) function, which broadcasts the array
to exactly the shape given, or else errors out if this is not
possible.
I like np.broadcast_to as a new function. We can document it alongside
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.haes...@crans.org
wrote:
Hi,
Le
Hi,
Le 07/12/2014 08:10, Stephan Hoyer a écrit :
In [5]: %timeit xray.core.utils.as_shape(x, y.shape)
10 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
I recently wrote function to manually broadcast an ndarray to a given shape
according to numpy's broadcasting rules (using strides):
https://github.com/xray/xray/commit/7aee4a3ed2dfd3b9aff7f3c5c6c68d51df2e3ff3
The same functionality can be done pretty straightforwardly with
np.broadcast_arrays,
24 matches
Mail list logo