Skip to content

Commit 1636f2a

Browse files
authored
Merge pull request #296 from QuantumSavory/compactificationwarning
warning on failed compactification
2 parents 901b7b2 + ca36dcc commit 1636f2a

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66
# News
77

8-
## v0.9.4 - 2024-06-14
8+
## v0.9.4 - 2024-06-19
99

1010
- Addition of a constructor for concatenated quantum codes -- `Concat`.
1111
- Addition of multiple unexported classical code constructors.
12+
- Failed compactification of gates now only raises a warning instead of throwing an error. Defaults to slower non-compactified gates.
1213
- Gate errors are now conveniently supported by the various ECC benchmark setups in the `ECC` module.
1314
- Remove printing of spurious debug info from the PyBP decoder.
1415
- Significant improvements to the low-level circuit compiler (the sumtype compactifier), leading to faster Pauli frame simulation of noisy circuits.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Makie = "0.20, 0.21"
5656
Nemo = "0.42, 0.43, 0.44, 0.45"
5757
Plots = "1.38.0"
5858
PrecompileTools = "1.2"
59-
PyQDecoders = "0.2.0"
59+
PyQDecoders = "0.2.1"
6060
Quantikz = "1.3.1"
6161
QuantumInterface = "0.3.3"
6262
QuantumOpticsBase = "0.4.18"

src/pauli_frames.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ function _pftrajectories(circuit;trajectories=5000,threads=true)
175175
ccircuit = if eltype(circuit) <: CompactifiedGate
176176
circuit
177177
else
178-
compactify_circuit(circuit)
178+
try
179+
compactify_circuit(circuit)
180+
catch err
181+
@warn "Could not compactify the circuit, falling back to a slower version of the simulation. Consider reporting this issue to the package maintainers to improve performance. The offending gate was `$(err.args[2])`."
182+
circuit
183+
end
179184
end
180185
frames = _create_pauliframe(ccircuit; trajectories)
181186
nthr = min(Threads.nthreads(),trajectories÷(100))

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ end
6969
@doset "ecc_throws"
7070
@doset "precompile"
7171
@doset "pauliframe"
72+
@doset "sumtypecompactification"
7273
@doset "allocations"
7374
VERSION >= v"1.10" && @doset "doctests"
7475
get(ENV,"JET_TEST","")=="true" && @doset "jet"

test/test_sumtypecompactification.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using Test
2+
using QuantumClifford
3+
4+
@testset "SumTypes compactification" begin
5+
@test_warn "Could not compactify the circuit" QuantumClifford.pftrajectories([ClassicalXOR{17}((65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81), 282)])
6+
QuantumClifford.compactify_circuit([ClassicalXOR{3}((65, 66, 67), 282)])
7+
end

0 commit comments

Comments
 (0)