简化行梯形变换矩阵

transformation matrix of reduced row echelon form

我可以使用命令 R = rref(C).

在 Matlab 中计算矩阵 C 的简化行阶梯形 R

但是,我还想跟踪执行的步骤,即获得给我 TC = R 的变换矩阵 T。据我所知,该矩阵应该在以下情况下隐式计算使用 Gauss-Jordan 消去法。

有没有办法得到T?也许解决方法?在 matlab documentation 中,我找不到任何信息。其他编程语言中是否有可能 return T?

的 rref 函数

您可以利用基本行运算等同于乘以一个 左边的初等矩阵。设 c 为大小为 (mxn) 的矩阵;

z= rref([c eye(m)]); % [c I] is multiplied by some matrix T
% the result is [rref(c) T]
r= z(:,1:n); % the reduced row echelon form of c
t= z(:,n+1:end); % now we have T