-
Notifications
You must be signed in to change notification settings - Fork 361
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
Add instructions to set simulator state #1163
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chriseclectic
added
the
Changelog: New Feature
Include in the Added section of the changelog
label
Feb 26, 2021
chriseclectic
force-pushed
the
set-state
branch
from
March 16, 2021 17:09
65a9158
to
f2c29cc
Compare
chriseclectic
force-pushed
the
set-state
branch
2 times, most recently
from
March 24, 2021 21:29
587239a
to
fb2321f
Compare
chriseclectic
changed the title
[WIP] Add instructions to set simulator state
Add instructions to set simulator state
Mar 24, 2021
Current support is for statevector, density matrix, unitary, superop, stabilizer
Move default_qubits to separate file Move instructions to subfolders Add set instructions to backends
chriseclectic
force-pushed
the
set-state
branch
from
March 25, 2021 17:00
e5aae89
to
b1c152c
Compare
vvilpas
reviewed
Mar 26, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I only have a small doubt regarding a switch block.
@@ -580,6 +580,9 @@ void State<statevec_t>::apply_ops(const std::vector<Operations::Op> &ops, | |||
else if(op.name == "end_register_blocking"){ | |||
BaseState::qreg_.leave_register_blocking(); | |||
} | |||
case OpType::set_statevec: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we missing a break
statement for the sim_op
case?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add instructions for setting the simulator state to a custom value.
Note: performance for these instructions for large numbers of qubits will be quite bad since the instruction is being serialized via JSON which is very inefficient for matrices and vectors.
TODO:
Details and comments
Adds instructions for setting the simulator state for statevector, density matrix, unitary, and stabilizer methods. These are simulator directive instructions so cannot be unrolled to gates like
initialize
instructions. They also must be applied to all qubits in a circuit, unlike initialize.Example
For follow up PRs