-
Notifications
You must be signed in to change notification settings - Fork 76
Add DepolarizedBellPair #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
78ff6e7
Add depolirzed state
hanakl 6fdecff
add test
hanakl cc3e35d
Replace noisy_pair_func
hanakl 46bd93d
Use shorthand keyword argument in noisy_pair_func
hanakl 320a697
Changes to DepolarizedBellPair
hanakl 3ab7dd1
Use DepolarizedBellPair in examples and tests
hanakl 0e0ddca
Merge remote-tracking branch 'origin/master' into hana_depolarized_state
hanakl d74e47a
Change test names
hanakl 9ba0bc4
Add description to CHANGELOG.md
hanakl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| """ | ||
| $TYPEDEF | ||
|
|
||
| Fields: | ||
|
|
||
| $FIELDS | ||
|
|
||
| A symbolic representation of the depolarized |Φ⁺⟩ = (|00⟩+|11⟩)/√2 Bell state: | ||
| `p |Φ⁺⟩⟨Φ⁺| + (1-p) I/4` | ||
|
|
||
| where `I/4` is the two-qubit maximally mixed state. | ||
|
|
||
| The fidelity `F = ⟨Φ⁺|ρ|Φ⁺⟩` relates to the depolarization parameter by: | ||
| - `F = (3p + 1) / 4` | ||
| - `p = (4F - 1) / 3` | ||
|
|
||
| Can be constructed from either parameter: | ||
| - `DepolarizedBellPair(p)` — depolarization parameter `p ∈ [0, 1]` | ||
| - `DepolarizedBellPair(F=F)` — from fidelity `F ∈ [1/4, 1]` | ||
| """ | ||
| @withmetadata struct DepolarizedBellPair <: AbstractTwoQubitState | ||
| """Depolarization parameter `p ∈ [0, 1]`, related to fidelity by `F = (3p+1)/4`""" | ||
| p | ||
| end | ||
|
|
||
| DepolarizedBellPair(; F) = DepolarizedBellPair((4 * F - 1) / 3) | ||
|
|
||
| stateparameters(::Type{DepolarizedBellPair}) = (:p,) | ||
| stateparametersrange(::Type{DepolarizedBellPair}) = (p=(;min=0,max=1,good=1),) | ||
|
|
||
| symbollabel(x::DepolarizedBellPair) = "ρᵖ" | ||
|
|
||
| function express_nolookup(x::DepolarizedBellPair, r::QuantumOpticsRepr) | ||
| pure_dm = SProjector((Z1⊗Z1 + Z2⊗Z2) / sqrt(2)) | ||
| mixed_dm = MixedState(pure_dm) | ||
| return express(x.p*pure_dm + (1-x.p)*mixed_dm, r) | ||
| end | ||
|
|
||
| function express_nolookup(x::DepolarizedBellPair, r::CliffordRepr) | ||
| pure_dm = SProjector(StabilizerState("ZZ XX")) | ||
| mixed_dm = MixedState(StabilizerState("ZZ XX")) | ||
| return express(x.p * pure_dm + (1 - x.p) * mixed_dm, r) | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| @testitem "StatesZoo DepolarizedBellPair" begin | ||
| using Test | ||
| using QuantumSavory | ||
| using QuantumSavory.StatesZoo | ||
| using QuantumOpticsBase | ||
| using QuantumClifford | ||
| using LinearAlgebra | ||
|
|
||
| # p-constructor and fidelity-constructor consistency | ||
| p = 0.7 | ||
| F = (3p + 1) / 4 | ||
| s_from_p = DepolarizedBellPair(p) | ||
| s_from_F = DepolarizedBellPair(F=F) | ||
| @test express(s_from_p) ≈ express(s_from_F) | ||
|
|
||
| # trace is 1 for any p | ||
| for p in [0.0, 0.5, 1.0] | ||
| dm = express(DepolarizedBellPair(p)) | ||
| @test tr(dm) ≈ 1 | ||
| end | ||
|
|
||
| # at p=1, pure Bell state: ⟨ZZ⟩ = 1 | ||
| reg = Register(2) | ||
| initialize!(reg[1:2], DepolarizedBellPair(1.0)) | ||
| @test observable(reg[1:2], QuantumSymbolics.Z⊗QuantumSymbolics.Z) ≈ 1 | ||
| reg_c = Register(2, CliffordRepr()) | ||
| initialize!(reg_c[1:2], DepolarizedBellPair(1.0)) | ||
| @test observable(reg_c[1:2], QuantumSymbolics.Z⊗QuantumSymbolics.Z) ≈ 1 | ||
|
|
||
| # at p=0, maximally mixed: density matrix = I/4 | ||
| dm_mixed = express(DepolarizedBellPair(0.0)) | ||
| @test dm_mixed.data ≈ LinearAlgebra.I / 4 | ||
|
|
||
| # fidelity-to-p and p-to-fidelity roundtrip | ||
| for F in [0.25, 0.5, 0.75, 1.0] | ||
| p_rt = (4F - 1) / 3 | ||
| @test (3p_rt + 1) / 4 ≈ F | ||
| dm = express(DepolarizedBellPair(F=F)) | ||
| @test tr(dm) ≈ 1 | ||
| end | ||
|
|
||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.