GSoC 2012 Application Guru Devanla: Density Operators for Quantum Module - sympy/sympy GitHub Wiki

My information

  • Name: Guru Devanla
  • University / current enrollment: University of Illinois, Chicago (graduating 2013)
  • Bio/background: I am a PhD student in the Department of Computer Science at UIC. My current research is on quantum algorithms on problems related to graphs. I have been learning and working on quantum computing for the past 1 year and I have a good understanding of the framework on which quantum computing is based on. I am also very comfortable with linear algebra required to work in this area and I hope that would help me in this project as well. I have worked in software development, both in design and development of trading/analytical applications at Morgan Stanley, Exelon and a host of other companies. I have programming experience in C++, Java, C# and more recently for 2+ years I have used Python for my research assistantship at National Center for Data Mining at UIC. More information about me can be found in my [CV] (https://github.com/gdevanla/myresume/blob/master/resume.txt)
  • Email: grdvnl [at] gmail [dot] com
  • GitHub : [My GitHub] https://github.com/gdevanla

My coding platform

My current setup is a 32-bit Ubuntu system. I have been programming in Python for three years now for my research projects including live projects at National Center For Data Mining at UIC for 2 years. Prior to that, I have worked on both Java and C# based projects.

I am comfortable with GIT and my GitHub profile can be found at (https://github.com/gdevanla). I have experience working with remote teams (with team members I have never met and only communicated through phone and email).

Getting to know the community/codebase

###Patch requirement: I forked the git repository and began to work on [http://code.google.com/p/sympy/issues/detail?id=3169]. This issue was created after my initial Pull request 1137, and it was concluded this needs more review and time. But, during this process I got to work on the sympy.physics.quantum module which helped me quickly ramp up and understand what features were lacking in the module.

Currently, another pull request [Pull request 1159] (https://github.com/sympy/sympy/pull/1159) is currently being reviewed and certain requirements are still being decided as part of the comments thread.

###Introduction to mailing list and mentor I introduced myself to the list and also started having some conversation with Brian Granger who has been involved with the quantum module. Some of the discussions I had with him can be found on the issue pages [Issue 3199] (http://code.google.com/p/sympy/issues/detail?id=3199) and also in the mailing list.

My Project

Goal

The goal of this project is to add an implementation of density matrix and related functionality to the sympy.physics.quantum module. This functionality should extend the quantum module to support density operators for arbitrary quantum systems and for qubit related operations. The density matrix implementation would include functionality to represent density matrices in different bases, make them work with states and tensor products of states. We will also implement a specialized density operator to deal with n-bit qubits. The density operator will also include methods to measure expectations, entropy/entanglements and also perform partial trace operations on of tensors states or just qubits. One other offshoot effect of this goal would be to implement a generic Trace expression.

Motivation

The density matrix is an important representation/tool in quantum mechanics and quantum computing. It is used to measure and perform calculations on mixed states of quantum systems. Providing this functionality to the current quantum module will greatly extend the use of the quantum modules by both researchers and students' looking to work on quantum mechanics and more importantly quantum computing. For a computer science research student like me, having such tools would help tremendously in quickly prototyping and running some simulations involving density operators. Dealing with bipartite systems is easier, but once we need to perform measurements on arbitrary sized systems having such operations would be very helpful.

On the personal side, working on this would expose me to a lot more algebra involved in using density operators, which I could use in my current research. I have been using libquantum.c implementation for my simulations, but even libqauntum library does not provide the functionality we plan to build as part of this module. I hope to continue contributing to Sympy community past summer as I continue working in this exciting area.

How my background fits:

As stated in the background section I am a polyglot and also experienced in using Python for large scale live projects. This is in addition to the years of experience I have in developing software for time-critical functions like the trading/analytic application.

Additionally, my current research experience in quantum computing puts me at a unique position to apply my programming skills and my knowledge in this very specialized area. I hope this "mixed state" will be an asset while I spend my summer contributing to Sympy. I am also inspired by the fact that I can continue using Sympy (including my contribution) for my ongoing research past summer.

Timeline ( based on 40 hour work week)

  • Startup period (April 24-May 21): Become more familiar with the quantum code base; sketch out a more detailed design of the modules which will implement the proposed functionality and discuss with the sympy community. In addition, I plan to read up and get comfortable with continuous Hilbert spaces to help in the implementation of position and momentum density matrices and also on Time evolution. Overall, I plan to use this period to read up on existing code and quantum mechanics pieces I am not familiar with.

  • Weeks 1,2 : density.py code restructure based on what is needed for to (a) implement represent, (b) position momentum density matrices. TensorProduct.py also will be updated to handle Tensor Products of mixed spaces/discrete systems correctly. Implement density matrices for position and momentum.

  • Week 3,4 : Qubit density matrices, qubit density matrices with tensor products.

  • Weeks 5,6 : qapply for density op L and R operations. Change and test for both generic and qubit related density op., density op with tensors, and multi-qubit tensors.

By end of 6th week, most of the infrastructure to use density matrices should be available. From here on we build the other operations related to density matrices.This will be a good point to review overall implementation before moving forward.

  • Weeks 7 ,8 : Generic Trace op and operations related to Tr(matrix), Tr(tensor products), Partial Trace operations :general density op, n-qubits , tensor products of n-qubits
  • Weeks 9, 10 : Start work on Time evolution.
  • Weeks 11,12: Buffer period. Clean up code, review documentation and complete pending tasks based on agreements with the mentor.

###Git Updates:

I plan to push regularly on a daily basis to my branch on github to help my mentor provide me regular feedback. That way I provide ample time for my mentor to review code before the scheduled pull request.

The plan is to submit a pull request at the end of every time period of the line item listed below. For example at end of week 2, 4, 6 etc.

High-Level Implementation Details

An implementation of density operators has been started by Brian Granger at (https://github.com/ellisonbg/sympy/tree/densityop). My plan is to start working off this branch.

My first steps is to sync up the changes on this branch with the latest master. Then, as listed in the timeline section, I plan to structure the generic density operator as a class. Following this I plan to implement density matrices for position and momentum operators. The tensorproducts.py will be updated to support these changes. The changes on tensorproduct.py will include changes to representing mixed spaces. These classes will also have _represent_ methods to represent them in different bases.

Following the generic density matrix implementation, I plan to extend this to qubit related denisty matrices. These classes will support states as tensor products. The qubit specific density operator will also support tensort products of multilple-qubits.

Before, building in full blown functionality into these classes, I plan to implement a generic Tr Expr. This expression should be able to take in single matrix or tensor products and evaluate the expression. Examples: Tr(matrix), Tr(TensorProducts).

Regarding Partial Trace operations, it will be decided if these operations need to be part of the DensityOp classes or if they can be expressions by themselves. These partial trace operations will be fully capable of working with tensor products, sequence of states and and also on multi-qubit tensor products.

Examples: Given a_i \in A, b_i in \B , c_i in C:

  • TrPartial( density( a_1 \otimes b_1, a_2 \otimes b_2, ..), 0) to trace B
  • TrPartial( density( a_1 \otimes b_1 \otimes c_1, a_2 \otimes b_2 \otimes c_2, ..), 1,2) to trace BC

Also, qapply.py will have to be modified to enable the density operators to be manipulated correctly. The final results involving density op must be retained when muls are performed on density ops as input.

Also, more detailed and recent discussions on the issue this project is attempting to solve can be found at Issue 3199. The comments provide some more nitty-gritty details this section may not have.

Plan for weekly progress report ( via blog posts )

I plan to post my progress on a weekly basis to my blog rhoforsympy.

I plan to submit pull requests during the end of every time interval listed in the timeline. The timeline is split such that the development is iterative and we could quickly go back and change things before problems get blown out of proportion. Even the mentor has good time to review my code based on the time lines provided that ensure the delivery time lines are met smoothly.

⚠️ **GitHub.com Fallback** ⚠️