cda-tum / mqt-qcec

MQT QCEC - A tool for Quantum Circuit Equivalence Checking
https://mqt.readthedocs.io/projects/qcec
MIT License
90 stars 21 forks source link

Fix segfault in ZX-checker when idle qubits are stripped #253

Closed pehamTom closed 1 year ago

pehamTom commented 1 year ago

Description

Fixes #251.

The problem was that "incomplete" mappings that occur when qubits are stripped were not handled correctly. Sometimes an index that couldn't appear as an output qubit in the ZX-diagram miter was used.

However, in the process of fixing this bug, it has become apparent that the ZX-checker also requires some form of permutation handling like with the dd checker. This would have to be done as a pre-processing step because the permutations have to be worked out properly before building the equivalence checking miter.

The current version doesn't segfault anymore because there is never a case where qubit indices out of range are assigned. Therefore the diagrams are always concatenated in some way. Now since they are not always connected correctly, the ZX-checker just yields NoInformation in those cases.

Checklist:

codecov[bot] commented 1 year ago

Codecov Report

Merging #253 (a769770) into main (d3e58e4) will decrease coverage by 0.3%. The diff coverage is 100.0%.

@@           Coverage Diff           @@
##            main    #253     +/-   ##
=======================================
- Coverage   96.1%   95.9%   -0.3%     
=======================================
  Files         34      34             
  Lines       1757    1739     -18     
  Branches     221     214      -7     
=======================================
- Hits        1690    1669     -21     
- Misses        67      70      +3     
Flag Coverage Δ
cpp 95.5% <100.0%> (-0.3%) :arrow_down:
python 97.3% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/checker/zx/ZXChecker.cpp 100.0% <100.0%> (ø)

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.