我终于发现,可以使用 LU分解 完成此操作。在此, U 矩阵表示线性系统的简化形式。
from numpy import arrayfrom scipy.linalg import lua = array([[2.,4.,4.,4.],[1.,2.,3.,3.],[1.,2.,2.,2.],[1.,4.,3.,4.]])pl, u = lu(a, permute_l=True)
然后
u读
array([[ 2., 4., 4., 4.], [ 0., 2., 1., 2.], [ 0., 0., 1., 1.], [ 0., 0., 0., 0.]])
取决于系统的可溶解性,该基质具有上部三角形或梯形结构。在上述情况下,由于矩阵只有rank,所以会出现零线
3。



