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

Add DumpRegister #1138

Closed
tcNickolas opened this issue Feb 9, 2024 · 0 comments · Fixed by #1173
Closed

Add DumpRegister #1138

tcNickolas opened this issue Feb 9, 2024 · 0 comments · Fixed by #1173
Assignees
Labels
enhancement New feature or request needs triage

Comments

@tcNickolas
Copy link
Member

Is your feature request related to a problem? Please describe.
When I work on larger code that might have several different qubit registers serving different purposes, I want to be able to dump just the state of some of them, not of all systems. Typically, in such scenarios I know that these qubits are not entangled with the rest of the system, for example:

  • In the katas, ShowQuantumStateComparison reuses the input register to show multiple states that can be prepared from it, uncomputing the preparation operation between them. This is inconvenient, since the state preparation operation might not have an adjoint defined. Instead, we could allocate an extra register and print the state of just that register.
  • Similarly, for oracle-based problems, I need to check if the state of the input register didn't change, and if it did, let the user know - ideally printing its state separately from the state of the target qubit that is also allocated at this time.

Describe the solution you'd like
DumpRegister functionality similar to that of DumpMachine but allowing to the state of just one register. (This was mentioned as part of #579, but I think it's worth a separate callout.)

If the qubits are entangled with others, I'm fine with a message telling me this, like the classic QDK did, I'm usually interested in cases when they're not.

@tcNickolas tcNickolas added enhancement New feature or request needs triage labels Feb 9, 2024
@swernli swernli self-assigned this Feb 16, 2024
swernli added a commit that referenced this issue Feb 17, 2024
This change adds an implementation of `DumpRegister` as an intrinsic in the standard library with matching implementation in the evaluator. It works by getting a full state dump and calculating if the state corresponding to the given qubits is separable from the rest, returning an error if it is not.

Fixes #1138
github-merge-queue bot pushed a commit that referenced this issue Feb 28, 2024
This change adds an implementation of `DumpRegister` as an intrinsic in
the standard library with matching implementation in the evaluator. It
works by getting a full state dump and calculating if the state
corresponding to the given qubits is separable from the rest, returning
an error if it is not.

Fixes #1138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants