-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Graphix does not handle double-entanglement consistently.
This has been reported in Mateo's comment: #332 (comment).
When a pair of qubits is entangled twice, simulators consider that the second entanglement cancels the first one, which is expected: Pattern.get_graph
), the second entanglement is ignored, which makes flow analyses and Pauli presimulation ignore the second entanglement.
For instance, the following test currently fails, revealing that the round-trip between patterns and open graphs is distinguishable by simulation.
def test_double_entanglement() -> None:
pattern = Pattern(input_nodes=[0, 1], cmds=[command.E((0, 1)), command.E((0, 1))])
pattern2 = OpenGraph.from_pattern(pattern).to_pattern()
state = pattern.simulate_pattern()
state2 = pattern2.simulate_pattern()
assert np.abs(np.dot(state.flatten().conjugate(), state2.flatten())) == pytest.approx(1)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working