[Numpy-discussion] Re: ndarray shape permutation

2022-05-17 Thread Robert Kern
On Tue, May 17, 2022 at 10:36 PM Joseph Fox-Rabinovitz < jfoxrabinov...@gmail.com> wrote: > You could easily write an extension to ndarray that maps axis names to > indices and vice versa. > Indeed. There have been several over the years. The current most-maintained one is xarray, near as I can t

[Numpy-discussion] Re: ndarray shape permutation

2022-05-17 Thread Joseph Fox-Rabinovitz
You could easily write an extension to ndarray that maps axis names to indices and vice versa. Joe On Tue, May 17, 2022, 21:32 Paul Korir wrote: > Thanks for your replies. > > In retrospect, I realise that using the shape will not be helpful for a > cubic array i.e. the permutations of (10, 10,

[Numpy-discussion] next NumPy Newcomers' Hour

2022-05-17 Thread Inessa Pawson
The next Newcomers' Hour will be held this Thursday, May 19th, at 4 pm UTC. Stop by to ask questions or just to say hi as we don't have an agenda for this meeting. Join us via Zoom: https://us02web.zoom.us/j/87192457898 Cheers, Inessa Inessa Pawson NumPy Contributor Experience Lead _

[Numpy-discussion] Re: ndarray shape permutation

2022-05-17 Thread Paul Korir
Thanks for your replies. In retrospect, I realise that using the shape will not be helpful for a cubic array i.e. the permutations of (10, 10, 10) are all (10, 10, 10)! However, the problem remains. Let me try to explain. Short version The problem boils down to the meaning of axis indices as a

[Numpy-discussion] Re: ENH: Support Random Unit Vector

2022-05-17 Thread Robert Kern
On Tue, May 17, 2022 at 5:20 AM wrote: > ### Proposed new feature or change: > > Description > > > Often you want to randomize a "direction" that doesn't have "size". This > can be useful when: > * You want to randomize the direction of an NPC walk developing in a 2D or > 3D games, where

[Numpy-discussion] Re: ndarray shape permutation

2022-05-17 Thread Sebastian Berg
On Tue, 2022-05-17 at 12:16 +0200, Andras Deak wrote: > On Mon, May 16, 2022, at 17:54, Paul Korir wrote: > > Hellos, > > I would like to propose > > `numpy.ndarray.permute_shape()` > > method to predictably permute the shape of an ndarray. In my > > opinion, > > the current alternatives (`swapax

[Numpy-discussion] Re: ndarray shape permutation

2022-05-17 Thread Andras Deak
On Mon, May 16, 2022, at 17:54, Paul Korir wrote: > Hellos, > I would like to propose `numpy.ndarray.permute_shape()` > method to predictably permute the shape of an ndarray. In my opinion, > the current alternatives (`swapaxes`, `transform`, `moveaxes` and > friends) are counterintuitive and re

[Numpy-discussion] ENH: Support Random Unit Vector

2022-05-17 Thread saroad2
### Proposed new feature or change: Description Often you want to randomize a "direction" that doesn't have "size". This can be useful when: * You want to randomize the direction of an NPC walk developing in a 2D or 3D games, where its speed is a predefined constant. * You're developin

[Numpy-discussion] ndarray shape permutation

2022-05-17 Thread Paul Korir
Hellos, I would like to propose `numpy.ndarray.permute_shape()` method to predictably permute the shape of an ndarray. In my opinion, the current alternatives (`swapaxes`, `transform`, `moveaxes` and friends) are counterintuitive and rely on referring to the axis indices. It would be abundantly