diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d5cc47c..d53e8db88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,11 @@ # News -## v0.9.4 - 2024-06-14 +## v0.9.4 - 2024-06-19 - Addition of a constructor for concatenated quantum codes -- `Concat`. - Addition of multiple unexported classical code constructors. +- Failed compactification of gates now only raises a warning instead of throwing an error. Defaults to slower non-compactified gates. - Gate errors are now conveniently supported by the various ECC benchmark setups in the `ECC` module. - Remove printing of spurious debug info from the PyBP decoder. - Significant improvements to the low-level circuit compiler (the sumtype compactifier), leading to faster Pauli frame simulation of noisy circuits. diff --git a/Project.toml b/Project.toml index 15c21efa5..efbf60078 100644 --- a/Project.toml +++ b/Project.toml @@ -56,7 +56,7 @@ Makie = "0.20, 0.21" Nemo = "0.42, 0.43, 0.44, 0.45" Plots = "1.38.0" PrecompileTools = "1.2" -PyQDecoders = "0.2.0" +PyQDecoders = "0.2.1" Quantikz = "1.3.1" QuantumInterface = "0.3.3" QuantumOpticsBase = "0.4.18" diff --git a/src/pauli_frames.jl b/src/pauli_frames.jl index 0fde80f1c..2a4504c8a 100644 --- a/src/pauli_frames.jl +++ b/src/pauli_frames.jl @@ -175,7 +175,12 @@ function _pftrajectories(circuit;trajectories=5000,threads=true) ccircuit = if eltype(circuit) <: CompactifiedGate circuit else - compactify_circuit(circuit) + try + compactify_circuit(circuit) + catch err + @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])`." + circuit + end end frames = _create_pauliframe(ccircuit; trajectories) nthr = min(Threads.nthreads(),trajectories÷(100)) diff --git a/test/runtests.jl b/test/runtests.jl index 1177d673f..f274479a4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -69,6 +69,7 @@ end @doset "ecc_throws" @doset "precompile" @doset "pauliframe" +@doset "sumtypecompactification" @doset "allocations" VERSION >= v"1.10" && @doset "doctests" get(ENV,"JET_TEST","")=="true" && @doset "jet" diff --git a/test/test_sumtypecompactification.jl b/test/test_sumtypecompactification.jl new file mode 100644 index 000000000..11c902d4e --- /dev/null +++ b/test/test_sumtypecompactification.jl @@ -0,0 +1,7 @@ +using Test +using QuantumClifford + +@testset "SumTypes compactification" begin + @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)]) + QuantumClifford.compactify_circuit([ClassicalXOR{3}((65, 66, 67), 282)]) +end