MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / test_cofactor

Method test_cofactor

linear_algebra/src/test_linear_algebra.py:145–153  ·  view source on GitHub ↗

test for Matrix method cofactor()

(self)

Source from the content-addressed store, hash-verified

143 assert minors[x][y] == a.minor(x, y)
144
145 def test_cofactor(self) -> None:
146 """
147 test for Matrix method cofactor()
148 """
149 a = Matrix([[1, 2, 3], [2, 4, 5], [6, 7, 8]], 3, 3)
150 cofactors = [[-3, 14, -10], [5, -10, 5], [-2, 1, 0]]
151 for x in range(a.height()):
152 for y in range(a.width()):
153 assert cofactors[x][y] == a.cofactor(x, y)
154
155 def test_determinant(self) -> None:
156 """

Callers

nothing calls this directly

Calls 4

heightMethod · 0.95
widthMethod · 0.95
cofactorMethod · 0.95
MatrixClass · 0.70

Tested by

no test coverage detected