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

♻️🎨 Code cleanup and refactors #798

Merged
merged 11 commits into from
Jan 12, 2025
Merged

♻️🎨 Code cleanup and refactors #798

merged 11 commits into from
Jan 12, 2025

Conversation

burgholzer
Copy link
Member

Description

Starting the year with some obligatory code cleanup and refactors.
The individual commits and the commit messages should more or less convey the bigger changes.
For the most part, it's really all about defining clearer interfaces and following some new clang-tidy suggestions.

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 usability Anything related to usability refactor Anything related to code refactoring code quality Code quality improvements minor Minor version update DD Anything related to the DD package Core Anything related to the Core library and IR c++ Anything related to C++ code labels Jan 10, 2025
@burgholzer burgholzer self-assigned this Jan 10, 2025
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 90.95689% with 86 lines in your changes missing coverage. Please review.

Project coverage is 92.0%. Comparing base (2404c85) to head (c381adb).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/ir/QuantumComputation.cpp 91.0% 27 Missing ⚠️
...c/ir/parsers/qasm3_parser/passes/ConstEvalPass.cpp 0.0% 16 Missing ⚠️
src/ir/operations/SymbolicOperation.cpp 56.0% 11 Missing ⚠️
include/mqt-core/dd/Operations.hpp 79.4% 8 Missing ⚠️
src/ir/operations/ClassicControlledOperation.cpp 86.5% 7 Missing ⚠️
src/algorithms/QPE.cpp 94.0% 6 Missing ⚠️
src/algorithms/Grover.cpp 92.1% 4 Missing ⚠️
include/mqt-core/ir/operations/AodOperation.hpp 0.0% 2 Missing ⚠️
include/mqt-core/ir/parsers/qasm3_parser/Types.hpp 0.0% 1 Missing ⚠️
...e/ir/parsers/qasm3_parser/passes/ConstEvalPass.hpp 0.0% 1 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #798     +/-   ##
=======================================
- Coverage   92.2%   92.0%   -0.3%     
=======================================
  Files        125     123      -2     
  Lines      13760   13776     +16     
  Branches    2167    2153     -14     
=======================================
- Hits       12697   12684     -13     
- Misses      1063    1092     +29     
Flag Coverage Δ
cpp 91.8% <90.9%> (-0.3%) ⬇️
python 99.7% <ø> (ø)
Files with missing lines Coverage Δ
include/mqt-core/dd/Simulation.hpp 100.0% <100.0%> (ø)
include/mqt-core/ir/QuantumComputation.hpp 100.0% <100.0%> (+8.0%) ⬆️
...-core/ir/operations/ClassicControlledOperation.hpp 96.7% <100.0%> (-0.2%) ⬇️
...clude/mqt-core/ir/operations/CompoundOperation.hpp 100.0% <100.0%> (ø)
include/mqt-core/ir/operations/Control.hpp 100.0% <ø> (ø)
include/mqt-core/ir/operations/Expression.hpp 92.7% <100.0%> (ø)
...ude/mqt-core/ir/operations/NonUnitaryOperation.hpp 100.0% <ø> (ø)
include/mqt-core/ir/operations/Operation.hpp 79.0% <100.0%> (-1.0%) ⬇️
...clude/mqt-core/ir/operations/StandardOperation.hpp 100.0% <ø> (ø)
...clude/mqt-core/ir/operations/SymbolicOperation.hpp 100.0% <ø> (ø)
... and 28 more

... and 2 files with indirect coverage changes

- opting for references where null values are not expected or accepted.
- moving code from headers to source files.
- fixing new clang-tidy warnings
- adding a little more noexcept were appropriate

Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Replaced raw pointer usages with references across the codebase for improved clarity and type safety. This adjustment simplifies operations and ensures consistency, particularly when applying, measuring, or resetting operations in simulation and functionality logic. Corresponding tests have been updated to reflect this change.

Signed-off-by: burgholzer <burgholzer@me.com>
This is only used in one part of DDSIM that is scheduled for removal. And removed code is debugged code.

Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
these members had getters since a while back. there is no need to keep them as public members.

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 merged commit 5c3cb8e into main Jan 12, 2025
30 checks passed
@burgholzer burgholzer deleted the early-2025-cleanup branch January 12, 2025 18:55
burgholzer added a commit to cda-tum/mqt-qcec that referenced this pull request Jan 12, 2025
## Description

This PR updates the MQT Core version used in QCEC to the latest version.
This includes changes from cda-tum/mqt-core#798.
Algorithms are now constructed slightly differently and some of the
methods now take references instead of pointers.

This PR also fixes one compiler warning related to a potential
uniniatialized usage in the equivalence checking manager.

## 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.
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 DD Anything related to the DD package minor Minor version update refactor Anything related to code refactoring usability Anything related to usability
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant