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 NonUnitaryOperation class to simplify target handling #399

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

burgholzer
Copy link
Member

Description

In the NonUnitaryOperation class, the previous implementation used two different vectors to manage the targets for Measure and other operations, which lead to redundancy in the code. This update unifies the handling of targets by using only one vector (named targets) for all operations. This simplification enhances the code readability and maintainability. It also removes the need of several functions like getTargets() and getUsedQubits(). Several function argument lists have also been refactored for cleaner and more consistent usage. Further, the print() function was restructured for better clarity. Overall, these changes will be beneficial for future development work.

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.

In the NonUnitaryOperation class, the previous implementation used two different vectors to manage the targets for Measure and other operations, which lead to redundancy in the code. This update unifies the handling of targets by using only one vector (named targets) for all operations. This simplification enhances the code readability and maintainability. It also removes the need of several functions like getTargets() and getUsedQubits().
Several function argument lists have also been refactored for cleaner and more consistent usage. Further, the print() function was restructured for better clarity. Overall, these changes will be beneficial for future development work.

Signed-off-by: burgholzer <[email protected]>
@burgholzer burgholzer added refactor Anything related to code refactoring Core Anything related to the Core library and IR c++ Anything related to C++ code labels Aug 16, 2023
@burgholzer burgholzer added this to the MQT Core milestone Aug 16, 2023
@burgholzer burgholzer self-assigned this Aug 16, 2023
@github-actions
Copy link
Contributor

Cpp-Linter Report ✔️

No problems need attention.

Have any feedback or feature suggestions? Share it here.

@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #399 (7fdc0a6) into main (702369d) will decrease coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #399     +/-   ##
=======================================
- Coverage   89.3%   89.3%   -0.1%     
=======================================
  Files         98      98             
  Lines      11655   11636     -19     
  Branches    2087    2085      -2     
=======================================
- Hits       10413   10394     -19     
  Misses      1242    1242             
Flag Coverage Δ
cpp 89.3% <100.0%> (-0.1%) ⬇️
python 100.0% <ø> (ø)
Files Changed Coverage Δ
include/operations/NonUnitaryOperation.hpp 100.0% <100.0%> (ø)
src/operations/NonUnitaryOperation.cpp 94.5% <100.0%> (-0.2%) ⬇️

@burgholzer burgholzer merged commit 6c47062 into main Aug 16, 2023
31 checks passed
@burgholzer burgholzer deleted the simplify-non-unitary branch August 16, 2023 16:35
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 refactor Anything related to code refactoring
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant