Closed babacry closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.83%. Comparing base (
e2e8aef
) to head (74305a0
). Report is 2 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I suspect that the bug is in the logic of how to pull Pauli gates through Clifford gates (e.g. cirq.CZ
)
cirq.testing.assert_circuits_have_same_unitary_given_final_permutation(
input_circuit, transformed_circuit, {q: q for q in input_circuit.all_qubits()}
)
and
sampler = cirq.Simulator(dtype=np.complex128)
psi0 = sampler.simulate(input_circuit).final_state_vector
psi1 = sampler.simulate(transformed_circuit).final_state_vector
assert np.isclose(np.abs(np.vdot(psi0, psi1)) ** 2, 1.0)
both passed for all test cases.
a: ───H───@───────?───────────────H───
│
b: ───────X───@───@───@───@───@───H───
│ │ │ │ │
c: ───────────X───X───X───X───X───H───
where ? can be any single-qubit-gate, e.g., X
/ H
.
schema="XX_PAIR"
a
, the idle pieces lengths are 1, 3
a: ───H───@───────?───X───X───────H───
│
b: ───────X───@───@───@───@───@───H───
│ │ │ │ │
c: ───────────X───X───X───X───X───H───
Is this expected? I suspect we can't commute through the moment ?
at due to non commutativity, right? or should we take care of ?
case by case? for example, if ?=X
, then, we can add 2 more X
gates for qubit a
in the transformed circuit above. while, '?=H', we can't insert more, right?
Now, we rely on cirq.has_stabilizer_effect
to determine if an operation is Clifford. While, cirq.has_stabilizer_effect(cirq.M)
returns True
, resulting in a polluted clifford piece. Add a criteria for function _is_clifford_moment
and the test case in the comment above.
Also changed default schema in the new commit.
Enable adding dynamical decoupling in single qubit gate moments only.
Adding mechanism is described in the code. In short:
2 test cases added for single qubit gates moments insertion mode:
Test case 1: add dd preserves the circuit.
Test case 2:
input_circuit's diagram is:
output diagram is