-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Addition of Traces of MutableDenseMatrix #9072
Conversation
This fix is wrong. mutableDenseMatrix shouldn't be hashable, since it's mutable. The fix is to call sympify in the constrictor of Trace, which will convert a mutable matrix to an immutable one. |
I am not sure what that means. Does it mean that |
Yes |
Yes I think so. Although I'm entirely clear on This will need a test. (if this goes in first, we can always fix up the XFAIL in #9063). |
(Or if #9063 goes first, drop the XAIL here.) |
You should probably do |
@@ -53,6 +53,11 @@ def test_Trace_doit(): | |||
assert Trace(q).doit(deep=False).arg == q | |||
|
|||
|
|||
def test_Trace_MutableMatrix_plus(): | |||
X = Matrix([[1, 2], [3, 4]]) |
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.
This should reference #9043, either in the test name or in a comment.
XFAIL is for tests that should pass but do not. Your test does pass. I think this should be Then I'm +1. |
9b51d15
to
e9158ba
Compare
Done! I am glad I know how to do this now. |
@@ -53,6 +53,12 @@ def test_Trace_doit(): | |||
assert Trace(q).doit(deep=False).arg == q | |||
|
|||
|
|||
def test_Trace_MutableMatrix_plus(): | |||
# FIXME: Issue #9043 |
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.
No "FIXME" b/c you have fixed it (?)
Put "Fixes #9043" in the commit message so it will close the bug automatically. |
14ec843
to
5f5cd77
Compare
Please pick one:
or
|
Addition of Trace(X) returned TypeError when X was MutableDenseMatrix. This is because MutableDenseMatrix isn't hashable. This is fixed by calling sympify in the constrictor of Trace, which will convert a mutable matrix to an immutable one. Further adding a test for this. Fixes sympy#9043
5618d55
to
750f53f
Compare
+1. I will merge in around 24 hours. |
Addition of Traces of MutableDenseMatrix
Addition of Trace(X) returned TypeError when X was
MutableDenseMatrix. This was because MutableDenseMatrix
wasn't hashable. This has been fixed by introducing
hashable_content function for Trace. This function
returns sympify(X) which is hashable and hence making
MutableDenseMatrix hashable.
Fixes: #9043