Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Dump the Bloch sphere coordinates of a Qubit (from the simulator) #1049

Open
RufusJWB opened this issue Jun 29, 2022 · 2 comments
Open

Dump the Bloch sphere coordinates of a Qubit (from the simulator) #1049

RufusJWB opened this issue Jun 29, 2022 · 2 comments
Labels
area: target machines Target machines like the quantum, trace, or Toffoli simulators enhancement New feature or request

Comments

@RufusJWB
Copy link

Please describe what you would like the feature to accomplish.
I'd like to dump a QuBit from the simulator in the form of Bloch sphere coordinates

Describe the solution you'd like

use qb1 = Qubit();
DumpRegisterAsBlochSphereCoordinates((),[qb1])

Describe alternatives you've considered
I was thinking about dumping the state from the simulator into a text file, parse the text file and calculate the Bloch sphere coordinates.

Additional context
You could use https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.blochspherecoordinates

@RufusJWB RufusJWB added enhancement New feature or request needs triage An initial review by a maintainer is needed labels Jun 29, 2022
@RufusJWB RufusJWB changed the title Dump the Bloch Sphere coordinates of a QuBit (from the simulator) Dump the Bloch sphere coordinates of a QuBit (from the simulator) Jun 29, 2022
@RufusJWB RufusJWB changed the title Dump the Bloch sphere coordinates of a QuBit (from the simulator) Dump the Bloch sphere coordinates of a Qubit (from the simulator) Jun 29, 2022
@cgranade
Copy link
Contributor

If you're using Q# from Python, the qsharp.capture_diagnostics context manager can be used to extract simulator dumps into QuTiP objects, where you can perform this kind of analysis.

For example:

with qsharp.capture_diagnostics(as_qobj=True) as diag:
    RunMain.simulate()
# diag should now contain QuTiP objects for each DumpMachine call in
# RunMain

@RufusJWB
Copy link
Author

If you're using Q# from Python,

I'm intending to using q# directly. If this is not working, I'd prefer to use c# over Python. Would you have an example in c#?

@bettinaheim bettinaheim added area: target machines Target machines like the quantum, trace, or Toffoli simulators and removed needs triage An initial review by a maintainer is needed labels Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: target machines Target machines like the quantum, trace, or Toffoli simulators enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants