Skip to content

Commit

Permalink
pretty printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Nov 3, 2024
1 parent fdfbf38 commit 4ddd241
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/nonclifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,24 @@ function _allthreesumtozero(a,b,c)
true
end


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" *
"Moreover, 𝐩𝐫𝐨𝐣𝐞𝐜𝐭! in this library operates as a 'deterministic' method to verify whether a measurement operator commutes with stabilizers.\n\n" *
error("The method `project!` is not applicable for `GeneralizedStabilizer` when measuring the hermitian `PauliOperator`, ℳ.\n\n" *
"The `GeneralizedStabilizer` 𝜏 is updated by measuring = 𝒶⋅𝒹ₘ⋅𝓈ₙ, resulting in the new state 𝜏′ defined as:\n\n" *
" 𝜏′ = ¼(ℐ + ℳ)𝜏(ℐ + ) = (𝜙′, ℬ(𝒮′, 𝒟′)) = 𝛴 𝜙ᵢⱼ' 𝒫ᵢ 𝜌 𝒫ⱼ†,\n\n" *
"where (𝒮′, 𝒟′) is derived from (𝒮, 𝒟) through the traditional stabilizer update, and 𝜙' represents the updated density matrix.\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 `PauliOperator`.\n\n" *
"Specifically, this expectation value is derived from the trace Tr[𝜏′] = Tr[𝜙ᵢⱼ′] in the expression:\n\n" *
" 𝜏′ = 𝛴 𝜙ᵢⱼ' 𝒫ᵢ 𝜌 𝒫ⱼ†,\n\n" *
"where 𝜙ᵢⱼ′ is the updated density matrix. \n\n" *
"The trace Tr[𝜏′] = Tr[𝜙ᵢⱼ′] represents the probability of measuring either 0 or a non-zero outcome and serves as the normalization required for 𝜏′.\n\n" *
"To correctly perform the 'nondeterministic' projection, please use `projectrand!(::GeneralizedStabilizer, ::PauliOperator)`.\n\n" *
"Moreover, `project!` 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.\n\n" *
"𝐍𝐨𝐭𝐞𝐬:\n" *
"- 𝐫𝐨𝐰𝐝𝐞𝐜𝐨𝐦𝐩𝐨𝐬𝐞(𝐌, 𝝉.𝐬𝐭𝐚𝐛): Provides the decomposition of 𝐌 in terms of stabilizer and destabilizer rows of the given tableau of 𝝉.\n\n" *
"- 𝐞𝐱𝐩𝐞𝐜𝐭(𝐌, 𝝉): Returns the updated density matrix 𝛟′, where the trace 𝐓𝐫[𝛟′] provides the expectation value of measuring 𝐌.\n\n")
"Therefore, there are semantic nuances in defining `project!` consistently for `GeneralizedStabilizer`, particularly regarding the interpretations of `anticom` and `res` in this context.\n\n" *
"𝒩𝒪𝒯ℰ𝒮:\n" *
"- `rowdecompose(ℳ, 𝜏.stab)`: Provides the decomposition of in terms of stabilizer and destabilizer rows of the given tableau of 𝜏.\n\n" *
"- `expect(ℳ, 𝜏)`: Returns the updated density matrix 𝜙ᵢⱼ′, where the trace Tr[𝜙ᵢⱼ′] provides the expectation value of measuring .\n\n")

function projectrand!(sm::GeneralizedStabilizer, p::PauliOperator)
eval = expect(p, sm)
Expand Down

0 comments on commit 4ddd241

Please sign in to comment.