Skip to content

Commit

Permalink
noncliff: better error message for inapplicable project! of Generaliz…
Browse files Browse the repository at this point in the history
…edStabilizer
  • Loading branch information
Fe-r-oz committed Nov 3, 2024
1 parent 78d4430 commit 393e59a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/nonclifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,29 @@ function _allthreesumtozero(a,b,c)
true
end

function project!(sm::GeneralizedStabilizer, p::PauliOperator)
project!(::GeneralizedStabilizer, ::PauliOperator) =
error("The method `𝐩𝐫𝐨𝐣𝐞𝐜𝐭!` is not applicable for `𝐆𝐞𝐧𝐞𝐫𝐚𝐥𝐢𝐳𝐞𝐝𝐒𝐭𝐚𝐛𝐢𝐥𝐢𝐳𝐞𝐫` with hermitian `𝐏𝐚𝐮𝐥𝐢𝐎𝐩𝐞𝐫𝐚𝐭𝐨𝐫`, 𝐌.\n\n" *
"The `𝐆𝐞𝐧𝐞𝐫𝐚𝐥𝐢𝐳𝐞𝐝𝐒𝐭𝐚𝐛𝐢𝐥𝐢𝐳𝐞𝐫` 𝝉 is updated by measuring 𝐌 = 𝒶𝒹ₘ𝓈ₙ, resulting in the new state 𝝉′ defined as:\n\n" *
" 𝝉′ = ¼(𝐈 + 𝐌)𝝉(𝐈 + 𝐌) = (𝝌′, 𝐁(𝐒′, 𝐃′)),\n\n" *
"where (𝐒′, 𝐃′) is derived from (𝐒, 𝐃) through the traditional stabilizer update.\n\n" *
"Note that ¼(𝐈 − 𝐌)𝝉(𝐈 − 𝐌) can be obtained by changing the sign of 𝒶.\n\n" *
"This projection requires a probabilistic approach, as measurement outcomes depend on the expectation value of the `𝐏𝐚𝐮𝐥𝐢𝐎𝐩𝐞𝐫𝐚𝐭𝐨𝐫`.\n\n" *
"Specifically, this expectation value is derived from the trace 𝐓𝐫[𝝉′] = 𝐓𝐫[𝝌′] in the expression:\n\n" *
" 𝝉′ = 𝚺 𝝌'ᵢⱼ 𝐏ᵢ 𝛒 𝐏ⱼ†,\n\n" *
"where 𝝌′ is the updated density matrix. \n\n" *
"The trace 𝐓𝐫[𝝉′] = 𝐓𝐫[𝝌′] represents the probability of measuring either 𝟬 or a non-zero outcome and serves as the normalization required for 𝝉′.\n\n" *
"To correctly perform the 'nondeterministic' projection, please use `𝐩𝐫𝐨𝐣𝐞𝐜𝐭𝐫𝐚𝐧𝐝!(::𝐆𝐞𝐧𝐞𝐫𝐚𝐥𝐢𝐳𝐞𝐝𝐒𝐭𝐚𝐛𝐢𝐥𝐢𝐳𝐞𝐫, ::𝐏𝐚𝐮𝐥𝐢𝐎𝐩𝐞𝐫𝐚𝐭𝐨𝐫)`.\n\n" *
"`𝐩𝐫𝐨𝐣𝐞𝐜𝐭!` in this library operates as a 'deterministic' method to verify whether a measurement operator commutes with stabilizers.\n\n" *
"Based on this commutation, it executes additional steps to determine the resultant state after projection.\n\n" *
"Therefore, there are semantic nuances in defining `𝐩𝐫𝐨𝐣𝐞𝐜𝐭!` consistently for `𝐆𝐞𝐧𝐞𝐫𝐚𝐥𝐢𝐳𝐞𝐝𝐒𝐭𝐚𝐛𝐢𝐥𝐢𝐳𝐞𝐫`, particularly regarding the interpretations of `𝐚𝐧𝐭𝐢𝐜𝐨𝐦` and `𝐫𝐞𝐬` in this context.")

function projectrand!(sm::GeneralizedStabilizer, p::PauliOperator)
eval = expect(p, sm)
prob₁ = (real(eval)+1)/2
error("This functionality is not implemented yet")
end

function _proj₋(sm::GeneralizedStabilizer, p::PauliOperator)
end
function _proj₊(sm::GeneralizedStabilizer, p::PauliOperator)
function _proj(sm::GeneralizedStabilizer, p::PauliOperator)
end

nqubits(sm::GeneralizedStabilizer) = nqubits(sm.stab)
Expand Down

0 comments on commit 393e59a

Please sign in to comment.