NVIDIA/cuda-quantum

Bloch sphere visualization for single-qubit operations

bettinaheim opened this issue · 6 comments

Description

The CUDA-Q platform allows users to build and execute hybrid quantum-classical kernels. While learning CUDA-Q and also while developing with CUDA-Q, it is helpful to visualize quantum circuits and states to gain intuition, to spot check code, and to communicate with others. We need to expand the visualization functionality into CUDA-Q. We would like to add functionality to visualize single qubit state vectors on a Bloch sphere.

Scenarios

A developer who has defined a single qubit quantum kernel and has found the statevector after applying that kernel using cudaq.get_state(kernel) should now be able to view the vector representation on the Bloch sphere. Both the ability to graph multiple statevectors onto one Bloch sphere and multiple Bloch spheres side by side should also be made possible.

Details

We would primarily like to make this available in Jupyter notebooks. For this issue, it is hence sufficient if this is supported in Python only (not in C++). To simplify development, we can take an optional dependency on QuTiP and its tools for Bloch sphere plotting to add a new member function add_to_bloch_sphere on cudaq.State. This function should create a new Bloch sphere if no argument is given, and it should add the state vector to an existing Bloch sphere if a Bloch sphere object is passed as argument.
The add_to_bloch_sphere function should check if the qutip package is installed and fail with a comprehensive error to please install qutip if it is not. It should also check if
the state is a single qubit state and give a comprehensive error otherwise.
Additionally, there should be a new cudaq.show function that takes one or more Bloch spheres and visualizes them side by side.

Bonus

It would be nice if the Bloch sphere(s) could also be plotted in LaTeX. However, this functionality is not expected for completion of this issue.

Hi bettinaheim, My First hello to you .

I am Inderpal Suthar , and I have been learning about quantum computing since 2022.

Experience - Qiskit , QuTiP , Cirq , DWave
Participation - Quantum Hackathons,IBM Quantum Challenges.,Womanium Quantum Program 2023
I am interested in this issue and want to contribute under UnitaryHack.
Best Regards
Inderpal Suthar

Linkedin:-
https://www.linkedin.com/in/inderpal-suthar-b38344260/
Github :-
https://github.com/InderpalSuthar

Hi,

If anybody is working on this, I do not want to disturb them, but if not, I would like to give this a try.

Hi @sayana25 ,
I am working on this .