matlab中的“permute”在python中

时间:2012-10-08 18:34:38

标签: python matlab

我正在将程序从matlab翻译成Python。

matlab代码使用permute方法:

B = PERMUTE(A,ORDER) rearranges the dimensions of A so that they
%   are in the order specified by the vector ORDER.  The array produced
%   has the same values as A but the order of the subscripts needed to 
%   access any particular element are rearranged as specified by ORDER.
%   For an N-D array A, numel(ORDER)>=ndims(A). All the elements of 
%   ORDER must be unique.

Python / NumPy中是否有等效的方法?

1 个答案:

答案 0 :(得分:25)

这已归入numpy.ndarray中的transpose函数。默认行为会反转订单,但您可以提供自己订单的列表。