22

我正在将一个程序从 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 中是否有等效方法?

4

1 回答 1

28

这被卷入到transpose函数中numpy.ndarray。默认行为会颠倒顺序,但您可以提供自己的顺序列表。

于 2012-10-08T18:50:36.950 回答