AlgebraicJulia / DiagrammaticEquations.jl

MIT License
12 stars 1 forks source link

Bundling Operators #40

Open lukem12345 opened 1 year ago

lukem12345 commented 1 year ago

When a physicist writes down an equation, such as the Halfar Equation:

∂ₜ(h) == Γ*∘(⋆,d,⋆)(d(h) ∧ mag(d(h))^(n-1) ∧ h^(n+2))

, they are forced, by virtue of this linear syntax, to write d(H) many times.

By switching to a diagrammatic syntax, we can avoid this restriction, and write a single arrow which applies d to H.

In our current compiler from linear to diagrammatic syntax, we do not perform this optimization. This was fine when matrix-vector multiplication was not the bottleneck of our simulations, and is in some way "truer" to the way in which the equations were input, but computational efficiency now demands that this is a higher priority. These duplicate paths are also redundant from a language standpoint, as noted previously.

So, we should write some operation called bundle that removes redundant paths. A cobundle operation will likely be useful for later compiler passes.

We note that in general, compilation via Decapode editing will be an optimization problem where the constraints are e.g. number of matrices, number of variables that need to be dynamically allocated, and so on.