Skip to content

Commit

Permalink
Merge branch 'master' into stabilizers
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Feb 14, 2024
2 parents 22184e6 + 4b4e6c3 commit 7cd30b2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_quantum_info_clifford.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ def test_clifford_from_circuit(backend, measurement):
backend.assert_allclose(obj.probabilities(), result.probabilities())


@pytest.mark.parametrize("seed", [1, 10])
@pytest.mark.parametrize("algorithm", ["AG04", "BM20"])
@pytest.mark.parametrize("nqubits", [1, 2, 3, 10, 50])
def test_clifford_to_circuit(backend, nqubits, algorithm):
def test_clifford_to_circuit(backend, nqubits, algorithm, seed):
if backend.__class__.__name__ == "TensorflowBackend":
pytest.skip("CliffordBackend not defined for Tensorflow engine.")

clifford = random_clifford(nqubits, backend=backend)
clifford = random_clifford(nqubits, seed=seed, backend=backend)

symplectic_matrix_original = Clifford.from_circuit(
clifford, engine=backend
Expand Down
19 changes: 19 additions & 0 deletions tests/test_quantum_info_quantum_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def test_errors(backend):
matrix = random_density_matrix(2**3, backend=backend)
net = QuantumNetwork(matrix, (2,) * 3, backend=backend)

comb_partition = (2,) * 4
comb_sys_out = (False, True) * 2
comb = random_density_matrix(2**4, backend=backend)
comb_choi = QuantumNetwork(
comb, comb_partition, system_output=comb_sys_out, backend=backend
)

with pytest.raises(TypeError):
QuantumNetwork(channel.to_choi(backend=backend), partition=True)

Expand Down Expand Up @@ -91,6 +98,18 @@ def test_errors(backend):
with pytest.raises(NotImplementedError):
net @ network

with pytest.raises(ValueError):
network @ net

with pytest.raises(ValueError):
network @ QuantumNetwork(comb, (16, 16), pure=True, backend=backend)

with pytest.raises(ValueError):
comb_choi @ QuantumNetwork(comb, (16, 16), pure=True, backend=backend)

with pytest.raises(ValueError):
comb_choi @ net

with pytest.raises(ValueError):
QuantumNetwork(matrix, (1, 2), backend=backend)

Expand Down

0 comments on commit 7cd30b2

Please sign in to comment.