Skip to content

Commit

Permalink
Minor documentation fixes around phases and a workaround for Makie …
Browse files Browse the repository at this point in the history
…plotting regression (#163)
  • Loading branch information
Krastanov committed Aug 16, 2023
1 parent 3b9058a commit 6b4918b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

# News

## v0.8.15 - dev
## v0.8.15 - 2023-08-16

- Initial support for GPU accelerated circuit simulation (with CUDA).
- Minor documentation fixes around `phases` and a workaround for Makie plotting regression.

## v0.8.14 - 2023-07-19

Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuantumClifford"
uuid = "0525e862-1e90-11e9-3e4d-1b39d7109de1"
authors = ["Stefan Krastanov <stefan@krastanov.org>"]
version = "0.8.14"
version = "0.8.15"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down Expand Up @@ -43,7 +43,7 @@ Graphs = "1.4.1"
HostCPUFeatures = "0.1.6"
ILog2 = "0.2.3"
MacroTools = "0.5.9"
Makie = "0.19"
Makie = "0.19.7"
Nemo = "0.34, 0.35"
Plots = "1.38.0"
PrecompileTools = "1"
Expand Down
19 changes: 13 additions & 6 deletions docs/src/stab-algebra-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,20 @@ operator**. If you want to perform a Monte Carlo simulation, you need to
randomize the phase of the stabilizer at the anticommuting index yourself. For
instance, one can do:

```julia
newstate, anticomindex, result = project!(state, projector)
if isnothing(result)
newstate.phases[anticomindex] = rand([0x0,0x2])
end
```jldoctest proj
julia> newstate, anticomindex, result = project!(copy(s), P"XII")
if isnothing(result)
phases(newstate)[anticomindex] = rand([0x0,0x2])
end
result, anticomindex
(nothing, 2)
```

Or we can project on a commuting operator, hence no anticommuting terms (the
Of course, this is a rather cumbersome way to run a simulation, so we also provide
[`projectrand!`](@ref) which does the necessary randomization automatically,
for cases where you do not need the fine grained control of `project!`.

We can project on a commuting operator, hence no anticommuting terms (the
index is zero), and the result is perfectly determined (-1, or in our convention
to represent the phase, 0x2).

Expand Down Expand Up @@ -352,6 +358,7 @@ julia> project!(copy(s), P"ZZI", phases=false)
## Sparse single-qubit measurements

In many circumstances only a single-qubit operator is being measured. In that case one should use the [`projectX!`](@ref), [`projectY!`](@ref), and [`projectZ!`](@ref) functions as they are much faster thanks to tracking only a single qubit.
They have versions that randomize the phase as necessary as well: [`projectXrand!`](@ref), [`projectYrand!`](@ref), and [`projectZrand!`](@ref).

## Gate-like interface

Expand Down
5 changes: 4 additions & 1 deletion ext/QuantumCliffordMakieExt/QuantumCliffordMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ function Makie.plot!(myplot::StabilizerPlot)
throw(ErrorException("`xzcomponents` should be `:split` or `:together`"))
end
r = r[end:-1:1,:]'
Makie.heatmap!(myplot, r;
hm = Makie.heatmap!(myplot, r;
colorrange = (0, 3),
colormap=myplot.colormap
)
for k in [:colorscale, :highclip, :lowclip]
myplot[k] = hm[k]
end
myplot
end

Expand Down
4 changes: 2 additions & 2 deletions src/QuantumClifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,9 @@ Base.copy(d::MixedDestabilizer) = MixedDestabilizer(copy(d.tab),d.rank)
@inline nqubits(s::AbstractStabilizer) = nqubits(tab(s))
@inline nqubits(t::Tableau) = t.nqubits

"""The phases of a given tableau."""
"""The phases of a given tableau. It is a view, i.e. if you modify this array, the original tableau caries these changes."""
@inline phases(t::Tableau) = t.phases
@inline phases(s::Stabilizer) = phases(tab(s))
@inline phases(s::AbstractStabilizer) = phases(tab(stabilizerview(s)))

##############################
# Pauli Operator Helpers
Expand Down

2 comments on commit 6b4918b

@Krastanov
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/89787

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.15 -m "<description of version>" 6b4918b624d642de77f11b2ee4dd8f36fcdc1d37
git push origin v0.8.15

Please sign in to comment.