♻️ Refactor NonUnitaryOperation
class to simplify target handling
#399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: