returns the cofactor (signed minor) along (x, y)
(self, x: int, y: int)
| 392 | return Matrix(minor, self.__width - 1, self.__height - 1).determinant() |
| 393 | |
| 394 | def cofactor(self, x: int, y: int) -> float: |
| 395 | """ |
| 396 | returns the cofactor (signed minor) along (x, y) |
| 397 | """ |
| 398 | if self.__height != self.__width: |
| 399 | raise Exception("Matrix is not square") |
| 400 | if 0 <= x < self.__height and 0 <= y < self.__width: |
| 401 | return (-1) ** (x + y) * self.minor(x, y) |
| 402 | else: |
| 403 | raise Exception("Indices out of bounds") |
| 404 | |
| 405 | def determinant(self) -> float: |
| 406 | """ |