Skip to content

Provide Collection of Rewrite Rules #75

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Provide Collection of Rewrite Rules #75

wants to merge 2 commits into from

Conversation

lukem12345
Copy link
Member

@lukem12345 lukem12345 commented Sep 13, 2024

See AlgebraicJulia/Decapodes.jl#252

This branch may be affected by #74

@decapode begin
(X,y)::Form1
y == ∘(d,δ)(X) + ∘(δ,d)(X)
end),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like overkill to use a whole decapode for this since it will always be a single LHS, RHS pair. Also the SymbolicUtils stuff will be able to use the @rule macro for defining rules.

Copy link
Member Author

@lukem12345 lukem12345 Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to replace operations which take place directly on Decapodes. In this case, this Decapode replaces this hand-written sub-Decapode insertion: https://github.com/AlgebraicJulia/Decapodes.jl/blob/main/src/operators.jl#L320

function add_Lie_2D!(::Type{Val{1}}, d::SummationDecapode, proj1_Lie::Int, proj2_Lie::Int, res_Lie::Int)

  ## Outputs result of dual derivative Dual1 to Dual2
  dual_d_1_tgt = add_part!(d, :Var, type=:infer, name=nothing)
  add_part!(d, :Op1, src=proj2_Lie, tgt=dual_d_1_tgt, op1=:d)

  ## Takes interior product of Primal1 and Dual2 to Dual1
  inter_product_2_res = add_part!(d, :Var, type=:infer, name=nothing)
  add_Inter_Prod_2D!(Val{2}, d, dual_d_1_tgt, proj1_Lie, inter_product_2_res)

  ## Takes interior product of Primal1 and Dual1 to Dual0
  inter_product_1_res = add_part!(d, :Var, type=:infer, name=nothing)
  add_Inter_Prod_2D!(Val{1}, d, proj2_Lie, proj1_Lie, inter_product_1_res)

  ## Outputs result of dual derivative Dual0 to Dual1
  dual_d_0_tgt = add_part!(d, :Var, type=:infer, name=nothing)
  add_part!(d, :Op1, src=inter_product_1_res, tgt=dual_d_0_tgt, op1=:d)

  ## Outputs sum of both dual_d_0 and inter_product_2
  summation_tgt = add_part!(d, , sum=res_Lie)

  add_part!(d, :Summand, summand=inter_product_2_res, summation=summation_tgt)
  add_part!(d, :Summand, summand=dual_d_0_tgt, summation=summation

@lukem12345
Copy link
Member Author

This PR is low-priority, because it is a Developer Experience PR, and would require an unknown amount of developer time to resolve issues relating to segfaults when using Decapode ACSets in source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants