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

🐛 Simulations only work correctly for the first run and check nothing from the second run #347

Closed
canhminhdo opened this issue Jan 5, 2024 · 1 comment · Fixed by #348
Assignees
Labels
bug Something isn't working c++ Anything related to C++ code

Comments

@canhminhdo
Copy link

Environment information

  • OS: Mac
  • C++ compiler: Apple clang version 15.0.0
  • mqt.core version: newest

Description

Each simulation is executed on a TaskManager. However, after completing each simulation, the TaskManager did not reset the iterator to the beginning of quantum operations so that the next simulation could be executed normally.
Therefore, the iterator remains at the end of quantum operations and nothing is executed for the next simulation. Consequently, the result from the second simulation is always equivalent.

Expected behavior

After completing each simulation, the TaskManager has to reset the iterator to the beginning of quantum operations.

How to Reproduce

See the situation by simply checking the equivalence of the following two circuits with simulations
qc1.x(0);
qc2.x(0);

// add a global phase of -1
qc2.z(0);
qc2.x(0);
qc2.z(0);
qc2.x(0);

@burgholzer burgholzer added bug Something isn't working c++ Anything related to C++ code labels Jan 5, 2024
@burgholzer burgholzer moved this to In Progress in MQT Jan 5, 2024
@burgholzer burgholzer moved this to In Progress in MQT Verification Jan 5, 2024
@burgholzer burgholzer self-assigned this Jan 5, 2024
@burgholzer
Copy link
Member

Thanks for raising this issue! I can confirm the underlying problem and have absolutely no idea how that has not surfaced earlier in the tests or during actual use.
#348 should fix this.

burgholzer added a commit that referenced this issue Jan 5, 2024
## Description

This PR fixes an issue that `TaskManager` class was only ever being
reliably usable once due to its internal iterator and permutation not
being reset in further invocations.
 
Fixes #347

## 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 <[email protected]>
@github-project-automation github-project-automation bot moved this from In Progress to Done in MQT Jan 5, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in MQT Verification Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c++ Anything related to C++ code
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants