Exemple #1
0
def test_is_projection():
    """Check that non-Hermitian projection matrix returns False."""
    mat = np.array([[0, 1], [0, 1]])
    np.testing.assert_equal(is_projection(mat), False)
Exemple #2
0
def test_is_not_pd_non_projection():
    """Check that non-projection matrix returns False."""
    mat = np.array([[-1, -1], [-1, -1]])
    np.testing.assert_equal(is_projection(mat), False)
Exemple #3
0
def test_is_projection_not_square():
    """Input must be a square matrix."""
    mat = np.array([[-1, 1, 1], [1, 2, 3]])
    np.testing.assert_equal(is_projection(mat), False)
Exemple #4
0
def test_is_projection_2():
    """Check that projection matrix returns True."""
    mat = np.array([[1, 0], [0, 1]])
    np.testing.assert_equal(is_projection(mat), True)