Skip to content

Commit f873abc

Browse files
committed
fix docs not building issue
1 parent cf20e85 commit f873abc

File tree

3 files changed

+18
-34
lines changed

3 files changed

+18
-34
lines changed

docs/make.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using Multigraphs
66

77
indigo = DocThemeIndigo.install(ZXCalculus)
88
makedocs(;
9-
modules = Module[ZXCalculus],
9+
modules = Module[ZXCalculus, ZXCalculus.ZX, ZXCalculus.ZXW, ZXCalculus.ZW, ZXCalculus.Utils, ZXCalculus.Application, ZXCalculus.PMG],
1010
format=Documenter.HTML(;
1111
# ...
1212
# put your indigo css in assets

docs/src/api.md

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
# APIs
2+
3+
```@autodocs
4+
Modules = [ZXCalculus, ZXCalculus.ZX, ZXCalculus.ZXW, ZXCalculus.ZW, ZXCalculus.Utils, ZXCalculus.PMG]
5+
Order = [:function, :type]
6+
```

docs/src/tutorials.md

+12-33
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Tutorials
2-
```@meta
3-
CurrentModule= ZXCalculus.ZX
4-
```
52

6-
ZX-diagrams are the basic objects in ZX-calculus. In our implementation, each ZX-diagram consists of a multigraph and vertices information including the type of vertices and the phase of vertices. [`ZXDiagram`](@ref) is the data structure for representing
3+
ZX-diagrams are the basic objects in ZX-calculus. In our implementation, each ZX-diagram consists of a multigraph and vertices information including the type of vertices and the phase of vertices. [`ZXCalculus.ZX.ZXDiagram`](@ref) is the data structure for representing
74
ZX-diagrams.
85

96
There are 5 types of vertices: `In`, `Out`, `Z`, `X`, `H` which represent the inputs of quantum circuits, outputs of quantum circuits, Z-spiders, X-spiders, H-boxes. There can be a phase for each vertex. The phase of a vertex of `Z` or `X` is the phase of a Z or X-spider. For the other types of vertices, the phase is zero by default.
@@ -12,21 +9,15 @@ In each `ZXDiagram`, there is a `layout` for storing layout information for the
129

1310
## Construction of ZX-diagrams
1411

15-
As we usually focus on quantum circuits, the recommended way to construct `ZXDiagram`s is by the following function.
16-
```@docs
17-
ZXDiagram(nbits::T) where T<:Integer
18-
```
19-
Then one can use `push_gate!` to push quantum gates at the end of a quantum circuit, or use `pushfirst_gate!` to push gates at the beginning of a quantum circuit.
20-
```@docs
21-
push_gate!(zxd::ZXDiagram{T, P}, ::Val{:Z}, loc::T, phase = zero(P); autoconvert::Bool=true) where {T, P}
22-
pushfirst_gate!(zxd::ZXDiagram{T, P}, ::Val{:Z}, loc::T, phase::P = zero(P)) where {T, P}
23-
```
12+
As we usually focus on quantum circuits, the recommended way to construct `ZXDiagram`s is by the following function [`ZXCalculus.ZX.ZXDiagram(nbits::T) where {T<:Integer}`](@ref).
13+
14+
Then one can use [`ZXCalculus.ZX.push_gate!`](@ref) to push quantum gates at the end of a quantum circuit, or use [`ZXCalculus.ZX.pushfirst_gate!`](@ref)to push gates at the beginning of a quantum circuit.
2415

2516
For example, in `example\ex1.jl`, one can generate the demo circuit by the function
2617
```julia
2718
using ZXCalculus
2819
function generate_example()
29-
zxd = ZXDiagram(4)
20+
zxd = ZXCalculus.ZX.ZXDiagram(4)
3021
push_gate!(zxd, Val(:Z), 1, 3//2)
3122
push_gate!(zxd, Val(:H), 1)
3223
push_gate!(zxd, Val(:Z), 1, 1//2)
@@ -56,11 +47,7 @@ function generate_example()
5647
end
5748
```
5849

59-
In the paper [arXiv:1902.03178](https://arxiv.org/abs/1902.03178), they introduced a special type of ZX-diagrams, graph-like ZX-diagrams, which consists of Z-spiders with 2 different types of edges only. We use [`ZXGraph`](@ref) for representing this special type of ZX-diagrams. One can convert a `ZXDiagram` into a `ZXGraph` by simply use the construction function:
60-
```@docs
61-
ZXGraph(zxd::ZXDiagram{T, P}) where {T, P}
62-
```
63-
50+
In the paper [arXiv:1902.03178](https://arxiv.org/abs/1902.03178), they introduced a special type of ZX-diagrams, graph-like ZX-diagrams, which consists of Z-spiders with 2 different types of edges only. We use [`ZXCalculus.ZX.ZXGraph`](@ref) for representing this special type of ZX-diagrams. One can convert a `ZXDiagram` into a `ZXGraph` by simply use the construction function [`ZXCalculus.ZX.ZXGraph(zxd::ZXCalculus.ZX.ZXDiagram{T, P}) where {T, P}`](@ref):
6451

6552
## Visualization
6653

@@ -78,18 +65,12 @@ With `ZXCalculus.jl`, one can manipulate ZX-diagrams at different levels.
7865
- Rewriting ZX-diagrams with rules
7966
- Rewriting ZX-diagrams at the graphical level
8067

81-
The highest level is the circuit simplification algorithms. By now there are two algorithms are available:
82-
```@docs
83-
clifford_simplification(circ::ZXDiagram)
84-
phase_teleportation(circ::ZXDiagram{T, P}) where {T, P}
85-
```
68+
The highest level is the circuit simplification algorithms. By now there are two algorithms are available: [`ZXCalculus.ZX.clifford_simplification`](@ref) and [`ZXCalculus.ZX.phase_teleportation`](ref).
69+
8670
The input of these algorithms will be a ZX-diagram representing a quantum circuit. And these algorithms will return a ZX-diagram of a simplified quantum circuit. For more details, please refer to [Clifford simplification](https://arxiv.org/abs/1902.03178) and [phase teleportation](https://arxiv.org/abs/1903.10477).
8771

88-
One can rewrite ZX-diagrams with rules. In `ZXCalculus.jl`, rules are identified as data structures [`Rule`](@ref). And we can use the following functions to simplify ZX-diagrams:
89-
```@docs
90-
simplify!(r::ZXCalculus.AbstractRule, zxd::AbstractZXDiagram)
91-
replace!(r::ZXCalculus.AbstractRule, zxd::AbstractZXDiagram)
92-
```
72+
One can rewrite ZX-diagrams with rules. In `ZXCalculus.jl`, rules are identified as data structures [`Rule`](@ref). And we can use the following functions to simplify ZX-diagrams: [`ZXCalculus.ZX.simplify!`](@ref) and [`ZXCalculus.ZX.replace!`](@ref).
73+
9374
For example, in `example/ex1.jl`, we can get a simplified graph-like ZX-diagram by:
9475
```julia
9576
zxd = generate_example()
@@ -102,10 +83,8 @@ replace!(Rule{:pab}(), zxg)
10283
The difference between `simplify!` and `replace!` is that `replace!` only matches vertices and tries to rewrite with all matched vertices once, while `simplify!` will keep matching until nothing matched.
10384

10485
The following APIs are useful for more detailed rewriting.
105-
```@docs
106-
match(::ZXCalculus.AbstractRule, zxd::AbstractZXDiagram{T, P}) where {T, P}
107-
rewrite!(r::ZXCalculus.AbstractRule, zxd::AbstractZXDiagram{T, P}, matches::Vector{Match{T}}) where {T, P}
108-
```
86+
1. [`ZXCalculus.ZX.match`](@ref)
87+
2. [`ZXCalculus.ZX.rewrite!`](@ref)
10988

11089
The lowest level for rewriting ZX-diagrams is manipulating the multigraphs directly. This way is not recommended unless one wants to develop new rules in ZX-calculus.
11190

0 commit comments

Comments
 (0)