-
Notifications
You must be signed in to change notification settings - Fork 197
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
Implement Reverse Jordan-Wigner Transformation #255
Comments
Thank you for creating the issue! We are mentors of this event (Also Qiskit Advocates) - https://github.com/qiskit-community/quantum-hackathon-korea-21 and while handling the questions, we found there is no reverse Jordan Wigner function in Qiskit. We hope to contribute to Qiskit Nature by providing this function with our attendees. |
Do you have a use-case/example of situations where this reverse transformation would be useful for a particular algorithm or problem being solved? |
it can be used for making anti-symmetric groups. also https://github.com/quantumlib/OpenFermion-FQE/blob/e4261fb7de19ae64a2a608e7c136503088976ca9/src/fqe/openfermion_utils.py this doc shows another use-case of this function in the openfermion side. In this time we've received a question because they want to reverse encode the computed qubit state into a fermionic state. |
@GyeonghumKim implemented mapper We would improve these codes and consider making relevant examples. |
#702 shows that we are in the process of migrating the Maybe you can use this opportunity in a few weeks to open a PR which adds this reverse mapping? If you're still interested, I would suggest that you subscribe to #703 and once that is resolved, you add this mapper of yours to the aforementioned location. What do you think? |
Hi @mrossinek why not! thank you so much! we will follow #703 and add our mapper! |
Hi @0sophy1! It has been a while and Qiskit Nature just underwent yet another large refactoring (hopefully the last one as big as this for a long time). Are you still interested in adding the reverse Jordan-Wigner mapping to Qiskit Nature? I see that the implementation was basically already done (@BStar14). Instead of the version you proposed there I would suggest to add the reverse map to the existing |
Hey, I will likely need this feature in the near-ish future. Would you guys mind if I tried adding it to the |
Was this implementation working previously? @BStar14 @GyeonghumKim @0sophy1 I was going through it and updating it to work with the recent updates. Mostly this means using PauliSparseOp and converting the result from dense labels to sparse labels so it's compatible with the new FermionicOp It seems to map all the Pauli strings with Z correctly but it's missing terms on the way back. Only things I did were what I described above. Here's a test script, there are some print statements commented for debugging:
And the output:
|
@MarcoBarroca, this issue was suspended because we couldn't find its usecase. I would be grateful if you could share your idea. It is also fine to update the code on your own. Maybe @GyeonghunKim can provide more help for it. |
I've modified the implementation to use the FermionicOp arithmetic instead of doing so only at the end. Seems simpler this way and I've recovered the same results from the original implementation. Still looks like it's missing something for Operators X and Y as the reverse still isn't the same as the original.
Output:
|
Found the issue! Both implementations work fine! Just do a
I'll work to make a |
Done! I think reverse JordanWigner will be enough for what I’m working on but I wonder if there shouldn’t be a ReverseQubitMapper() or modify/rename FermionicMapper() class in the future to handle reverse transformations for all mappers. One other question. Why doesn’t FermionicOp.equiv() put all the operators in .normal_mode() before checking equivalence? I took a while to figure out I had recovered the same operator already. |
What is the expected behavior?
While Jordan-Wigner transformation is implemented in the
mappers
framework (JordanWignerMapper
), the reverse transformation is missing.Inspiration can be drawn from https://github.com/quantumlib/OpenFermion/blob/master/src/openfermion/transforms/opconversions/reverse_jordan_wigner.py
PS: If maintainers agree with this issue, it will be solved by collaboration among Quantum Hackathon Korea participants.
The text was updated successfully, but these errors were encountered: