QuantumClifford.QuantumClifford
— ModuleA module for using the Stabilizer formalism and simulating Clifford circuits.
diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index acdab7ae8..747dbde9f 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-27T17:54:29","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.0","generation_timestamp":"2024-10-09T21:59:52","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/API/index.html b/dev/API/index.html index bf14f106d..6be3b7746 100644 --- a/dev/API/index.html +++ b/dev/API/index.html @@ -4,7 +4,7 @@ padding-top: 0 !important; padding-bottom: 0 !important; } -
Stabilizer states can be represented with the Stabilizer
, Destabilizer
, MixedStabilizer
, and MixedDestabilizer
tableau data structures. You probably want to use MixedDestabilizer
which supports the widest set of operations.
Moreover, a MixedDestabilizer
can be stored inside a Register
together with a set of classical bits in which measurement results can be written.
Lastly, for Pauli frame simulations there is the PauliFrame
type, a tableau in which each row represents a different Pauli frame.
There are convenience constructors for common types of states and operators.
Acting on quantum states can be performed either:
apply!
function. Particularly useful for Monte Carlo simulations and Perturbative Expansion Symbolic Results.See the full list of operations for a list of implemented operations.
QuantumClifford.QuantumClifford
— ModuleA module for using the Stabilizer formalism and simulating Clifford circuits.
QuantumClifford.continue_stat
— ConstantReturned by applywstatus!
if the circuit simulation should continue.
QuantumClifford.failure_stat
— ConstantReturned by applywstatus!
if the circuit reports a failure.
See also: VerifyOp
, BellMeasurement
.
QuantumClifford.false_success_stat
— ConstantReturned by applywstatus!
if the circuit reports a success, but it is a false positive (i.e., there was an undetected error).
See also: VerifyOp
, BellMeasurement
.
QuantumClifford.true_success_stat
— ConstantReturned by applywstatus!
if the circuit reports a success and there is no undetected error.
See also: VerifyOp
, BellMeasurement
.
QuantumClifford.AbstractSingleQubitOperator
— TypeSupertype of all single-qubit symbolic operators.
QuantumClifford.AbstractSymbolicOperator
— TypeSupertype of all symbolic operators. Subtype of AbstractCliffordOperator
QuantumClifford.AbstractTwoQubitOperator
— TypeSupertype of all two-qubit symbolic operators.
QuantumClifford.BellMeasurement
— TypeA Bell measurement performing the correlation measurement corresponding to the given pauli
projections on the qubits at the selected indices.
QuantumClifford.CircuitStatus
— TypeA convenience struct to represent the status of a circuit simulated by mctrajectories
QuantumClifford.ClassicalXOR
— TypeApplies an XOR gate to classical bits. Currently only implemented for functionality with pauli frames.
QuantumClifford.CliffordOperator
— TypeClifford Operator specified by the mapping of the basis generators.
julia> tCNOT
+States
Stabilizer states can be represented with the Stabilizer
, Destabilizer
, MixedStabilizer
, and MixedDestabilizer
tableau data structures. You probably want to use MixedDestabilizer
which supports the widest set of operations.
Moreover, a MixedDestabilizer
can be stored inside a Register
together with a set of classical bits in which measurement results can be written.
Lastly, for Pauli frame simulations there is the PauliFrame
type, a tableau in which each row represents a different Pauli frame.
There are convenience constructors for common types of states and operators.
Operations
Acting on quantum states can be performed either:
- In a "linear algebra" language where unitaries, measurements, and other operations have separate interfaces. This is an explicitly deterministic lower-level interface, which provides a great deal of control over how tableaux are manipulated. See the Stabilizer Tableau Algebra Manual as a primer on these approaches.
- Or in a "circuit" language, where the operators (and measurements and noise) are represented as circuit gates. This is a higher-level interface in which the outcome of an operation can be stochastic. The API for it is centered around the
apply!
function. Particularly useful for Monte Carlo simulations and Perturbative Expansion Symbolic Results.
See the full list of operations for a list of implemented operations.
Autogenerated API list
QuantumClifford.QuantumClifford
— ModuleA module for using the Stabilizer formalism and simulating Clifford circuits.
sourceQuantumClifford.continue_stat
— ConstantReturned by applywstatus!
if the circuit simulation should continue.
sourceQuantumClifford.failure_stat
— ConstantReturned by applywstatus!
if the circuit reports a failure.
See also: VerifyOp
, BellMeasurement
.
sourceQuantumClifford.false_success_stat
— ConstantReturned by applywstatus!
if the circuit reports a success, but it is a false positive (i.e., there was an undetected error).
See also: VerifyOp
, BellMeasurement
.
sourceQuantumClifford.true_success_stat
— ConstantReturned by applywstatus!
if the circuit reports a success and there is no undetected error.
See also: VerifyOp
, BellMeasurement
.
sourceQuantumClifford.AbstractSingleQubitOperator
— TypeSupertype of all single-qubit symbolic operators.
sourceQuantumClifford.AbstractSymbolicOperator
— TypeSupertype of all symbolic operators. Subtype of AbstractCliffordOperator
sourceQuantumClifford.AbstractTwoQubitOperator
— TypeSupertype of all two-qubit symbolic operators.
sourceQuantumClifford.BellMeasurement
— TypeA Bell measurement performing the correlation measurement corresponding to the given pauli
projections on the qubits at the selected indices.
sourceQuantumClifford.CircuitStatus
— TypeA convenience struct to represent the status of a circuit simulated by mctrajectories
sourceQuantumClifford.ClassicalXOR
— TypeApplies an XOR gate to classical bits. Currently only implemented for functionality with pauli frames.
sourceQuantumClifford.CliffordOperator
— TypeClifford Operator specified by the mapping of the basis generators.
julia> tCNOT
X₁ ⟼ + XX
X₂ ⟼ + _X
Z₁ ⟼ + Z_
@@ -33,12 +33,12 @@
julia> CliffordOperator(d)
X₁ ⟼ + Z
-Z₁ ⟼ + Y
sourceQuantumClifford.Destabilizer
— TypeA tableau representation of a pure stabilizer state. The tableau tracks the destabilizers as well, for efficient projections. On initialization there are no checks that the provided state is indeed pure. This enables the use of this data structure for mixed stabilizer state, but a better choice would be to use MixedDestabilizer
.
sourceQuantumClifford.MixedDestabilizer
— TypeA tableau representation for mixed stabilizer states that keeps track of the destabilizers in order to provide efficient projection operations.
The rank r
of the n
-qubit tableau is tracked, either so that it can be used to represent a mixed stabilizer state, or so that it can be used to represent an n-r
logical-qubit code over n
physical qubits. The "logical" operators are tracked as well.
When the constructor is called on an incomplete Stabilizer
it automatically calculates the destabilizers and logical operators, following chapter 4 of (Gottesman, 1997). Under the hood the conversion uses the canonicalize_gott!
canonicalization. That canonicalization permutes the columns of the tableau, but we automatically undo the column permutation in the preparation of a MixedDestabilizer
so that qubits are not reindexed. The boolean keyword arguments undoperm
and reportperm
can be used to control this behavior and to report the permutations explicitly.
See also: stabilizerview
, destabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.MixedStabilizer
— TypeA slight improvement of the Stabilizer
data structure that enables more naturally and completely the treatment of mixed states, in particular when the project!
function is used.
sourceQuantumClifford.NoiseOp
— TypeAn operator that applies the given noise
model to the qubits at the selected indices
.
sourceQuantumClifford.NoiseOpAll
— TypeAn operator that applies the given noise
model to all qubits.
sourceQuantumClifford.NoisyGate
— TypeA gate consisting of the given noise
applied after the given perfect Clifford gate
.
sourceQuantumClifford.PauliChannel
— TypeA Pauli channel datastructure, mainly for use with StabMixture
See also: UnitaryPauliChannel
sourceQuantumClifford.PauliFrame
— Typestruct PauliFrame{T, S} <: QuantumClifford.AbstractQCState
This is a wrapper around a tableau. This "frame" tableau is not to be viewed as a normal stabilizer tableau, although it does conjugate the same under Clifford operations. Each row in the tableau refers to a single frame. The row represents the Pauli operation by which the frame and the reference differ.
sourceQuantumClifford.PauliFrame
— MethodPauliFrame(
+Z₁ ⟼ + Y
sourceQuantumClifford.Destabilizer
— TypeA tableau representation of a pure stabilizer state. The tableau tracks the destabilizers as well, for efficient projections. On initialization there are no checks that the provided state is indeed pure. This enables the use of this data structure for mixed stabilizer state, but a better choice would be to use MixedDestabilizer
.
sourceQuantumClifford.MixedDestabilizer
— TypeA tableau representation for mixed stabilizer states that keeps track of the destabilizers in order to provide efficient projection operations.
The rank r
of the n
-qubit tableau is tracked, either so that it can be used to represent a mixed stabilizer state, or so that it can be used to represent an n-r
logical-qubit code over n
physical qubits. The "logical" operators are tracked as well.
When the constructor is called on an incomplete Stabilizer
it automatically calculates the destabilizers and logical operators, following chapter 4 of (Gottesman, 1997). Under the hood the conversion uses the canonicalize_gott!
canonicalization. That canonicalization permutes the columns of the tableau, but we automatically undo the column permutation in the preparation of a MixedDestabilizer
so that qubits are not reindexed. The boolean keyword arguments undoperm
and reportperm
can be used to control this behavior and to report the permutations explicitly.
See also: stabilizerview
, destabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.MixedStabilizer
— TypeA slight improvement of the Stabilizer
data structure that enables more naturally and completely the treatment of mixed states, in particular when the project!
function is used.
sourceQuantumClifford.NoiseOp
— TypeAn operator that applies the given noise
model to the qubits at the selected indices
.
sourceQuantumClifford.NoiseOpAll
— TypeAn operator that applies the given noise
model to all qubits.
sourceQuantumClifford.NoisyGate
— TypeA gate consisting of the given noise
applied after the given perfect Clifford gate
.
sourceQuantumClifford.PauliChannel
— TypeA Pauli channel datastructure, mainly for use with StabMixture
See also: UnitaryPauliChannel
sourceQuantumClifford.PauliFrame
— Typestruct PauliFrame{T, S} <: QuantumClifford.AbstractQCState
This is a wrapper around a tableau. This "frame" tableau is not to be viewed as a normal stabilizer tableau, although it does conjugate the same under Clifford operations. Each row in the tableau refers to a single frame. The row represents the Pauli operation by which the frame and the reference differ.
sourceQuantumClifford.PauliFrame
— MethodPauliFrame(
frames,
qubits,
measurements
) -> PauliFrame{Stabilizer{QuantumClifford.Tableau{Vector{UInt8}, LinearAlgebra.Adjoint{UInt64, Matrix{UInt64}}}}}
-
Prepare an empty set of Pauli frames with the given number of frames
and qubits
. Preallocates spaces for measurement
number of measurements.
sourceQuantumClifford.PauliMeasurement
— TypeA Stabilizer measurement on the entirety of the quantum register.
projectrand!(state, pauli)
and apply!(state, PauliMeasurement(pauli))
give the same (possibly non-deterministic) result. Particularly useful when acting on Register
.
See also: apply!
, projectrand!
.
sourceQuantumClifford.PauliNoise
— TypePauli noise model with probabilities px
, py
, and pz
respectively for the three types of Pauli errors.
sourceQuantumClifford.PauliNoise
— MethodConstructs an unbiased Pauli noise model with total probability of error p
.
sourceQuantumClifford.PauliOperator
— TypeA multi-qubit Pauli operator ($±\{1,i\}\{I,Z,X,Y\}^{\otimes n}$).
A Pauli can be constructed with the P
custom string macro or by building up one through products and tensor products of smaller operators.
julia> pauli3 = P"-iXYZ"
+
Prepare an empty set of Pauli frames with the given number of frames
and qubits
. Preallocates spaces for measurement
number of measurements.
sourceQuantumClifford.PauliMeasurement
— TypeA Stabilizer measurement on the entirety of the quantum register.
projectrand!(state, pauli)
and apply!(state, PauliMeasurement(pauli))
give the same (possibly non-deterministic) result. Particularly useful when acting on Register
.
See also: apply!
, projectrand!
.
sourceQuantumClifford.PauliNoise
— TypePauli noise model with probabilities px
, py
, and pz
respectively for the three types of Pauli errors.
sourceQuantumClifford.PauliNoise
— MethodConstructs an unbiased Pauli noise model with total probability of error p
.
sourceQuantumClifford.PauliOperator
— TypeA multi-qubit Pauli operator ($±\{1,i\}\{I,Z,X,Y\}^{\otimes n}$).
A Pauli can be constructed with the P
custom string macro or by building up one through products and tensor products of smaller operators.
julia> pauli3 = P"-iXYZ"
-iXYZ
julia> pauli4 = 1im * pauli3 ⊗ X
@@ -55,7 +55,7 @@
(true, false)
julia> p[1] = (true, true); p
-+ YYZ
sourceQuantumClifford.Register
— TypeA register, representing the state of a computer including both a tableaux and an array of classical bits (e.g. for storing measurement results)
sourceQuantumClifford.Reset
— TypeReset the specified qubits to the given state.
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: sMRZ
sourceQuantumClifford.SingleQubitOperator
— TypeA "symbolic" general single-qubit operator which permits faster multiplication than an operator expressed as an explicit tableau.
julia> op = SingleQubitOperator(2, true, true, true, false, true, true) # Tableau components and phases
++ YYZ
sourceQuantumClifford.Register
— TypeA register, representing the state of a computer including both a tableaux and an array of classical bits (e.g. for storing measurement results)
sourceQuantumClifford.Reset
— TypeReset the specified qubits to the given state.
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: sMRZ
sourceQuantumClifford.SingleQubitOperator
— TypeA "symbolic" general single-qubit operator which permits faster multiplication than an operator expressed as an explicit tableau.
julia> op = SingleQubitOperator(2, true, true, true, false, true, true) # Tableau components and phases
SingleQubitOperator on qubit 2
X₁ ⟼ - Y
Z₁ ⟼ - X
@@ -76,7 +76,7 @@
julia> CliffordOperator(op, 1, compact=true) # You can also extract just the non-trivial part of the tableau
X₁ ⟼ - Y
-Z₁ ⟼ - X
See also: sHadamard
, sPhase
, sId1
, sX
, sY
, sZ
, CliffordOperator
Or simply consult subtypes(QuantumClifford.AbstractSingleQubitOperator)
and subtypes(QuantumClifford.AbstractTwoQubitOperator)
for a full list. You can think of the s
prefix as "symbolic" or "sparse".
sourceQuantumClifford.SparseGate
— TypeA Clifford gate, applying the given cliff
operator to the qubits at the selected indices
.
apply!(state, cliff, indices)
and apply!(state, SparseGate(cliff, indices))
give the same result.
sourceQuantumClifford.StabMixture
— Typemutable struct StabMixture{T, F}
Represents mixture ∑ ϕᵢⱼ Pᵢ ρ Pⱼ† where ρ is a pure stabilizer state.
julia> StabMixture(S"-X")
+Z₁ ⟼ - X
See also: sHadamard
, sPhase
, sId1
, sX
, sY
, sZ
, CliffordOperator
Or simply consult subtypes(QuantumClifford.AbstractSingleQubitOperator)
and subtypes(QuantumClifford.AbstractTwoQubitOperator)
for a full list. You can think of the s
prefix as "symbolic" or "sparse".
sourceQuantumClifford.SparseGate
— TypeA Clifford gate, applying the given cliff
operator to the qubits at the selected indices
.
apply!(state, cliff, indices)
and apply!(state, SparseGate(cliff, indices))
give the same result.
sourceQuantumClifford.StabMixture
— Typemutable struct StabMixture{T, F}
Represents mixture ∑ ϕᵢⱼ Pᵢ ρ Pⱼ† where ρ is a pure stabilizer state.
julia> StabMixture(S"-X")
A mixture ∑ ϕᵢⱼ Pᵢ ρ Pⱼ† where ρ is
𝒟ℯ𝓈𝓉𝒶𝒷
+ Z
@@ -101,7 +101,7 @@
0.0+0.353553im | + _ | + Z
0.0-0.353553im | + Z | + _
0.853553+0.0im | + _ | + _
- 0.146447+0.0im | + Z | + Z
See also: PauliChannel
sourceQuantumClifford.Stabilizer
— TypeStabilizer, i.e. a list of commuting multi-qubit Hermitian Pauli operators.
Instances can be created with the S
custom string macro or as direct sum of other stabilizers.
Stabilizers and Destabilizers In many cases you probably would prefer to use the MixedDestabilizer
data structure, as it caries a lot of useful additional information, like tracking rank and destabilizer operators. Stabilizer
has mostly a pedagogical value, and it is also used for slightly faster simulation of a particular subset of Clifford operations.
julia> s = S"XXX
+ 0.146447+0.0im | + Z | + Z
See also: PauliChannel
sourceQuantumClifford.Stabilizer
— TypeStabilizer, i.e. a list of commuting multi-qubit Hermitian Pauli operators.
Instances can be created with the S
custom string macro or as direct sum of other stabilizers.
Stabilizers and Destabilizers In many cases you probably would prefer to use the MixedDestabilizer
data structure, as it caries a lot of useful additional information, like tracking rank and destabilizer operators. Stabilizer
has mostly a pedagogical value, and it is also used for slightly faster simulation of a particular subset of Clifford operations.
julia> s = S"XXX
ZZI
IZZ"
+ XXX
@@ -134,7 +134,7 @@
julia> s[1,1] = (true, false); s
+ X_
-+ __
There are no automatic checks for correctness (i.e. independence of all rows, commutativity of all rows, hermiticity of all rows). The rank (number of rows) is permitted to be less than the number of qubits (number of columns): canonilization, projection, etc. continue working in that case. To great extent this library uses the Stabilizer
data structure simply as a tableau. This might be properly abstracted away in future versions.
See also: PauliOperator
, canonicalize!
sourceQuantumClifford.Stabilizer
— MethodConvert a graph representing a stabilizer state to an explicit Stabilizer.
See also: graphstate
sourceQuantumClifford.UnbiasedUncorrelatedNoise
— TypeDepolarization noise model with total probability of error p
.
sourceQuantumClifford.UnitaryPauliChannel
— TypeA Pauli channel datastructure, mainly for use with StabMixture
.
More convenient to use than PauliChannel
when you know your Pauli channel is unitary.
julia> Tgate = UnitaryPauliChannel(
++ __
There are no automatic checks for correctness (i.e. independence of all rows, commutativity of all rows, hermiticity of all rows). The rank (number of rows) is permitted to be less than the number of qubits (number of columns): canonilization, projection, etc. continue working in that case. To great extent this library uses the Stabilizer
data structure simply as a tableau. This might be properly abstracted away in future versions.
See also: PauliOperator
, canonicalize!
sourceQuantumClifford.Stabilizer
— MethodConvert a graph representing a stabilizer state to an explicit Stabilizer.
See also: graphstate
sourceQuantumClifford.UnbiasedUncorrelatedNoise
— TypeDepolarization noise model with total probability of error p
.
sourceQuantumClifford.UnitaryPauliChannel
— TypeA Pauli channel datastructure, mainly for use with StabMixture
.
More convenient to use than PauliChannel
when you know your Pauli channel is unitary.
julia> Tgate = UnitaryPauliChannel(
(I, Z),
((1+exp(im*π/4))/2, (1-exp(im*π/4))/2)
)
@@ -149,7 +149,7 @@
0.853553+0.0im | + _ | + _
0.0+0.353553im | + _ | + Z
0.0-0.353553im | + Z | + _
- 0.146447+0.0im | + Z | + Z
sourceQuantumClifford.VerifyOp
— TypeA "probe" to verify that the state of the qubits corresponds to a desired good_state
, e.g. at the end of the execution of a circuit.
sourceQuantumClifford.sCNOT
— TypeA "symbolic" CNOT. See also: AbstractSymbolicOperator
sourceQuantumClifford.sCPHASE
— TypeA "symbolic" CPHASE. See also: AbstractSymbolicOperator
sourceQuantumClifford.sCXYZ
— TypeA "symbolic" single-qubit CXYZ. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sCZYX
— TypeA "symbolic" single-qubit CZYX. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sHadamard
— TypeA "symbolic" single-qubit Hadamard. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sHadamardXY
— TypeA "symbolic" single-qubit HadamardXY. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sHadamardYZ
— TypeA "symbolic" single-qubit HadamardYZ. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sId1
— TypeA "symbolic" single-qubit Identity operation.
See also: SingleQubitOperator
sourceQuantumClifford.sInvPhase
— TypeA "symbolic" single-qubit InvPhase. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sInvSQRTX
— TypeA "symbolic" single-qubit InvSQRTX. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sInvSQRTY
— TypeA "symbolic" single-qubit InvSQRTY. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sInvZCrY
— TypeA "symbolic" InvZCrY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sMRX
— Typesource QuantumClifford.sMRY
— Typesource QuantumClifford.sMRZ
— TypeMeasure a qubit in the Z basis and reset to the |0⟩ state.
It does not trace out the qubit! As described below there is a difference between measuring the qubit (followed by setting it to a given known state) and "tracing out" the qubit. By reset here we mean "measuring and setting to a known state", not "tracing out".
julia> s = MixedDestabilizer(S"XXX ZZI IZZ") # |000⟩+|111⟩
+ 0.146447+0.0im | + Z | + Z
sourceQuantumClifford.VerifyOp
— TypeA "probe" to verify that the state of the qubits corresponds to a desired good_state
, e.g. at the end of the execution of a circuit.
sourceQuantumClifford.sCNOT
— TypeA "symbolic" CNOT. See also: AbstractSymbolicOperator
sourceQuantumClifford.sCPHASE
— TypeA "symbolic" CPHASE. See also: AbstractSymbolicOperator
sourceQuantumClifford.sCXYZ
— TypeA "symbolic" single-qubit CXYZ. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sCZYX
— TypeA "symbolic" single-qubit CZYX. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sHadamard
— TypeA "symbolic" single-qubit Hadamard. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sHadamardXY
— TypeA "symbolic" single-qubit HadamardXY. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sHadamardYZ
— TypeA "symbolic" single-qubit HadamardYZ. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sId1
— TypeA "symbolic" single-qubit Identity operation.
See also: SingleQubitOperator
sourceQuantumClifford.sInvPhase
— TypeA "symbolic" single-qubit InvPhase. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sInvSQRTX
— TypeA "symbolic" single-qubit InvSQRTX. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sInvSQRTY
— TypeA "symbolic" single-qubit InvSQRTY. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sInvZCrY
— TypeA "symbolic" InvZCrY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sMRX
— Typesource QuantumClifford.sMRY
— Typesource QuantumClifford.sMRZ
— TypeMeasure a qubit in the Z basis and reset to the |0⟩ state.
It does not trace out the qubit! As described below there is a difference between measuring the qubit (followed by setting it to a given known state) and "tracing out" the qubit. By reset here we mean "measuring and setting to a known state", not "tracing out".
julia> s = MixedDestabilizer(S"XXX ZZI IZZ") # |000⟩+|111⟩
𝒟ℯ𝓈𝓉𝒶𝒷
+ Z__
+ _X_
@@ -199,7 +199,7 @@
𝒮𝓉𝒶𝒷━
+ Z__
- ZZ_
-- Z_Z
sourceQuantumClifford.sMX
— TypeSymbolic single qubit X measurement. See also Register
, projectXrand!
, sMY
, sMZ
sourceQuantumClifford.sMY
— TypeSymbolic single qubit Y measurement. See also Register
, projectYrand!
, sMX
, sMZ
sourceQuantumClifford.sMZ
— TypeSymbolic single qubit Z measurement. See also Register
, projectZrand!
, sMX
, sMY
sourceQuantumClifford.sPhase
— TypeA "symbolic" single-qubit Phase. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sSQRTX
— TypeA "symbolic" single-qubit SQRTX. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sSQRTY
— TypeA "symbolic" single-qubit SQRTY. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sSWAP
— TypeA "symbolic" SWAP. See also: AbstractSymbolicOperator
sourceQuantumClifford.sX
— TypeA "symbolic" single-qubit X. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sXCX
— TypeA "symbolic" XCX. See also: AbstractSymbolicOperator
sourceQuantumClifford.sXCY
— TypeA "symbolic" XCY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sXCZ
— TypeA "symbolic" XCZ. See also: AbstractSymbolicOperator
sourceQuantumClifford.sY
— TypeA "symbolic" single-qubit Y. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sYCX
— TypeA "symbolic" YCX. See also: AbstractSymbolicOperator
sourceQuantumClifford.sYCY
— TypeA "symbolic" YCY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sYCZ
— TypeA "symbolic" YCZ. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZ
— TypeA "symbolic" single-qubit Z. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sZCX
— TypeA "symbolic" ZCX. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZCY
— TypeA "symbolic" ZCY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZCZ
— TypeA "symbolic" ZCZ. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZCrY
— TypeA "symbolic" ZCrY. See also: AbstractSymbolicOperator
sourceQuantumClifford.PauliError
— FunctionA convenient constructor for various types of Pauli errors, that can be used as circuit gates in simulations. Returns more specific types when necessary.
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies a biased Pauli error on all qubits
independently, each with probabilities px
, py
, pz
. Note that the probability of any error occurring is px+py+pz
. Because of this, PauliError(1, p)
is equivalent to PauliError(1,p/3,p/3,p/3)
. Similarly, if one wanted to exclude Z errors from PauliError(1,p/3,p/3,p/3)
while mainting the same rate of X errors, one could write PauliError(1, p*2/3, 0, 0)
(in the sense that Y errors can be interpreted as an X and a Z happening at the same time).
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies an unbiased Pauli error on all qubits
, each with independent probability p
.
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies a biased Pauli error on qubit q
with independent probabilities px
, py
, pz
. Note that the probability of any error occurring is px+py+pz
. Because of this, PauliError(1, p)
is equivalent to PauliError(1,p/3,p/3,p/3)
. Similarly, if one wanted to exclude Z errors from PauliError(1,p/3,p/3,p/3)
while mainting the same rate of X errors, one could write PauliError(1, p*2/3, 0, 0)
(in the sense that Y errors can be interpreted as an X and a Z happening at the same time).
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies an unbiased Pauli error on qubit q
with probability p
.
sourceQuantumClifford.affectedqubits
— FunctionA method giving the qubits acted upon by a given operation. Part of the Noise interface.
sourceQuantumClifford.applybranches
— FunctionCompute all possible new states after the application of the given operator. Reports the probability of each one of them. Deterministic (as it reports all branches of potentially random processes), part of the Perturbative Expansion interface.
sourceQuantumClifford.applynoise!
— FunctionA method modifying a given state by applying the corresponding noise model. It is non-deterministic, part of the Noise interface.
sourceQuantumClifford.applywstatus!
— MethodUsed for mctrajectories
.
sourceQuantumClifford.bell
— Functionsource QuantumClifford.sMX
— TypeSymbolic single qubit X measurement. See also Register
, projectXrand!
, sMY
, sMZ
sourceQuantumClifford.sMY
— TypeSymbolic single qubit Y measurement. See also Register
, projectYrand!
, sMX
, sMZ
sourceQuantumClifford.sMZ
— TypeSymbolic single qubit Z measurement. See also Register
, projectZrand!
, sMX
, sMY
sourceQuantumClifford.sPhase
— TypeA "symbolic" single-qubit Phase. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sSQRTX
— TypeA "symbolic" single-qubit SQRTX. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sSQRTY
— TypeA "symbolic" single-qubit SQRTY. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sSWAP
— TypeA "symbolic" SWAP. See also: AbstractSymbolicOperator
sourceQuantumClifford.sX
— TypeA "symbolic" single-qubit X. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sXCX
— TypeA "symbolic" XCX. See also: AbstractSymbolicOperator
sourceQuantumClifford.sXCY
— TypeA "symbolic" XCY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sXCZ
— TypeA "symbolic" XCZ. See also: AbstractSymbolicOperator
sourceQuantumClifford.sY
— TypeA "symbolic" single-qubit Y. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sYCX
— TypeA "symbolic" YCX. See also: AbstractSymbolicOperator
sourceQuantumClifford.sYCY
— TypeA "symbolic" YCY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sYCZ
— TypeA "symbolic" YCZ. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZ
— TypeA "symbolic" single-qubit Z. See also: SingleQubitOperator
, AbstractSymbolicOperator
sourceQuantumClifford.sZCX
— TypeA "symbolic" ZCX. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZCY
— TypeA "symbolic" ZCY. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZCZ
— TypeA "symbolic" ZCZ. See also: AbstractSymbolicOperator
sourceQuantumClifford.sZCrY
— TypeA "symbolic" ZCrY. See also: AbstractSymbolicOperator
sourceQuantumClifford.PauliError
— FunctionA convenient constructor for various types of Pauli errors, that can be used as circuit gates in simulations. Returns more specific types when necessary.
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies a biased Pauli error on all qubits
independently, each with probabilities px
, py
, pz
. Note that the probability of any error occurring is px+py+pz
. Because of this, PauliError(1, p)
is equivalent to PauliError(1,p/3,p/3,p/3)
. Similarly, if one wanted to exclude Z errors from PauliError(1,p/3,p/3,p/3)
while mainting the same rate of X errors, one could write PauliError(1, p*2/3, 0, 0)
(in the sense that Y errors can be interpreted as an X and a Z happening at the same time).
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies an unbiased Pauli error on all qubits
, each with independent probability p
.
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies a biased Pauli error on qubit q
with independent probabilities px
, py
, pz
. Note that the probability of any error occurring is px+py+pz
. Because of this, PauliError(1, p)
is equivalent to PauliError(1,p/3,p/3,p/3)
. Similarly, if one wanted to exclude Z errors from PauliError(1,p/3,p/3,p/3)
while mainting the same rate of X errors, one could write PauliError(1, p*2/3, 0, 0)
(in the sense that Y errors can be interpreted as an X and a Z happening at the same time).
sourceQuantumClifford.PauliError
— Method"Construct a gate operation that applies an unbiased Pauli error on qubit q
with probability p
.
sourceQuantumClifford.affectedqubits
— FunctionA method giving the qubits acted upon by a given operation. Part of the Noise interface.
sourceQuantumClifford.applybranches
— FunctionCompute all possible new states after the application of the given operator. Reports the probability of each one of them. Deterministic (as it reports all branches of potentially random processes), part of the Perturbative Expansion interface.
sourceQuantumClifford.applynoise!
— FunctionA method modifying a given state by applying the corresponding noise model. It is non-deterministic, part of the Noise interface.
sourceQuantumClifford.applywstatus!
— MethodUsed for mctrajectories
.
sourceQuantumClifford.bell
— FunctionPrepare one or more Bell pairs (with optional phases).
julia> bell()
+ XX
+ ZZ
@@ -217,15 +217,15 @@
- XX__
+ ZZ__
- __XX
-- __ZZ
sourceQuantumClifford.bigram
— Methodbigram(
+- __ZZ
sourceQuantumClifford.bigram
— Methodbigram(
state::QuantumClifford.AbstractStabilizer;
clip
) -> Matrix{Int64}
-
Get the bigram of a tableau.
It is the list of endpoints of a tableau in the clipped gauge.
If clip=true
(the default) the tableau is converted to the clipped gauge in-place before calculating the bigram. Otherwise, the clip gauge conversion is skipped (for cases where the input is already known to be in the correct gauge).
Introduced in (Nahum et al., 2017), with a more detailed explanation of the algorithm in (Li et al., 2019) and (Gullans et al., 2021).
See also: canonicalize_clip!
sourceQuantumClifford.bitview
— FunctionA view of the classical bits stored with the state
sourceQuantumClifford.canonicalize!
— Methodcanonicalize!(
+
Get the bigram of a tableau.
It is the list of endpoints of a tableau in the clipped gauge.
If clip=true
(the default) the tableau is converted to the clipped gauge in-place before calculating the bigram. Otherwise, the clip gauge conversion is skipped (for cases where the input is already known to be in the correct gauge).
Introduced in (Nahum et al., 2017), with a more detailed explanation of the algorithm in (Li et al., 2019) and (Gullans et al., 2021).
See also: canonicalize_clip!
sourceQuantumClifford.bitview
— FunctionA view of the classical bits stored with the state
sourceQuantumClifford.canonicalize!
— Methodcanonicalize!(
state::QuantumClifford.AbstractStabilizer;
phases,
ranks
-) -> Any
+) -> Union{Tuple{QuantumClifford.AbstractStabilizer, Int64, Int64}, QuantumClifford.AbstractStabilizer}
Canonicalize a stabilizer (in place).
Assumes the input is a valid stabilizer (all operators commute and have real phases). It permits redundant generators and identity generators.
julia> ghz = S"XXXX
ZZII
IZZI
@@ -276,7 +276,7 @@
+ XXXX
+ Z__Z
+ _Z_Z
-+ ____
Based on (Garcia et al., 2012).
See also: canonicalize_rref!
, canonicalize_gott!
sourceQuantumClifford.canonicalize_clip!
— Methodcanonicalize_clip!(
++ ____
Based on (Garcia et al., 2012).
See also: canonicalize_rref!
, canonicalize_gott!
sourceQuantumClifford.canonicalize_clip!
— Methodcanonicalize_clip!(
state::QuantumClifford.AbstractStabilizer;
phases
) -> QuantumClifford.AbstractStabilizer
@@ -294,32 +294,32 @@
+ _XZX__
- _ZYX_Z
- __YZ_X
-- ____Z_
If phases=false
is set, the canonicalization does not track the phases in the tableau, leading to a significant speedup.
Introduced in (Nahum et al., 2017), with a more detailed explanation of the algorithm in Appendix A of (Li et al., 2019)
See also: canonicalize!
, canonicalize_rref!
, canonicalize_gott!
.
sourceQuantumClifford.canonicalize_gott!
— MethodInplace Gottesman canonicalization of a tableau.
This uses different canonical form from canonicalize!
. It is used in the computation of the logical X and Z operators of a MixedDestabilizer
.
It returns the (in place) modified state, the indices of the last pivot of both Gaussian elimination steps, and the permutations that have been used to put the X and Z tableaux in standard form.
Based on (Gottesman, 1997).
See also: canonicalize!
, canonicalize_rref!
sourceQuantumClifford.canonicalize_rref!
— Methodcanonicalize_rref!(
+- ____Z_
If phases=false
is set, the canonicalization does not track the phases in the tableau, leading to a significant speedup.
Introduced in (Nahum et al., 2017), with a more detailed explanation of the algorithm in Appendix A of (Li et al., 2019)
See also: canonicalize!
, canonicalize_rref!
, canonicalize_gott!
.
sourceQuantumClifford.canonicalize_gott!
— MethodInplace Gottesman canonicalization of a tableau.
This uses different canonical form from canonicalize!
. It is used in the computation of the logical X and Z operators of a MixedDestabilizer
.
It returns the (in place) modified state, the indices of the last pivot of both Gaussian elimination steps, and the permutations that have been used to put the X and Z tableaux in standard form.
Based on (Gottesman, 1997).
See also: canonicalize!
, canonicalize_rref!
sourceQuantumClifford.canonicalize_rref!
— Methodcanonicalize_rref!(
state::QuantumClifford.AbstractStabilizer,
colindices;
phases
) -> Tuple{QuantumClifford.AbstractStabilizer, Any}
-
Canonicalize a stabilizer (in place) along only some columns.
This uses different canonical form from canonicalize!
. It also indexes in reverse in order to make its use in traceout!
more efficient. Its use in traceout!
is its main application.
It returns the (in place) modified state and the index of the last pivot.
Based on (Audenaert and Plenio, 2005).
See also: canonicalize!
, canonicalize_gott!
sourceQuantumClifford.canonicalize_rref!
— Methodcanonicalize_rref!(
+
Canonicalize a stabilizer (in place) along only some columns.
This uses different canonical form from canonicalize!
. It also indexes in reverse in order to make its use in traceout!
more efficient. Its use in traceout!
is its main application.
It returns the (in place) modified state and the index of the last pivot.
Based on (Audenaert and Plenio, 2005).
See also: canonicalize!
, canonicalize_gott!
sourceQuantumClifford.canonicalize_rref!
— Methodcanonicalize_rref!(
state::QuantumClifford.AbstractStabilizer;
phases
) -> Tuple{QuantumClifford.AbstractStabilizer, Any}
-
sourceQuantumClifford.centralizer
— MethodFor a given set of Paulis (in the form of a Tableau
), return the subset of Paulis that commute with all Paulis in set.
julia> centralizer(T"XX ZZ _Z")
-+ ZZ
sourceQuantumClifford.clifford_cardinality
— MethodThe size of the Clifford group 𝒞
over a given number of qubits, possibly modulo the phases.
For n qubits, not accounting for phases is 2ⁿⁿΠⱼ₌₁ⁿ(4ʲ-1)
. There are 4ⁿ
different phase configurations.
julia> clifford_cardinality(7)
+
sourceQuantumClifford.centralizer
— MethodFor a given set of Paulis (in the form of a Tableau
), return the subset of Paulis that commute with all Paulis in set.
julia> centralizer(T"XX ZZ _Z")
++ ZZ
sourceQuantumClifford.clifford_cardinality
— MethodThe size of the Clifford group 𝒞
over a given number of qubits, possibly modulo the phases.
For n qubits, not accounting for phases is 2ⁿⁿΠⱼ₌₁ⁿ(4ʲ-1)
. There are 4ⁿ
different phase configurations.
julia> clifford_cardinality(7)
457620995529680351512370381586432000
When not accounting for phases (phases = false
) the result is the same as the size of the Symplectic group Sp(2n) ≡ 𝒞ₙ/𝒫ₙ
, where 𝒫ₙ
is the Pauli group over n
qubits.
julia> clifford_cardinality(7, phases=false)
-27930968965434591767112450048000
See also: enumerate_cliffords
.
sourceQuantumClifford.comm
— FunctionCheck whether two operators commute.
0x0
if they commute, 0x1
if they anticommute.
julia> P"XX"*P"ZZ", P"ZZ"*P"XX"
+27930968965434591767112450048000
See also: enumerate_cliffords
.
sourceQuantumClifford.comm
— FunctionCheck whether two operators commute.
0x0
if they commute, 0x1
if they anticommute.
julia> P"XX"*P"ZZ", P"ZZ"*P"XX"
(- YY, - YY)
julia> comm(P"ZZ", P"XX")
0x00
julia> comm(P"IZ", P"XX")
-0x01
See also: comm!
sourceQuantumClifford.comm!
— FunctionAn in-place version of comm
, storing its output in the given buffer.
sourceQuantumClifford.compactify_circuit
— MethodConvert a list of gates to a more optimized "sum type" format which permits faster dispatch.
Generally, this should be called on a circuit before it is used in a simulation.
sourceQuantumClifford.contractor
— MethodReturn the subset of Paulis in a Stabilizer that have identity operators on all qubits corresponding to the given subset, without the entries corresponding to subset.
julia> contractor(S"_X X_", [1])
-+ X
sourceQuantumClifford.delete_columns
— MethodReturn the given stabilizer without all the qubits in the given iterable.
The resulting tableaux is not guaranteed to be valid (to retain its commutation relationships).
julia> delete_columns(S"XYZ YZX ZXY", [1,3])
+0x01
See also: comm!
sourceQuantumClifford.comm!
— FunctionAn in-place version of comm
, storing its output in the given buffer.
sourceQuantumClifford.compactify_circuit
— MethodConvert a list of gates to a more optimized "sum type" format which permits faster dispatch.
Generally, this should be called on a circuit before it is used in a simulation.
sourceQuantumClifford.contractor
— MethodReturn the subset of Paulis in a Stabilizer that have identity operators on all qubits corresponding to the given subset, without the entries corresponding to subset.
julia> contractor(S"_X X_", [1])
++ X
sourceQuantumClifford.delete_columns
— MethodReturn the given stabilizer without all the qubits in the given iterable.
The resulting tableaux is not guaranteed to be valid (to retain its commutation relationships).
julia> delete_columns(S"XYZ YZX ZXY", [1,3])
+ Y
+ Z
-+ X
See also: traceout!
sourceQuantumClifford.destabilizerview
— MethodA view of the subtableau corresponding to the destabilizer. See also tab
, stabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.enumerate_cliffords
— MethodGive the i-th n-qubit Clifford operation, where i∈{1..2ⁿⁿΠⱼ₌₁ⁿ(4ʲ-1)}
The algorithm is detailed in (Koenig and Smolin, 2014).
See also: symplecticGS
, clifford_cardinality
.
sourceQuantumClifford.enumerate_cliffords
— MethodGive all n-qubit Clifford operations.
The algorithm is detailed in (Koenig and Smolin, 2014).
See also: symplecticGS
, clifford_cardinality
.
sourceQuantumClifford.enumerate_phases
— MethodGiven an operator, return all operators that have the same tableau but different phases.
julia> length(collect(enumerate_phases(tCNOT)))
-16
See also: enumerate_cliffords
, clifford_cardinality
.
sourceQuantumClifford.enumerate_phases
— MethodGiven a set of operators, return all operators that have the same tableaux but different phases.
julia> length(collect(enumerate_phases(enumerate_cliffords(2))))
-11520
See also: enumerate_cliffords
, clifford_cardinality
.
sourceQuantumClifford.enumerate_single_qubit_gates
— MethodGenerate a symbolic single-qubit gate given its index. Optionally, set non-trivial phases.
julia> enumerate_single_qubit_gates(6)
++ X
See also: traceout!
sourceQuantumClifford.destabilizerview
— MethodA view of the subtableau corresponding to the destabilizer. See also tab
, stabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.enumerate_cliffords
— MethodGive the i-th n-qubit Clifford operation, where i∈{1..2ⁿⁿΠⱼ₌₁ⁿ(4ʲ-1)}
The algorithm is detailed in (Koenig and Smolin, 2014).
See also: symplecticGS
, clifford_cardinality
.
sourceQuantumClifford.enumerate_cliffords
— MethodGive all n-qubit Clifford operations.
The algorithm is detailed in (Koenig and Smolin, 2014).
See also: symplecticGS
, clifford_cardinality
.
sourceQuantumClifford.enumerate_phases
— MethodGiven an operator, return all operators that have the same tableau but different phases.
julia> length(collect(enumerate_phases(tCNOT)))
+16
See also: enumerate_cliffords
, clifford_cardinality
.
sourceQuantumClifford.enumerate_phases
— MethodGiven a set of operators, return all operators that have the same tableaux but different phases.
julia> length(collect(enumerate_phases(enumerate_cliffords(2))))
+11520
See also: enumerate_cliffords
, clifford_cardinality
.
sourceQuantumClifford.enumerate_single_qubit_gates
— MethodGenerate a symbolic single-qubit gate given its index. Optionally, set non-trivial phases.
julia> enumerate_single_qubit_gates(6)
sPhase on qubit 1
X₁ ⟼ + Y
Z₁ ⟼ + Z
@@ -327,7 +327,7 @@
julia> enumerate_single_qubit_gates(6, qubit=2, phases=(true, true))
SingleQubitOperator on qubit 2
X₁ ⟼ - Y
-Z₁ ⟼ - Z
See also: enumerate_cliffords
.
sourceQuantumClifford.fastcolumn
— FunctionConvert a tableau to a memory layout that is fast for column operations.
In this layout a column of the tableau is stored (mostly) contiguously in memory. Due to bitpacking, e.g., packing 64 bits into a single UInt64
, the memory layout is not perfectly contiguous, but it is still optimal given that some bitwrangling is required to extract a given bit.
See also: fastrow
sourceQuantumClifford.fastrow
— FunctionConvert a tableau to a memory layout that is fast for row operations.
In this layout a Pauli string (a row of the tableau) is stored contiguously in memory.
See also: fastrow
sourceQuantumClifford.generate!
— MethodGenerate a Pauli operator by using operators from a given the Stabilizer.
It assumes the stabilizer is already canonicalized. It modifies the Pauli operator in place, generating it in reverse, up to a phase. That phase is left in the modified operator, which should be the identity up to a phase. Returns the new operator and the list of indices denoting the elements of stabilizer
that were used for the generation.
julia> ghz = S"XXXX
+Z₁ ⟼ - Z
See also: enumerate_cliffords
.
sourceQuantumClifford.fastcolumn
— FunctionConvert a tableau to a memory layout that is fast for column operations.
In this layout a column of the tableau is stored (mostly) contiguously in memory. Due to bitpacking, e.g., packing 64 bits into a single UInt64
, the memory layout is not perfectly contiguous, but it is still optimal given that some bitwrangling is required to extract a given bit.
See also: fastrow
sourceQuantumClifford.fastrow
— FunctionConvert a tableau to a memory layout that is fast for row operations.
In this layout a Pauli string (a row of the tableau) is stored contiguously in memory.
See also: fastrow
sourceQuantumClifford.generate!
— MethodGenerate a Pauli operator by using operators from a given the Stabilizer.
It assumes the stabilizer is already canonicalized. It modifies the Pauli operator in place, generating it in reverse, up to a phase. That phase is left in the modified operator, which should be the identity up to a phase. Returns the new operator and the list of indices denoting the elements of stabilizer
that were used for the generation.
julia> ghz = S"XXXX
ZZII
IZZI
IIZZ";
@@ -344,7 +344,7 @@
true
julia> generate!(P"XII",canonicalize!(S"XII")) === nothing
-false
sourceQuantumClifford.gf2_H_to_G
— MethodFor a given F(2,2) parity check matrix, return the generator matrix.
sourceQuantumClifford.gf2_gausselim!
— MethodGaussian elimination over the binary field.
sourceQuantumClifford.gf2_invert
— MethodInvert a binary matrix.
sourceQuantumClifford.gf2_isinvertible
— MethodCheck whether a binary matrix is invertible.
sourceQuantumClifford.ghz
— FunctionPrepare a GHZ state of n qubits.
julia> ghz()
+false
sourceQuantumClifford.gf2_H_to_G
— MethodFor a given F(2,2) parity check matrix, return the generator matrix.
sourceQuantumClifford.gf2_gausselim!
— MethodGaussian elimination over the binary field.
sourceQuantumClifford.gf2_invert
— MethodInvert a binary matrix.
sourceQuantumClifford.gf2_isinvertible
— MethodCheck whether a binary matrix is invertible.
sourceQuantumClifford.ghz
— FunctionPrepare a GHZ state of n qubits.
julia> ghz()
+ XXX
+ ZZ_
+ _ZZ
@@ -357,7 +357,7 @@
+ XXXX
+ ZZ__
+ _ZZ_
-+ __ZZ
sourceQuantumClifford.graph_gate
— MethodA helper function converting the gate indices from graphstate
into a Clifford operator.
julia> s = S" XXX
++ __ZZ
sourceQuantumClifford.graph_gate
— MethodA helper function converting the gate indices from graphstate
into a Clifford operator.
julia> s = S" XXX
YZ_
-_ZZ";
@@ -374,7 +374,7 @@
+ _ZX
julia> canonicalize!(s) == canonicalize!(Stabilizer(graph))
-true
See also: graph_gatesequence
sourceQuantumClifford.graph_gatesequence
— MethodA helper function converting the gate indices from graphstate
into a sequence of gates.
julia> s = S" XXX
+true
See also: graph_gatesequence
sourceQuantumClifford.graph_gatesequence
— MethodA helper function converting the gate indices from graphstate
into a sequence of gates.
julia> s = S" XXX
YZ_
-_ZZ";
@@ -394,7 +394,7 @@
+ _ZX
julia> canonicalize!(s) == canonicalize!(Stabilizer(graph))
-true
See also: graph_gatesequence
sourceQuantumClifford.graphstate!
— MethodAn in-place version of graphstate
.
sourceQuantumClifford.graphstate
— MethodConvert any stabilizer state to a graph state
Graph states are a special type of entangled stabilizer states that can be represented by a graph. For a graph $G=(V,E)$ the corresponding stabilizers are $S_v = X_v \prod_{u ∈ N(v)} Z_u$. Notice that such tableau rows contain only a single X operator. There is a set of single qubit gates that converts any stabilizer state to a graph state.
This function returns the graph state corresponding to a stabilizer and the gates that might be necessary to convert the stabilizer into a state representable as a graph.
For a tableau stab
you can convert it with:
graph, hadamard_idx, iphase_idx, flips_idx = graphstate()
where graph
is the graph representation of stab
, and the rest specifies the single-qubit gates converting stab
to graph
: hadamard_idx
are the qubits that require a Hadamard gate (mapping X ↔ Z), iphase_idx
are (different) qubits that require an inverse Phase gate (Y → X), and flips_idx
are the qubits that require a phase flip (Pauli Z gate), after the previous two sets of gates.
julia> using Graphs
+true
See also: graph_gatesequence
sourceQuantumClifford.graphstate!
— MethodAn in-place version of graphstate
.
sourceQuantumClifford.graphstate
— MethodConvert any stabilizer state to a graph state
Graph states are a special type of entangled stabilizer states that can be represented by a graph. For a graph $G=(V,E)$ the corresponding stabilizers are $S_v = X_v \prod_{u ∈ N(v)} Z_u$. Notice that such tableau rows contain only a single X operator. There is a set of single qubit gates that converts any stabilizer state to a graph state.
This function returns the graph state corresponding to a stabilizer and the gates that might be necessary to convert the stabilizer into a state representable as a graph.
For a tableau stab
you can convert it with:
graph, hadamard_idx, iphase_idx, flips_idx = graphstate()
where graph
is the graph representation of stab
, and the rest specifies the single-qubit gates converting stab
to graph
: hadamard_idx
are the qubits that require a Hadamard gate (mapping X ↔ Z), iphase_idx
are (different) qubits that require an inverse Phase gate (Y → X), and flips_idx
are the qubits that require a phase flip (Pauli Z gate), after the previous two sets of gates.
julia> using Graphs
julia> s = S" XXX
ZZ_
@@ -421,15 +421,15 @@
1-element Vector{Int64}:
3
The Graphs.jl
library provides many graph-theory tools and the MakieGraphs.jl
library provides plotting utilities for graphs.
You can directly call the graph constructor on a stabilizer, if you just want the graph and do not care about the Clifford operation necessary to convert an arbitrary state to a state representable as a graph:
julia> collect(edges( Graph(bell()) ))
1-element Vector{Graphs.SimpleGraphs.SimpleEdge{Int64}}:
- Edge 1 => 2
For a version that does not copy the stabilizer, but rather performs transformations in-place, use graphstate!
. It would perform canonicalize_gott!
on its argument as it finds a way to convert it to a graph state.
sourceQuantumClifford.groupify
— MethodReturn the full stabilizer group represented by the input generating set (a Stabilizer
).
The returned object is exponentially long.
julia> groupify(S"XZ ZX")
+ Edge 1 => 2
For a version that does not copy the stabilizer, but rather performs transformations in-place, use graphstate!
. It would perform canonicalize_gott!
on its argument as it finds a way to convert it to a graph state.
sourceQuantumClifford.groupify
— MethodReturn the full stabilizer group represented by the input generating set (a Stabilizer
).
The returned object is exponentially long.
julia> groupify(S"XZ ZX")
+ __
+ XZ
+ ZX
-+ YY
sourceQuantumClifford.logdot
— MethodLogarithm of the inner product between to Stabilizer states.
If the result is nothing
, the dot inner product is zero. Otherwise the inner product is 2^(-logdot/2)
.
The actual inner product can be computed with LinearAlgebra.dot
.
Based on (Garcia et al., 2012).
sourceQuantumClifford.logicalxview
— MethodA view of the subtableau corresponding to the logical X operators. See also tab
, stabilizerview
, destabilizerview
, logicalzview
sourceQuantumClifford.logicalzview
— MethodA view of the subtableau corresponding to the logical Z operators. See also tab
, stabilizerview
, destabilizerview
, logicalxview
sourceQuantumClifford.mctrajectories
— MethodRun multiple Monte Carlo trajectories and report the aggregate final statuses of each.
See also: pftrajectories
, petrajectories
sourceQuantumClifford.mctrajectory!
— MethodRun a single Monte Carlo sample, starting with (and modifying) state
by applying the given circuit
. Uses apply!
under the hood.
sourceQuantumClifford.minimal_generating_set
— MethodFor a not-necessarily-minimal generating set, return the minimal generating set.
The input has to have only real phases.
julia> minimal_generating_set(S"__ XZ ZX YY")
++ YY
sourceQuantumClifford.logdot
— MethodLogarithm of the inner product between to Stabilizer states.
If the result is nothing
, the dot inner product is zero. Otherwise the inner product is 2^(-logdot/2)
.
The actual inner product can be computed with LinearAlgebra.dot
.
Based on (Garcia et al., 2012).
sourceQuantumClifford.logicalxview
— MethodA view of the subtableau corresponding to the logical X operators. See also tab
, stabilizerview
, destabilizerview
, logicalzview
sourceQuantumClifford.logicalzview
— MethodA view of the subtableau corresponding to the logical Z operators. See also tab
, stabilizerview
, destabilizerview
, logicalxview
sourceQuantumClifford.mctrajectories
— MethodRun multiple Monte Carlo trajectories and report the aggregate final statuses of each.
See also: pftrajectories
, petrajectories
sourceQuantumClifford.mctrajectory!
— MethodRun a single Monte Carlo sample, starting with (and modifying) state
by applying the given circuit
. Uses apply!
under the hood.
sourceQuantumClifford.minimal_generating_set
— MethodFor a not-necessarily-minimal generating set, return the minimal generating set.
The input has to have only real phases.
julia> minimal_generating_set(S"__ XZ ZX YY")
+ XZ
-+ ZX
sourceQuantumClifford.normalizer
— MethodReturn all Pauli operators with the same number of qubits as the given Tableau
t
that commute with all operators in t
.
julia> normalizer(T"X")
++ ZX
sourceQuantumClifford.normalizer
— MethodReturn all Pauli operators with the same number of qubits as the given Tableau
t
that commute with all operators in t
.
julia> normalizer(T"X")
+ _
-+ X
sourceQuantumClifford.pauligroup
— MethodReturn the full Pauli group of a given length. Phases are ignored by default, but can be included by setting phases=true
.
julia> pauligroup(1)
++ X
sourceQuantumClifford.pauligroup
— MethodReturn the full Pauli group of a given length. Phases are ignored by default, but can be included by setting phases=true
.
julia> pauligroup(1)
+ _
+ X
+ Z
@@ -451,32 +451,32 @@
-i_
-iX
-iZ
--iY
sourceQuantumClifford.petrajectories
— MethodRun a perturbative expansion to a given order. This is the main public function for the perturbative expansion approach.
See also: pftrajectories
, mctrajectories
sourceQuantumClifford.pfmeasurements
— Methodpfmeasurements(frame::PauliFrame) -> Any
-
Returns the measurement results for each frame in the PauliFrame
instance.
Relative measurements The return measurements are relative to the reference measurements, i.e. they only say whether the reference measurements have been flipped in the given frame.
sourceQuantumClifford.pfmeasurements
— Methodpfmeasurements(register::Register, frame::PauliFrame) -> Any
-
Takes the references measurements from the given Register
and applies the flips as prescribed by the PauliFrame
relative measurements. The result is the actual (non-relative) measurement results for each frame.
sourceQuantumClifford.pfmeasurements
— Methodpfmeasurements(register::Register) -> Vector{Bool}
-
Returns the measurements stored in the bits of the given Register
.
sourceQuantumClifford.pftrajectories
— FunctionPerform a "Pauli frame" style simulation of a quantum circuit.
sourceQuantumClifford.pftrajectories
— Methodpftrajectories(
+-iY
sourceQuantumClifford.petrajectories
— MethodRun a perturbative expansion to a given order. This is the main public function for the perturbative expansion approach.
See also: pftrajectories
, mctrajectories
sourceQuantumClifford.pfmeasurements
— Methodpfmeasurements(frame::PauliFrame) -> Any
+
Returns the measurement results for each frame in the PauliFrame
instance.
Relative measurements The return measurements are relative to the reference measurements, i.e. they only say whether the reference measurements have been flipped in the given frame.
sourceQuantumClifford.pfmeasurements
— Methodpfmeasurements(register::Register, frame::PauliFrame) -> Any
+
Takes the references measurements from the given Register
and applies the flips as prescribed by the PauliFrame
relative measurements. The result is the actual (non-relative) measurement results for each frame.
sourceQuantumClifford.pfmeasurements
— Methodpfmeasurements(register::Register) -> Vector{Bool}
+
Returns the measurements stored in the bits of the given Register
.
sourceQuantumClifford.pftrajectories
— FunctionPerform a "Pauli frame" style simulation of a quantum circuit.
sourceQuantumClifford.pftrajectories
— Methodpftrajectories(
circuit;
trajectories,
threads
) -> PauliFrame{Stabilizer{QuantumClifford.Tableau{Vector{UInt8}, LinearAlgebra.Adjoint{UInt64, Matrix{UInt64}}}}, Matrix{Bool}}
-
The main method for running Pauli frame simulations of circuits. See the other methods for lower level access.
Multithreading is enabled by default, but can be disabled by setting threads=false
. Do not forget to launch Julia with multiple threads enabled, e.g. julia -t4
, if you want to use multithreading.
See also: mctrajectories
, petrajectories
sourceQuantumClifford.pftrajectories
— Methodpftrajectories(state::PauliFrame, circuit) -> PauliFrame
-
Evolve each frame stored in PauliFrame
by the given circuit.
sourceQuantumClifford.pftrajectories
— Methodpftrajectories(
+
The main method for running Pauli frame simulations of circuits. See the other methods for lower level access.
Multithreading is enabled by default, but can be disabled by setting threads=false
. Do not forget to launch Julia with multiple threads enabled, e.g. julia -t4
, if you want to use multithreading.
See also: mctrajectories
, petrajectories
sourceQuantumClifford.pftrajectories
— Methodpftrajectories(state::PauliFrame, circuit) -> PauliFrame
+
Evolve each frame stored in PauliFrame
by the given circuit.
sourceQuantumClifford.pftrajectories
— Methodpftrajectories(
register::Register,
circuit;
trajectories
) -> Tuple{Register, PauliFrame{Stabilizer{QuantumClifford.Tableau{Vector{UInt8}, LinearAlgebra.Adjoint{UInt64, Matrix{UInt64}}}}, Matrix{Bool}}}
-
For a given Register
and circuit, simulates the reference circuit acting on the register and then also simulate numerous PauliFrame
trajectories. Returns the register and the PauliFrame
instance.
Use pfmeasurements
to get the measurement results.
sourceQuantumClifford.phases
— MethodThe phases of a given tableau. It is a view, i.e. if you modify this array, the original tableau caries these changes.
sourceQuantumClifford.prodphase
— MethodGet the phase of the product of two Pauli operators.
Phase is encoded as F(4) in the low qubits of an UInt8.
julia> P"ZZZ"*P"XXX"
+
For a given Register
and circuit, simulates the reference circuit acting on the register and then also simulate numerous PauliFrame
trajectories. Returns the register and the PauliFrame
instance.
Use pfmeasurements
to get the measurement results.
sourceQuantumClifford.phases
— MethodThe phases of a given tableau. It is a view, i.e. if you modify this array, the original tableau caries these changes.
sourceQuantumClifford.prodphase
— MethodGet the phase of the product of two Pauli operators.
Phase is encoded as F(4) in the low qubits of an UInt8.
julia> P"ZZZ"*P"XXX"
-iYYY
julia> prodphase(P"ZZZ", P"XXX")
0x03
julia> prodphase(P"XXX", P"ZZZ")
-0x01
sourceQuantumClifford.projectXrand!
— MethodprojectXrand!(state, qubit) -> Tuple{Register, UInt8}
-
Project qubit
of state
along the X axis and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectX!
, projectZrand!
, projectYrand!
sourceQuantumClifford.projectYrand!
— MethodprojectYrand!(state, qubit) -> Tuple{Register, UInt8}
-
Project qubit
of state
along the Y axis and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectY!
, projectXrand!
, projectZrand!
sourceQuantumClifford.projectZrand!
— MethodprojectZrand!(state, qubit) -> Tuple{Register, UInt8}
-
Project qubit
of state
along the Z axis and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectZ!
, projectXrand!
, projectYrand!
sourceQuantumClifford.projectrand!
— Methodprojectrand!(state, pauli) -> Tuple{Register, Any}
-
Measure pauli
operator on state
and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectXrand!
, projectZrand!
, projectYrand!
sourceQuantumClifford.puttableau!
— MethodPut source tableau in target tableau at given row and column. Assumes target location is zeroed out.
sourceQuantumClifford.quantumstate
— FunctionOnly the quantum part of the state (excluding classical bits)
sourceQuantumClifford.random_all_to_all_clifford_circuit
— MethodRandom all-to-all Clifford circuit.
The circuit contains nqubits
qubits and ngates
gates. The connectivity is all to all. Each gate in the circuit is a random 2-qubit Clifford gate on randomly picked two qubits.
sourceQuantumClifford.random_brickwork_clifford_circuit
— MethodRandom brickwork Clifford circuit.
The connectivity of the random circuit is brickwork in some dimensions. Each gate in the circuit is a random 2-qubit Clifford gate.
The brickwork is defined as follows: The qubits are arranged as a lattice, and lattice_size
contains side length in each dimension. For example, a chain of length five will have lattice_size = (5,)
, and a 5×5 lattice will have lattice_size = (5, 5)
.
In multi-dimensional cases, gate layers act alternatively along each direction. The nearest two layers along the same direction are offset by one qubit, forming a so-called brickwork. The boundary condition is chosen as open.
sourceQuantumClifford.random_clifford
— MethodA random Clifford operator generated by the Bravyi-Maslov Algorithm 2 from (Bravyi and Maslov, 2021).
sourceQuantumClifford.random_clifford1
— MethodRandom symbolic single-qubit Clifford applied to qubit at index qubit
.
See also: SingleQubitOperator
, random_clifford
sourceQuantumClifford.random_destabilizer
— MethodA random Stabilizer/Destabilizer tableau generated by the Bravyi-Maslov Algorithm 2 from (Bravyi and Maslov, 2021).
random_destabilizer(n)
gives a n-qubit tableau of rank n
. random_destabilizer(r,n)
gives a n-qubit tableau of rank r
.
sourceQuantumClifford.random_pauli
— FunctionA random Pauli operator on n qubits.
Use nophase=false
to randomize the phase. Use realphase=false
to get operators with phases including ±i.
Optionally, a "flip" probability p
can be provided specified, in which case each bit is set to I with probability 1-p
and to X or Y or Z with probability p
. Useful for simulating unbiased Pauli noise.
See also random_pauli!
sourceQuantumClifford.random_pauli!
— FunctionAn in-place version of random_pauli
sourceQuantumClifford.random_stabilizer
— MethodA random Stabilizer tableau generated by the Bravyi-Maslov Algorithm 2 from (Bravyi and Maslov, 2021).
sourceQuantumClifford.single_x
— Methodsource QuantumClifford.single_y
— Methodsource QuantumClifford.single_z
— Methodsource QuantumClifford.stab_to_gf2
— MethodThe F(2,2) matrix of a given tableau, represented as the concatenation of two binary matrices, one for X and one for Z.
sourceQuantumClifford.stabilizerplot
— FunctionA Makie.jl recipe for pictorial representation of a tableau.
Requires a Makie.jl backend to be loaded, e.g. using CairoMakie
.
Alternatively, you can use the Plots.jl plotting ecosystem, e.g. using Plots; plot(S"XXX ZZZ")
.
Consult the documentation for more details on visualization options.
sourceQuantumClifford.stabilizerplot_axis
— FunctionA Makie.jl recipe for pictorial representation of a tableau.
Requires a Makie.jl backend to be loaded, e.g. using CairoMakie
.
Alternatively, you can use the Plots.jl plotting ecosystem, e.g. using Plots; plot(S"XXX ZZZ")
.
Consult the documentation for more details on visualization options.
sourceQuantumClifford.stabilizerview
— MethodA view of the subtableau corresponding to the stabilizer. See also tab
, destabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.symplecticGS
— MethodPerform the Symplectic Gram-Schmidt procedure that gives a Clifford operator canonically related to a given Pauli operator.
The algorithm is detailed in (Koenig and Smolin, 2014).
julia> symplecticGS(P"X", padded_n=3)
+0x01
sourceQuantumClifford.projectXrand!
— MethodprojectXrand!(state, qubit) -> Tuple{Register, UInt8}
+
Project qubit
of state
along the X axis and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectX!
, projectZrand!
, projectYrand!
sourceQuantumClifford.projectYrand!
— MethodprojectYrand!(state, qubit) -> Tuple{Register, UInt8}
+
Project qubit
of state
along the Y axis and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectY!
, projectXrand!
, projectZrand!
sourceQuantumClifford.projectZrand!
— MethodprojectZrand!(state, qubit) -> Tuple{Register, UInt8}
+
Project qubit
of state
along the Z axis and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectZ!
, projectXrand!
, projectYrand!
sourceQuantumClifford.projectrand!
— Methodprojectrand!(state, pauli) -> Tuple{Register, Any}
+
Measure pauli
operator on state
and randomize the phase if necessary.
Lower boilerplate version of project!
.
See also: project!
, projectXrand!
, projectZrand!
, projectYrand!
sourceQuantumClifford.puttableau!
— MethodPut source tableau in target tableau at given row and column. Assumes target location is zeroed out.
sourceQuantumClifford.quantumstate
— FunctionOnly the quantum part of the state (excluding classical bits)
sourceQuantumClifford.random_all_to_all_clifford_circuit
— MethodRandom all-to-all Clifford circuit.
The circuit contains nqubits
qubits and ngates
gates. The connectivity is all to all. Each gate in the circuit is a random 2-qubit Clifford gate on randomly picked two qubits.
sourceQuantumClifford.random_brickwork_clifford_circuit
— MethodRandom brickwork Clifford circuit.
The connectivity of the random circuit is brickwork in some dimensions. Each gate in the circuit is a random 2-qubit Clifford gate.
The brickwork is defined as follows: The qubits are arranged as a lattice, and lattice_size
contains side length in each dimension. For example, a chain of length five will have lattice_size = (5,)
, and a 5×5 lattice will have lattice_size = (5, 5)
.
In multi-dimensional cases, gate layers act alternatively along each direction. The nearest two layers along the same direction are offset by one qubit, forming a so-called brickwork. The boundary condition is chosen as open.
sourceQuantumClifford.random_clifford
— MethodA random Clifford operator generated by the Bravyi-Maslov Algorithm 2 from (Bravyi and Maslov, 2021).
sourceQuantumClifford.random_clifford1
— MethodRandom symbolic single-qubit Clifford applied to qubit at index qubit
.
See also: SingleQubitOperator
, random_clifford
sourceQuantumClifford.random_destabilizer
— MethodA random Stabilizer/Destabilizer tableau generated by the Bravyi-Maslov Algorithm 2 from (Bravyi and Maslov, 2021).
random_destabilizer(n)
gives a n-qubit tableau of rank n
. random_destabilizer(r,n)
gives a n-qubit tableau of rank r
.
sourceQuantumClifford.random_pauli
— FunctionA random Pauli operator on n qubits.
Use nophase=false
to randomize the phase. Use realphase=false
to get operators with phases including ±i.
Optionally, a "flip" probability p
can be provided specified, in which case each bit is set to I with probability 1-p
and to X or Y or Z with probability p
. Useful for simulating unbiased Pauli noise.
See also random_pauli!
sourceQuantumClifford.random_pauli!
— FunctionAn in-place version of random_pauli
sourceQuantumClifford.random_stabilizer
— MethodA random Stabilizer tableau generated by the Bravyi-Maslov Algorithm 2 from (Bravyi and Maslov, 2021).
sourceQuantumClifford.single_x
— Methodsource QuantumClifford.single_y
— Methodsource QuantumClifford.single_z
— Methodsource QuantumClifford.stab_to_gf2
— MethodThe F(2,2) matrix of a given tableau, represented as the concatenation of two binary matrices, one for X and one for Z.
sourceQuantumClifford.stabilizerplot
— FunctionA Makie.jl recipe for pictorial representation of a tableau.
Requires a Makie.jl backend to be loaded, e.g. using CairoMakie
.
Alternatively, you can use the Plots.jl plotting ecosystem, e.g. using Plots; plot(S"XXX ZZZ")
.
Consult the documentation for more details on visualization options.
sourceQuantumClifford.stabilizerplot_axis
— FunctionA Makie.jl recipe for pictorial representation of a tableau.
Requires a Makie.jl backend to be loaded, e.g. using CairoMakie
.
Alternatively, you can use the Plots.jl plotting ecosystem, e.g. using Plots; plot(S"XXX ZZZ")
.
Consult the documentation for more details on visualization options.
sourceQuantumClifford.stabilizerview
— MethodA view of the subtableau corresponding to the stabilizer. See also tab
, destabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.symplecticGS
— MethodPerform the Symplectic Gram-Schmidt procedure that gives a Clifford operator canonically related to a given Pauli operator.
The algorithm is detailed in (Koenig and Smolin, 2014).
julia> symplecticGS(P"X", padded_n=3)
X₁ ⟼ + X__
X₂ ⟼ + _X_
X₃ ⟼ + __X
@@ -486,7 +486,7 @@
julia> symplecticGS(P"Z")
X₁ ⟼ + Z
-Z₁ ⟼ + X
See also: enumerate_cliffords
, clifford_cardinality
.
sourceQuantumClifford.tab
— MethodExtract the underlying tableau structure.
julia> s = S"X"
+Z₁ ⟼ + X
See also: enumerate_cliffords
, clifford_cardinality
.
sourceQuantumClifford.tab
— MethodExtract the underlying tableau structure.
julia> s = S"X"
+ X
julia> tab(s)
@@ -505,11 +505,11 @@
+ X
julia> typeof(tab(tHadamard))
-QuantumClifford.Tableau{Vector{UInt8}, Matrix{UInt64}}
See also: stabilizerview
, destabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.xbit
— MethodExtract as a new bit array the X part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumClifford.xview
— MethodGet a view of the X part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumClifford.zbit
— MethodExtract as a new bit array the Z part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumClifford.zview
— MethodGet a view of the Y part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumInterface.apply!
— FunctionIn QuantumClifford
the apply!
function is used to apply any quantum operation to a stabilizer state, including unitary Clifford operations, Pauli measurements, and noise. Thus, this function may result in a random/stochastic result (e.g. with measurements or noise).
sourceQuantumInterface.embed
— MethodEmbed a Pauli operator in a larger Pauli operator.
julia> embed(5, 3, P"-Y")
+QuantumClifford.Tableau{Vector{UInt8}, Matrix{UInt64}}
See also: stabilizerview
, destabilizerview
, logicalxview
, logicalzview
sourceQuantumClifford.xbit
— MethodExtract as a new bit array the X part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumClifford.xview
— MethodGet a view of the X part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumClifford.zbit
— MethodExtract as a new bit array the Z part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumClifford.zview
— MethodGet a view of the Y part of the UInt
array of packed qubits of a given Pauli operator.
sourceQuantumInterface.apply!
— FunctionIn QuantumClifford
the apply!
function is used to apply any quantum operation to a stabilizer state, including unitary Clifford operations, Pauli measurements, and noise. Thus, this function may result in a random/stochastic result (e.g. with measurements or noise).
sourceQuantumInterface.embed
— MethodEmbed a Pauli operator in a larger Pauli operator.
julia> embed(5, 3, P"-Y")
- __Y__
julia> embed(5, (3,5), P"-YX")
-- __Y_X
sourceQuantumInterface.entanglement_entropy
— FunctionGet bipartite entanglement entropy of a subsystem
Defined as entropy of the reduced density matrix.
It can be calculated with multiple different algorithms, the most performant one depending on the particular case.
Currently implemented are the :clip
(clipped gauge), :graph
(graph state), and :rref
(Gaussian elimination) algorithms. Benchmark your particular case to choose the best one.
sourceQuantumInterface.entanglement_entropy
— MethodGet bipartite entanglement entropy by first converting the state to a graph and computing the rank of the adjacency matrix.
Based on "Entanglement in graph states and its applications".
sourceQuantumInterface.entanglement_entropy
— MethodGet bipartite entanglement entropy by converting to RREF form (i.e., partial trace form).
The state will be partially canonicalized in an RREF form.
See also: canonicalize_rref!
, traceout!
.
sourceQuantumInterface.entanglement_entropy
— MethodGet bipartite entanglement entropy of a contiguous subsystem by passing through the clipped gauge.
If clip=false
is set the canonicalization step is skipped, useful if the input state is already in the clipped gauge.
See also: bigram
, canonicalize_clip!
sourceQuantumInterface.expect
— Methodexpect(p::PauliOperator, st::AbstractStabilizer)
Compute the expectation value of a Pauli operator p
on a stabilizer state st
. This function will allocate a temporary copy of the stabilizer state st
.
sourceQuantumInterface.nqubits
— MethodThe number of qubits of a given state.
sourceQuantumInterface.project!
— Methodproject!(
+- __Y_X
sourceQuantumInterface.entanglement_entropy
— FunctionGet bipartite entanglement entropy of a subsystem
Defined as entropy of the reduced density matrix.
It can be calculated with multiple different algorithms, the most performant one depending on the particular case.
Currently implemented are the :clip
(clipped gauge), :graph
(graph state), and :rref
(Gaussian elimination) algorithms. Benchmark your particular case to choose the best one.
sourceQuantumInterface.entanglement_entropy
— MethodGet bipartite entanglement entropy by first converting the state to a graph and computing the rank of the adjacency matrix.
Based on "Entanglement in graph states and its applications".
sourceQuantumInterface.entanglement_entropy
— MethodGet bipartite entanglement entropy by converting to RREF form (i.e., partial trace form).
The state will be partially canonicalized in an RREF form.
See also: canonicalize_rref!
, traceout!
.
sourceQuantumInterface.entanglement_entropy
— MethodGet bipartite entanglement entropy of a contiguous subsystem by passing through the clipped gauge.
If clip=false
is set the canonicalization step is skipped, useful if the input state is already in the clipped gauge.
See also: bigram
, canonicalize_clip!
sourceQuantumInterface.expect
— Methodexpect(p::PauliOperator, st::AbstractStabilizer)
Compute the expectation value of a Pauli operator p
on a stabilizer state st
. This function will allocate a temporary copy of the stabilizer state st
.
sourceQuantumInterface.nqubits
— MethodThe number of qubits of a given state.
sourceQuantumInterface.project!
— Methodproject!(
state,
pauli::PauliOperator;
keep_result,
@@ -595,7 +595,7 @@
𝒮𝓉𝒶𝒷━
+ Z__
+ _Z_
-+ __X
See the "Datastructure Choice" section in the documentation for more details.
See also: projectX!
, projectY!
, projectZ!
, projectrand!
sourceQuantumInterface.project!
— Methodproject!(
++ __X
See the "Datastructure Choice" section in the documentation for more details.
See also: projectX!
, projectY!
, projectZ!
, projectrand!
sourceQuantumInterface.project!
— Methodproject!(
state::MixedStabilizer,
pauli::PauliOperator;
phases
@@ -611,25 +611,25 @@
julia> project!(ms, P"IIY")[1]
+ X__
+ _Z_
-+ __Y
Similarly to project!
on Stabilizer
, this function has cubic complexity when the Pauli operator commutes with all rows of the tableau. Most of the time it is better to simply use MixedDestabilizer
representation.
Unlike other project!
methods, this one does not allow for keep_result=false
, as the correct rank or anticommutation index can not be calculated without the expensive (cubic) canonicalization operation required by keep_result=true
.
See the "Datastructure Choice" section in the documentation for more details.
sourceQuantumInterface.projectX!
— MethodMeasure a given qubit in the X basis. A faster special-case version of project!
.
See also: project!
, projectXrand!
, projectY!
, projectZ!
.
sourceQuantumInterface.projectY!
— MethodMeasure a given qubit in the Y basis. A faster special-case version of project!
.
See also: project!
, projectYrand!
, projectX!
, projectZ!
.
sourceQuantumInterface.projectZ!
— MethodMeasure a given qubit in the Z basis. A faster special-case version of project!
.
See also: project!
, projectZrand!
, projectY!
, projectX!
.
sourceQuantumInterface.reset_qubits!
— Methodreset_qubits!(
++ __Y
Similarly to project!
on Stabilizer
, this function has cubic complexity when the Pauli operator commutes with all rows of the tableau. Most of the time it is better to simply use MixedDestabilizer
representation.
Unlike other project!
methods, this one does not allow for keep_result=false
, as the correct rank or anticommutation index can not be calculated without the expensive (cubic) canonicalization operation required by keep_result=true
.
See the "Datastructure Choice" section in the documentation for more details.
sourceQuantumInterface.projectX!
— MethodMeasure a given qubit in the X basis. A faster special-case version of project!
.
See also: project!
, projectXrand!
, projectY!
, projectZ!
.
sourceQuantumInterface.projectY!
— MethodMeasure a given qubit in the Y basis. A faster special-case version of project!
.
See also: project!
, projectYrand!
, projectX!
, projectZ!
.
sourceQuantumInterface.projectZ!
— MethodMeasure a given qubit in the Z basis. A faster special-case version of project!
.
See also: project!
, projectZrand!
, projectY!
, projectX!
.
sourceQuantumInterface.reset_qubits!
— Methodreset_qubits!(
s::MixedDestabilizer,
newstate::QuantumClifford.AbstractStabilizer,
qubits;
phases
) -> MixedDestabilizer
-
sourceQuantumInterface.reset_qubits!
— Methodreset_qubits!(
+
sourceQuantumInterface.reset_qubits!
— Methodreset_qubits!(
s::MixedStabilizer,
newstate,
qubits;
phases
) -> MixedStabilizer
-
sourceQuantumInterface.reset_qubits!
— Methodreset_qubits!(
+
sourceQuantumInterface.reset_qubits!
— Methodreset_qubits!(
s::Stabilizer,
newstate,
qubits;
phases
-) -> Any
-
Reset a given set of qubits to be in the state newstate
. These qubits are traced out first, which could lead to "nonlocal" changes in the tableau.
sourceQuantumInterface.tensor
— FunctionTensor product between operators or tableaux.
Tensor product between CiffordOperators:
julia> tensor(CliffordOperator(sCNOT), CliffordOperator(sCNOT))
+) -> Union{PauliOperator, Stabilizer}
+
Reset a given set of qubits to be in the state newstate
. These qubits are traced out first, which could lead to "nonlocal" changes in the tableau.
sourceQuantumInterface.tensor
— FunctionTensor product between operators or tableaux.
Tensor product between CiffordOperators:
julia> tensor(CliffordOperator(sCNOT), CliffordOperator(sCNOT))
X₁ ⟼ + XX__
X₂ ⟼ + _X__
X₃ ⟼ + __XX
@@ -656,7 +656,7 @@
+ XZ____
- _Z____
+ ___XZ_
-- ____Z_
See also tensor_pow
.
sourceQuantumInterface.tensor_pow
— MethodRepeated tensor product of an operators or a tableau.
For CliffordOperator
:
julia> tensor_pow(CliffordOperator(sHadamard), 3)
+- ____Z_
See also tensor_pow
.
sourceQuantumInterface.tensor_pow
— MethodRepeated tensor product of an operators or a tableau.
For CliffordOperator
:
julia> tensor_pow(CliffordOperator(sHadamard), 3)
X₁ ⟼ + Z__
X₂ ⟼ + _Z_
X₃ ⟼ + __Z
@@ -678,16 +678,21 @@
+ ___XZ____
+ ____Z____
+ ______XZ_
-+ _______Z_
See also tensor
.
sourceQuantumInterface.traceout!
— Methodsource QuantumInterface.traceout!
— Methodtraceout!(
++ _______Z_
See also tensor
.
sourceQuantumInterface.traceout!
— Methodtraceout!(
+ s::Stabilizer,
+ qubits;
+ phases,
+ rank
+) -> Union{Tuple{Stabilizer, Any}, Stabilizer}
+
Trace out a qubit.
See also: delete_columns
sourceQuantumInterface.traceout!
— Methodtraceout!(
s::Union{MixedDestabilizer, MixedStabilizer},
qubits;
phases,
rank
-) -> Any
-
sourcePrivate API
Private Implementation Details These functions are used internally by the library and might be drastically modified or deleted without warning or deprecation.
QuantumClifford.AbstractMeasurement
— TypeSupertype of all symbolic single-qubit measurements.
sourceQuantumClifford.SymbolicDataType
— TypeAn intermediary when we want to create a new concrete type in a macro.
sourceQuantumClifford.Tableau
— TypeInternal Tableau type for storing a list of Pauli operators in a compact form. No special semantic meaning is attached to this type, it is just a convenient way to store a list of Pauli operators. E.g. it is not used to represent a stabilizer state, or a stabilizer group, or a Clifford circuit.
sourceBase.hcat
— MethodHorizontally concatenates tableaux.
julia> hcat(ghz(2), ghz(2))
+) -> Union{Tuple{Union{MixedDestabilizer, MixedStabilizer}, Any}, MixedDestabilizer, MixedStabilizer}
+
sourcePrivate API
Private Implementation Details These functions are used internally by the library and might be drastically modified or deleted without warning or deprecation.
QuantumClifford.AbstractMeasurement
— TypeSupertype of all symbolic single-qubit measurements.
sourceQuantumClifford.SymbolicDataType
— TypeAn intermediary when we want to create a new concrete type in a macro.
sourceQuantumClifford.Tableau
— TypeInternal Tableau type for storing a list of Pauli operators in a compact form. No special semantic meaning is attached to this type, it is just a convenient way to store a list of Pauli operators. E.g. it is not used to represent a stabilizer state, or a stabilizer group, or a Clifford circuit.
sourceBase.hcat
— Methodsource Base.inv
— Methodinv(
++ ZZZZ
See also: vcat
sourceBase.inv
— Methodinv(
c::CliffordOperator;
phases
) -> CliffordOperator{QuantumClifford.Tableau{Vector{UInt8}, Matrix{UInt64}}}
@@ -705,28 +710,28 @@
julia> inv(CliffordOperator(tHadamard))
X₁ ⟼ + Z
-Z₁ ⟼ + X
sourceBase.permute!
— MethodPermute the qubits (i.e., columns) of the state in place.
sourceBase.permute!
— MethodPermute the qubits (i.e., columns) of the tableau in place.
sourceBase.vcat
— MethodVertically concatenates tableaux.
julia> vcat(ghz(2), ghz(2))
+Z₁ ⟼ + X
sourceBase.permute!
— MethodPermute the qubits (i.e., columns) of the state in place.
sourceBase.permute!
— MethodPermute the qubits (i.e., columns) of the tableau in place.
sourceBase.vcat
— Methodsource LinearAlgebra.dot
— MethodThe inner product of two Stabilizers.
Based on (Garcia et al., 2012).
julia> using LinearAlgebra
++ ZZ
See also: hcat
sourceLinearAlgebra.dot
— MethodThe inner product of two Stabilizers.
Based on (Garcia et al., 2012).
julia> using LinearAlgebra
julia> dot(S"Z", S"Z")
1.0
julia> dot(S"Z", S"Y")
-0.7071067811865476
See also: logdot
sourceQuantumClifford._apply_nonthread!
— MethodNonvectorized version of apply!
used for unit tests.
sourceQuantumClifford._apply_nonthread!
— MethodNonvectorized version of apply!
used for unit tests.
sourceQuantumClifford._mul_left_nonvec!
— MethodNonvectorized version of mul_left!
used for unit tests.
sourceQuantumClifford._remove_rowcol!
— MethodUnexported low-level function that removes a row (by shifting all rows up as necessary)
Because MixedDestabilizer is not mutable we return a new MixedDestabilizer with the same (modified) xzs array.
Used on its own, this function will break invariants. Meant to be used with projectremove!
.
sourceQuantumClifford._rowmove!
— MethodUnexported low-level function that moves row i to row j.
Used on its own, this function will break invariants. Meant to be used in _remove_rowcol!
.
sourceQuantumClifford._stim_prodphase
— MethodThe quantumlib/Stim implementation, which performs the prodphase and mul_left! together. Used for unit tests.
sourceQuantumClifford.apply_single_x!
— MethodApply a Pauli X to the i
-th qubit of state s
. You should use apply!(stab,sX(i))
instead of this.
sourceQuantumClifford.apply_single_y!
— MethodApply a Pauli Y to the i
-th qubit of state s
. You should use apply!(stab,sY(i))
instead of this.
sourceQuantumClifford.apply_single_z!
— MethodApply a Pauli Z to the i
-th qubit of state s
. You should use apply!(stab,sZ(i))
instead of this.
sourceQuantumClifford.applynoise_branches
— FunctionCompute all possible new states after the application of the given noise model. Reports the probability of each one of them. Deterministic (as it reports all branches of potentially random processes), part of the Noise interface.
sourceQuantumClifford.colswap!
— MethodSwap two columns of a stabilizer in place.
sourceQuantumClifford.destab_looks_good
— MethodCheck basic consistency requirements of a destabilizer. Used in tests.
sourceQuantumClifford.enumerate_cliffords_slow
— MethodThe O(n^4) implementation from (Koenig and Smolin, 2014) – their algorithm seems wrong as ⟨w'₁|wₗ⟩=bₗ which is not always zero.
sourceQuantumClifford.fill_tril
— MethodAssign (symmetric) random ints to off diagonals of matrix.
sourceQuantumClifford.get_all_subtypes
— MethodReturns a tuple of all concrete subtypes and all UnionAll non-abstract subtypes of a given type.
sourceQuantumClifford.gf2_H_standard_form_indices
— MethodThe permutation of columns which turns a binary matrix into standard form. It is assumed the matrix has already undergone Gaussian elimination.
sourceQuantumClifford.initZ!
— MethodinitZ!(frame::PauliFrame) -> PauliFrame
-
Inject random Z errors over all frames and qubits for the supplied PauliFrame with probability 0.5.
Calling this after initialization is essential for simulating any non-deterministic circuit. It is done automatically by most PauliFrame
constructors.
sourceQuantumClifford.make_sumtype
— Methodjulia> make_sumtype([sCNOT])
+0.7071067811865476
See also: logdot
sourceQuantumClifford._apply_nonthread!
— MethodNonvectorized version of apply!
used for unit tests.
sourceQuantumClifford._apply_nonthread!
— MethodNonvectorized version of apply!
used for unit tests.
sourceQuantumClifford._mul_left_nonvec!
— MethodNonvectorized version of mul_left!
used for unit tests.
sourceQuantumClifford._remove_rowcol!
— MethodUnexported low-level function that removes a row (by shifting all rows up as necessary)
Because MixedDestabilizer is not mutable we return a new MixedDestabilizer with the same (modified) xzs array.
Used on its own, this function will break invariants. Meant to be used with projectremove!
.
sourceQuantumClifford._rowmove!
— MethodUnexported low-level function that moves row i to row j.
Used on its own, this function will break invariants. Meant to be used in _remove_rowcol!
.
sourceQuantumClifford._stim_prodphase
— MethodThe quantumlib/Stim implementation, which performs the prodphase and mul_left! together. Used for unit tests.
sourceQuantumClifford.apply_single_x!
— MethodApply a Pauli X to the i
-th qubit of state s
. You should use apply!(stab,sX(i))
instead of this.
sourceQuantumClifford.apply_single_y!
— MethodApply a Pauli Y to the i
-th qubit of state s
. You should use apply!(stab,sY(i))
instead of this.
sourceQuantumClifford.apply_single_z!
— MethodApply a Pauli Z to the i
-th qubit of state s
. You should use apply!(stab,sZ(i))
instead of this.
sourceQuantumClifford.applynoise_branches
— FunctionCompute all possible new states after the application of the given noise model. Reports the probability of each one of them. Deterministic (as it reports all branches of potentially random processes), part of the Noise interface.
sourceQuantumClifford.colswap!
— MethodSwap two columns of a stabilizer in place.
sourceQuantumClifford.destab_looks_good
— MethodCheck basic consistency requirements of a destabilizer. Used in tests.
sourceQuantumClifford.enumerate_cliffords_slow
— MethodThe O(n^4) implementation from (Koenig and Smolin, 2014) – their algorithm seems wrong as ⟨w'₁|wₗ⟩=bₗ which is not always zero.
sourceQuantumClifford.fill_tril
— MethodAssign (symmetric) random ints to off diagonals of matrix.
sourceQuantumClifford.get_all_subtypes
— MethodReturns a tuple of all concrete subtypes and all UnionAll non-abstract subtypes of a given type.
sourceQuantumClifford.gf2_H_standard_form_indices
— MethodThe permutation of columns which turns a binary matrix into standard form. It is assumed the matrix has already undergone Gaussian elimination.
sourceQuantumClifford.initZ!
— MethodinitZ!(frame::PauliFrame) -> PauliFrame
+
Inject random Z errors over all frames and qubits for the supplied PauliFrame with probability 0.5.
Calling this after initialization is essential for simulating any non-deterministic circuit. It is done automatically by most PauliFrame
constructors.
sourceQuantumClifford.make_sumtype
— Methodjulia> make_sumtype([sCNOT])
quote
@sum_type CompactifiedGate :hidden begin
sCNOT(::Int64, ::Int64)
end
-end
sourceQuantumClifford.make_sumtype_method
— Function``` julia> makesumtypemethod([sCNOT], :apply!, (:s,)) quote function QuantumClifford.apply!(s, g::CompactifiedGate) @cases g begin sCNOT(q1, q2) => apply!(s, sCNOT(q1, q2)) end end end
sourceQuantumClifford.make_sumtype_variant_constructor
— Methodjulia> make_sumtype_variant_constructor(sCNOT)
+end
sourceQuantumClifford.make_sumtype_method
— Function``` julia> makesumtypemethod([sCNOT], :apply!, (:s,)) quote function QuantumClifford.apply!(s, g::CompactifiedGate) @cases g begin sCNOT(q1, q2) => apply!(s, sCNOT(q1, q2)) end end end
sourceQuantumClifford.make_sumtype_variant_constructor
— Methodjulia> make_sumtype_variant_constructor(sCNOT)
:(CompactifiedGate(g::sCNOT) = begin
(CompactifiedGate').sCNOT(g.q1, g.q2)
-end)
sourceQuantumClifford.make_variant
— Methodjulia> make_variant(sCNOT)
-:(sCNOT(::Int64, ::Int64))
sourceQuantumClifford.make_variant_deconstruct
— Functionjulia> make_variant_deconstruct(sCNOT, :apply!, (:s,))
-:(sCNOT(q1, q2) => apply!(s, sCNOT(q1, q2)))
sourceQuantumClifford.mixed_destab_looks_good
— MethodCheck basic consistency requirements of a mixed destabilizer. Used in tests.
sourceQuantumClifford.mixed_stab_looks_good
— MethodCheck basic consistency requirements of a mixed stabilizer. Used in tests.
sourceQuantumClifford.pfmeasurement
— FunctionFor a given simulated state, e.g. a PauliFrame
instance, returns the measurement results.
sourceQuantumClifford.precise_inv
— MethodInverting a binary matrix: uses floating point for small matrices and Nemo for large matrices.
sourceQuantumClifford.project_cond!
— Methodsource QuantumClifford.projectremoverand!
— MethodUnexported low-level function that projects a qubit and returns the result while making the tableau smaller by a qubit.
Because MixedDestabilizer is not mutable we return a new MixedDestabilizer with the same (modified) xzs array.
sourceQuantumClifford.quantum_mallows
— MethodSample (h, S) from the distribution P_n(h, S) from Bravyi and Maslov Algorithm 1.
sourceQuantumClifford.remove_column!
— MethodUnexported low-level function that removes a column (by shifting all columns to the right of the target by one step to the left)
Because Tableau is not mutable we return a new Tableau with the same (modified) xzs array.
sourceQuantumClifford.rowdecompose
— MethodDecompose a Pauli $P$ in terms of stabilizer and destabilizer rows from a given tableaux.
For given tableaux of rows destabilizer rows $\{d_i\}$ and stabilizer rows $\{s_i\}$, there are boolean vectors $b$ and $c$ such that $P = i^p \prod_i d_i^{b_i} \prod_i s_i^{c_i}$.
This function returns p
, b
, c
.
julia> s = MixedDestabilizer(ghz(2))
+end)
sourceQuantumClifford.make_variant
— Methodjulia> make_variant(sCNOT)
+:(sCNOT(::Int64, ::Int64))
sourceQuantumClifford.make_variant_deconstruct
— Functionjulia> make_variant_deconstruct(sCNOT, :apply!, (:s,))
+:(sCNOT(q1, q2) => apply!(s, sCNOT(q1, q2)))
sourceQuantumClifford.mixed_destab_looks_good
— MethodCheck basic consistency requirements of a mixed destabilizer. Used in tests.
sourceQuantumClifford.mixed_stab_looks_good
— MethodCheck basic consistency requirements of a mixed stabilizer. Used in tests.
sourceQuantumClifford.pfmeasurement
— FunctionFor a given simulated state, e.g. a PauliFrame
instance, returns the measurement results.
sourceQuantumClifford.precise_inv
— MethodInverting a binary matrix: uses floating point for small matrices and Nemo for large matrices.
sourceQuantumClifford.project_cond!
— Methodsource QuantumClifford.projectremoverand!
— MethodUnexported low-level function that projects a qubit and returns the result while making the tableau smaller by a qubit.
Because MixedDestabilizer is not mutable we return a new MixedDestabilizer with the same (modified) xzs array.
sourceQuantumClifford.quantum_mallows
— MethodSample (h, S) from the distribution P_n(h, S) from Bravyi and Maslov Algorithm 1.
sourceQuantumClifford.remove_column!
— MethodUnexported low-level function that removes a column (by shifting all columns to the right of the target by one step to the left)
Because Tableau is not mutable we return a new Tableau with the same (modified) xzs array.
sourceQuantumClifford.rowdecompose
— MethodDecompose a Pauli $P$ in terms of stabilizer and destabilizer rows from a given tableaux.
For given tableaux of rows destabilizer rows $\{d_i\}$ and stabilizer rows $\{s_i\}$, there are boolean vectors $b$ and $c$ such that $P = i^p \prod_i d_i^{b_i} \prod_i s_i^{c_i}$.
This function returns p
, b
, c
.
julia> s = MixedDestabilizer(ghz(2))
𝒟ℯ𝓈𝓉𝒶𝒷
+ Z_
+ _X
@@ -738,7 +743,7 @@
(3, Bool[1, 0], Bool[1, 1])
julia> im^3 * P"Z_" * P"XX" * P"ZZ"
-+ XY
sourceQuantumClifford.sample_geometric_2
— MethodThis function samples a number from 1 to n
where n >= 1
probability of outputting i
is proportional to 2^i
sourceQuantumClifford.stab_looks_good
— MethodCheck basic consistency requirements of a stabilizer. Used in tests.
sourceQuantumClifford.to_cpu
— Functioncopies the memory content of the object to CPU
You can only use this function if CUDA.jl is imported
For more advanced users to_cpu(data, element_type)
will reinterpret elements of data and converts them to element_type
. For example based on your CPU architecture, if working with matrices of UInt32 is faster than UInt64, you can use to_cpu(data, UInt32)
julia> using QuantumClifford: to_cpu, to_gpu
++ XY
sourceQuantumClifford.sample_geometric_2
— MethodThis function samples a number from 1 to n
where n >= 1
probability of outputting i
is proportional to 2^i
sourceQuantumClifford.stab_looks_good
— MethodCheck basic consistency requirements of a stabilizer. Used in tests.
sourceQuantumClifford.to_cpu
— Functioncopies the memory content of the object to CPU
You can only use this function if CUDA.jl is imported
For more advanced users to_cpu(data, element_type)
will reinterpret elements of data and converts them to element_type
. For example based on your CPU architecture, if working with matrices of UInt32 is faster than UInt64, you can use to_cpu(data, UInt32)
julia> using QuantumClifford: to_cpu, to_gpu
julia> using CUDA # without this import, to_cpu, to_gpu are just function
@@ -761,7 +766,7 @@
julia> pf_gpu = to_gpu(PauliFrame(1000, 2, 2));
julia> circuit = [sMZ(1, 1), sHadamard(2), sMZ(2, 2)];
julia> pftrajectories(pf_gpu, circuit);
-julia> measurements = to_cpu(pf_gpu.measurements);
See also: to_gpu
sourceQuantumClifford.to_gpu
— Functioncopies the memory content of the object to GPU
You can only use this function if CUDA.jl is imported
For more advanced users to_gpu(data, element_type)
will reinterpret elements of data and converts them to element_type
. For example based on your GPU architecture, if working with matrices of UInt64 is faster than UInt32, you can use to_gpu(data, UInt64)
julia> using QuantumClifford: to_cpu, to_gpu
+julia> measurements = to_cpu(pf_gpu.measurements);
See also: to_gpu
sourceQuantumClifford.to_gpu
— Functioncopies the memory content of the object to GPU
You can only use this function if CUDA.jl is imported
For more advanced users to_gpu(data, element_type)
will reinterpret elements of data and converts them to element_type
. For example based on your GPU architecture, if working with matrices of UInt64 is faster than UInt32, you can use to_gpu(data, UInt64)
julia> using QuantumClifford: to_cpu, to_gpu
julia> using CUDA # without this import, to_cpu, to_gpu are just function
@@ -784,4 +789,4 @@
julia> pf_gpu = to_gpu(PauliFrame(1000, 2, 2));
julia> circuit = [sMZ(1, 1), sHadamard(2), sMZ(2, 2)];
julia> pftrajectories(pf_gpu, circuit);
-julia> measurements = to_cpu(pf_gpu.measurements);
See also: to_cpu
sourceQuantumClifford.trusted_rank
— FunctionA "trusted" rank
which returns rank(state)
for Mixed[De]Stabilizer
and length(state)
for [De]Stabilizer
.
sourceQuantumClifford.zero!
— MethodZero-out a given row of a Tableau
sourceQuantumClifford.zero!
— MethodZero-out the phases and single-qubit operators in a PauliOperator
sourceQuantumClifford.@qubitop1
— MacroMacro used to define single qubit symbolic gates and their qubit_kernel
methods.
sourceQuantumClifford.@qubitop2
— MacroMacro used to define 2-qubit symbolic gates and their qubit_kernel
methods.
sourceQuantumClifford.@valbooldispatch
— MacroTurns f(Val(x))
into x ? f(Val(true)) : f(Val(false))
in order to avoid dynamic dispatch
source
Settings
This document was generated with Documenter.jl version 1.7.0 on Friday 27 September 2024. Using Julia version 1.10.5.