Lazy Replace
- Dominant language
- Python
- Stars
- 150
- Forks
- 79
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 10
Description
It would be very useful to have a lazy version of replace, which only gets applied when the expression tree is traversed.
**Example:**
Say I have an expression `expr` which contains a `ufl.ConstantValue` named `c` as a parameter. If I want to have the derivative of `expr` wrt. `c` I can do so by creating a `ufl.Coefficient` named `f` and doing:
```
ufl.replace(expr, {c: f})
ufl.derivative(expr, f)
```
However this traverses the expression tree twice.
(This issue would also be fixed by implementing derivative wrt. `ufl.ConstantValue`, but there are more examples where this is desirable). This came up as a discussion point when reviewing a recent Firedrake PR. Tagging @dham .
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.