-
Notifications
You must be signed in to change notification settings - Fork 1
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
Better support for using Operator Aliases #35
Comments
The way I would do this without additional parsing code would be to deduce the definition of vector calculus operators using e.g. oscillator = @decapode begin
X::Form0
V::Form0
∂ₜ(X) == V
∂ₜ(V) == -k(X) + div(V)
end
osc2D = infer_types!(resolve_overloads!(oscillator))
@test osc2D == @decapode begin
X::Form0
V::Form0
∂ₜ(X) == V
∂ₜ(V) == -k(X) + div_0(V)
end |> infer_types! |> resolve_overloads!
, where I suppose that this would not work if in one 2D Decapode, the result of |
I think it is probably fine to both update the parser code to allow definitions of new operators as composites of operators and to add a We could then use a |
Although PR AlgebraicJulia/Decapodes.jl#142 addresses some of these concerns, it does not One can consider that PR as providing reasonable defaults for Further, carrying around these operators throughout the lifetime of a Decapode object will best be handled via nested Decapodes. This will likely require Decapodes which contain
Going off of the selection provided by the "Punctuation" section of the manual, I think that |
I like single equal sign for operator aliases like |
It sounds like this issue is about specifying a DSL for what is done when we “open operators” in Decapodes https://github.com/AlgebraicJulia/Decapodes.jl/blob/55ff02b26497ddc0122a9fbd8b6f0e89a7047ebc/src/operators.jl#L160 Is there anything in the AlgebraicJulia ecosystem that already has a DSL that parses little functions into a data structure that is easy to iterate over? This sounds like a directed wiring diagram. |
An attempt at this feature was made a long time ago with AlgebraicRewriting, but that failed due to reasons specified here. But since these sorts of operations apparently only require editing the inner parts of an operator, then an AR approach may be feasible. We can implement this feature by calling @decapode on the LHS for the “L” of a rule, @decapode on the RHS for the “R” of a rule, and specify “I” to be the variables of the same name (I.e. the outer parts) |
Or, we could go the |
The goal here is to use familiar
Div, Grad, Curl, Lapl
operators in their familiar role in vector calculus. What support do we need in the Decapodes language for that? Probably and alias operator like:=
Then we can update all the docs examples to use these operators when appropriate. We can't uniformly introduce a exterior calculus definitions of div, grad, curl because of things like how gradient of Pressure should be
dP
but gradient of concentration should be⋆dC
. Unless we can dispatch on expected return type in the type inference code, I think that we can just introduce a manual aliasing operator into the decapode macro, and then have local aliases in each example.The text was updated successfully, but these errors were encountered: