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
Densityop general : very basic features for density operators #1312
Conversation
…easure that works
* Now inherits from HermitianOperator. * Simpler design. * Updated printing.
…value error need to be handled in tests
SymPy Bot Summary: 🔴 There were test failures. @gdevanla: Please fix the test failures. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYqcYaDA Interpreter: /usr/bin/python2.6 (2.6.7-final-0) Automatic review by SymPy Bot. |
SymPy Bot Summary: 🔴 There were test failures. @gdevanla: Please fix the test failures. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY8K4aDA Interpreter: /usr/bin/python3 (3.2.3-candidate-2) Automatic review by SymPy Bot. |
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYtZQbDA Interpreter: /home/stefan/python2.5/Python-2.5.6/python (2.5.6-final-0) Automatic review by SymPy Bot. |
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYxL4aDA Interpreter: /usr/bin/python3 (3.2.3-candidate-2) Automatic review by SymPy Bot. |
"""Expands the density operator into the matrix format""" | ||
terms = [] | ||
for (state, prob) in self.args: | ||
terms.append(prob*state*Dagger(state)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to create OuterProduct
s here. Just enclosing (state * Dagger(state))
in parentheses will automatically take care of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would use the parens to get OuterProduct
s here.
@ellisonbg @flacjacket @certik I have updated the PR with changes suggested ( except for Notebook examples) @ellisonbg I have not used used Notebook before. Do you think I can add the changes(examples for Notebook) you suggested as part of examples in the next PR. That will give me time to work on that. Or else, I can update this PR is next few days. I am fine either way. @flacjacket I will update test_printing for density operators, once your printing related PR is merged. Will that be sufficient? |
Let's add the notebook now if you can. Let us know if you have any problems installing it. Here are link to the IPython docs for this: http://ipython.org/ipython-doc/dev/install/index.html |
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY5t0aDA Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0) Automatic review by SymPy Bot. |
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYuZQbDA Interpreter: /usr/bin/python2.7 (2.7.2-final-0) Automatic review by SymPy Bot. |
Waiting on the printing tests is fine, I'd just brought it up so you were aware of it, but that was before I noticed that you'd mentioned it on your blog post. |
"""Return list of all states""" | ||
return Tuple(*[arg[0] for arg in self.args]) | ||
|
||
def probs(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a docstring with one or two doctests showing how to use probs().
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYj6caDA Interpreter: /usr/bin/python3 (3.2.3-candidate-2) Automatic review by SymPy Bot. |
@ellisonbg I see that there is an examples/notebook folder where there is 1 .ipynb file. Should I add my notebook to that folder or to examples/advanced folder. Also, I do not see any notebook for other quantum modules. Am I looking at the wrong place? Either ways, once I have the location I can upload an updated version of the file. I will be starting off from the file you already had at: |
Fixed the doc strings and also added density.ipynb to examples/notebook. |
Guru, On Wed, May 30, 2012 at 2:31 PM, Guru Devanla
I guess let's use examples/notebook
No, but @flacjacket wasn't there a notebook for spin examples?
Brian E. Granger |
There wasn't ever one that I submitted. I've got some stuff I did for testing myself, I'll try to put them together and clean it up and get it in another PR. |
OK thanks. On Wed, May 30, 2012 at 4:05 PM, Sean Vig
Brian E. Granger |
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY1Y8aDA Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0) Automatic review by SymPy Bot. |
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYvJQbDA Interpreter: /usr/bin/python2.7 (2.7.2-final-0) Automatic review by SymPy Bot. |
SymPy Bot Summary: ✳️ All tests have passed. Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYkacaDA Interpreter: /usr/bin/python3 (3.2.3-candidate-2) Automatic review by SymPy Bot. |
Hm, that last line of your notebook looks like a bug in qapply. It should split up OuterProducts, but it only does so when it appears on the left of a multiplication, so it misses it when it is the right most term in the expression (as in this case). |
Yes, I think this is a bug. @gdevania can you tackle this bug in a On Thu, May 31, 2012 at 7:59 PM, Sean Vig
Brian E. Granger |
Sure, will track it and work on it on a separate PR. |
This looks good for a first iteration, I'll merge this in. |
Densityop general : very basic features for density operators
This version implements the initial features needed for Density operator. Using qubits as states is not fully supported in this version.