Today I submitted a pull request
What went into this weeks pull request
The framework and routines were inherited from Brian’s github branch.
- The _eval_args function was added. I went back-and-forth on deciding if we needed strong checks to make sure the states used to build density objects should be strictly KetBase and Qubits. But, there were scenarios where just symbols could be used for states, or even QExpr could be used. So, discarded that check. But, this would mean Density objects could have arbitrary objects for states. Flip side to this is, represent() on density objects which do not have a KetBase object does not work very well. For example, having ‘mul’ expressions for ‘state’ creates problems in represent functions. But, my assumption is represent function need not handle such scenarios. Similarly, I went back and forth regarding checking for valid values for probabilities. Then, I dropped those validations as well.
- Added test routines for all public facing methods in density.py. Some methods from original DensityOp branch are not in this pull request. I will add them back in future requests.
- I also created a minor pull request for minor printing changes that were in the original densityOp branch. This takes care of changes to the latex() in operator.py. I will add checks for density operator after this pull request is accepted.
- Added test routines for changes related to density in qapply.py. These checks will have to be extended after I make density operators work well with Qubits.
- Added doc strings.
Where I spent a my time while trying to accomplish this weeks tasks:
- Understanding the process-function call flow of _eval_args, _print methods.
- Getting familiarized with operator.py , represent(), and qapply().
(The following point is also a question for my next task)
- The way _qsympify_sequence(seq) method is implemented, it treats any Qubit() passed as state to Density as a sequence object. Therefore, the Qubit object is lost and a tuple is replaced instead of the Qubit object. This needs to a fixed or a work around decided so that Qubits can be provided as states to Density objects.
My next steps ( plan for next week’s pull request):
- Discuss with the mentor team and see how to approach the problem with Qubits being converted to sequence. ( in next 2 days )
- Add remaining functionality into density.py ( entropy, reduced trace operations ) ( should be completed by middle of next week )
- Blog about the implementation details of changes to tensorproduct.py with respect to what we would need for density operators. I hope to also have this part implemented by end of next week.
- Address issues with the current pull request. I plan to have this as the top priority task and work on this every time it comes back to me.
I gave a lightening talk at Google Chicago office this week regarding my GSoC 2012 project and there was lot of interest in Sympy. Particularly, folks were very excited to know about Sympy Live website which I spoke about in the presentation.
Also, met one of our Sympy contributors Matthew Rocklin at the meeting. Nice to meet someone you know only as an email-id, in person!