I was wondering if there was some code available for Hamiltonian simulation for sparse matrix. And also if they exist, they correspond to a divide and conquer approach or a Quantum walk approach?


Update on the subject: there are several implementations in the wild. I don't know if you still need them, but even if you don't it will hopefully be useful to other people.

I chose to list the implementations by "provenance" rather than by the algorithm used because there are not that much implementations. This may change in the future.

  1. Qiskit-aqua: Qiskit is the library of IBM for quantum computing. Qiskit-aqua is the part of the library that deals with quantum algorithms.

    The Qiskit-aqua implementation can only simulate Hamiltonians that are a sum of hermitian matrices that can be written as tensor products of Pauli operators. To do so, they used the Trotter-Suzuki formula.

    The documentation is available here.

  2. simcount: Implementation of 3 hamiltonian simulation algorithms for a specific kind of hamiltonian. Based on Quipper. All their work is explained in the paper Toward the first quantum simulation with quantum speedup (Andrew M. Childs, Dmitri Maslov, Yunseong Nam, Neil J. Ross, Yuan Su, 2017).

    The 3 algorithms (and their variations) implemented in the repository have been optimised for a very specific Hamiltonian $$H = \sum_{j=1}^n \left( \vec{\sigma}_j \cdot{} \vec{\sigma}_{j+1} + h_j \sigma_j^z \right).$$

    The implementations are available here.

  3. QatHS (disclaimer: I did this one): Implementation of the Trotter-Suzuki formula along with Hamiltonian Simulation algorithms for black-box oracles. The oracle-based Hamiltonian Simulation algorithms are based on a Master thesis available here (requires to ask for the PDF, I could not find it elsewhere).

    In short: you can simulate any Hermitian matrix as long as you have an oracle for each of the matrices in your decomposition. Integer-weighted matrices have been extensively tested with the wave equation solver implementation, fixed-points weighted matrices should also work but have not been tested as thoroughly.

    The implementation is available here.

  • $\begingroup$ The 2nd link ("...is available here") is dead. Could you update this? $\endgroup$ – thespaceman Sep 23 '20 at 16:15
  • 1
    $\begingroup$ I realised this yesterday, I'll update the whole answer shortly (4-5 hours). $\endgroup$ – Adrien Suau Sep 24 '20 at 7:18
  • $\begingroup$ I'd also very much appreciate it if you include new Hamiltonian simulation software/methods. Additionally, I have a clarifying question. Does Hamiltonian simulation imply simulating only the form $e^{-iAt}$ or can it also refer to the more general form $e^{At}$? $\endgroup$ – thespaceman Sep 24 '20 at 16:29
  • 1
    $\begingroup$ Done! And about your question, $e^{-iAt} = \left( e^{iAt} \right)^\dagger$, so yes you can simulate the general form as well, just by inverting the quantum circuit (or giving a negative time). $\endgroup$ – Adrien Suau Sep 25 '20 at 7:36
  • $\begingroup$ Great, I appreciate the update! As for my question, I am specifically interested in estimating $e^{At}$, so what I was wondering is if Hamiltonian simulation refers specifically to estimating $e^{iAt}$ or if it also refers to the exponentiation of any matrix (e.g $e^{At}$). $\endgroup$ – thespaceman Sep 28 '20 at 15:57

In this article the authors stated that they used this Group Leader's algorithm in order to obtain the circuit implementing the hamiltonian simulation used as a subroutine in an instance of HHL algorithm.

Unfortunately though, I did not understand quite well how they actually managed to find the circuit with that method.

  • 2
    $\begingroup$ I know this one and I understand it well. I even did an implementation on it. But I want actually something that is not using this one. Either divide and conquer algorithms or quantum walks with a real code. The GLOA can be long to run actually. $\endgroup$ – cnada Aug 14 '18 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.