mit-han-lab / torchquantum

A PyTorch-based framework for Quantum Classical Simulation, Quantum Machine Learning, Quantum Neural Networks, Parameterized Quantum Circuits with support for easy deployments on real quantum computers.
https://torchquantum.org
MIT License
1.28k stars 191 forks source link

add support for more quantum algorithms #136

Closed Hanrui-Wang closed 1 year ago

Hanrui-Wang commented 1 year ago

To enrich torchquantum's support of various algorithms, we need your help on implementing more quantum algorithms in TQ! You may choose any quantum algorithm you like to implement such as quantum fourier transformation, any variational quantum algorithms etc. One example could be https://github.com/mit-han-lab/torchquantum/blob/main/torchquantum/algorithms/vqe.py

Basically the user will call the tq.algorithm.xxx to initialize the algorithm and then execute and readout.

You can start will implemented the PDE algorithm as below:

Variational quantum algorithms (VQAs) provide a promising approach to solving complex problems that are difficult or even intractable for classical computers. Many real-world problems, such as finding the lowest energy state of a molecule or optimizing the allocation of resources, can be formulated as optimization problems. VQAs employ variational techniques to iteratively improve an initial guess for the solution by modifying a set of parameters that define a quantum circuit. By running the circuit on a quantum computer and measuring the output, one can estimate the objective function, and the optimization process can be repeated to converge towards the optimal solution. Partial differential equations (PDEs) are mathematical equations that describe a wide range of physical phenomena, including fluid dynamics, electromagnetism, and quantum mechanics. Solving PDEs is of great importance in various scientific and engineering fields. However, traditional methods for solving PDEs on classical computers often face challenges when dealing with large-scale systems, especially nonlinear systems. Many approaches have been proposed for encoding PDE problems into quantum computers[1, 2, 3]. By leveraging quantum superposition and entanglement, quantum algorithms can explore a vast solution space more efficiently than classical methods, potentially leading to significant speedups. For this project, implement one VQA for solving PDE using TorchQuantum in an interactive notebook.

[1] Javier Gonzalez-Conde, A ́ngel Rodr ́ıguez-Rozas, Enrique Solano, and Mikel Sanz. Simulating option price dynamics with exponential quantum speedup, 2022. [2] Michael Lubasch, Jaewoo Joo, Pierre Moinier, Martin Kiffner, and Dieter Jaksch. Variational quantum algorithms for nonlinear problems. Physical Review A, 101(1), jan 2020. [3] Yuki Sato, Ruho Kondo, Satoshi Koide, Hideki Takamatsu, and Nobuyuki Imoto. Variational quan- tum algorithm based on the minimum potential energy for solving the poisson equation. Physical Review A, 104(5), nov 2021.

Please don't hesitate to let us know for any questions!

Anantha-Rao12 commented 1 year ago

Hi @Hanrui-Wang and Team TorchQuantum,

This seems to be an interesting problem. I would like to take it up as part of UnitaryHack. I have 3 doubts:

  1. In this issue, are you looking to implement a quantum algorithm to solve a PDE as given or implement any quantum algorithm such as a Quantum phase estimation or Quantum Fourier transform?

  2. If I understand correctly, you are looking for a tutorial-type jupyter notebook that uses a variational quantum algorithm to solve a PDE. I was thinking about solving the Poisson equation (Sato, Yuki, et al.). Do you have a particular preference for any other PDE?

  3. If I am solving the Laplace equation as given in Sato, Yuki, et al what boundary conditions do you want me to use? I see that the easiest one is the Dirichlet condition. Is that true? Looking forward to your inputs.

Based on this, I will be happy to solve and submit a PR.

Hanrui-Wang commented 1 year ago

Hi Anantha,

Thank you for the interest to this topic! For your questions:

  1. I'm looking for any quantum algorithms, not limited to the PDE solver. PED solver is only one example that you may work on.
  2. Yes, assuming you select the PDE algorithm, we are looking for an implementation of a class under torchquantum.algorithms, and then a tutorial type notebook to explain and walk through the usage of the class will be preferred to let users better understand the algorithm.
  3. Yes, you may start will Dirichlet condition. Preferably also support the Neumann condition.
Jayshah25 commented 1 year ago

Hi @Hanrui-Wang and the Torch Quantum team, I would like to contribute to this issue as a part of unitary hack. As a start, I would try to implement QAOA!

s-aldaihan commented 1 year ago

Hi @Hanrui-Wang, I am also interested in this problem. Please let me know if you are considering opening the issue for more contributors. Thanks!

bopardikarsoham commented 1 year ago

Hi @Hanrui-Wang , I am also interested in working on this issue

hrahman12 commented 1 year ago

Hi I'd like to work on this issue! Can I be assigned this?

YuNariai commented 1 year ago

I would like to implement Quantum Fourier Transformation or QPE if nobody has already worked on it. I have a question, how do you like to use QFT? for example, Inside a circuit, and call QFT function to finish the circuit?

Gopal-Dahale commented 1 year ago

Hi @Hanrui-Wang, I would like to implement Grover's Search Algorithm. Can you assign this issue to me as well?

RamAIbot commented 1 year ago

Hi @Hanrui-Wang , I am planning to add Quantum Image encoding (methods like FRQI) for unitary hack. Will it be eligible ?

Hanrui-Wang commented 1 year ago

Hi @Hanrui-Wang , I am planning to add Quantum Image encoding (methods like FRQI) for unitary hack. Will it be eligible ?

Hi RamAIbot,

Yes, that is eligible, please go ahead!

Gopal-Dahale commented 1 year ago

Hi @Hanrui-Wang, can you take a look at #144? If there are any suggested changes, I'll make them before the deadline.

Hanrui-Wang commented 1 year ago

Congrats @YuNariai @Gopal-Dahale and @bopardikarsoham for merging the QFT, Grover and superdense coding algorithms! Since the UnitaryHack comes to the end, I will close this issue. We will very appreciate if you could continue to contribute more algorithm blocks to TQ. Thank you all for the contributions!