From 89a4686f9bba91b956b45df0722ab426f5273ba8 Mon Sep 17 00:00:00 2001 From: Matt Cuffaro Date: Sat, 14 Dec 2024 07:46:07 -0500 Subject: [PATCH 1/2] adding flat-sharp to operators dictionary --- src/operators.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/operators.jl b/src/operators.jl index df3186a6..cbbfed52 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -74,6 +74,8 @@ function default_dec_matrix_generate(sd::HasDeltaSet, my_symbol::Symbol, hodge:: :♭ => dec_♭(sd) + :♭♯ => ♭♯_mat(sd) + # Averaging Operator :avg₀₁ => dec_avg₀₁(sd) @@ -169,6 +171,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 From 541d97b979ff391f83931b1f7a1d1ce3433db876 Mon Sep 17 00:00:00 2001 From: Matt Cuffaro Date: Sat, 14 Dec 2024 08:50:11 -0500 Subject: [PATCH 2/2] added :mag to default_dec_generate_matrix --- docs/src/cism/cism.md | 8 ++------ docs/src/ebm_melt/ebm_melt.md | 10 ++-------- docs/src/grigoriev/grigoriev.md | 8 ++------ src/operators.jl | 1 + 4 files changed, 7 insertions(+), 20 deletions(-) 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 cbbfed52..982f643e 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -80,6 +80,7 @@ function default_dec_matrix_generate(sd::HasDeltaSet, my_symbol::Symbol, hodge:: :avg₀₁ => dec_avg₀₁(sd) :neg => x -> -1 .* x + :mag => x -> norm.(x) _ => error("Unmatched operator $my_symbol") end