Skip to content

Commit 9e3388a

Browse files
committed
restructure module folders
1 parent f873abc commit 9e3388a

28 files changed

+138
-137
lines changed

src/Application/Application.jl

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Application
2+
3+
using OMEinsum, MLStyle
4+
using ..ZXW: ZXWDiagram, Z, X, W, H, D, Input, Output
5+
using ..Utils: PiUnit, Factor, Parameter, unwrap_scalar
6+
using ..ZXW: get_outputs, get_inputs, degree, neighbors, vertices, scalar, nin, nout
7+
8+
include("to_eincode.jl")
9+
end # module Application
File renamed without changes.

src/PMG/PMG.jl

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module PMG
2+
3+
using Graphs
4+
5+
import Graphs: AbstractEdge, src, dst, nv, ne, neighbors
6+
import Graphs.SimpleGraphs: vertices
7+
8+
export HalfEdge, src, dst, new_edge, PlanarMultigraph
9+
10+
include("planar_multigraph.jl")
11+
12+
end # module PlanarMultigraph
File renamed without changes.

src/Utils/Utils.jl

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Utils
2+
3+
using Expronicon.ADT: @const_use, @adt
4+
using MLStyle
5+
6+
include("scalar.jl")
7+
include("phase.jl")
8+
include("parameter.jl")
9+
10+
end
File renamed without changes.

src/phase.jl src/Utils/phase.jl

File renamed without changes.

src/scalar.jl src/Utils/scalar.jl

File renamed without changes.

src/ZW/ZW.jl

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
module ZW
2+
using Expronicon.ADT: @adt, @const_use
3+
using MLStyle, Graphs
4+
using ..ZXW: _round_phase, Parameter
5+
6+
# these will be changed to using PlanarMultigraph: vertices after we split out package
7+
using ..PMG:
8+
vertices,
9+
nv,
10+
has_vertex,
11+
ne,
12+
neighbors,
13+
rem_edge!,
14+
add_edge!,
15+
degree,
16+
next,
17+
split_vertex!,
18+
split_edge!,
19+
face,
20+
trace_face,
21+
make_hole!,
22+
add_vertex_and_facet_to_boarder!,
23+
split_facet!,
24+
twin,
25+
prev,
26+
add_multiedge!,
27+
join_facet!,
28+
trace_vertex,
29+
join_vertex!
30+
31+
# these remains
32+
using ..Utils: add_phase!, Scalar, Phase, Parameter, PiUnit, Factor, add_power!
33+
using ..PMG: PlanarMultigraph, HalfEdge, new_edge, src, dst
34+
import ..Utils: add_power!
35+
import ..ZX: add_global_phase!, scalar, spiders, rem_spider!
36+
import Graphs.rem_edge!
37+
38+
export ZWDiagram
39+
40+
include("zw_adt.jl")
41+
include("zw_diagram.jl")
42+
include("zw_utils.jl")
43+
end # module ZW

src/zw_adt.jl src/ZW/zw_adt.jl

File renamed without changes.
File renamed without changes.

src/zw_utils.jl src/ZW/zw_utils.jl

File renamed without changes.

src/ZX/ZX.jl

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module ZX
2+
3+
using Graphs, Multigraphs, YaoHIR, YaoLocations
4+
using YaoHIR.IntrinsicOperation
5+
using YaoHIR: Chain
6+
using YaoLocations: plain
7+
using MLStyle
8+
using ..Utils: Scalar, Phase, add_phase!
9+
10+
import ..Utils: add_power!
11+
12+
export spiders,
13+
tcount, spider_type, phase, rem_spider!, rem_spiders!, pushfirst_gate!, push_gate!
14+
15+
export SpiderType, EdgeType
16+
export AbstractZXDiagram, ZXDiagram, ZXGraph
17+
18+
export AbstractRule
19+
export Rule, Match
20+
21+
export rewrite!, simplify!
22+
23+
export convert_to_chain, convert_to_zxd
24+
export clifford_simplification, full_reduction, circuit_extraction, phase_teleportation
25+
26+
include("abstract_zx_diagram.jl")
27+
include("zx_layout.jl")
28+
include("zx_diagram.jl")
29+
include("zx_graph.jl")
30+
31+
include("rules.jl")
32+
include("simplify.jl")
33+
34+
include("circuit_extraction.jl")
35+
include("phase_teleportation.jl")
36+
37+
include("ir.jl")
38+
end
File renamed without changes.
File renamed without changes.

src/ir.jl src/ZX/ir.jl

File renamed without changes.
File renamed without changes.

src/rules.jl src/ZX/rules.jl

File renamed without changes.

src/simplify.jl src/ZX/simplify.jl

File renamed without changes.
File renamed without changes.

src/zx_graph.jl src/ZX/zx_graph.jl

File renamed without changes.
File renamed without changes.

src/ZXCalculus.jl

+7-137
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,11 @@
11
module ZXCalculus
22

3-
module Utils
4-
5-
using Expronicon.ADT: @const_use, @adt
6-
using MLStyle
7-
8-
include("scalar.jl")
9-
include("phase.jl")
10-
include("parameter.jl")
11-
12-
end
13-
14-
module ZX
15-
16-
using Graphs, Multigraphs, YaoHIR, YaoLocations
17-
using YaoHIR.IntrinsicOperation
18-
using YaoHIR: Chain
19-
using YaoLocations: plain
20-
using MLStyle
21-
using ..Utils: Scalar, Phase, add_phase!
22-
23-
import ..Utils: add_power!
24-
25-
export spiders,
26-
tcount, spider_type, phase, rem_spider!, rem_spiders!, pushfirst_gate!, push_gate!
27-
28-
export SpiderType, EdgeType
29-
export AbstractZXDiagram, ZXDiagram, ZXGraph
30-
31-
export AbstractRule
32-
export Rule, Match
33-
34-
export rewrite!, simplify!
35-
36-
export convert_to_chain, convert_to_zxd
37-
export clifford_simplification, full_reduction, circuit_extraction, phase_teleportation
38-
39-
include("abstract_zx_diagram.jl")
40-
include("zx_layout.jl")
41-
include("zx_diagram.jl")
42-
include("zx_graph.jl")
43-
44-
include("rules.jl")
45-
include("simplify.jl")
46-
47-
include("circuit_extraction.jl")
48-
include("phase_teleportation.jl")
49-
50-
include("ir.jl")
51-
end
52-
53-
module ZXW
54-
55-
using Expronicon.ADT: @const_use, @adt
56-
using MLStyle, Multigraphs, Graphs
57-
using ..Utils: Scalar, Phase, Parameter, PiUnit, Factor, add_phase!
58-
using ..ZX: safe_convert, AbstractRule, Rule, Match
59-
60-
import ..Utils: add_power!
61-
import ..ZX:
62-
rewrite!, simplify!, push_gate!, pushfirst_gate!, spiders, rem_spider!, rem_spiders!
63-
64-
export ZXWDiagram, substitute_variables!
65-
66-
include("adts.jl")
67-
include("zxw_diagram.jl")
68-
include("zxw_rules.jl")
69-
include("utils.jl")
70-
71-
end # module ZXW
72-
73-
module PMG
74-
75-
using Graphs
76-
77-
import Graphs: AbstractEdge, src, dst, nv, ne, neighbors
78-
import Graphs.SimpleGraphs: vertices
79-
80-
export HalfEdge, src, dst, new_edge, PlanarMultigraph
81-
82-
include("planar_multigraph.jl")
83-
84-
end # module PlanarMultigraph
85-
86-
module ZW
87-
using Expronicon.ADT: @adt, @const_use
88-
using MLStyle, Graphs
89-
using ..ZXW: _round_phase, Parameter
90-
91-
# these will be changed to using PlanarMultigraph: vertices after we split out package
92-
using ..PMG:
93-
vertices,
94-
nv,
95-
has_vertex,
96-
ne,
97-
neighbors,
98-
rem_edge!,
99-
add_edge!,
100-
degree,
101-
next,
102-
split_vertex!,
103-
split_edge!,
104-
face,
105-
trace_face,
106-
make_hole!,
107-
add_vertex_and_facet_to_boarder!,
108-
split_facet!,
109-
twin,
110-
prev,
111-
add_multiedge!,
112-
join_facet!,
113-
trace_vertex,
114-
join_vertex!
115-
116-
# these remains
117-
using ..Utils: add_phase!, Scalar, Phase, Parameter, PiUnit, Factor, add_power!
118-
using ..PMG: PlanarMultigraph, HalfEdge, new_edge, src, dst
119-
import ..Utils: add_power!
120-
import ..ZX: add_global_phase!, scalar, spiders, rem_spider!
121-
import Graphs.rem_edge!
122-
123-
export ZWDiagram
124-
125-
include("zw_adt.jl")
126-
include("zw_diagram.jl")
127-
include("zw_utils.jl")
128-
end # module ZW
129-
130-
module Application
131-
132-
using OMEinsum, MLStyle
133-
using ..ZXW: ZXWDiagram, Z, X, W, H, D, Input, Output
134-
using ..Utils: PiUnit, Factor, Parameter, unwrap_scalar
135-
using ..ZXW: get_outputs, get_inputs, degree, neighbors, vertices, scalar, nin, nout
136-
137-
include("to_eincode.jl")
138-
end # module Application
139-
3+
include("Utils/Utils.jl")
4+
include("ZX/ZX.jl")
5+
include("ZXW/ZXW.jl")
6+
include("PMG/PMG.jl")
7+
include("ZW/ZW.jl")
8+
include("Application/Application.jl")
1409
include("deprecations.jl")
10+
14111
end # module

src/ZXW/ZXW.jl

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module ZXW
2+
3+
using Expronicon.ADT: @const_use, @adt
4+
using MLStyle, Multigraphs, Graphs
5+
using ..Utils: Scalar, Phase, Parameter, PiUnit, Factor, add_phase!
6+
using ..ZX: safe_convert, AbstractRule, Rule, Match
7+
8+
import ..Utils: add_power!
9+
import ..ZX:
10+
rewrite!, simplify!, push_gate!, pushfirst_gate!, spiders, rem_spider!, rem_spiders!
11+
12+
export ZXWDiagram, substitute_variables!
13+
14+
include("adts.jl")
15+
include("zxw_diagram.jl")
16+
include("zxw_rules.jl")
17+
include("utils.jl")
18+
19+
end # module ZXW

src/adts.jl src/ZXW/adts.jl

File renamed without changes.

src/utils.jl src/ZXW/utils.jl

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)