diff --git a/docs/src/cism/cism.md b/docs/src/cism/cism.md index b4d624cf..5f298cf2 100644 --- a/docs/src/cism/cism.md +++ b/docs/src/cism/cism.md @@ -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 diff --git a/docs/src/ebm_melt/ebm_melt.md b/docs/src/ebm_melt/ebm_melt.md index 485b2d47..2a0efe62 100644 --- a/docs/src/ebm_melt/ebm_melt.md +++ b/docs/src/ebm_melt/ebm_melt.md @@ -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 diff --git a/docs/src/grigoriev/grigoriev.md b/docs/src/grigoriev/grigoriev.md index 7bebba6b..f2bdfd7a 100644 --- a/docs/src/grigoriev/grigoriev.md +++ b/docs/src/grigoriev/grigoriev.md @@ -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 diff --git a/src/operators.jl b/src/operators.jl index df3186a6..982f643e 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -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 @@ -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