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

Match doesn't respect matrix non-commutativity #17172

anpandey opened this issue Jul 10, 2019 · 0 comments


Copy link

commented Jul 10, 2019

match doesn't obey the commutativity of matrix expressions when matching scalars between two expressions. As a demonstration:

>>> from import N
>>> A, B, C, D = map(lambda x: MatrixSymbol(x, N, N), ['A', 'B', 'C', 'D'])
>>> w = Wild('w')
>>> a, b = symbols('a b')
>>> e1 = a * b * (A * B * C * D)
>>> e2 = w * (D * C * B * A)
>>> e1.match(e2)
{w_: a*b}

e1.match(e1) should be None, since the associated matrix multiplications are in a different order (and so not indentical).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.