MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / inverse

Method inverse

matrix/matrix_class.py:223–227  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

221 return Matrix(values)
222
223 def inverse(self) -> Matrix:
224 determinant = self.determinant()
225 if not determinant:
226 raise TypeError("Only matrices with a non-zero determinant have an inverse")
227 return self.adjugate() * (1 / determinant)
228
229 def __repr__(self) -> str:
230 return str(self.rows)

Callers 1

__pow__Method · 0.95

Calls 2

determinantMethod · 0.95
adjugateMethod · 0.95

Tested by

no test coverage detected