Skip to content

Visualization of quantum state #579

@DmitryVasilevsky

Description

@DmitryVasilevsky

We visualize quantum state in a few places (DumpMachine, playground, debugger...) It is a list of amplitudes for all basis vectors (maybe including additional information such as phase, probability, etc). Such visualization isn't always intuitive and is getting very large fast with larger number of qubits.

We should consider providing alternative ways of this visualization.

  1. We are omitting basis vectors with 0 (or near-0) amplitudes. If the space to display the state is limited, the output may be sorted by the magnitude of the amplitude and only top of the list shown with an option to expand.

  2. When we show basis state it is not clear which qubit corresponds to which variable. For example, we may have |010> basis state. An explanation may be added that the order is q0, q1, target. I.e., the first 0 is the value of q0, the second 1 is the value of q1, and the last 0 is the value of target.

  3. User may only be interested in a part of the quantum state - say, only state for qubits a and b. We could use something similar to the QDK's DumpRegister function to display only the relevant information. An open question is what to do if register qubits are entangled with the rest of the system. (Done Add DumpRegister #1173)

  4. For some interesting values of amplitudes, we may have representation in radicals. For example, instead of displaying 0.70710678118654, we may show √2 / 2. (Done Alternative State Visualization  #1162)

  5. We can recognize certain states, For example, instead of displaying

|0⟩	√2 / 2
|1⟩	√2 / 2

we can display a LaTeX formula with nice coefficients: √2/2 · ( |0⟩+|1⟩ ). (Partially done #1162)

Potential future items to recognize:

    * Recognize trigonometric form, such as sin(𝝅/8) or cos(1).
    * Recognize common normalization coefficient, such as 1/2 ( |00⟩ + |01⟩ + |10⟩ + |11⟩ )
    * Recognize well-known states such as: |0> |1> |+> |-> |Bell> |CATn>
  1. If the state is separable, it would be nice to show it as a tensor product.

For example, instead of displaying

|00⟩	0.5000+0.0000𝑖
|01⟩	0.5000+0.0000𝑖
|10⟩	0.5000+0.0000𝑖
|11⟩	0.5000+0.0000𝑖

We can display |+⟩⊗|+⟩. But we also should combine states for a more concise display, such as |10⟩ is preferable to |1⟩⊗|0⟩.

  1. (From discussion) Bring back DumpOperation. Potentially display matrix on hover for simple operations.

  2. (From discussion) What-if scenarios. Take current state in the debugger and show what would happen if some operation is applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions