NVIDIA / cuda-quantum

C++ and Python support for the CUDA Quantum programming model for heterogeneous quantum-classical workflows
https://nvidia.github.io/cuda-quantum/
Other
424 stars 147 forks source link

Bloch sphere visualization for single-qubit operations #1639

Closed bettinaheim closed 2 weeks ago

bettinaheim commented 2 months ago

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.

InderpalSuthar commented 1 month ago

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

sayana25 commented 1 month ago

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.

InderpalSuthar commented 1 month ago

Hi @sayana25 , I am working on this .

InderpalSuthar commented 1 month ago

Hi Sir , As we discussed I am working on this .

khalatepradnya commented 2 weeks ago

@prateekchawla: Please add a comment (anything) to this issue so it can be assigned to you for your work on PR#1763

efratshabtai commented 1 week ago

@prateekchawla: Please add a comment (anything) to this issue so it can be assigned to you for your work on PR#1763

@prateekchawla168 Please add a comment to this issue so we can assign it to you and you can get your bounty :)