Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️🐛 Refactor qc::Permutation and fix corner case in Qiskit layout import #858

Merged
merged 6 commits into from
Mar 10, 2025

Conversation

burgholzer
Copy link
Member

Description

This PR refactors the qc::Permutation class to not subclass from std::map. This has caused more harm than good, especially in the Python bindings, where pybind automatically binds some of the std::map members and then won't accept them being called on a Permutation object.
This creates quite a bit of boilerplate code for exposing the map interface in the permutation class, but has no other major influence (except that the Python bindings now work properly).

Additionally, this fixes an error related to the layout import from Qiskit related to Qiskit/qiskit#12749. It turns out that calling the public API of the TranspileLayout may throw errors if the final_layout is None.

Last, but not least, this PR adds a warnings ignore filter for a nonsense GCC warning, which should make the build log warning free again.

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

@burgholzer burgholzer self-assigned this Mar 10, 2025
@burgholzer burgholzer added code quality Code quality improvements fix Fix for something that isn't working Core Anything related to the Core library and IR c++ Anything related to C++ code labels Mar 10, 2025
@burgholzer burgholzer added this to the MQT Core milestone Mar 10, 2025
Copy link

codecov bot commented Mar 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.3%. Comparing base (a927ced) to head (1fecc96).
Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #858   +/-   ##
=====================================
  Coverage   92.3%   92.3%           
=====================================
  Files        137     138    +1     
  Lines      13619   13664   +45     
  Branches    2104    2104           
=====================================
+ Hits       12574   12622   +48     
+ Misses      1045    1042    -3     
Flag Coverage Δ
cpp 92.1% <100.0%> (+<0.1%) ⬆️
python 99.7% <100.0%> (+<0.1%) ⬆️
Files with missing lines Coverage Δ
include/mqt-core/ir/Permutation.hpp 100.0% <100.0%> (ø)
src/ir/QuantumComputation.cpp 92.8% <100.0%> (+0.2%) ⬆️
src/mqt/core/plugins/qiskit.py 100.0% <100.0%> (ø)
src/qasm3/Parser.cpp 92.4% <100.0%> (ø)
src/qasm3/passes/TypeCheckPass.cpp 88.7% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@burgholzer burgholzer force-pushed the permutation-class-fixes branch from 0d8bc17 to 2f57652 Compare March 10, 2025 11:40
this has caused more harm than good by now, especially in the Python bindings

Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
@burgholzer burgholzer force-pushed the permutation-class-fixes branch from 2f57652 to 1fecc96 Compare March 10, 2025 11:55
@burgholzer burgholzer merged commit 5e94260 into main Mar 10, 2025
31 checks passed
@burgholzer burgholzer deleted the permutation-class-fixes branch March 10, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Anything related to C++ code code quality Code quality improvements Core Anything related to the Core library and IR fix Fix for something that isn't working
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant