6

I'm implementing a LinearTransformation class, which inherits from numpy.matrix and uses numpy.matrix.I to calculate the inverse of the transformation matrix.

Does anyone know whether numpy checks for orthogonality of the matrix before trying to calculate the inverse? I ask because most of my matrices (but not all) will be orthogonal and I wondered whether to implement some quick orthogonality check before trying to invert.

4

1 回答 1

11

它不是!

numpy.linalg.inv(A)实际上调用numpy.linalg.solve(A,I),其中I的身份,求解使用lapack 的 LU 分解

也就是说,最终,它会在默认情况下未检测到正交性的情况下进行高斯消除。

而且我不认为有机会在黑暗中检查诸如A * A.T = I矩阵乘以矩阵之类的东西是昂贵的。

于 2013-05-15T16:31:13.140 回答