Description
After merging the master into the piecewise-graphstate branch, I noticed that observable
behaves unexpected when using StabilizerState
in QuantumOpticsRepr
. This could be related to #212.
In the below example I execute a simple protocol that generates a "ZZX XIZ IXZ" state: First, Alice and Bob share three bell pairs in the beginning. Alice then applies the necessary CZ gates and projects the state onto Bob.
When staying in CliffordRepr
everything works as expected. When switching to the full dm, observable
still returns the correct fidelity when using projector(Ket(Stabilizer(graph)))
, however, it returns a lower fidelity when using projector(StabilizerState(Stabilizer(graph)))
. This is surprising, as these projectors are equivalent (projector(Ket(Stabilizer(graph))) == express(projector(StabilizerState(Stabilizer(graph))))
returns true
)
Expected behavior
The result of observable
should always be 1.
Minimal Reproducible Example 👇
using QuantumSavory
using QuantumClifford
bg = QuantumOpticsRepr() # or CliffordRepr()
regA = Register([Qubit() for _ in 1:3], [bg for _ in 1:3]) # Alice
regB = Register([Qubit() for _ in 1:3], [bg for _ in 1:3]) # Bob
net = RegisterNet([regA, regB])
# Alice and Bob share three bell pairs
bell = StabilizerState("XX ZZ")
for i in 1:3
initialize!((net[1][i], net[2][i]), bell)
end
# Alice applies CZ gates to create "ZZX XIZ IXZ" and measures in X
pm = 3 # "piecemaker"
for i in [1,2]
apply!((net[1][pm], net[1][i]), ZCZ)
end
for i in 1:3
zmeas = project_traceout!(net[1][i], X)
if zmeas==2 apply!(net[2][i], Z) end # Bob applies correction immediately after Alice's measurement (ftl)
end
# Reference graph - did they create the correct graph state?
graph = Graph()
add_vertices!(graph, 3)
add_edge!(graph, (1, pm))
add_edge!(graph, (2, pm))
@info "STABILIZER" Stabilizer(graph)
# Calculate fidelity
@info"PROJECTORS THE SAME?", projector(Ket(Stabilizer(graph))) == express(projector(StabilizerState(Stabilizer(graph))))
# using `StabilizerState`
# this only works as expected when using `CliffordRepr` (it should be 1 and is 1) but does not when using `QuantumOpticsRepr` (is 0.25
fidel = real(observable(net[2][1:3], projector(StabilizerState(Stabilizer(graph)))))
@info fidel
# addition check using `Ket`
if bg == QuantumOpticsRepr() # this naturally cannot be used with `CliffordRepr`
fidel = real(observable(net[2][1:3], projector(Ket(Stabilizer(graph))))) # works as expected (should be 1 and is 1)
@info fidel
end
output bg = QuantumOpticsRepr()
┌ Info: STABILIZER
│ Stabilizer(graph) =
│ + X_Z
│ + _XZ
└ + ZZX
[ Info: ("PROJECTORS THE SAME?", true)
[ Info: 0.2499999999999999
[ Info: 0.9999999999999999
output bg = CliffordRepr()
┌ Info: STABILIZER
│ Stabilizer(graph) =
│ + X_Z
│ + _XZ
└ + ZZX
[ Info: ("PROJECTORS THE SAME?", true)
[ Info: 1.0
Environment:
- Output of
using Pkg; Pkg.status()
Status `~/QuantumSavory.jl/examples/graphstateswitch/Project.toml`
[c7e460c6] ArgParse v1.2.0
[336ed68f] CSV v0.10.15
[861a8166] Combinatorics v1.0.2
[6ed1e86c] ConcurrentSim v1.5.0
[8f4d0f93] Conda v1.10.2
[a93c6f00] DataFrames v1.7.0
[31c24e10] Distributions v0.25.119
[bd48cda9] GraphRecipes v0.5.13
[86223c79] Graphs v1.12.1
[c8e1da08] IterTools v1.10.0
[b964fa9f] LaTeXStrings v1.4.0
[46757867] NetworkLayout v0.4.10
[f0f68f2c] PlotlyJS v0.18.16
[91a5bcdd] Plots v1.40.13
[438e738f] PyCall v1.96.4
[0525e862] QuantumClifford v0.9.19
[5717a53b] QuantumInterface v0.3.10
[4f57444f] QuantumOpticsBase v0.5.7
[2de2e421] QuantumSavory v0.6.0 `../..`
[efa7fd63] QuantumSymbolics v0.4.9
[158674fc] ReinforcementLearning v0.11.0
[c5292f4c] ResumableFunctions v1.0.3
[295af30f] Revise v3.7.6
[2913bbd2] StatsBase v0.34.4
[f3b207a7] StatsPlots v0.15.7
[ddb6d928] YAML v0.4.13
[8dfed614] Test v1.11.0
Git Log:
commit 3e966fa8831a7123dacaa0034b0999c5aa80c586 (HEAD -> piecewise-graphstate, origin/piecewise-graphstate)
Merge: efadd11 6533bfa
Author: Luise Prielinger <[email protected]>
Date: Tue May 6 13:10:05 2025 +0200
Merge branch 'master' into piecewise-graphstate
commit efadd11495a8bba818c812aa676c613965a6f4fd
Author: Luise Prielinger <[email protected]>
Date: Tue May 6 13:01:14 2025 +0200
added locks to simplified protocols
commit 6533bfa27453836ad9075abc03e9f76d607e296c (origin/master, origin/HEAD, master)
Author: Stefan Krastanov <[email protected]>
Date: Tue Apr 29 15:23:56 2025 -0400