-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up fermionic mappers by means of an intermediate conversion to majorana operators #1340
Comments
Adding a bit of historical context: Performance of the mappers being sub-par is a known problem. See also #771 and #1289 for related discussions. There is also #1301. The Bonsai mapper was also discussed before and is briefly referred to by #1289. #1270 is adding a That makes this issue/feature request a bit of a duplicate unless you want to rephrase it to explicitly ask for an implementation of the Bonsai mapping algorithm. |
Thank you for your response. I have gone through the linked discussions but did not find any discussion related to the proposal I am making. I am not suggesting the implementation of the Bonsai mapper. Rather, I am proposing a speed-up that can be achieved after introducing My request is for the implementation of I have observed a significant speedup with my unoptimized python code, which is not parallelized, but could be (for a 28-qubit chemical Hamiltonian with 220288 terms, qiskit takes ~68s while my method takes ~7s) |
Ah thanks for the clarification! That is indeed an interesting proposal 👍 |
@diagonal-hamiltonian Do you have a good idea, why the way via Majorana operators is faster? I am wondering if it is due to the integer tuple implementation being more efficient than the string based SparseLabelOp operators. The MajoranaOp I have implemented is also a SparseLabelOp for compatibility reasons, i.e. it uses string labels instead of tuples of int. |
@grossardt To be honest, I was quite surprised just how much faster this is as I am not entirely sure why. Initially, I thought the speed-up was from circumventing the Pauli multiplication in |
Hello, can you share your work, code? How did you get the speed up? |
What should we add?
From personal experience, the Qubit mapper is super slow. In my research, I found a way to speed things up for Majorana-string mappings eg: Jordan-Wigner, Bravyi-Kitaev, Ternary-tree, and Parity (see the Bonsai algorithm for more details). Some small background on the solution. Fermionic systems can be represented in the Majorana basis as:
where$h_{ij}, h_{ijkl}, c_{ij}$ and $c_{ijkl}$ are real coefficients. The 2N-Majorana operators are given in terms of linear combinations of the ladder operators:
The solution is as follows:
For each term in the
FermionicOp
, one should cache the result somehow of coefficients of the Majoranas resulting from['+', '+', '-', '-']
,['+', '-', '+', '-']
,['+', '-']
, ... etc. The Majoranaic Hamiltonian should then be sorted so that terms add like:where$(0,1,2,3) \equiv m_0m_1m_2m_3$ and we use a dictionary as ${\text{majornana operator:coeff}}$ . One must account for the anticommutation relations ${m_i,m_j}=\delta_{ij}$ here so
Mapper objects in qiskit like
JordanWignerMapper
use aPauliTable
object to map mode operators to qubits. The object is structured:I include a graph of the speed comparison. I can also provide code if requested.
The text was updated successfully, but these errors were encountered: