How does numpy.linalg.inv calculate the inverse orthogonal matrix?

I implement the LinearTransformation class, which inherits from numpy.matrix and uses numpy.matrix.I to calculate the inverse of the matrix transformation.

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

+4
source share
1 answer

This is not true!

numpy.linalg.inv(A) actually calls numpy.linalg.solve(A,I) , where I is the identifier and decides to use lapack LU factorization .

That is, in the end, it eliminates the Gauss, where orthogonality is not defined by default.

And I donโ€™t think there is a shot in the dark to check something like A * AT = I , since the matrix time matrix is โ€‹โ€‹expensive.

+5
source

Source: https://habr.com/ru/post/1480983/


All Articles