qiskit-advocate/qamp-fall-22

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 in quantm_info
    • Nice to have:
      • Experiences in development to bind python and C++
  • Mentee 2
    • Required:
      • Experiences in python library development and C++
      • Deep knowledge of StabilizerState in quantm_info
    • Nice to have:
      • Experiences in development to bind python and C++

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 of AerStatevector
    • 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.

implementation

  • 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.

performance

  • Prepare a demo for Checkpoint 3

By-products

Here are some of the by-products of during the tasks

PR1621

The image below is an example of the display in a local environment:

qiskit_textbook

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!! 🌟🌟🌟