Skip to content

Commit

Permalink
Export plots in docs as SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Jul 16, 2023
1 parent b18976f commit e16d71b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
31 changes: 31 additions & 0 deletions docs/src/examples/google-rqc.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Google's Quantum Advantage experiment

```@setup circuit
using CairoMakie
CairoMakie.activate!(type = "svg")
```

!!! danger "🚧 Broken code 🚧"
There is a lot of work in progress, and this code may not work yet.
Specifically, `slices` is not implemented yet.
Expand Down Expand Up @@ -29,6 +34,8 @@ The experiment consisted on sampling Random Quantum Circuits (RQC). The state of

...

Thanks to `Tenet`'s much cared design, the experiment can be replicated conceptually in less than 20loc.

```@example circuit
using QuacIO
using Tenet
Expand All @@ -41,6 +48,30 @@ tn = TensorNetwork(circuit)
plot(tn) # hide
```

```@example circuit
# simplify Tensor Network by preemptively contracting trivial cases
tn = transform(tn, Tenet.RankSimplification)
plot(tn) # hide
```

```julia
addprocs(10)
@everywhere using Tenet, EinExprs

# parallel stochastic contraction path search
@everywhere tn = $tn
path = @distributed (x -> minimum(flops, x...)) for _ in 1:100
einexpr(tn, optimizer = Greedy)
end
```

```@example circuit
using EinExprs # hide
using NetworkLayout # hide
path = einexpr(tn, optimizer = Greedy) # hide
plot(path, layout=Stress()) # hide
```

```julia
using Distributed
using Iterators: product
Expand Down
1 change: 1 addition & 0 deletions docs/src/quantum/peps.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Makie.inline!(true)
set_theme!(resolution=(800,400))
using CairoMakie
CairoMakie.activate!(type = "svg")
using Tenet
using NetworkLayout
Expand Down
4 changes: 3 additions & 1 deletion docs/src/visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ using Makie
Makie.inline!(true)
set_theme!(resolution=(800,400))
using CairoMakie
CairoMakie.activate!(type = "svg")
using Tenet
```

Expand All @@ -15,7 +18,6 @@ Makie.plot(::Tenet.TensorNetwork)
```

```@example viz
using CairoMakie # hide
tn = rand(TensorNetwork, 14, 4, seed=0) # hide
plot(tn, labels=true)
```

0 comments on commit e16d71b

Please sign in to comment.