Skip to content

Commit

Permalink
polishing docs and tests for sMRZ
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov committed Jun 13, 2023
1 parent 83994fa commit cd7e90d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/misc_ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ end
Be careful, this operation implies first tracing out the qubits, which can lead to mixed states
if these qubits were entangled with the rest of the system.
See also: [`sMZR`](@ref)"""
See also: [`sMRZ`](@ref)"""
struct Reset{T<:Tableau} <: AbstractOperation # TODO simplify type parameters (remove nesting)
resetto::Stabilizer{T}
indices::Vector{Int}
Expand Down
6 changes: 3 additions & 3 deletions src/symbolic_cliffords.jl
Original file line number Diff line number Diff line change
Expand Up @@ -467,23 +467,23 @@ julia> apply!(Register(copy(s)), sMRZ(1)) |> quantumstate # |000⟩ or |011⟩,
- Z_Z
```
See also: [`Reset`](@ref), [`MZ`](@ref)"""
See also: [`Reset`](@ref), [`sMZ`](@ref)"""
struct sMRZ <: AbstractOperation
qubit::Int
bit::Int
end

"""Measure a qubit in the X basis and reset to the |+⟩ state.
See also: [`MRZ`](@ref), [`Reset`](@ref), [`MZ`](@ref)"""
See also: [`sMRZ`](@ref), [`Reset`](@ref), [`sMZ`](@ref)"""
struct sMRX <: AbstractOperation
qubit::Int
bit::Int
end

"""Measure a qubit in the Y basis and reset to the |i₊⟩ state.
See also: [`MRZ`](@ref), [`Reset`](@ref), [`MZ`](@ref)"""
See also: [`sMRZ`](@ref), [`Reset`](@ref), [`sMZ`](@ref)"""
struct sMRY <: AbstractOperation
qubit::Int
bit::Int
Expand Down
2 changes: 1 addition & 1 deletion test/test_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ end
)
@show rep
@test_broken length(JET.get_reports(rep)) == 0 # false positive from https://github.com/aviatesk/JET.jl/issues/444
@test length(JET.get_reports(rep)) <= 1
@test length(JET.get_reports(rep)) <= 2
end
8 changes: 8 additions & 0 deletions test/test_pauliframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,12 @@ end
mf2 = pfmeasurements(pftrajectories(copy(frame), ghz_circuit2))
@test all(0.25.*[1 1 1 0 1 1] .<= sum(ms2, dims=1)./100 .<= 0.75.*[1 1 1 0 1 1])
@test all(0.25.*[1 1 1 0 1 1] .<= sum(mf2, dims=1)./100 .<= 0.75.*[1 1 1 0 1 1])

noncom_circuit = [
sHadamard(1), sMRZ(1,1), sX(1), sMZ(1,2), sMRZ(1,3), sMRZ(1,4), sHadamard(1), sMZ(1,5)
]
ms3 = stack([bitview(mctrajectory!(copy(state), noncom_circuit)[1]) for i in 1:100], dims=1)
mf3 = pfmeasurements(pftrajectories(copy(frame), noncom_circuit))
@test all(0.25.*[1 4 4 0 1 0] .<= sum(ms3, dims=1)./100 .<= 0.75.*[1 2 2 0 1 0])
@test all(0.25.*[1 0 0 0 1 0] .<= sum(mf3, dims=1)./100 .<= 0.75.*[1 0 0 0 1 0])
end

2 comments on commit cd7e90d

@Krastanov
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release Notes:

  • 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).

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/85511

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.5 -m "<description of version>" cd7e90de0fca5cb3d106f5b92481d01547290755
git push origin v0.8.5

Please sign in to comment.