Skip to content
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

Centralizing Operators #291

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions docs/src/cism/cism.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,8 @@ We provide here the mapping from symbols to differential operators. As more of t
function generate(sd, my_symbol; hodge=GeometricHodge())
# We pre-allocate matrices that encode differential operators.
op = @match my_symbol begin
:mag => x -> norm.(x)
:♯ => begin
sharp_mat = ♯_mat(sd, AltPPSharp())
x -> sharp_mat * x
end
x => error("Unmatched operator $my_symbol")
x => default_dec_matrix_generate(sd, x, hodge)
_ => error("Unmatched operator $my_symbol")
end
return (args...) -> op(args...)
end
Expand Down
10 changes: 2 additions & 8 deletions docs/src/ebm_melt/ebm_melt.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,8 @@ constants_and_parameters = (
# Define how symbols map to Julia functions
function generate(sd, my_symbol; hodge=GeometricHodge())
op = @match my_symbol begin
:♯ => begin
sharp_mat = ♯_mat(sd, AltPPSharp())
x -> sharp_mat * x
end
:mag => x -> begin
norm.(x)
end
x => error("Unmatched operator $my_symbol")
x => default_dec_matrix_generate(sd, x, hodge)
_ => error("Unmatched operator $my_symbol")
end
return (args...) -> op(args...)
end
Expand Down
8 changes: 2 additions & 6 deletions docs/src/grigoriev/grigoriev.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@ to_graphviz(ice_dynamics)
``` @example DEC
function generate(sd, my_symbol; hodge=GeometricHodge())
op = @match my_symbol begin
:mag => x -> norm.(x)
:♯ => begin
sharp_mat = ♯_mat(sd, AltPPSharp())
x -> sharp_mat * x
end
x => error("Unmatched operator $my_symbol")
x => default_dec_matrix_generate(sd, x, hodge)
_ => error("Unmatched operator $my_symbol")
end
return op
end
Expand Down
4 changes: 4 additions & 0 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ function default_dec_matrix_generate(sd::HasDeltaSet, my_symbol::Symbol, hodge::

:♭ => dec_♭(sd)

:♭♯ => ♭♯_mat(sd)

# Averaging Operator
:avg₀₁ => dec_avg₀₁(sd)

:neg => x -> -1 .* x
:mag => x -> norm.(x)
_ => error("Unmatched operator $my_symbol")
end

Expand Down Expand Up @@ -169,6 +172,7 @@ function default_dec_generate(sd::HasDeltaSet, my_symbol::Symbol, hodge::Discret
:plus => (+)
:(-) || :neg => x -> -1 .* x
:ln => (x -> log.(x))
:mag => x -> norm.(x)

_ => error("Unmatched operator $my_symbol")
end
Expand Down
Loading