Do not simplify in overloaded operators, type mappers - #152
Merged
Conversation
1 task
inducer
force-pushed
the
no-simp-in-operators
branch
from
October 7, 2024 18:14
c8e444f to
4190844
Compare
inducer
force-pushed
the
no-simp-in-operators
branch
from
October 15, 2024 15:23
4190844 to
e194173
Compare
inducer
force-pushed
the
no-simp-in-operators
branch
3 times, most recently
from
October 21, 2024 02:54
0c76ffa to
a787ba3
Compare
inducer
force-pushed
the
no-simp-in-operators
branch
2 times, most recently
from
October 21, 2024 03:04
2c129f2 to
f41f938
Compare
inducer
commented
Oct 21, 2024
alexfikl
reviewed
Oct 21, 2024
Owner
Author
They sure are. I'm trying to figure out whether the damage can be controlled or whether we need to do this in a more piecemeal fashion. |
inducer
force-pushed
the
no-simp-in-operators
branch
2 times, most recently
from
October 21, 2024 17:31
f77d984 to
0d03277
Compare
inducer
force-pushed
the
no-simp-in-operators
branch
from
October 21, 2024 22:13
0d03277 to
de7caf5
Compare
inducer
force-pushed
the
no-simp-in-operators
branch
from
October 22, 2024 15:12
de7caf5 to
e355f08
Compare
Collaborator
|
diff --git a/pymbolic/geometric_algebra/__init__.py b/pymbolic/geometric_algebra/__init__.py
index fbc7e30..4291b74 100644
--- a/pymbolic/geometric_algebra/__init__.py
+++ b/pymbolic/geometric_algebra/__init__.py
@@ -526,6 +526,7 @@ class MultiVector(Generic[CoeffT]):
"""
space: Space
+ mapper_method = "map_multivector"
# {{{ construction
diff --git a/pymbolic/mapper/coefficient.py b/pymbolic/mapper/coefficient.py
index 99516f0..b09b4f6 100644
--- a/pymbolic/mapper/coefficient.py
+++ b/pymbolic/mapper/coefficient.py
@@ -100,6 +100,9 @@ class CoefficientCollector(Mapper):
return {1: expr}
def map_constant(self, expr):
+ if expr == 0:
+ return {}
+
return {1: expr}
def map_algebraic_leaf(self, expr):
EDIT: Well, that was wrong, there are other errors too :( |
inducer
force-pushed
the
no-simp-in-operators
branch
from
October 28, 2024 22:07
e355f08 to
802b5aa
Compare
inducer
force-pushed
the
no-simp-in-operators
branch
2 times, most recently
from
November 3, 2024 21:17
d776b9b to
543e1b1
Compare
inducer
force-pushed
the
no-simp-in-operators
branch
3 times, most recently
from
November 6, 2024 21:36
6964471 to
b4b87cb
Compare
Co-authored-by: Alexandru Fikl <alexfikl@gmail.com>
Co-authored-by: Alexandru Fikl <alexfikl@gmail.com>
inducer
force-pushed
the
no-simp-in-operators
branch
from
November 6, 2024 21:53
c9dfd23 to
a48a937
Compare
inducer
marked this pull request as ready for review
November 6, 2024 21:54
inducer
force-pushed
the
no-simp-in-operators
branch
from
November 6, 2024 22:08
a48a937 to
c76853d
Compare
inducer
enabled auto-merge (rebase)
November 6, 2024 22:09
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11.
Closes #149.
What finally tipped the balance is that the overload-y operators are hard to precisely type, which made typing various downstream user packages unnecessarily hard.
loopycc @kaushikcfd