示例#1
0
    def test_submatrix_of_4_by_4_matrix_is_3_by_3_matrix(self):
        matrix = Matrix([[-6, 1, 1, 6], [-8, 5, 8, 6], [-1, 0, 8, 2],
                         [-7, 1, -1, 1]])

        result = matrix.submatrix(2, 1)

        assert result == Matrix([[-6, 1, 6], [-8, 8, 6], [-7, -1, 1]])
示例#2
0
    def test_caclculating_minor_of_3_by_3_matrix(self):
        matrix = Matrix([[3, 5, 0], [2, -1, -7], [6, -1, 5]])
        sub_matrix = matrix.submatrix(1, 0)

        determinant = sub_matrix.determinant()
        minor = matrix.minor(1, 0)

        assert determinant == 25
        assert determinant == minor
示例#3
0
    def test_submatrix_of_3_by_3_is_2_by_2_matrix(self):
        matrix = Matrix([[1, 5, 0], [-3, 2, 7], [0, 6, -3]])

        result = matrix.submatrix(0, 2)

        assert result == Matrix([[-3, 2], [0, 6]])