Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephBond committed Oct 27, 2023
1 parent d517521 commit be7dc0c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/Graph/Slice.purs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ fwdSlice αs0 g0 = fst $ runWithGraph $ tailRecM go (M.empty × inEdges g0 αs0)
pure $ Loop (M.insert α βs h × es)

-- | De Morgan dual of forward slicing (▷_G)° ≡ Backward slicing on the opposite graph (◁_{G_op})
fwdSliceDual :: forall g. Graph g => Set Vertex -> g -> g
fwdSliceDual αs0 g0 = bwdSlice αs0 (op g0)
fwdDualAsBwdOp :: forall g. Graph g => Set Vertex -> g -> g
fwdDualAsBwdOp αs0 g0 = bwdSlice αs0 (op g0)

fwdDual :: forall g. Graph g => Set Vertex -> g -> g
fwdDual αs0 g0 = fwdSlice (sinks g0 `difference` αs0) g0

-- | Forward slicing (▷_G) ≡ De Morgan dual of backward slicing on the opposite graph (◁_{G_op})°
fwdSliceAsDeMorgan :: forall g. Graph g => Set Vertex -> g -> g
Expand Down
8 changes: 4 additions & 4 deletions test/Specs.purs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ misc_cases =
, { file: "records", fwd_expect: "{a : 2, b : 6, c : 7, d : (5 : []), e : 7}" }
, { file: "reverse", fwd_expect: "(2 : (1 : []))" }
-- TODO: move to slicing tests once we fix matrix-update
-- , { file: "slicing/dtw/average-series"
-- , fwd_expect:
-- "(2.5 : (0.5 : (0.5 : (2.5 : (2.5 : (1.0 : (0.5 : [])))))))"
-- }
-- , { file: "slicing/dtw/average-series"
-- , fwd_expect:
-- "(2.5 : (0.5 : (0.5 : (2.5 : (2.5 : (1.0 : (0.5 : [])))))))"
-- }
]

desugar_cases :: Array TestSpec
Expand Down
4 changes: 2 additions & 2 deletions test/Util.purs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Expr (ProgCxt)
import GaloisConnection (GaloisConnection(..))
import Graph (Vertex, selectαs, select𝔹s, sinks, vertices)
import Graph.GraphImpl (GraphImpl)
import Graph.Slice (bwdSliceDual, fwdSliceDual, fwdSliceDeMorgan) as G
import Graph.Slice (bwdSliceDual, fwdDualAsBwdOp, fwdSliceDeMorgan) as G
import Lattice (Raw, 𝔹, botOf, erase, topOf)
import Module (File, initialConfig, open, parse)
import Parse (program)
Expand Down Expand Up @@ -153,7 +153,7 @@ testGraph s gconfig spec@{ δv } benchmarking = do
when logging (logAs "BwdAll/input slice" (prettyP $ select𝔹s eα αs'))

do
g' <- benchmark (method <> "-FwdDual") $ \_ -> pure (G.fwdSliceDual αs_in g)
g' <- benchmark (method <> "-FwdDual") $ \_ -> pure (G.fwdDualAsBwdOp αs_in g)
when logging (logAs "FwdDual/output slice" (prettyP $ select𝔹s vα (vertices g')))

do
Expand Down

0 comments on commit be7dc0c

Please sign in to comment.