mqt-qmap icon indicating copy to clipboard operation
mqt-qmap copied to clipboard

Delayed Phase Correction

Open pehamTom opened this issue 1 year ago • 6 comments

Description

This PR introduces a feature where stabilizer phases are ignored during Clifford synthesis. If that happens, the phases are corrected during a post-processing step.

Fixes #326

Checklist:

  • [ ] The pull request only contains commits that are related to it.
  • [ ] I have added appropriate tests and documentation.
  • [ ] I have made sure that all CI jobs on GitHub pass.
  • [ ] The pull request introduces no new warnings and follows the project's style guidelines.

pehamTom avatar Nov 14 '23 16:11 pehamTom

Hey @pehamTom 👋🏼

Haven't looked through this at all yet. Just a brief question: Is this something that's always guaranteed to be faster than the original version? If so, could we just fully replace the old version and avoid adding all those if statements for deciding between both options? Just thinking about maintainability here.

burgholzer avatar Nov 14 '23 23:11 burgholzer

Ignoring the phase during synthesis does not guarantee depth-optimality. One could always back-propagate Paulis and fuse them with any single-qubit gates as a post-processing step. But I think it makes sense to respect the chosen gateset and leave the rest up to the user.

I wanted to compress the settings we have anyway. The maxsat method should be removed entirely for example as it is always worse. But that is something for another PR.

pehamTom avatar Nov 15 '23 00:11 pehamTom

Codecov Report

Merging #397 (4b48b48) into main (5453be3) will increase coverage by 0.1%. Report is 2 commits behind head on main. The diff coverage is 96.2%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #397     +/-   ##
=======================================
+ Coverage   92.3%   92.4%   +0.1%     
=======================================
  Files         44      49      +5     
  Lines       4158    4468    +310     
  Branches     701     764     +63     
=======================================
+ Hits        3839    4132    +293     
- Misses       319     336     +17     
Flag Coverage Δ
cpp 92.0% <96.2%> (+0.2%) :arrow_up:
python 95.9% <ø> (ø)
Files Coverage Δ
include/cliffordsynthesis/Configuration.hpp 100.0% <ø> (ø)
include/cliffordsynthesis/Tableau.hpp 97.6% <100.0%> (+0.5%) :arrow_up:
...de/cliffordsynthesis/encoding/ObjectiveEncoder.hpp 100.0% <100.0%> (ø)
include/cliffordsynthesis/encoding/SATEncoder.hpp 100.0% <ø> (ø)
...e/cliffordsynthesis/encoding/SingleGateEncoder.hpp 100.0% <ø> (ø)
...lude/cliffordsynthesis/encoding/TableauEncoder.hpp 100.0% <100.0%> (ø)
src/Architecture.cpp 95.0% <100.0%> (ø)
src/cliffordsynthesis/CliffordSynthesizer.cpp 97.5% <100.0%> (+<0.1%) :arrow_up:
src/cliffordsynthesis/Utils.cpp 100.0% <100.0%> (ø)
...rc/cliffordsynthesis/encoding/MultiGateEncoder.cpp 100.0% <100.0%> (ø)
... and 10 more

... and 1 file with indirect coverage changes

codecov[bot] avatar Nov 15 '23 15:11 codecov[bot]

Ignoring the phase during synthesis does not guarantee depth-optimality. One could always back-propagate Paulis and fuse them with any single-qubit gates as a post-processing step. But I think it makes sense to respect the chosen gateset and leave the rest up to the user.

I wanted to compress the settings we have anyway. The maxsat method should be removed entirely for example as it is always worse. But that is something for another PR.

Sorry for responding so late here. For some reason, I missed the notification for the message.

I see! In that case, the separate option definitely makes sense. Compressing the settings is definitely much appreciated (in a separate PR, of course).

Is this PR ready for review then?

burgholzer avatar Nov 16 '23 16:11 burgholzer

Now it is ready for review.

pehamTom avatar Nov 17 '23 10:11 pehamTom

Cpp-Linter Report :warning:

Some files did not pass the configured checks!

clang-tidy reports: 1 concern(s)
  • src/Architecture.cpp

    /src/Architecture.cpp:95:21: warning: [readability-identifier-naming]

    invalid case style for static constant 'singleQubitGates'

      static const auto singleQubitGates = {"id", "u1", "u2", "u3",
                        ^~~~~~~~~~~~~~~~
                        SINGLE_QUBIT_GATES
    

Have any feedback or feature suggestions? Share it here.

github-actions[bot] avatar Nov 17 '23 10:11 github-actions[bot]