Closed amicciche closed 2 months ago
Attention: Patch coverage is 2.77778%
with 35 lines
in your changes missing coverage. Please review.
Project coverage is 82.24%. Comparing base (
1fb1783
) to head (e6548f9
).
Files | Patch % | Lines |
---|---|---|
src/noise.jl | 0.00% | 18 Missing :warning: |
src/pauli_frames.jl | 0.00% | 17 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'm now having this error when I try to use QuantumClifford:
yeah, tests fail, so I have definitely done something silly. Should have waited for tests to pass before pinging you
it is fixed now
The applynoise!()
that takes a PauliFrame
seems to work correctly, however with the way the constructors are written for PauliError
, one can't do something like the following (which will probably a common enough case to warrant fixing):
I tried to fix this by changing Integer to Real on line 37 of noise.jl, but this caused an error. Here:
What error did the change to Real cause?
marking this as a draft just to make my review queue a bit more manageable. Mark it as finished when ready for review.
What error did the change to Real cause?
When I change it to Real:
I get this error:
Float is a Real so when you do PauliNoise(x::Real, y::Real, z::Real) = PauliNoise(float(x), float(y), float(z))
you end up with infinite recursion.
A cleaner solution than both what I have written and what you have written is to specify the type for the constructor:
julia> struct A{T} a::T end
julia> A(a::Real) = A{Float64}(a)
A
julia> A(1)
A{Float64}(1.0)
Or even better, something that does not hardcode Float64
julia> struct A{T} a::T end
julia> function A(a::Real)
a = float(a)
return A{typeof(a)}(a)
end
A
julia> A(1)
A{Float64}(1.0)
julia> A(BigInt(1))
A{BigFloat}(1.0)
So the cleanest solution should be something along the lines of
function PauliNoise(px::Real, py::Real, pz::Real)
px, py, pz = float.((px, py, pz))
px, py, pz = promote(px, py, pz)
T = typeof(px)
return PauliNoise{T}(px, py, pz)
end
Ah, I see! I'll try to fix this later today, using what you suggested, thanks!
Your code worked as provided! Thanks! With that, I think everything works. I checked for a few codes that doing PauliError(qubit, p) after decoding results in the same logical vs physical error rate plots as PauliError(qubit, p/3, p/3, p/3). For some CSS codes, I also checked that the X and Z logical error corresponding to those simulations also matches doing PauliError(qubit, p*2/3, 0, 0) and PauliError(qubit, 0, 0, p*2/3) correspondingly (and the other X/Z logical error is 0). Similarly, PauliError(qubit, 0, p*2/3, 0) gives the same performance as PauliError(qubit, p).
This is the code that was mentioned in our Zulip messages. One note, it seemed to be that line 41 in the noise.jl,
n = nqubits(s)
wasn't doing anything, so I went ahead and deleted that in addition to the functions I added.As mentioned over Zulip, because of the error, this code is untested, aside from being able to generate the object from the Julia REPL.