Is there a faster way of flipping and rotating an array in numpy? For example, rotating one time clockwise and then flipping?
import numpy as np
a = np.arange(0,10)
b = np.arange(-11,-1)
ar = np.array([a,b])
print ar
print ar.shape
ar = np.rot90(ar, 3)
print np.fliplr(ar)
print ar.shape
Output:
[[ 0 1 2 3 4 5 6 7 8 9]
[-11 -10 -9 -8 -7 -6 -5 -4 -3 -2]]
(2, 10)
[[ 0 -11]
[ 1 -10]
[ 2 -9]
[ 3 -8]
[ 4 -7]
[ 5 -6]
[ 6 -5]
[ 7 -4]
[ 8 -3]
[ 9 -2]]
(10, 2)
[Finished in 0.1s]
P.S.: This question is not a duplicate of: Transposing a NumPy array. The present question does not contest the stability of the "transpose" function; it is asking for the function itself.