首页 > 解决方案 > Fast algorithm for computing cofactor matrix

问题描述

I wonder if there is a fast algorithm, say (O(n^3)) for computing the cofactor matrix (or conjugate matrix) of a N*N square matrix. And yes one could first compute its determinant and inverse separately and then multiply them together. But how about this square matrix is non-invertible?

I am curious about the accepted answer here:Speed up python code for computing matrix cofactors

What would it mean by "This probably means that also for non-invertible matrixes, there is some clever way to calculate the cofactor (i.e., not use the mathematical formula that you use above, but some other equivalent definition)."?

标签: numpymatrixlinear-algebramatrix-multiplicationscientific-computing

解决方案


分解 M = L x D x U,其中
L是下三角形,主对角线上有一个,是主对角线
U上的上三角形,并且
D是对角线。

您可以使用与 Cholesky 分解类似的反向替换。然后,

M^{ -1 } = U^{ -1 } x D^{ -1 } x L^{ -1 }

然后将辅因子矩阵转置为:

Cof( M )^T = Det( U ) x Det( D ) x Det( L ) x M^{ -1 }。

如果M是单数或几乎是单数,则 的一个(或多个)元素D将为零或几乎为零。用矩阵乘积中的零和行列式中的 1 替换这些元素,并将上述等式用于转置辅因子矩阵。


推荐阅读