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

✨ Support for Qiskit's final_layout #592

Merged
merged 8 commits into from
Apr 20, 2024

Conversation

TeWas
Copy link
Contributor

@TeWas TeWas commented Apr 19, 2024

Description

This PR adds support for Qiskit's final_layout attribute when importing circuits from Qiskit. It interprets the output_permutation of an MQT QuantumComputation object based on Qiskit's final_index_layout(), which maps the original input circuit's qubit indices to the final physical qubit indices after routing. This mapping is the result of applying routing_permutation() to the initial_layout. Additionally, it fixes the interpretation of the output_permutation in initializeIOMapping() to align with Qiskit's final_layout.

Fixes #439

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 added enhancement New feature or request usability Anything related to usability Core Anything related to the Core library and IR c++ Anything related to C++ code python Anything related to Python code labels Apr 19, 2024
@burgholzer burgholzer added this to the MQT Core milestone Apr 19, 2024
@burgholzer burgholzer self-requested a review April 19, 2024 09:26
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.4%. Comparing base (4d6f788) to head (fe401eb).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #592   +/-   ##
=====================================
  Coverage   91.4%   91.4%           
=====================================
  Files        131     131           
  Lines      14091   14090    -1     
  Branches    2249    2249           
=====================================
  Hits       12885   12885           
+ Misses      1206    1205    -1     
Flag Coverage Δ
cpp 91.1% <100.0%> (-0.1%) ⬇️
python 99.7% <100.0%> (+0.2%) ⬆️
Files Coverage Δ
src/QuantumComputation.cpp 81.8% <100.0%> (-0.1%) ⬇️
src/mqt/core/plugins/qiskit.py 100.0% <100.0%> (+0.4%) ⬆️

burgholzer added a commit that referenced this pull request Apr 20, 2024
## Description

This PR brings some small improvements to the bindings of the `Control`
and `Permutation` classes.
In particular, it adds hashing support and as well as equality
comparisons.
For the `Permutation` class, it also adds an implicit conversion to a
Python dictionary and fixes the Python stubs to include the constructor
of the class.

This was inspired by #592 and helps to simplify some of the tests there.

## Checklist:

<!---
This checklist serves as a reminder of a couple of things that ensure
your pull request will be merged swiftly.
-->

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

---------

Signed-off-by: burgholzer <burgholzer@me.com>
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for this contribution. Nicely done! 🎉
I just rebased the PR on the current main branch and simplified some of the checks a little bit.

@burgholzer burgholzer enabled auto-merge (squash) April 20, 2024 15:44
@burgholzer burgholzer merged commit cb555c9 into cda-tum:main Apr 20, 2024
36 checks passed
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 Core Anything related to the Core library and IR enhancement New feature or request python Anything related to Python code usability Anything related to usability
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

✨ Support for Qiskit's final_layout
2 participants