diff --git a/src/nonclifford.jl b/src/nonclifford.jl index c601db748..710b4fd9e 100644 --- a/src/nonclifford.jl +++ b/src/nonclifford.jl @@ -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)