Exemplo n.º 1
0
def test_average_infid_projection_5() -> None:
    """Testing higher levels and subspaces."""
    actual = np.kron(
        np.array([[0 + 0j, 1, 0], [1, 0, 0], [0, 0, 34345j]], ),
        Id,
    )
    almost_equal(average_infid(ideal=X, actual=actual, index=[0], dims=[3, 2]),
                 0)
Exemplo n.º 2
0
def test_average_infid_projection_2() -> None:
    """Testing another subspace."""
    actual = np.kron(Id, X)
    almost_equal(average_infid(X, actual, index=[1], dims=[2, 2]), 0)
Exemplo n.º 3
0
def test_average_infid_projection() -> None:
    """Testing only one subspace."""
    actual = np.kron(X, Id)
    almost_equal(average_infid(X, actual, index=[0], dims=[2, 2]), 0)
Exemplo n.º 4
0
def test_average_infid_2() -> None:
    """Testing that X and Y have maximal error."""
    almost_equal(average_infid(X, Y), np.array(2.0 / 3))
Exemplo n.º 5
0
def test_average_infid_1() -> None:
    """Testing that a matrix has no error with itself."""
    almost_equal(average_infid(X, X), 0)
Exemplo n.º 6
0
def test_average_infid_projection_4() -> None:
    """Testing higher levels."""
    actual = np.array([[0 + 0j, 1, 0], [1, 0, 0], [0, 0, 34345j]], )
    almost_equal(average_infid(ideal=X, actual=actual, index=[0], dims=[3]), 0)