[ what is an equivalent of matlab permute(A, [3 2 1]) in python? ]
If A
is a 2x2 array, what is an equivalent expression in python for permute(A, [3 2 1])
in MATLAB?
Thank you
Answer 1
You are looking for numpy.transpose
np.transpose( np.expand_dims(A, axis=2), (2, 1, 0) )
Since numpy
does not have trailing Singleton dimensions by default, you need to explicitly add it using np.expand_dims