Skip to content

Commit

Permalink
Merge branch 'master' into bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz authored Jan 17, 2025
2 parents 95f2d21 + 0d13791 commit 0e953b6
Show file tree
Hide file tree
Showing 25 changed files with 666 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v4

# restore records from the artifacts
- uses: dawidd6/action-download-artifact@v6
- uses: dawidd6/action-download-artifact@v7
with:
workflow: benchmark.yml
name: performance-tracking
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-julia-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
JULIA_NUM_THREADS: ${{ matrix.threads }}
JET_TEST: ${{ matrix.jet }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
with:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
env:
JULIA_NUM_THREADS: ${{ matrix.threads }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
with:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@

# News

## v0.9.16 - 2024-12-29

- 100× faster unbiased `random_pauli`.
- Enhancements to `GF(2)` Linear Algebra: unexported, experimental `gf2_row_echelon_with_pivots!`, `gf2_nullspace`, `gf2_rowspace_basis`.

## v0.9.15 - 2024-12-22

- `pftrajectories` now supports fast multiqubit measurements with `PauliMeasurement` in addition to the already supported single qubit measurements `sMX/Z/Y` and workarounds like `naive_syndrome_circuit`.

## v0.9.14 - 2024-11-03

- **(fix)** `affectedqubits()` on `sMX`, `sMY`, and `sMR*`
Expand Down Expand Up @@ -75,7 +84,7 @@
- Gate errors are now conveniently supported by the various ECC benchmark setups in the `ECC` module.
- Significant improvements to the low-level circuit compiler (the sumtype compactifier), leading to faster Pauli frame simulation of noisy circuits.
- Bump `QuantumOpticsBase.jl` package extension compat bound.
- **(fix)** Remove printing of spurious debug info from the PyBP decoder.
- **(fix)** Remove printing of spurious debug info from the PyBP decoder.
- **(fix)** Failed compactification of gates now only raises a warning instead of throwing an error. Defaults to slower non-compactified gates.

## v0.9.3 - 2024-04-10
Expand All @@ -93,7 +102,7 @@
- Implemented `iscss` function to identify whether a given code is known to be a CSS (Calderbank-Shor-Steane) code.
- Added the classical Reed-Muller code in the ECC module.
- Added the surface code to the ECC module.

## v0.9.0 - 2024-03-19

- **(breaking)** The defaults in `random_pauli` are now `realphase=true` and `nophase=true`.
Expand Down
8 changes: 4 additions & 4 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 <[email protected]> and QuantumSavory community members"]
version = "0.9.14"
version = "0.9.16"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down Expand Up @@ -48,15 +48,15 @@ Combinatorics = "1.0"
DataStructures = "0.18"
DocStringExtensions = "0.9"
Graphs = "1.9"
Hecke = "0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34"
Hecke = "0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35"
HostCPUFeatures = "0.1.6"
ILog2 = "0.2.3, 1, 2"
InteractiveUtils = "1.9"
LDPCDecoders = "0.3.1"
LinearAlgebra = "1.9"
MacroTools = "0.5.9"
Makie = "0.20, 0.21"
Nemo = "0.42.1, 0.43, 0.44, 0.45, 0.46, 0.47"
Makie = "0.20, 0.21, 0.22"
Nemo = "0.42.1, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48"
Plots = "1.38.0"
PrecompileTools = "1.2"
PyQDecoders = "0.2.1"
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ To install it use:
```

Works efficiently with
[pure](https://quantumsavory.github.io/QuantumClifford.jl/dev/manual/#Stabilizers-1) and
[mixed stabilizer](https://quantumsavory.github.io/QuantumClifford.jl/dev/mixed/#Mixed-Stabilizer-States-1)
[pure](https://qc.quantumsavory.org/dev/stab-algebra-manual/#Stabilizers) and
[mixed stabilizer](https://qc.quantumsavory.org/dev/mixed/#Mixed-Stabilizer-States)
states of thousands of qubits
as well as
[sparse or dense Clifford operations](https://quantumsavory.github.io/QuantumClifford.jl/dev/manual/#Clifford-Operators-1)
[sparse or dense Clifford operations](https://qc.quantumsavory.org/dev/stab-algebra-manual/#Clifford-Operators)
acting upon them.

Implements [Pauli frames](https://quantumsavory.github.io/QuantumClifford.jl/dev/ecc_example_sim/) for fast sampling.
Implements [Pauli frames](https://qc.quantumsavory.org/dev/ecc_example_sim/) for fast sampling.

Provides
[canonicalization](https://quantumsavory.github.io/QuantumClifford.jl/dev/manual/#Canonicalization-of-Stabilizers-1),
[projection](https://quantumsavory.github.io/QuantumClifford.jl/dev/manual/#Projective-Measurements-1), and
[generation](https://quantumsavory.github.io/QuantumClifford.jl/dev/manual/#Generating-a-Pauli-Operator-with-Stabilizer-Generators-1) operations,
[canonicalization](https://qc.quantumsavory.org/dev/stab-algebra-manual/#Canonicalization-of-Stabilizers),
[projection](http://qc.quantumsavory.org/dev/stab-algebra-manual/#Projective-Measurements), and
[generation](https://qc.quantumsavory.org/dev/stab-algebra-manual/#Generating-a-Pauli-Operator-with-Stabilizer-Generators) operations,
as well as
[partial traces](https://quantumsavory.github.io/QuantumClifford.jl/dev/manual/#Partial-Traces-1).
[partial traces](https://qc.quantumsavory.org/dev/stab-algebra-manual/#Partial-Traces).

```jldoctest
julia> P"X" * P"Z"
Expand Down
36 changes: 26 additions & 10 deletions docs/src/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,13 @@ @article{RevModPhys.87.307
}

@misc{goodenough2024bipartiteentanglementnoisystabilizer,
title={Bipartite entanglement of noisy stabilizer states through the lens of stabilizer codes},
title={Bipartite entanglement of noisy stabilizer states through the lens of stabilizer codes},
author={Kenneth Goodenough and Aqil Sajjad and Eneet Kaur and Saikat Guha and Don Towsley},
year={2024},
eprint={2406.02427},
archivePrefix={arXiv},
primaryClass={quant-ph},
url={https://arxiv.org/abs/2406.02427},
url={https://arxiv.org/abs/2406.02427},
}

@article{panteleev2021degenerate,
Expand Down Expand Up @@ -532,7 +532,7 @@ @article{wang2024coprime
}

@misc{voss2024multivariatebicyclecodes,
title={Multivariate Bicycle Codes},
title={Multivariate Bicycle Codes},
author={Lukas Voss and Sim Jian Xian and Tobias Haug and Kishor Bharti},
year={2024},
eprint={2406.19151},
Expand Down Expand Up @@ -562,6 +562,29 @@ @article{haah2011local
year={2011},
}

@article{golay1949notes,
title={Notes on digital coding},
author={Golay, Marcel JE},
journal={Proc. IEEE},
volume={37},
pages={657},
year={1949}
}

@book{huffman2010fundamentals,
title={Fundamentals of error-correcting codes},
author={Huffman, W Cary and Pless, Vera},
year={2010},
publisher={Cambridge university press}
}

@article{bhatia2018mceliece,
title={McEliece cryptosystem based on extended Golay code},
author={Bhatia, Amandeep Singh and Kumar, Ajay},
journal={arXiv preprint arXiv:1811.06246},
year={2018}
}

@article{hamming1950error,
title={Error detecting and error correcting codes},
author={Hamming, Richard W},
Expand All @@ -572,10 +595,3 @@ @article{hamming1950error
year={1950},
publisher={Nokia Bell Labs}
}

@book{huffman2010fundamentals,
title={Fundamentals of error-correcting codes},
author={Huffman, W Cary and Pless, Vera},
year={2010},
publisher={Cambridge university press}
}
3 changes: 3 additions & 0 deletions docs/src/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ For classical code construction routines:
- [bose1960class](@cite)
- [bose1960further](@cite)
- [error2024lin](@cite)
- [golay1949notes](@cite)
- [huffman2010fundamentals](@cite)
- [bhatia2018mceliece](@cite)
- [hamming1950error](@cite)
- [huffman2010fundamentals](@cite)

Expand Down
34 changes: 25 additions & 9 deletions ext/QuantumCliffordHeckeExt/lifted_product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ During the construction, we do arithmetic operations to get the group algebra el
Here `x` is the generator of the group algebra, i.e., offset-1 cyclic permutation, and `GA(1)` is the unit element.
```jldoctest
julia> import Hecke: group_algebra, GF, abelian_group, gens; import LinearAlgebra: diagind;
julia> import Hecke: group_algebra, GF, abelian_group, gens; import LinearAlgebra: diagind; using QuantumClifford.ECC;
julia> l = 63; GA = group_algebra(GF(2), abelian_group(l)); x = gens(GA)[];
Expand All @@ -52,10 +52,12 @@ julia> code_n(c1), code_k(c1)
(882, 24)
```
A [[175, 19, d ≤ 0]] code from Eq. (18) in Appendix A of [raveendran2022finite](@cite),
A [[175, 19, d ≤ 10]] code from Eq. (18) in Appendix A of [raveendran2022finite](@cite),
following the 4th constructor.
```jldoctest
julia> import Hecke; using QuantumClifford.ECC;
julia> base_matrix = [0 0 0 0; 0 1 2 5; 0 6 3 1]; l = 7;
julia> c2 = LPCode(base_matrix, l .- base_matrix', l);
Expand Down Expand Up @@ -162,15 +164,15 @@ Here is an example of a [[56, 28, 2]] 2BGA code from Table 2 of [lin2024quantum]
with direct product of `C₄ x C₂`.
```jldoctest
julia> import Hecke: group_algebra, GF, abelian_group, gens
julia> import Hecke: group_algebra, GF, abelian_group, gens; using QuantumClifford.ECC;
julia> GA = group_algebra(GF(2), abelian_group([14,2]));
julia> x, s = gens(GA);
julia> A = 1 + x^7
julia> A = 1 + x^7;
julia> B = 1 + x^7 + s + x^8 + s*x^7 + x
julia> B = 1 + x^7 + s + x^8 + s*x^7 + x;
julia> c = two_block_group_algebra_codes(A,B);
Expand All @@ -189,7 +191,7 @@ The ECC Zoo has an [entry for this family](https://errorcorrectionzoo.org/c/qcga
A [[756, 16, ≤ 34]] code from Table 3 of [bravyi2024high](@cite):
```jldoctest
julia> import Hecke: group_algebra, GF, abelian_group, gens
julia> import Hecke: group_algebra, GF, abelian_group, gens; using QuantumClifford.ECC;
julia> l=21; m=18;
Expand All @@ -215,10 +217,14 @@ where `𝐺ᵣ = ℤ/l₁ × ℤ/l₂ × ... × ℤ/lᵣ`.
A [[48, 4, 6]] Weight-6 TB-QLDPC code from Appendix A Table 2 of [voss2024multivariatebicyclecodes](@cite).
```jldoctest
julia> import Hecke: group_algebra, GF, abelian_group, gens; # hide
julia> import Hecke: group_algebra, GF, abelian_group, gens; using QuantumClifford.ECC;
julia> l=4; m=6;
julia> GA = group_algebra(GF(2), abelian_group([l, m]));
julia> x, y = gens(GA);
julia> z = x*y;
julia> A = x^3 + y^5;
Expand All @@ -238,10 +244,10 @@ where `𝑙` and `𝑚` are coprime, and can be expressed as univariate polynomi
with generator `𝜋 = 𝑥𝑦`. They can be viewed as a special case of Lifted Product construction
based on abelian group `ℤₗ x ℤₘ` where `ℤⱼ` cyclic group of order `j`.
[108, 12, 6]] coprime-bivariate bicycle (BB) code from Table 2 of [wang2024coprime](@cite).
[[108, 12, 6]] coprime-bivariate bicycle (BB) code from Table 2 of [wang2024coprime](@cite).
```jldoctest
julia> import Hecke: group_algebra, GF, abelian_group, gens;
julia> import Hecke: group_algebra, GF, abelian_group, gens; using QuantumClifford.ECC;
julia> l=2; m=27;
Expand All @@ -252,6 +258,10 @@ julia> 𝜋 = gens(GA)[1];
julia> A = 𝜋^2 + 𝜋^5 + 𝜋^44;
julia> B = 𝜋^8 + 𝜋^14 + 𝜋^47;
julia> c = two_block_group_algebra_codes(A, B);
julia> code_n(c), code_k(c)
(108, 12)
```
Expand All @@ -271,6 +281,8 @@ See also: [`two_block_group_algebra_codes`](@ref), [`bicycle_codes`](@ref).
A [[254, 28, 14 ≤ d ≤ 20]] code from (A1) in Appendix B of [panteleev2021degenerate](@cite).
```jldoctest
julia> import Hecke; using QuantumClifford.ECC
julia> c = generalized_bicycle_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 127);
julia> code_n(c), code_k(c)
Expand All @@ -281,6 +293,8 @@ An [[70, 8, 10]] *abelian* 2BGA code from Table 1 of [lin2024quantum](@cite), wi
order `l = 35`, illustrates that *abelian* 2BGA codes can be viewed as GB codes.
```jldoctest
julia> import Hecke; using QuantumClifford.ECC
julia> l = 35;
julia> c1 = generalized_bicycle_codes([0, 15, 16, 18], [0, 1, 24, 27], l);
Expand Down Expand Up @@ -317,6 +331,8 @@ code with the group `G = ℤ₃ˣ³` corresponds to a cubic code.
The ECC Zoo has an [entry for this family](https://errorcorrectionzoo.org/c/haah_cubic).
```jldoctest
julia> import Hecke; using QuantumClifford.ECC;
julia> c = haah_cubic_codes([0, 15, 20, 28, 66], [0, 58, 59, 100, 121], 6);
julia> code_n(c), code_k(c)
Expand Down
63 changes: 63 additions & 0 deletions src/QuantumClifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,69 @@ function gf2_H_to_G(H)
G[:,invperm(sindx)]
end

"""Performs in-place Gaussian elimination on a binary matrix and returns
its *row echelon form*,*rank*, the *transformation matrix*, and the *pivot
columns*. The transformation matrix that converts the original matrix into
the row echelon form. The `full` parameter controls the extent of elimination:
if `true`, only rows below the pivot are affected; if `false`, both above and
below the pivot are eliminated."""
function gf2_row_echelon_with_pivots!(M::AbstractMatrix{Int}; full=false)
r, c = size(M)
N = Matrix{Int}(LinearAlgebra.I, r, r)
p = 1
pivots = Int[]
for col in 1:c
@inbounds for row in p:r
if M[row, col] == 1
if row != p
M[[row, p], :] .= M[[p, row], :]
N[[row, p], :] .= N[[p, row], :]
end
break
end
end
if M[p, col] == 1
if !full
elim_range = p+1:r
else
elim_range = 1:r
end
@simd for j in elim_range
@inbounds if j != p && M[j, col] == 1
M[j, :] .= (M[j, :] .+ M[p, :]) .% 2
N[j, :] .= (N[j, :] .+ N[p, :]) .% 2
end
end
p += 1
push!(pivots, col)
end
if p > r
break
end
end
rank = p - 1
return M, rank, N, pivots
end

"""The nullspace of a binary matrix."""
function gf2_nullspace(H::AbstractMatrix{Int})
m = size(H',1)
_, matrix_rank, transformation_matrix, _ = gf2_row_echelon_with_pivots!(copy(H)')
if m == matrix_rank
# By the rank-nullity theorem, if rank(M) = m, then nullity(M) = 0
return zeros(Bool, 1, m)
end
# Extract the nullspace from the transformation matrix
return transformation_matrix[matrix_rank+1:end, :]
end

"""The basis for the row space of the binary matrix."""
function gf2_rowspace_basis(H::AbstractMatrix{Int})
pivots = gf2_row_echelon_with_pivots!(copy(H)')[4]
# Extract the rows corresponding to the pivot columns
H[pivots,:]
end

##############################
# Error classes
##############################
Expand Down
1 change: 1 addition & 0 deletions src/ecc/ECC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ include("codes/quantumreedmuller.jl")
include("codes/classical/reedmuller.jl")
include("codes/classical/recursivereedmuller.jl")
include("codes/classical/bch.jl")
include("codes/classical/golay.jl")
include("codes/classical/hamming.jl")

# qLDPC
Expand Down
Loading

0 comments on commit 0e953b6

Please sign in to comment.