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

✨ Better dynamic circuit support #346

Closed burgholzer closed 9 months ago

burgholzer commented 9 months ago

Description

This PR adds a new option to QCEC that allows to backpropagate the output permutation derived from the measurements of a circuit to the initial layout based on the optimization pass added in cda-tum/mqt-core#512.

This is especially helpful for verifying dynamic quantum circuits because it is rather hard (if not impossible) to define a proper initial layout for the circuit after it has been transformed to a regular quantum circuit by substituting resets and deferring measurements without an educated guess.

The new option is opt-in for now and can be activated by passing backpropagate_output_permutation=True as a keyword argument to the verify methods or by setting config.optimizations.backpropagate_output_permutation=True on a respective Configuration object.

Fixes #343

Checklist:

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (b52d8fd) 96.0% compared to head (d5d0cce) 90.7%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346/graphs/tree.svg?width=650&height=150&src=pr&token=eKL7Ya7iep&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum)](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) ```diff @@ Coverage Diff @@ ## main #346 +/- ## ======================================= - Coverage 96.0% 90.7% -5.4% ======================================= Files 34 34 Lines 1739 1749 +10 Branches 212 214 +2 ======================================= - Hits 1671 1587 -84 - Misses 68 162 +94 ``` | [Flag](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | Coverage Δ | | |---|---|---| | [cpp](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | `96.0% <100.0%> (+0.2%)` | :arrow_up: | | [python](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | `72.5% <100.0%> (-24.7%)` | :arrow_down: | | [Files](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum) | Coverage Δ | | |---|---|---| | [include/Configuration.hpp](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-aW5jbHVkZS9Db25maWd1cmF0aW9uLmhwcA==) | `96.3% <100.0%> (+<0.1%)` | :arrow_up: | | [include/EquivalenceCheckingManager.hpp](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-aW5jbHVkZS9FcXVpdmFsZW5jZUNoZWNraW5nTWFuYWdlci5ocHA=) | `100.0% <ø> (ø)` | | | [src/EquivalenceCheckingManager.cpp](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-c3JjL0VxdWl2YWxlbmNlQ2hlY2tpbmdNYW5hZ2VyLmNwcA==) | `94.2% <100.0%> (+0.1%)` | :arrow_up: | | [src/mqt/qcec/configuration.py](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum#diff-c3JjL21xdC9xY2VjL2NvbmZpZ3VyYXRpb24ucHk=) | `100.0% <100.0%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/cda-tum/mqt-qcec/pull/346/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cda-tum)