From c04c01c36befd824e372158a5a3063b08ec460a4 Mon Sep 17 00:00:00 2001 From: Stefan Krastanov Date: Mon, 15 Aug 2022 11:55:36 -0400 Subject: [PATCH] clean up from JET tests Signed-off-by: Stefan Krastanov --- CHANGELOG.md | 4 ++-- Project.toml | 2 +- src/QuantumClifford.jl | 5 ++--- src/experimental/NoisyCircuits.jl | 10 +--------- src/project_trace_reset.jl | 2 ++ test/test_jet.jl | 1 + 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d5ba2811..22a4f487b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # News -## v0.5.8 - dev +## v0.5.8 -- Implement `projectremoverand!` which besides performing a projective measurement lik `projectrand!` also removed the measured qubit from the tableau, returning a smaller tableau. Not yet exported in public API. +- Implement `projectremoverand!` which besides performing a projective measurement like `projectrand!` also removes the measured qubit from the tableau, returning a smaller tableau. Not yet exported in public API. ## v0.5.7 - 2022-07-24 diff --git a/Project.toml b/Project.toml index 3ba067e06..76435f792 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "QuantumClifford" uuid = "0525e862-1e90-11e9-3e4d-1b39d7109de1" authors = ["Stefan Krastanov "] -version = "0.5.8-dev" +version = "0.5.8" [deps] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/src/QuantumClifford.jl b/src/QuantumClifford.jl index 83853b86b..cb6aa33cd 100644 --- a/src/QuantumClifford.jl +++ b/src/QuantumClifford.jl @@ -471,7 +471,7 @@ Stabilizer{Vector{UInt8}, Matrix{UInt64}} See also: [`stabilizerview`](@ref), [`destabilizerview`](@ref), [`logicalxview`](@ref), [`logicalzview`](@ref) """ -tab(s::Stabilizer) = s +tab(s::Stabilizer{V,T}) where {V,T} = s tab(s::AbstractStabilizer) = s.tab ############################## @@ -669,8 +669,7 @@ Base.copy(d::MixedDestabilizer) = MixedDestabilizer(copy(d.tab),d.rank) @inline logicalzview(s::MixedDestabilizer) = @view s.tab[end÷2+s.rank+1:end] """The number of qubits of a given state.""" -@inline nqubits(s::Stabilizer) = s.nqubits -@inline nqubits(s::AbstractStabilizer) = s.tab.nqubits +@inline nqubits(s::AbstractStabilizer) = tab(s).nqubits ############################## # Pauli Operator Helpers diff --git a/src/experimental/NoisyCircuits.jl b/src/experimental/NoisyCircuits.jl index f6513495f..eb0addd8a 100644 --- a/src/experimental/NoisyCircuits.jl +++ b/src/experimental/NoisyCircuits.jl @@ -214,15 +214,7 @@ function mctrajectory!(state,circuit) return state, continue_stat end -function countmap(samples::Vector{CircuitStatus}) # A simpler version of StatsBase.countmap, because StatsBase is slow to import - #= - T = eltype(samples) - counts = Dict{T,Int} - for s in samples - counts[s] = get(counts, s, 0)+1 - end - counts - =# +function countmap(samples::Vector{CircuitStatus}) # A simpler faster version of StatsBase.countmap counts = zeros(length(registered_statuses)) for s in samples counts[s.status] += 1 diff --git a/src/project_trace_reset.jl b/src/project_trace_reset.jl index 5a60f2ff3..33ec798e0 100644 --- a/src/project_trace_reset.jl +++ b/src/project_trace_reset.jl @@ -828,6 +828,7 @@ function _remove_rowcol!(s::MixedDestabilizer, r,c) MixedDestabilizer(Stabilizer((@view t.phases[1:end-2]),cols-1,(@view t.xzs[:,1:end-2])), newrank) end +#= """Unexported low-level function that projects a qubit and returns the result while making the tableau smaller by a qubit. Because MixedDestabilizer is not mutable we return a new MixedDestabilizer with the same (modified) xzs array. @@ -835,6 +836,7 @@ Because MixedDestabilizer is not mutable we return a new MixedDestabilizer with function projectremove!(s::MixedDestabilizer, projfunc::F, qubit) where {F<:Union{typeof(projectX!),typeof(projectY!),typeof(projectZ!)}} error("can not be implemented in the style of project!, because one can not change `res` after the row has been removed") end +=# """Unexported low-level function that projects a qubit and returns the result while making the tableau smaller by a qubit. diff --git a/test/test_jet.jl b/test/test_jet.jl index 957817dee..9891672cc 100644 --- a/test/test_jet.jl +++ b/test/test_jet.jl @@ -1,6 +1,7 @@ using JET using ArrayInterface using Static +using Graphs function test_jet() @testset "JET checks" begin