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

[Feature] Preserve sharing during simplification #24

Open
MilesCranmer opened this issue Apr 24, 2023 · 0 comments
Open

[Feature] Preserve sharing during simplification #24

MilesCranmer opened this issue Apr 24, 2023 · 0 comments

Comments

@MilesCranmer
Copy link
Member

Right now the simplification routines will break any shared subexpressions. This means if you have an expression:

inner = cos(x1) - 3.2
expression = exp(inner) + inner

where the same inner is used at each stage, if you go to simplify it, it will break this connection, and you will end up with:

expression = exp(cos(x1) - 3.2) + cos(x1) - 3.2

however, there is a way to get around this.

Whenever there is a shared node, it should be split into a system of equations. Then, each individual equation can be treated normally with simplification. At the end, the system of equations can be sewn together with the same structure as before, preserving shared variables.


@AlCap23 in case of interest

MilesCranmer added a commit that referenced this issue Apr 24, 2023
- Did not actually do this; it is more complicated (see #24)
@MilesCranmer MilesCranmer changed the title [Feature] Structure-preserving simplification [Feature] Preserve sharing during simplification Apr 24, 2023
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

1 participant