AlgebraicJulia / AlgebraicJulia/DiagrammaticEquations.jl
Infer Constants From Computation Graph Analysis
- Dominant language
- Julia
- Stars
- 20
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
Currently, users can tag forms as constants using the `::Constant` tag in the `@decapode` eDSL. This is a valuable for tools such as sensitivity analysis and time stepping algorithms we outsource to DiffEq.jl that perform error analysis.
However, with our current typing scheme, tagging a quantity as Constant precludes it from being tagged as a particular differential form, which interferes with type inference. Workarounds have taken place in Decapodes by [setting Constants to the `infer` type and running the type inference algorithm after accessor code from the `p` named tuple is emitted](https://github.com/AlgebraicJulia/Decapodes.jl/blob/f66011d1948171c861d34470d22acafd97656a59/src/simulation.jl#L727). Workarounds have also appeared as [type inference rules](https://github.com/AlgebraicJulia/DiagrammaticEquations.jl/blob/55d2972c175ad704b4991d351e2ee2e0117680f4/src/deca/deca_acset.jl#L83) which consider Constants directly where possible.
While these workarounds have allowed for some performance gains, we should ultimately infer which variables are Constants by performing program analysis on the Decapode object. This allows for type inference to execute without being locally blocked by inconvenient tags which shadow valuable information on the degree and primality of differential forms.
So, we should provide an algorithm that determines constants by analyzing the Decapode object. Note that some of these constants may in fact be parameters (functions of time). So, we should allow for the `p` named tuple to be passed either static values or functions of `t`, or provide a means of specifying this some other way.
This is closely related to the issue of constant propagation mentioned in issue [51](https://github.com/AlgebraicJulia/DiagrammaticEquations.jl/issues/51).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.