matlab的“置换"在python中 [英] matlab's "permute" in python
本文介绍了matlab的“置换"在python中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将程序从matlab转换为Python.
I'm translating a program from matlab to Python.
matlab代码使用permute方法:
The matlab code uses the method 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中是否有等效的方法?
Is there an equivalent method in Python/NumPy ?
推荐答案
这已滚动到 transpose
函数.默认行为会颠倒订单,但是您可以提供自己的订单列表.
This is rolled into the transpose
function in numpy.ndarray
. The default behavior reverses the order, but you can supply a list of your own order.
这篇关于matlab的“置换"在python中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文