Closed reb-ddm closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.4%. Comparing base (
a46794a
) to head (faf7d2e
).
Hey @reb-ddm 👋🏼
Many thanks for all the work here! I took the liberty to rework some bits and pieces, but overall this is looking great and ready to merge. Once CI is all-green here, I'll start by merging the mqt-core PR and changing back the submodule pointers from the fork to the main repository. After that, this should be good to go 🎉
Description
Added a flag
checkPartialEquivalence
in order to decide whether to check for total equivalence or for partial equivalence. Two circuits are partially equivalent if, for each possible initial input state, they have the same probability for each measurement outcome. Therefore the state of not measured qubits (= garbage qubits), or phases are ignored.The Construction Checker and the Simulation Checker implement this by reducing the contribution of garbage qubits in the matrix/vector representation of the circuit. Additionally, all weights in the DD representation are set to their magnitude, such that different phases don't influence the result.
The Alternating Checker implements it by checking that the resulting matrix representation is equal to a diagonal matrix, modulo garbage qubits (instead of checking that it is equal to the identity matrix).
For more information, there is documentation in the file
PartialEquivalence.ipynb
.An additional feature are the automatically generated benchmarks for partial equivalence. The function
generatePartiallyEquivalentCircuits
generates pairs of circuits which are partially equivalent, following the method described in the paper Partial Equivalence Checking of Quantum Circuits in Section VI. B.Fixes issue #155
Checklist: