Enhancement of Aer-based `quantum_info`
hhorii opened this issue · 7 comments
Description
AerStatevector
will be released in Qiskit-Aer 0.11. AerStatevector
supports qiskit.quantum_info.states.Statevector
interface with Qiskit-Aer statevector and provide much better performance than it. In this project, mentees develop more classes of quantum_info
with Qiskit-Aer, such as Densitymatrix
and StabilizerState
.
Deliverables
New python classes: AerDensitymatrix
and AerStatevectorState
Mentors details
- Mentor 1
- Name: Hiroshi Horii
- GitHub ID: @hhorii
- What they do: Lead of Qiskit-Aer development
Number of mentees
2
Type of mentees
- Mentee 1
- Required:
- Experiences in python library development and C++
- Deep knowledge of
Denstymatrix
inquantm_info
- Nice to have:
- Experiences in development to bind python and C++
- Required:
- Mentee 2
- Required:
- Experiences in python library development and C++
- Deep knowledge of
StabilizerState
inquantm_info
- Nice to have:
- Experiences in development to bind python and C++
- Required:
Hi @hhorii, I probably do not strictly meet the requirements, but I would like to see if there is any area where I can help.
First of all I am a software developer with a career of almost 20 years. I have used Python 2/3 since 2015 to now. I have some experience in OSS in areas unrelated to quantum computing as a contributor. I have also used C++ intermittently from 2003 to 2015 mostly for embedded systems. But I don't have deep knowledge for neither Denstymatrix
nor StabilizerState
in quantm_info
.
I have played with binding of python and C++ using Boost.Pytho beforen, but I have no experience using them for business purposes.
@derwind Thank you for your comment. I believe that you do not need C++ implementation to implement Densitymatrix
but knowledge of C++ will be very helpful to understand the current implementation of AerStatevector
. Binding part was already done by using pybind11. AerStatevector
is now under review here. I expect that you implement AerDensitmatrix
as I am implementing AerStatevector
.
The scope of development may be narrow than what you expected. Please tell me still you are interested in this porject.
In my opinion, implementation of AerStabilizerState
needs knowledge of StabilizerState
.
@hhorii Thank you for your reply. There is still some uncertainty for me due to lack of my knowledge , but I am willing to take on the challenge since I believe this is a good first step in understanding Qiskit itself and how to better utilize it in the future. First of all I checked out your PR#1590 locally to understand the situation, built qiskit-aer and ran the following code:
>>> from qiskit import QuantumCircuit
>>> from qiskit_aer.quantum_info.states.aer_statevector import AerStatevector
>>> qc = QuantumCircuit(1)
>>> sv = AerStatevector(qc)
>>> sv.trace()
1.0
I have no knowledge of StabilizerState, so when tackling this issue, I would like to implement the AerDensitymatrix
class, which relates to a density matrix that I am relatively familiar with. I will be looking up the concept etc I don't know as I go along.
Checkpoint 1
The presentation slide is: Enhancement_of_Aer-based_quantum_info.pdf
Checkpoint 2
Review of Checkpoint 1
Review briefly what we have accomplished up to checkpoint 1.
- Investigated the initialization sequence in
AerStatevector
. - Investigated the state transitions of the inner class
AerState
.
Tasks and progress
Remaining tasks and progress to this point are listed below. Checked areas are those that are complete or nearly complete:
- Implement APIs of
AerDensityMatrix
with the same methodology ofAerStatevector
- Prepare a stub implementation corresponding to
AerStatevector
. - Understand the extensions for DensityMatrix in the C++ layer of Aer.
- Proceed with the implementation of
AerDensityMatrix
. - Complete the implementation of
AerDensityMatrix
. - Create a PR on GitHub and have it merged.
- Prepare a stub implementation corresponding to
- Test
AerDensityMatrix
using Terra's unittests- Rewrite Terra's unit tests for Aer.
- Add
AerDensityMatrix
specific tests. - Verify that
AerDensityMatrix
passes the new unittests.
- Measure performance of
AerDensityMatrix
- Check performance several times during implementation.
- Verify performance with full
AerDensityMatrix
.
- Prepare a demo for Checkpoint 3
By-products
Here are some of the by-products of during the tasks
- Use AerStatevector in unittests #1621
- Fixed a bug in
AerStatevector
's unittests. - The fix is now included in Qiskit Aer 0.11.1.
- Fixed a bug in
- AerState uses instructions unsupported in matrix_product_state method #1640
- Not fixed. Under discussion.
- AerStatevector(QuantumVolume(1)) raises an error #1641
- Not fixed. Under discussion.
- Some design and implementation issues were discussed through weekly online meetings with my mentor and daily Slack discussions. Several items were identified that we plan to fix.
- Imcomplete design of
AerDensityMatrix
time evolution implementation. - Inconsistencies related to the internal representation of the memory layout of
numpy.ndarray
. - Consideration of noisy simulations with Kraus operators, etc.
- Imcomplete design of
- The relevant sections of the Qiskit textbook have been translated into Japanese. Currently waiting for proofread:
The image below is an example of the display in a local environment:
Current impression
At the start of the project, I was confused by many things I did not know, but through weekly discussions with my mentor @hhorii, the situation gradually became clearer. Since the nature of the project is software development, we encountered many puzzling behaviors and bugs, but I feel that we have been able to solve them one by one in cooperation with my mentor. There are still a few hurdles to overcome before implementation is complete, but I believe that we can overcome them by continuing to move forward. Thank you.
Final Showcase
I attached the slide used in the Final Showcase and the Jupyter notebook used in the performance measurement demo.
Enhancement_of_Aer-based_quantum_info.pdf
performance_check_dm.ipynb.zip
Now all but one of the milestones declared in Checkpoint 2 have been achieved. That item is "Create a PR on GitHub and have it merged", which is ended with the creation of a draft PR. This, however, is actually for the good. Instead of forcing ourselves to create a PR and pretend to be perfect, we chose to continue with our QAMP journey. We will keep going to finish in the very near future!
Congratulations on completing all the requirements for QAMP Fall 2022!! 🌟🌟🌟