예제 #1
0
def test_raise_exception_when_inverse_of_a_noninvertible_matrix():
    A = Matrix(-4, 2, -2, -3,
               9, 6, 2, 6,
               0, -5, 1, -5,
               0, 0, 0, 0)
    assert not A.is_invertible()
    with pytest.raises(NonInvertibleMatrixError):
        A.inverse()
예제 #2
0
def testing_a_noninvertible_matrix_for_invertibility():
    # Given
    A = Matrix(-4, 2, -2, -3,
               9, 6, 2, 6,
               0, -5, 1, -5,
               0, 0, 0, 0)
    # Then
    assert A.determinant() == 0
    assert not A.is_invertible()
예제 #3
0
def testing_an_invertible_matrix_for_invertibility():
    # Given
    A = Matrix(6, 4, 4, 4,
               5, 5, 7, 6,
               4, -9, 3, -7,
               9, 1, 7, -6)
    # Then
    assert A.determinant() == -2120
    assert A.is_invertible()