diff --git a/CHANGELOG.md b/CHANGELOG.md index c81fd760e..630597930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ # News -## v0.8.5 - dev +## v0.8.6 - 2023-06-20 + +- Fixes to Quantikz circuit plotting of empty circuits and `PauliOperator` + +## v0.8.5 - 2023-06-13 - Internal helper method `mul_right!` is now available for right Pauli inplace multiplication. - Implemented `sMRZ` to reset single qubits to the |0⟩ (and respectively `sMRX` and `sMRY`). diff --git a/Project.toml b/Project.toml index 1ba6182c9..e49adab05 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "QuantumClifford" uuid = "0525e862-1e90-11e9-3e4d-1b39d7109de1" authors = ["Stefan Krastanov "] -version = "0.8.5" +version = "0.8.6" [deps] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/ext/QuantumCliffordQuantikzExt/QuantumCliffordQuantikzExt.jl b/ext/QuantumCliffordQuantikzExt/QuantumCliffordQuantikzExt.jl index c0768e947..db9ea6d04 100644 --- a/ext/QuantumCliffordQuantikzExt/QuantumCliffordQuantikzExt.jl +++ b/ext/QuantumCliffordQuantikzExt/QuantumCliffordQuantikzExt.jl @@ -20,6 +20,7 @@ function Quantikz.QuantikzOp(op::SparseGate) end end Quantikz.QuantikzOp(op::AbstractOperation) = Quantikz.MultiControlU(affectedqubits(op)) +Quantikz.QuantikzOp(op::PauliOperator) = Quantikz.MultiControlU("\\begin{array}{c}$(lstring(op))\\end{array}", affectedqubits(op)) Quantikz.QuantikzOp(op::sId1) = Quantikz.Id(affectedqubits(op)...) function Quantikz.QuantikzOp(op::AbstractSingleQubitOperator) T = typeof(op) @@ -83,8 +84,13 @@ function lstring(stab::Stabilizer) v = join(("\\mathtt{$(replace(string(p),"_"=>"I"))}" for p in stab),"\\\\") end -Base.show(io::IO, mime::MIME"image/png", circuit::AbstractVector{<:AbstractOperation}; scale=1, kw...) = - show(io, mime, [Quantikz.QuantikzOp(c) for c in circuit]; scale=scale, kw...) +function Base.show(io::IO, mime::MIME"image/png", circuit::AbstractVector{<:AbstractOperation}; scale=1, kw...) + if length(circuit)==0 + show(io, mime, [Quantikz.Id(1)]; scale=scale, kw...) + else + show(io, mime, [Quantikz.QuantikzOp(c) for c in circuit]; scale=scale, kw...) + end +end Base.show(io::IO, mime::MIME"image/png", gate::T; scale=1, kw...) where T<:AbstractOperation = show(io, mime, Quantikz.QuantikzOp(gate); scale=scale, kw...) diff --git a/src/affectedqubits.jl b/src/affectedqubits.jl index f8e6c7694..712a7f712 100644 --- a/src/affectedqubits.jl +++ b/src/affectedqubits.jl @@ -8,4 +8,5 @@ affectedqubits(b::BellMeasurement) = [m.qubit for m in b.measurements] affectedqubits(r::Reset) = r.indices affectedqubits(n::NoiseOp) = n.indices affectedqubits(g::PauliMeasurement) = 1:length(g.pauli) +affectedqubits(p::PauliOperator) = 1:length(p) affectedqubits(m::AbstractMeasurement) = [m.qubit]