def test_minor_3x3(self): a = Matrix([ [3, 5, 0], [2, -1, -7], [6, -1, 5] ]) b = a.submatrix(1, 0) self.assertEqual(b.determinant(), 25) self.assertEqual(a.minor(1, 0), 25)
def test_submatrix_3x3(self): a = Matrix([ [1, 5, 0], [-3, 2, 7], [0, 6, -3] ]) self.assertEqual( a.submatrix(0, 2), Matrix([ [-3, 2], [0, 6]] ) )
def test_submarix_4x4(self): a = Matrix([ [-6, 1, 1, 6], [-8, 5, 8, 6], [-1, 0, 8, 2], [-7, 1, -1, 1] ]) self.assertEqual( a.submatrix(2, 1), Matrix([ [-6, 1, 6], [-8, 8, 6], [-7, -1, 1] ]))