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 SwitchCaseOp that will be released in qiskit-terra 0.24.0 #1778

Merged
merged 6 commits into from
May 16, 2023

Conversation

hhorii
Copy link
Collaborator

@hhorii hhorii commented Apr 10, 2023

Summary

Add support of SwitchCaseOp

Details and comments

Until 0.24.0 is released, SwitchCaseOp defined in qiskit_aer/library/control_flow_instructions/switch_case.py is used. Once 0.24.0 is released, the second commit should be reset.

This will resolve #1759.

@hhorii hhorii added this to the Aer 0.13.0 milestone Apr 10, 2023
@hhorii hhorii requested a review from jakelishman April 10, 2023 15:42
Qiskit-Terra added a new instruction of control-flow `SwitchCaseOp`.
This commit enables Aer to simulate `SwitchCaseOp` by converting
its conditions and bodies with `AerMark` and `AerJump`.
@hhorii hhorii force-pushed the support_switch branch 2 times, most recently from c0d481f to 0338689 Compare April 10, 2023 15:55
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Thanks Hiroshi, it's great to have the PR for this support so quickly!

qiskit_aer/backends/aer_compiler.py Outdated Show resolved Hide resolved
qiskit_aer/backends/aer_compiler.py Outdated Show resolved Hide resolved
qiskit_aer/backends/aer_compiler.py Outdated Show resolved Hide resolved
qiskit_aer/backends/aer_compiler.py Outdated Show resolved Hide resolved
qiskit_aer/backends/aer_compiler.py Outdated Show resolved Hide resolved
qiskit_aer/backends/aer_compiler.py Outdated Show resolved Hide resolved
@hhorii
Copy link
Collaborator Author

hhorii commented Apr 20, 2023

@jakelishman Thanks. With you comments, codes became much simpler, I think.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

In principle I think this looks fine. We should probably wait until Terra 0.24 is released properly before merge, though, so we don't need the Aer temporaries.

@hhorii
Copy link
Collaborator Author

hhorii commented May 12, 2023

@jakelishman thank you for your review. terra 0.24.0 was released and I changed this PR to use its SwitchCaseOp.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Given my previous review, this now looks good to merge from me, thanks!

@hhorii hhorii merged commit 11b6f44 into Qiskit:main May 16, 2023
hitomitak pushed a commit to hitomitak/qiskit-aer that referenced this pull request May 17, 2023
…iskit#1778)

* Add support of `SwitchCaseOp`

Qiskit-Terra added a new instruction of control-flow `SwitchCaseOp`.
This commit enables Aer to simulate `SwitchCaseOp` by converting
its conditions and bodies with `AerMark` and `AerJump`.

* add switch_case temporarily until qiskit-terra 0.24.0 is released.
* simplify switch compilation
* use SwitchCaseOp of terra
* fix lint errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support switch statement in dynamic-circuits simulations
2 participants