Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naive Implementation of the Encoding Circuit #154

Merged
merged 23 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7f5bfbb
is_degenerate, is_degen tests, and naive implementation of encoding c…
dmtrung14 Jul 6, 2023
36d8133
augment bimatrix in naive_encoding_circuit
dmtrung14 Jul 6, 2023
e6dbb95
uncomment tests
dmtrung14 Jul 6, 2023
05e3c56
minor
dmtrung14 Jul 13, 2023
cd05fff
encoding circuit -split
dmtrung14 Jul 14, 2023
365553a
Slightly better docstring for is_degenerate -- please report in the d…
Krastanov Jul 16, 2023
14604eb
a simplified version of your `standard_tab_gott` - should be doing th…
Krastanov Jul 16, 2023
2a0c94f
provide a `reportperm` keyword argument to the `MixedDestabilizer` co…
Krastanov Jul 16, 2023
460a131
Merge branch 'master' of https://github.com/QuantumSavory/QuantumClif…
dmtrung14 Jul 21, 2023
8f6265a
streamlined standard_tab_gott and added reference
dmtrung14 Jul 21, 2023
2e568de
Merge branch 'minor' of https://github.com/dmtrung14/QuantumClifford.…
dmtrung14 Jul 21, 2023
4cdd2a6
streamlined standard_tab_gott and allowed undoperm and applied to nec
dmtrung14 Jul 29, 2023
cee2e31
Merge branch 'master' into minor
Krastanov Jul 29, 2023
18d505e
clean up and add tests
Krastanov Aug 4, 2023
abba3b2
temporarry changes
dmtrung14 Aug 4, 2023
1c345f8
temporary commit
dmtrung14 Aug 4, 2023
9939e6a
finally implement it, and a bunch of cleanup
Krastanov Sep 17, 2023
88b6d4b
Merge branch 'master' into pr/dmtrung14/154
Krastanov Sep 17, 2023
5b9b0ef
ammend
Krastanov Sep 17, 2023
4db5e8e
fix tests
Krastanov Sep 17, 2023
00a1465
correct for qubit permutations
Krastanov Sep 17, 2023
eb224c9
references
Krastanov Sep 17, 2023
ed698f3
fix documenter
Krastanov Sep 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

# News

## v0.8.17 - dev
- **(fix)** Some `affectedqubits` methods were returning single integers instead of a one-tuple.
- The non-public `ECC` module has seen a few improvements (a `naive_encoding_circuit` implementation and a few new codes), as well as some breaking changes to API.

## v0.8.16 - 2023-08-31

- **(breaking)** Changes to the circuit generation in the non-public ECC module. Adding a Shor syndrome measurement circuit.
Expand Down
2 changes: 1 addition & 1 deletion 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 <[email protected]>"]
version = "0.8.16"
version = "0.8.17"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ ENV["COLUMNS"] = 80
bib = CitationBibliography(joinpath(@__DIR__,"src/references.bib"),style=:authoryear)

makedocs(
bib,
plugins = [bib],
doctest = false,
clean = true,
sitename = "QuantumClifford.jl",
format = Documenter.HTML(),
format = Documenter.HTML(size_threshold_ignore = ["API.md"]),
modules = [QuantumClifford, QuantumClifford.Experimental.NoisyCircuits, QuantumInterface],
strict = Documenter.except(:missing_docs),
warnonly = [:missing_docs],
authors = "Stefan Krastanov",
pages = [
"QuantumClifford.jl" => "index.md",
Expand Down
4 changes: 2 additions & 2 deletions docs/src/ecc_example_sim.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Consider Steane 7-qubit code:

```@example 1
using QuantumClifford
using QuantumClifford.ECC: Steane7, naive_syndrome_circuit, encoding_circuit, parity_checks, code_s, code_n
using QuantumClifford.ECC: Steane7, naive_syndrome_circuit, naive_encoding_circuit, parity_checks, code_s, code_n
using Quantikz

code = Steane7()
Expand All @@ -21,7 +21,7 @@ H = parity_checks(code)

... and the corresponding encoding circuit
```@example 1
ecirc = encoding_circuit(code)
ecirc = naive_encoding_circuit(code)
```

... and the corresponding syndrome measurement circuit (the non-fault tolerant one)
Expand Down
44 changes: 38 additions & 6 deletions docs/src/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,44 @@ @article{gullans2020dynamical
publisher={APS}
}

@misc{hein2006entanglement,
title = {Entanglement in Graph States and its Applications},
url = {http://arxiv.org/abs/quant-ph/0602096},
journaltitle = {arXiv preprint arXiv:quant-ph/0602096},
author = {Hein, M. and Dür, W. and Eisert, J. and Raussendorf, R. and Nest, M. Van den and Briegel, H.-J.},
year = {2006},
@article{hein2006entanglement,
title={Entanglement in graph states and its applications},
author={Hein, Marc and D{\"u}r, Wolfgang and Eisert, Jens and Raussendorf, Robert and Nest, M and Briegel, H-J},
journal={arXiv preprint quant-ph/0602096},
url={https://arxiv.org/abs/quant-ph/0602096},
doi={10.48550/arXiv.quant-ph/0602096},
year={2006}
}

% Encoding circuits

@article{cleve1997efficient,
title={Efficient computations of encodings for quantum error correction},
author={Cleve, Richard and Gottesman, Daniel},
journal={Physical Review A},
volume={56},
number={1},
pages={76},
year={1997},
publisher={APS}
}

@inproceedings{grassl2011variations,
title={Variations on encoding circuits for stabilizer quantum codes},
author={Grassl, Markus},
booktitle={International Conference on Coding and Cryptology},
pages={142--158},
year={2011},
organization={Springer}
}

@article{grassl2002algorithmic,
title={Algorithmic aspects of quantum error-correcting codes},
author={Grassl, Markus},
journal={Mathematics of Quantum Computation},
pages={223--252},
year={2002},
publisher={CRC Press Boca Raton, FL}
}

% Examples of results that employ the tableaux formalism
Expand Down
15 changes: 13 additions & 2 deletions src/QuantumClifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export
sHadamard, sPhase, sInvPhase, SingleQubitOperator, sId1, sX, sY, sZ,
sCNOT, sCPHASE, sSWAP,
sXCX, sXCY, sXCZ, sYCX, sYCY, sYCZ, sZCX, sZCY, sZCZ,
sZCrY,
# Misc Ops
SparseGate,
sMX, sMY, sMZ, PauliMeasurement, Reset, sMRX, sMRY, sMRZ,
Expand Down Expand Up @@ -504,6 +505,11 @@ operators are tracked as well.
When the constructor is called on an incomplete [`Stabilizer`](@ref) it
automatically calculates the destabilizers and logical operators, following
chapter 4 of [gottesman1997stabilizer](@cite).
Under the hood the conversion uses the [`canonicalize_gott!`](@ref) canonicalization.
That canonicalization permutes the columns of the tableau, but we automatically undo the
column permutation in the preparation of a `MixedDestabilizer` so that qubits are not reindexed.
The boolean keyword arguments `undoperm` and `reportperm` can be used to control this behavior
and to report the permutations explicitly.

See also: [`stabilizerview`](@ref), [`destabilizerview`](@ref), [`logicalxview`](@ref), [`logicalzview`](@ref)
"""
Expand All @@ -513,7 +519,7 @@ mutable struct MixedDestabilizer{T<:Tableau} <: AbstractStabilizer
end

# Added a lot of type assertions to help Julia infer types
function MixedDestabilizer(stab::Stabilizer{T}; undoperm=true) where {T}
function MixedDestabilizer(stab::Stabilizer{T}; undoperm=true, reportperm=false) where {T}
rows,n = size(stab)
stab, r, s, permx, permz = canonicalize_gott!(copy(stab))
t = zero(T, n*2, n)
Expand Down Expand Up @@ -550,8 +556,13 @@ function MixedDestabilizer(stab::Stabilizer{T}; undoperm=true) where {T}
end
if undoperm
t = t[:,invperm(permx[permz])]::T
return MixedDestabilizer(t, r+s)::MixedDestabilizer{T}
end
if reportperm
return (MixedDestabilizer(t, r+s)::MixedDestabilizer{T}, r, permx, permz)
else
return MixedDestabilizer(t, r+s)::MixedDestabilizer{T}
end
MixedDestabilizer(t, r+s)::MixedDestabilizer{T}
end

function MixedDestabilizer(d::Destabilizer, r::Int)
Expand Down
4 changes: 2 additions & 2 deletions src/affectedqubits.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""A method giving the qubits acted upon by a given operation. Part of the Noise interface."""
function affectedqubits end
affectedqubits(g::AbstractSingleQubitOperator) = (g.q)
affectedqubits(g::AbstractSingleQubitOperator) = (g.q,)
affectedqubits(g::AbstractTwoQubitOperator) = (g.q1, g.q2)
affectedqubits(g::NoisyGate) = affectedqubits(g.gate)
affectedqubits(g::NoisyGate) = affectedqubits(g.gate,)
affectedqubits(g::SparseGate) = g.indices
affectedqubits(b::BellMeasurement) = map(m->m.qubit, b.measurements)
affectedqubits(r::Reset) = r.indices
Expand Down
1 change: 1 addition & 0 deletions src/canonicalization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,6 @@ function _canonicalize_gott!(stabilizer::Stabilizer; phases::Val{B}=Val(true)) w
end
zperm, s = gott_standard_form_indices((@view xzs[end÷2+1:end,:]),rows,columns,skip=r)
permute!(stabilizer,zperm)
# we have r+s==rows (or we have trailing rows that are zeroed)
stabilizer, r, s, xperm, zperm
end
Loading