我试图编写MATLAB代码,这样我就可以找到矩阵的置换矩阵。
让我们考虑下面的例子。我给出了矩阵A
和B
:
A = [1 2 3;4 5 6; 7 8 9] % is a given matrix
B = [9 7 8;3 1 2; 6 4 5] % is a permuted version of A.
我的目标是找到矩阵L
(预乘A
}和R
(后乘A
),以便L*A*R = B
:
% L is an n by n (3 by 3) that re-order the rows a matrix when it pre-multiply that matrix
L = [0 0 1;1 0 0;0 1 0]
% R is an n by n that re-order the columns of a matrix
R = [0 1 0;0 0 1;1 0 0]
B = L*A*R
当我知道L
和R
时,如何找到A
和B
?