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

Stop auto-flattening #69

Closed
inducer opened this issue Oct 29, 2021 · 4 comments
Closed

Stop auto-flattening #69

inducer opened this issue Oct 29, 2021 · 4 comments

Comments

@inducer
Copy link
Owner

inducer commented Oct 29, 2021

FP arithmetic isn't associative, after all.

@kaushikcfd
Copy link
Collaborator

I think the auto-flattening is just fine. See

>> import pymbolic.primitives as p
>>> a = p.Variable("a")
>>> b = p.Variable("b")
>>> c = p.Variable("c")

>>> (a * b) * c
Product((Variable('a'), Variable('b'), Variable('c')))  # flattening was legal and hence was done

>>> a * (b * c)
Product((Variable('a'), Product((Variable('b'), Variable('c')))))  # flattening wouldn't be legal and was avoided.

@inducer
Copy link
Owner Author

inducer commented Nov 20, 2022

12569d5 removed the flattening in IdentityMapper.

@inducer
Copy link
Owner Author

inducer commented Nov 20, 2022

As for flatten-upon-creation, we should document that the intended eval order is from left to right, so that the flattening behavior on operator overload is fine, as @kaushikcfd states.

@inducer
Copy link
Owner Author

inducer commented Nov 7, 2024

#152 removed the last of the auto-flattening AFAIK.

@inducer inducer closed this as completed Nov 7, 2024
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

No branches or pull requests

2 participants