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

Tr printing, Tr partial trace #1396

Merged
merged 14 commits into from Jul 16, 2012

Conversation

Projects
None yet
10 participants
@gdevanla
Contributor

gdevanla commented Jul 1, 2012

This PR implements printing operations for Tr operators and partial trace operations. Also cycle permutes are fixed for consistency. Some changes added to Density class to enable partial trace operations. Also, new set of Notebook examples have been provided.

@ellisonbg , @flacjacket, could you please review the design.

@gdevanla

This comment has been minimized.

Show comment
Hide comment
@gdevanla

gdevanla Jul 1, 2012

Contributor

The printing currently does not print out the indices that are provided as part of object creation. We need to figure out a way to output this along with all other arguments to Tr. Should it just be a [list] displayed after all other arguments to Tr or some super-script/subscript?

Contributor

gdevanla commented Jul 1, 2012

The printing currently does not print out the indices that are provided as part of object creation. We need to figure out a way to output this along with all other arguments to Tr. Should it just be a [list] displayed after all other arguments to Tr or some super-script/subscript?

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYm5seDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: d136cb7
branch hash: 11bb365255ed727e8bbea2e192c2a4c7235917a8

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYm5seDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: d136cb7
branch hash: 11bb365255ed727e8bbea2e192c2a4c7235917a8

Automatic review by SymPy Bot.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYxYseDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: d136cb7
branch hash: 11bb365255ed727e8bbea2e192c2a4c7235917a8

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYxYseDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: d136cb7
branch hash: 11bb365255ed727e8bbea2e192c2a4c7235917a8

Automatic review by SymPy Bot.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYqJMeDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: d136cb7
branch hash: 11bb365255ed727e8bbea2e192c2a4c7235917a8

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYqJMeDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: d136cb7
branch hash: 11bb365255ed727e8bbea2e192c2a4c7235917a8

Automatic review by SymPy Bot.

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Jul 2, 2012

This pull request fails (merged 11bb3652 into d136cb7).

travisbot commented Jul 2, 2012

This pull request fails (merged 11bb3652 into d136cb7).

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Jul 2, 2012

This pull request fails (merged ed384052 into d136cb7).

travisbot commented Jul 2, 2012

This pull request fails (merged ed384052 into d136cb7).

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Jul 2, 2012

This pull request fails (merged 88eed960 into d136cb7).

travisbot commented Jul 2, 2012

This pull request fails (merged 88eed960 into d136cb7).

@certik

This comment has been minimized.

Show comment
Hide comment
@certik

certik Jul 2, 2012

Member

@gdevanla, there are failures caused by your pull request:

________________________________________________________________________________
2575____________ sympy/physics/quantum/tests/test_density.py:test_doit _____________
2576  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/tests/test_density.py", line 49, in test_doit
2577    assert d.doit() == (1.0*A*C*Dagger(C)*Dagger(A) +
2578  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/density.py", line 167, in doit
2579    for arg in itertools.product(state.args, repeat=2):
2580AttributeError: 'module' object has no attribute 'product'
2581________________________________________________________________________________
2582______ sympy/physics/quantum/tests/test_tensorproduct.py:test_eval_trace _______
2583  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/tests/test_tensorproduct.py", line 94, in test_eval_trace
2584    assert t.doit() == ( 1.0*Tr(A*Dagger(A))*Tr(B*Dagger(B)) +
2585  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/core/trace.py", line 146, in doit
2586    return self.args[0]._eval_trace(indices=self.args[1])
2587  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/density.py", line 193, in _eval_trace
2588    return Tr(self.doit(), indices).doit()
2589  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/density.py", line 167, in doit
2590    for arg in itertools.product(state.args, repeat=2):
2591AttributeError: 'module' object has no attribute 'product'

Only the last failure was already in master, and the pull request #1398 fixes that one.

Member

certik commented Jul 2, 2012

@gdevanla, there are failures caused by your pull request:

________________________________________________________________________________
2575____________ sympy/physics/quantum/tests/test_density.py:test_doit _____________
2576  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/tests/test_density.py", line 49, in test_doit
2577    assert d.doit() == (1.0*A*C*Dagger(C)*Dagger(A) +
2578  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/density.py", line 167, in doit
2579    for arg in itertools.product(state.args, repeat=2):
2580AttributeError: 'module' object has no attribute 'product'
2581________________________________________________________________________________
2582______ sympy/physics/quantum/tests/test_tensorproduct.py:test_eval_trace _______
2583  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/tests/test_tensorproduct.py", line 94, in test_eval_trace
2584    assert t.doit() == ( 1.0*Tr(A*Dagger(A))*Tr(B*Dagger(B)) +
2585  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/core/trace.py", line 146, in doit
2586    return self.args[0]._eval_trace(indices=self.args[1])
2587  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/density.py", line 193, in _eval_trace
2588    return Tr(self.doit(), indices).doit()
2589  File "/home/vagrant/virtualenv/python2.5/lib/python2.5/site-packages/sympy/physics/quantum/density.py", line 167, in doit
2590    for arg in itertools.product(state.args, repeat=2):
2591AttributeError: 'module' object has no attribute 'product'

Only the last failure was already in master, and the pull request #1398 fixes that one.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYnJseDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 9ba3cb3
branch hash: 88eed960ae243f780460bfa9d3bccb7cad83260f

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYnJseDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 9ba3cb3
branch hash: 88eed960ae243f780460bfa9d3bccb7cad83260f

Automatic review by SymPy Bot.

@gdevanla

This comment has been minimized.

Show comment
Hide comment
@gdevanla

gdevanla Jul 2, 2012

Contributor

Ok, the error message is since itertools.product is not supported in Python 2.5 Will fix that soon.

Contributor

gdevanla commented Jul 2, 2012

Ok, the error message is since itertools.product is not supported in Python 2.5 Will fix that soon.

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Jul 2, 2012

Member

There's probably a replacement in the compatibility file.

Member

asmeurer commented Jul 2, 2012

There's probably a replacement in the compatibility file.

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Jul 2, 2012

Member

I'm curious why the trace stuff is in the core.

Member

asmeurer commented Jul 2, 2012

I'm curious why the trace stuff is in the core.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY8fsdDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 9ba3cb3
branch hash: 88eed960ae243f780460bfa9d3bccb7cad83260f

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY8fsdDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 9ba3cb3
branch hash: 88eed960ae243f780460bfa9d3bccb7cad83260f

Automatic review by SymPy Bot.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYlekeDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: 88eed960ae243f780460bfa9d3bccb7cad83260f

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYlekeDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: 88eed960ae243f780460bfa9d3bccb7cad83260f

Automatic review by SymPy Bot.

@gdevanla

This comment has been minimized.

Show comment
Hide comment
@gdevanla

gdevanla Jul 2, 2012

Contributor

@asmeurer The Tr module implemented currently is generic and does not have to belong to the physics module. The module in turn calls _eval_trace() methods in objects passed as 'args' to Tr. For now, yes _eval_trace() methods are defined for objects under physics/quantum module, but that need not be true always.

Contributor

gdevanla commented Jul 2, 2012

@asmeurer The Tr module implemented currently is generic and does not have to belong to the physics module. The module in turn calls _eval_trace() methods in objects passed as 'args' to Tr. For now, yes _eval_trace() methods are defined for objects under physics/quantum module, but that need not be true always.

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Jul 2, 2012

This pull request passes (merged b01f7e5 into 0930232).

travisbot commented Jul 2, 2012

This pull request passes (merged b01f7e5 into 0930232).

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY8_sdDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: b01f7e5

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY8_sdDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: b01f7e5

Automatic review by SymPy Bot.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYruwdDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: b01f7e5

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYruwdDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: b01f7e5

Automatic review by SymPy Bot.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 2, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY2NwdDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: b01f7e5

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 2, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY2NwdDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 0930232
branch hash: b01f7e5

Automatic review by SymPy Bot.

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Jul 2, 2012

Member

I agree it is general enough to not be in the physics module, but that doesn't mean it belongs in the core. Only very basic stuff that is used by everything should be in the core. Trace I think belongs somewhere else.

Member

asmeurer commented Jul 2, 2012

I agree it is general enough to not be in the physics module, but that doesn't mean it belongs in the core. Only very basic stuff that is used by everything should be in the core. Trace I think belongs somewhere else.

@gdevanla

This comment has been minimized.

Show comment
Hide comment
@gdevanla

gdevanla Jul 3, 2012

Contributor

Yes, one could say it is not a core operation. Do you have any suggestion on where it should go?

@ellisonbg Do you have any suggestion, based how the Tr operator would be used in the future?

Contributor

gdevanla commented Jul 3, 2012

Yes, one could say it is not a core operation. Do you have any suggestion on where it should go?

@ellisonbg Do you have any suggestion, based how the Tr operator would be used in the future?

@flacjacket

This comment has been minimized.

Show comment
Hide comment
@flacjacket

flacjacket Jul 3, 2012

Member

functions.elementary might be a good place for it.

Member

flacjacket commented Jul 3, 2012

functions.elementary might be a good place for it.

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Jul 3, 2012

Member

I'd put it somewhere other than elementary. That's supposed to be only elementary functions. See http://code.google.com/p/sympy/issues/detail?id=2149.

Member

asmeurer commented Jul 3, 2012

I'd put it somewhere other than elementary. That's supposed to be only elementary functions. See http://code.google.com/p/sympy/issues/detail?id=2149.

"t1 = TensorProduct(A,B,C)",
"",
"d = Density([t1, 1.0])",
"d.doit()",

This comment has been minimized.

@flacjacket

flacjacket Jul 6, 2012

Member

To display this result, you'll either need to split the cell here or use display() from IPython.core.display

@flacjacket

flacjacket Jul 6, 2012

Member

To display this result, you'll either need to split the cell here or use display() from IPython.core.display

@flacjacket

This comment has been minimized.

Show comment
Hide comment
@flacjacket

flacjacket Jul 6, 2012

Member

The rest of the changes seem alright to me, once we figure out a better place for trace to go.

Member

flacjacket commented Jul 6, 2012

The rest of the changes seem alright to me, once we figure out a better place for trace to go.

@gdevanla

This comment has been minimized.

Show comment
Hide comment
@gdevanla

gdevanla Jul 9, 2012

Contributor

I have other changes siting in the follow up branch. I will move the discussion on where Tr should go to the mailing list. I can submit a separate PR with just the re-factored changes. Will that work?

Alternatively, the one place I can think of after looking at existing folder structures is at : sympy/matrices/expressions. This folder already has modules for matadd, matmul, matpow, inverse and transpose.

Contributor

gdevanla commented Jul 9, 2012

I have other changes siting in the follow up branch. I will move the discussion on where Tr should go to the mailing list. I can submit a separate PR with just the re-factored changes. Will that work?

Alternatively, the one place I can think of after looking at existing folder structures is at : sympy/matrices/expressions. This folder already has modules for matadd, matmul, matpow, inverse and transpose.

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Jul 9, 2012

This pull request passes (merged e1a3a01 into 0930232).

travisbot commented Jul 9, 2012

This pull request passes (merged e1a3a01 into 0930232).

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 9, 2012

Member

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY6YMeDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 424160a
branch hash: e1a3a01

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 9, 2012

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY6YMeDA

Interpreter: /opt/pym32/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: 424160a
branch hash: e1a3a01

Automatic review by SymPy Bot.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 9, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY6oMeDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 424160a
branch hash: e1a3a01

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 9, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY6oMeDA

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 424160a
branch hash: e1a3a01

Automatic review by SymPy Bot.

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 9, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYuewdDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 424160a
branch hash: e1a3a01

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 9, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYuewdDA

Interpreter: /usr/bin/python3 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 424160a
branch hash: e1a3a01

Automatic review by SymPy Bot.

@flacjacket

This comment has been minimized.

Show comment
Hide comment
@flacjacket

flacjacket Jul 12, 2012

Member

Guru, have you sent a message to the list? I feel like since the damage was done and trace.py was put in core in the last PR, it should be alright to merge this and fix it in a later PR when a good spot is found. @asmeurer: what do you think about that?

@ellisonbg have you taken a look at this yet?

Member

flacjacket commented Jul 12, 2012

Guru, have you sent a message to the list? I feel like since the damage was done and trace.py was put in core in the last PR, it should be alright to merge this and fix it in a later PR when a good spot is found. @asmeurer: what do you think about that?

@ellisonbg have you taken a look at this yet?

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Jul 12, 2012

Member

That should be fine.

Member

asmeurer commented Jul 12, 2012

That should be fine.

@gdevanla

This comment has been minimized.

Show comment
Hide comment
@gdevanla

gdevanla Jul 12, 2012

Contributor

Ok, once @ellisonbg is fine with these changes, this can go.

I will start the mailing thread to discuss the where the Tr module should go.

Contributor

gdevanla commented Jul 12, 2012

Ok, once @ellisonbg is fine with these changes, this can go.

I will start the mailing thread to discuss the where the Tr module should go.

@ellisonbg

This comment has been minimized.

Show comment
Hide comment
@ellisonbg

ellisonbg Jul 12, 2012

Member

Hi guys, sorry I had been out of it. We just moved and I have been
offline for almost two weeks. I will look this over today so we can
get it merged.

On Wed, Jul 11, 2012 at 8:28 PM, Guru Devanla
reply@reply.github.com
wrote:

Ok, once @ellisonbg is fine with these changes, this can go.

I will start the mailing thread to discuss the where the Tr module should go.


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

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

Member

ellisonbg commented Jul 12, 2012

Hi guys, sorry I had been out of it. We just moved and I have been
offline for almost two weeks. I will look this over today so we can
get it merged.

On Wed, Jul 11, 2012 at 8:28 PM, Guru Devanla
reply@reply.github.com
wrote:

Ok, once @ellisonbg is fine with these changes, this can go.

I will start the mailing thread to discuss the where the Tr module should go.


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

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

@ellisonbg

This comment has been minimized.

Show comment
Hide comment
@ellisonbg

ellisonbg Jul 12, 2012

Member

I think this looks good. I will give some feedback on individual lines. My broad comment is that all your tests and notebook examples use symbols instead of bras/kets. Please include some tests with actual bras/kets and use bras/kets in the notebook examples.

Member

ellisonbg commented Jul 12, 2012

I think this looks good. I will give some feedback on individual lines. My broad comment is that all your tests and notebook examples use symbols instead of bras/kets. Please include some tests with actual bras/kets and use bras/kets in the notebook examples.

Show outdated Hide outdated sympy/core/trace.py
#TODO: Review if the permute method is needed
# and if it needs to return a new instance
#def permute(self, pos):

This comment has been minimized.

@ellisonbg

ellisonbg Jul 12, 2012

Member

I would like to have the permute method and it should return a new instance.

@ellisonbg

ellisonbg Jul 12, 2012

Member

I would like to have the permute method and it should return a new instance.

This comment has been minimized.

@gdevanla

gdevanla Jul 13, 2012

Contributor

@ellisonbg Actually, I had started a discussion on this on the mailing list. http://bit.ly/M7D9wF

I can work on this and see how we can achieve this. I will add to my TODO. In the subsequent PR, I will update this method based on how we decide to do it.

@gdevanla

gdevanla Jul 13, 2012

Contributor

@ellisonbg Actually, I had started a discussion on this on the mailing list. http://bit.ly/M7D9wF

I can work on this and see how we can achieve this. I will add to my TODO. In the subsequent PR, I will update this method based on how we decide to do it.

if (isinstance(state, Add)):
for arg in product(state.args, repeat=2):
terms.append(prob *
self._generate_outer_prod(arg[0], arg[1]))

This comment has been minimized.

@ellisonbg

ellisonbg Jul 12, 2012

Member

The _generate_outer_product method should be called _generate_tensor_product to be consistent with our naming. Also, can you summarize what this method does and why it is needed?

@ellisonbg

ellisonbg Jul 12, 2012

Member

The _generate_outer_product method should be called _generate_tensor_product to be consistent with our naming. Also, can you summarize what this method does and why it is needed?

This comment has been minimized.

@gdevanla

gdevanla Jul 13, 2012

Contributor

@ellisonbg I am guessing you were commenting on the _generate_outer_prod in tensor_product. I plan to remove that function.

The function here is just to reuse code needed within the for and if constructs. Am I in sync?

@gdevanla

gdevanla Jul 13, 2012

Contributor

@ellisonbg I am guessing you were commenting on the _generate_outer_prod in tensor_product. I plan to remove that function.

The function here is just to reuse code needed within the for and if constructs. Am I in sync?

@ellisonbg

This comment has been minimized.

Show comment
Hide comment
@ellisonbg

ellisonbg Jul 12, 2012

Member

This can come in a later PR, but I would like to see some tests with Traces of density matrices of tensor products of spin states to make sure the logic works when the representations are matrices.

Member

ellisonbg commented Jul 12, 2012

This can come in a later PR, but I would like to see some tests with Traces of density matrices of tensor products of spin states to make sure the logic works when the representations are matrices.

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Jul 13, 2012

This pull request fails (merged bcd53e1 into 0930232).

travisbot commented Jul 13, 2012

This pull request fails (merged bcd53e1 into 0930232).

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 14, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test command: setup.py test
master hash: 387547b
branch hash: bcd53e1

Interpreter 1: 🔴 There were test failures.

Interpreter: /usr/local/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYya8fDA

Interpreter 2: 🔴 There were test failures.

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY8ZwgDA

Interpreter 3: 🔴 There were test failures.

Interpreter: /usr/bin/python3.2 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY7vUfDA

Build HTML Docs: 🔴 There were test failures.

Docs build command: make html-errors
Sphinx version: 1.1.3

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYm-YfDA

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 14, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test command: setup.py test
master hash: 387547b
branch hash: bcd53e1

Interpreter 1: 🔴 There were test failures.

Interpreter: /usr/local/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYya8fDA

Interpreter 2: 🔴 There were test failures.

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY8ZwgDA

Interpreter 3: 🔴 There were test failures.

Interpreter: /usr/bin/python3.2 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY7vUfDA

Build HTML Docs: 🔴 There were test failures.

Docs build command: make html-errors
Sphinx version: 1.1.3

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYm-YfDA

Automatic review by SymPy Bot.

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Jul 14, 2012

This pull request fails (merged 4f3405d into 0930232).

travisbot commented Jul 14, 2012

This pull request fails (merged 4f3405d into 0930232).

@Krastanov

This comment has been minimized.

Show comment
Hide comment
@Krastanov

Krastanov Jul 14, 2012

Member

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test command: setup.py test
master hash: 0abed0f
branch hash: 4f3405d

Interpreter 1: 🔴 There were test failures.

Interpreter: /usr/local/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYn-YfDA

Interpreter 2: 🔴 There were test failures.

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYk_EeDA

Interpreter 3: 🔴 There were test failures.

Interpreter: /usr/bin/python3.2 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYkJUgDA

Build HTML Docs: 🔴 There were test failures.

Docs build command: make html-errors
Sphinx version: 1.1.3

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYzq8fDA

Automatic review by SymPy Bot.

Member

Krastanov commented Jul 14, 2012

SymPy Bot Summary: 🔴 There were test failures.

@gdevanla: Please fix the test failures.

Test command: setup.py test
master hash: 0abed0f
branch hash: 4f3405d

Interpreter 1: 🔴 There were test failures.

Interpreter: /usr/local/bin/python2.5 (2.5.6-final-0)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYn-YfDA

Interpreter 2: 🔴 There were test failures.

Interpreter: /usr/bin/python2.7 (2.7.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYk_EeDA

Interpreter 3: 🔴 There were test failures.

Interpreter: /usr/bin/python3.2 (3.2.3-candidate-2)
Architecture: Linux (64-bit)
Cache: yes

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYkJUgDA

Build HTML Docs: 🔴 There were test failures.

Docs build command: make html-errors
Sphinx version: 1.1.3

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYzq8fDA

Automatic review by SymPy Bot.

@jrioux

This comment has been minimized.

Show comment
Hide comment
@jrioux

jrioux Jul 15, 2012

Member

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY66cfDA

Interpreter: /usr/bin/python (2.7.0-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: fb35324
branch hash: 4f3405d

Automatic review by SymPy Bot.

Member

jrioux commented Jul 15, 2012

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY66cfDA

Interpreter: /usr/bin/python (2.7.0-final-0)
Architecture: Linux (32-bit)
Cache: yes
Test command: setup.py test
master hash: fb35324
branch hash: 4f3405d

Automatic review by SymPy Bot.

@ellisonbg

This comment has been minimized.

Show comment
Hide comment
@ellisonbg

ellisonbg Jul 16, 2012

Member

This is ready for merge, and the latest test run seems to pass. But the previous one had lots of failures that seem unrelated to this PR. Do anyone understand those failures?

Member

ellisonbg commented Jul 16, 2012

This is ready for merge, and the latest test run seems to pass. But the previous one had lots of failures that seem unrelated to this PR. Do anyone understand those failures?

@jrioux

This comment has been minimized.

Show comment
Hide comment
@jrioux

jrioux Jul 16, 2012

Member

There was a failure in test_gruntz in the master branch, which has since been fixed. There are still failures related to hash randomization in master, which makes it hard to evaluate whether any failure is introduced by this pull request or not. Judging by the latest test results here, I would say it is safe to merge this pull request.

Member

jrioux commented Jul 16, 2012

There was a failure in test_gruntz in the master branch, which has since been fixed. There are still failures related to hash randomization in master, which makes it hard to evaluate whether any failure is introduced by this pull request or not. Judging by the latest test results here, I would say it is safe to merge this pull request.

ellisonbg added a commit that referenced this pull request Jul 16, 2012

@ellisonbg ellisonbg merged commit b33c1ed into sympy:master Jul 16, 2012

@amakelov

This comment has been minimized.

Show comment
Hide comment
@amakelov

amakelov Jul 16, 2012

I'm not sure if this is relevant, but a recent run of travisbot on one of my PRs brought up an error in test_density.py. Here's the pull request: #1406 and the error report: http://travis-ci.org/#!/sympy/sympy/builds/1879684

amakelov commented Jul 16, 2012

I'm not sure if this is relevant, but a recent run of travisbot on one of my PRs brought up an error in test_density.py. Here's the pull request: #1406 and the error report: http://travis-ci.org/#!/sympy/sympy/builds/1879684

#Density operators with spin states
tp1 = TensorProduct(JzKet(1,1), JzKet(1,-1))
tp2 = TensorProduct(JzKet(1,-1/2), JzKet(1,-1/2))

This comment has been minimized.

@jrioux

jrioux Jul 16, 2012

Member

To avoid the python 3 problem this could be written tp2 = TensorProduct(JzKet(1,-S(1)/2), JzKet(1,-S(1)/2))

@jrioux

jrioux Jul 16, 2012

Member

To avoid the python 3 problem this could be written tp2 = TensorProduct(JzKet(1,-S(1)/2), JzKet(1,-S(1)/2))

This comment has been minimized.

@asmeurer

asmeurer Jul 16, 2012

Member

Note that in Python 2, this is giving 0, because you aren't using future division. Try adding from __future__ import division to the top of file.

I guess the question is if you want this to work with floating point half numbers.

@asmeurer

asmeurer Jul 16, 2012

Member

Note that in Python 2, this is giving 0, because you aren't using future division. Try adding from __future__ import division to the top of file.

I guess the question is if you want this to work with floating point half numbers.

@smichr

This comment has been minimized.

Show comment
Hide comment
@smichr

smichr Jul 17, 2012

Member

The problem (according to the error message) is that j and m are not both integer (or both half-integer). The message could be rewritten from "Both j and m must be integer or half-integer" to "j and m must both be integer or both be half-integer"

Member

smichr commented Jul 17, 2012

The problem (according to the error message) is that j and m are not both integer (or both half-integer). The message could be rewritten from "Both j and m must be integer or half-integer" to "j and m must both be integer or both be half-integer"

@gdevanla

This comment has been minimized.

Show comment
Hide comment
@gdevanla

gdevanla Jul 17, 2012

Contributor

I submitted a follow-up pull request to address this issue at #1425

Contributor

gdevanla commented Jul 17, 2012

I submitted a follow-up pull request to address this issue at #1425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment