Skip to content
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

Merged
merged 31 commits into from Jun 5, 2012

Conversation

gdevanla
Copy link
Contributor

This version implements the initial features needed for Density operator. Using qubits as states is not fully supported in this version.

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 92d8dad
branch hash: 398108be73cac096d17d7cf48c285737fb156c67

Automatic review by SymPy Bot.

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: ./bin/test && ./bin/doctest
master hash: 92d8dad
branch hash: 398108be73cac096d17d7cf48c285737fb156c67

Automatic review by SymPy Bot.

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: fcc69a6
branch hash: 92ca868

Automatic review by SymPy Bot.

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: ./bin/test && ./bin/doctest
master hash: c4d3b5b
branch hash: 92ca868

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))
Copy link
Member

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 OuterProducts here. Just enclosing (state * Dagger(state)) in parentheses will automatically take care of that.

Copy link
Member

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 OuterProducts here.

@gdevanla
Copy link
Contributor Author

@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?

@ellisonbg
Copy link
Member

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
http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html

@Krastanov
Copy link
Member

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)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 1f3fd71
branch hash: 6d66a1b

Automatic review by SymPy Bot.

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 1f3fd71
branch hash: 6d66a1b

Automatic review by SymPy Bot.

@flacjacket
Copy link
Member

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):
Copy link
Member

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().

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: ./bin/test && ./bin/doctest
master hash: 1f3fd71
branch hash: 6d66a1b

Automatic review by SymPy Bot.

@gdevanla
Copy link
Contributor Author

@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:
https://github.com/ellisonbg/sympy/blob/densityop/examples/notebooks/density.ipynb.

@gdevanla
Copy link
Contributor Author

Fixed the doc strings and also added density.ipynb to examples/notebook.

@ellisonbg
Copy link
Member

Guru,

On Wed, May 30, 2012 at 2:31 PM, Guru Devanla
reply@reply.github.com
wrote:

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

I guess let's use examples/notebook

Also, I do not see any notebook for other quantum modules. Am I looking at the wrong place?

No, but @flacjacket wasn't there a notebook for spin examples?

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:
https://github.com/ellisonbg/sympy/blob/densityop/examples/notebooks/density.ipynb.


Reply to this email directly or view it on GitHub:
#1312 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@flacjacket
Copy link
Member

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.

@ellisonbg
Copy link
Member

OK thanks.

On Wed, May 30, 2012 at 4:05 PM, Sean Vig
reply@reply.github.com
wrote:

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.


Reply to this email directly or view it on GitHub:
#1312 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@Krastanov
Copy link
Member

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)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 1f3fd71
branch hash: 1304488

Automatic review by SymPy Bot.

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 1f3fd71
branch hash: 1304488

Automatic review by SymPy Bot.

@Krastanov
Copy link
Member

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)
Architecture: Linux (64-bit)
Cache: yes
Test command: ./bin/test && ./bin/doctest
master hash: 1f3fd71
branch hash: 1304488

Automatic review by SymPy Bot.

@flacjacket
Copy link
Member

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

@ellisonbg
Copy link
Member

Yes, I think this is a bug. @gdevania can you tackle this bug in a
separate pull request?

On Thu, May 31, 2012 at 7:59 PM, Sean Vig
reply@reply.github.com
wrote:

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)


Reply to this email directly or view it on GitHub:
#1312 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@gdevanla
Copy link
Contributor Author

gdevanla commented Jun 1, 2012

Sure, will track it and work on it on a separate PR.

@flacjacket
Copy link
Member

This looks good for a first iteration, I'll merge this in.

flacjacket added a commit that referenced this pull request Jun 5, 2012
Densityop general : very basic features for density operators
@flacjacket flacjacket merged commit 1174a6a into sympy:master Jun 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants