Discussion:
[Numpy-discussion] Generalized flip function
Eren Sezener
2016-02-26 16:32:35 UTC
Permalink
Hi,

In PR #7346 we add a flip function that generalizes fliplr and flipud for
arbitrary axes.

flipud and fliplr reverse the elements of an array along axis=0 and axis=1
respectively. The new flip function reverses the elements of an array along
any given axis. In case flip is called with axis=0 or axis=1, the function
is equivalent to flipud and fliplr respectively.

A similar function is also available in MATLAB™.

We use this function in PR #7347 to generalize the rot90 function to rotate
an arbitrary plane (defined by the axes argument) of a multidimensional
array. By that we fix issue #6506.

Because flip function introduces a new API, @shoyer asked us to consult the
mailing list.

Any objection to adding the generalized flip function?

Best regards,
C. Eren Sezener & Denis Alevi
Joseph Fox-Rabinovitz
2016-02-26 16:36:03 UTC
Permalink
If nothing else, this is a nice complement to the generalized `stack` function.

-Joe
Post by Eren Sezener
Hi,
In PR #7346 we add a flip function that generalizes fliplr and flipud for
arbitrary axes.
flipud and fliplr reverse the elements of an array along axis=0 and axis=1
respectively. The new flip function reverses the elements of an array along
any given axis. In case flip is called with axis=0 or axis=1, the function
is equivalent to flipud and fliplr respectively.
A similar function is also available in MATLAB™.
We use this function in PR #7347 to generalize the rot90 function to rotate
an arbitrary plane (defined by the axes argument) of a multidimensional
array. By that we fix issue #6506.
mailing list.
Any objection to adding the generalized flip function?
Best regards,
C. Eren Sezener & Denis Alevi
_______________________________________________
NumPy-Discussion mailing list
https://mail.scipy.org/mailman/listinfo/numpy-discussion
Stephan Hoyer
2016-02-28 17:54:52 UTC
Permalink
I also think this is a good idea -- the generalized flip is much more
numpythonic than the specialized 2d versions.
On Fri, Feb 26, 2016 at 11:36 AM Joseph Fox-Rabinovitz <
Post by Joseph Fox-Rabinovitz
If nothing else, this is a nice complement to the generalized `stack` function.
-Joe
Post by Eren Sezener
Hi,
In PR #7346 we add a flip function that generalizes fliplr and flipud for
arbitrary axes.
flipud and fliplr reverse the elements of an array along axis=0 and
axis=1
Post by Eren Sezener
respectively. The new flip function reverses the elements of an array
along
Post by Eren Sezener
any given axis. In case flip is called with axis=0 or axis=1, the
function
Post by Eren Sezener
is equivalent to flipud and fliplr respectively.
A similar function is also available in MATLAB™.
We use this function in PR #7347 to generalize the rot90 function to
rotate
Post by Eren Sezener
an arbitrary plane (defined by the axes argument) of a multidimensional
array. By that we fix issue #6506.
the
Post by Eren Sezener
mailing list.
Any objection to adding the generalized flip function?
Best regards,
C. Eren Sezener & Denis Alevi
_______________________________________________
NumPy-Discussion mailing list
https://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________
NumPy-Discussion mailing list
https://mail.scipy.org/mailman/listinfo/numpy-discussion
Loading...