From f29341219f66dd5a7b6fb94934a62d869cf539b6 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 18 Dec 2023 14:51:01 +0000 Subject: [PATCH] build based on c8d531f --- dev/.documenter-siteinfo.json | 2 +- dev/API/index.html | 104 ++++++++++---------- dev/allops/index.html | 2 +- dev/canonicalization/index.html | 8 +- dev/commonstates/index.html | 2 +- dev/datastructures/index.html | 2 +- dev/ecc_example_sim/index.html | 8 +- dev/graphs/index.html | 2 +- dev/index.html | 2 +- dev/mixed/index.html | 2 +- dev/noise/index.html | 2 +- dev/noisycircuits/index.html | 2 +- dev/noisycircuits_API/index.html | 2 +- dev/noisycircuits_mc/index.html | 4 +- dev/noisycircuits_ops/index.html | 2 +- dev/noisycircuits_perturb/index.html | 4 +- dev/plotting/{bc13d326.svg => 06ad6061.svg} | 12 +-- dev/plotting/{40a4f2fe.svg => 29e20f26.svg} | 12 +-- dev/plotting/{5193034e.svg => 88376e40.svg} | 12 +-- dev/plotting/{5080f90c.svg => a2f9747a.svg} | 12 +-- dev/plotting/{b78518d1.svg => fe713cde.svg} | 12 +-- dev/plotting/index.html | 12 +-- dev/references/index.html | 2 +- dev/stab-algebra-manual/index.html | 2 +- dev/tutandpub/index.html | 2 +- 25 files changed, 114 insertions(+), 114 deletions(-) rename dev/plotting/{bc13d326.svg => 06ad6061.svg} (98%) rename dev/plotting/{40a4f2fe.svg => 29e20f26.svg} (99%) rename dev/plotting/{5193034e.svg => 88376e40.svg} (98%) rename dev/plotting/{5080f90c.svg => a2f9747a.svg} (98%) rename dev/plotting/{b78518d1.svg => fe713cde.svg} (99%) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 03e80eab5..dc0c47861 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-12-18T13:05:43","documenter_version":"1.2.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-12-18T14:50:53","documenter_version":"1.2.1"}} \ No newline at end of file diff --git a/dev/API/index.html b/dev/API/index.html index 881a7adb4..b15bfd5d5 100644 --- a/dev/API/index.html +++ b/dev/API/index.html @@ -4,7 +4,7 @@ padding-top: 0 !important; padding-bottom: 0 !important; } -

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:

See the full list of operations for a list of implemented operations.

Autogenerated API list

QuantumClifford.QuantumCliffordModule

A module for using the Stabilizer formalism and simulating Clifford circuits.

source
QuantumClifford.continue_statConstant

Returned by applywstatus! if the circuit simulation should continue.

source
QuantumClifford.failure_statConstant

Returned by applywstatus! if the circuit reports a failure.

See also: VerifyOp, BellMeasurement.

source
QuantumClifford.false_success_statConstant

Returned 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.

source
QuantumClifford.true_success_statConstant

Returned by applywstatus! if the circuit reports a success and there is no undetected error.

See also: VerifyOp, BellMeasurement.

source
QuantumClifford.AbstractSingleQubitOperatorType

Supertype of all single-qubit symbolic operators.

source
QuantumClifford.AbstractSymbolicOperatorType

Supertype of all symbolic operators. Subtype of AbstractCliffordOperator

source
QuantumClifford.AbstractTwoQubitOperatorType

Supertype of all two-qubit symbolic operators.

source
QuantumClifford.BellMeasurementType

A Bell measurement performing the correlation measurement corresponding to the given pauli projections on the qubits at the selected indices.

source
QuantumClifford.CircuitStatusType

A convenience struct to represent the status of a circuit simulated by mctrajectories

source
QuantumClifford.ClassicalXORType

Applies an XOR gate to classical bits. Currently only implemented for funcitonality with pauli frames.

source
QuantumClifford.CliffordOperatorType

Clifford 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.BellMeasurementType

A Bell measurement performing the correlation measurement corresponding to the given pauli projections on the qubits at the selected indices.

source
QuantumClifford.CliffordOperatorType

Clifford 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
source
QuantumClifford.DestabilizerType

A 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.

source
QuantumClifford.MixedDestabilizerType

A 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

source
QuantumClifford.PauliFrameType
struct 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.

source
QuantumClifford.DestabilizerType

A 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.

source
QuantumClifford.MixedDestabilizerType

A 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

source
QuantumClifford.PauliFrameType
struct 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.

source
QuantumClifford.PauliFrameMethod
PauliFrame(
     frames,
     qubits,
     measurements
 ) -> PauliFrame{Stabilizer{QuantumClifford.Tableau{Vector{UInt8}, LinearAlgebra.Adjoint{UInt64, Matrix{UInt64}}}}, Matrix{Bool}}
-

Prepare an empty set of Pauli frames with the given number of frames and qubits. Preallocates spaces for measurement number of measurements.

source
QuantumClifford.PauliOperatorType

A 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.

source
QuantumClifford.PauliOperatorType

A 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
source
QuantumClifford.RegisterType

A register, representing the state of a computer including both a tableaux and an array of classical bits (e.g. for storing measurement results)

source
QuantumClifford.ResetType

Reset 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

source
QuantumClifford.SingleQubitOperatorType

A "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
source
QuantumClifford.RegisterType

A register, representing the state of a computer including both a tableaux and an array of classical bits (e.g. for storing measurement results)

source
QuantumClifford.ResetType

Reset 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

source
QuantumClifford.SingleQubitOperatorType

A "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".

source
QuantumClifford.SparseGateType

A 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.

source
QuantumClifford.StabMixtureType
mutable 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".

source
QuantumClifford.SparseGateType

A 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.

source
QuantumClifford.StabMixtureType
mutable 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

source
QuantumClifford.StabilizerType

Stabilizer, 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

source
QuantumClifford.StabilizerType

Stabilizer, 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!

source
QuantumClifford.UnitaryPauliChannelType

A 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!

source
QuantumClifford.UnitaryPauliChannelType

A 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
source
QuantumClifford.VerifyOpType

A "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.

source
QuantumClifford.sMRZType

Measure 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
source
QuantumClifford.VerifyOpType

A "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.

source
QuantumClifford.sMRZType

Measure 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

See also: Reset, sMZ

source
QuantumClifford.PauliErrorFunction

A convenient constructor for various types of Pauli errors, that can be used as circuit gates in simulations. Returns more specific types when necessary.

source
QuantumClifford.applybranchesFunction

Compute 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.

source
QuantumClifford.applynoise!Function

A method modifying a given state by applying the corresponding noise model. It is non-deterministic, part of the Noise interface.

source
QuantumClifford.PauliErrorFunction

A convenient constructor for various types of Pauli errors, that can be used as circuit gates in simulations. Returns more specific types when necessary.

source
QuantumClifford.applybranchesFunction

Compute 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.

source
QuantumClifford.applynoise!Function

A method modifying a given state by applying the corresponding noise model. It is non-deterministic, part of the Noise interface.

source
QuantumClifford.bellFunction

Prepare one or more Bell pairs (with optional phases).

julia> bell()
 + XX
 + ZZ
 
@@ -217,11 +217,11 @@
 - XX__
 + ZZ__
 - __XX
-- __ZZ
source
QuantumClifford.bigramMethod
bigram(
     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., 2020).

See also: canonicalize_clip!

source
QuantumClifford.canonicalize!Method
canonicalize!(
+

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., 2020).

See also: canonicalize_clip!

source
QuantumClifford.canonicalize_clip!Method
canonicalize_clip!(
     state::QuantumClifford.AbstractStabilizer;
     phases
 ) -> QuantumClifford.AbstractStabilizer
@@ -294,25 +294,25 @@
 + _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!.

source
QuantumClifford.canonicalize_gott!Method

Inplace 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!

source
QuantumClifford.canonicalize_gott!Method

Inplace 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!

source
QuantumClifford.canonicalize_rref!Method
canonicalize_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!

source
QuantumClifford.commMethod

Check whether two operators commute.

0x0 if they commute, 0x1 if they anticommute.

julia> P"XX"*P"ZZ", P"ZZ"*P"XX"
+
source
QuantumClifford.commMethod

Check 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
source
QuantumClifford.compactify_circuitMethod

Convert 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.

source
QuantumClifford.fastcolumnFunction

Convert 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

source
QuantumClifford.fastrowFunction

Convert 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

source
QuantumClifford.generate!Method

Generate 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
+0x01
source
QuantumClifford.compactify_circuitMethod

Convert 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.

source
QuantumClifford.fastcolumnFunction

Convert 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

source
QuantumClifford.fastrowFunction

Convert 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

source
QuantumClifford.generate!Method

Generate 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";
@@ -329,7 +329,7 @@
 true
 
 julia> generate!(P"XII",canonicalize!(S"XII")) === nothing
-false
source
QuantumClifford.ghzFunction

Prepare a GHZ state of n qubits.

julia> ghz()
 + XXX
 + ZZ_
 + _ZZ
@@ -342,7 +342,7 @@
 + XXXX
 + ZZ__
 + _ZZ_
-+ __ZZ
source
QuantumClifford.graphstateMethod

Convert 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

source
QuantumClifford.graphstateMethod

Convert 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_
@@ -406,35 +406,35 @@
 1-element Vector{Int64}:
  3

The Graphs.jl library provides many graph-theory tools and the MakieGraphs.jl library provides plotting utilies 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.

source
QuantumClifford.logdotMethod

Logarithm 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).

source
QuantumClifford.pfmeasurementsMethod
pfmeasurements(frame::PauliFrame) -> Any
-

Returns the measurement results for each frame in the PauliFrame instance.

Relative mesurements

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.

source
QuantumClifford.pfmeasurementsMethod
pfmeasurements(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.

source
QuantumClifford.pftrajectoriesMethod
pftrajectories(
+ 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.

source
QuantumClifford.logdotMethod

Logarithm 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).

source
QuantumClifford.pfmeasurementsMethod
pfmeasurements(frame::PauliFrame) -> Any
+

Returns the measurement results for each frame in the PauliFrame instance.

Relative mesurements

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.

source
QuantumClifford.pfmeasurementsMethod
pfmeasurements(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.

source
QuantumClifford.pftrajectoriesMethod
pftrajectories(
     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

source
QuantumClifford.pftrajectoriesMethod
pftrajectories(
+

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

source
QuantumClifford.pftrajectoriesMethod
pftrajectories(
     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.

source
QuantumClifford.phasesMethod

The phases of a given tableau. It is a view, i.e. if you modify this array, the original tableau caries these changes.

source
QuantumClifford.prodphaseMethod

Get 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.

source
QuantumClifford.phasesMethod

The phases of a given tableau. It is a view, i.e. if you modify this array, the original tableau caries these changes.

source
QuantumClifford.prodphaseMethod

Get 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
source
QuantumClifford.random_pauliMethod

A random Pauli operator on n qubits.

Use realphase=true to get operators with phase ±1 (excluding ±i). nophase=true sets the phase to +1.

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, Y, or Z, each with probability p. Useful for simulating Pauli noise.

source
QuantumClifford.stabilizerplotFunction

A 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.

source
QuantumClifford.stabilizerplot_axisFunction

A 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.

source
QuantumClifford.random_pauliMethod

A random Pauli operator on n qubits.

Use realphase=true to get operators with phase ±1 (excluding ±i). nophase=true sets the phase to +1.

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, Y, or Z, each with probability p. Useful for simulating Pauli noise.

source
QuantumClifford.stabilizerplotFunction

A 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.

source
QuantumClifford.stabilizerplot_axisFunction

A 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.

source
QuantumClifford.xbitMethod

Extract as a new bit array the X part of the UInt array of packed qubits of a given Pauli operator.

source
QuantumClifford.zbitMethod

Extract as a new bit array the Z part of the UInt array of packed qubits of a given Pauli operator.

source
QuantumInterface.apply!Function

In 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).

source
QuantumClifford.xbitMethod

Extract as a new bit array the X part of the UInt array of packed qubits of a given Pauli operator.

source
QuantumClifford.zbitMethod

Extract as a new bit array the Z part of the UInt array of packed qubits of a given Pauli operator.

source
QuantumInterface.apply!Function

In 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).

source
QuantumInterface.embedMethod

Embed a Pauli operator in a larger Pauli operator.

julia> embed(5, 3, P"-Y")
 - __Y__
 
 julia> embed(5, (3,5), P"-YX")
-- __Y_X
source
QuantumInterface.entanglement_entropyFunction

Get 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.

source
QuantumInterface.entanglement_entropyMethod

Get 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".

source
QuantumInterface.expectMethod
expect(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.

source
QuantumInterface.entanglement_entropyFunction

Get 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.

source
QuantumInterface.entanglement_entropyMethod

Get 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".

source
QuantumInterface.expectMethod
expect(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.

source
QuantumInterface.project!Method
project!(
     state::MixedStabilizer,
     pauli::PauliOperator;
     phases
@@ -559,47 +559,47 @@
 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.

See also: projectX!, projectY!, projectZ!.

source
QuantumInterface.reset_qubits!Method
reset_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.

See also: projectX!, projectY!, projectZ!.

source
QuantumInterface.reset_qubits!Method
reset_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.

source
QuantumInterface.traceout!Method
traceout!(
+

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.

source

Private API

Private Implementation Details

These functions are used internally by the library and might be drastically modified or deleted without warning or deprecation.

QuantumClifford.TableauType

Internal 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.

source

Private API

Private Implementation Details

These functions are used internally by the library and might be drastically modified or deleted without warning or deprecation.

QuantumClifford.TableauType

Internal 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.

source
Base.invMethod
inv(
     c::CliffordOperator;
     phases
 ) -> CliffordOperator{QuantumClifford.Tableau{Vector{UInt8}, Matrix{UInt64}}}
-

Inverse of a CliffordOperator

source
QuantumClifford._remove_rowcol!Method

Unexported 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!.

source
QuantumClifford._rowmove!Method

Unexported 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!.

source
QuantumClifford.applynoise_branchesFunction

Compute 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.

source
QuantumClifford.initZ!Method
initZ!(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.

source
QuantumClifford._remove_rowcol!Method

Unexported 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!.

source
QuantumClifford._rowmove!Method

Unexported 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!.

source
QuantumClifford.applynoise_branchesFunction

Compute 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.

source
QuantumClifford.initZ!Method
initZ!(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.

source
QuantumClifford.make_sumtype_methodFunction

``` 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

source
QuantumClifford.make_sumtype_methodFunction

``` 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

source
QuantumClifford.projectremoverand!Method

Unexported 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.

source
QuantumClifford.remove_column!Method

Unexported 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.

source
QuantumClifford.rowdecomposeMethod

Decompose 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)
source
QuantumClifford.projectremoverand!Method

Unexported 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.

source
QuantumClifford.remove_column!Method

Unexported 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.

source
QuantumClifford.rowdecomposeMethod

Decompose 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
@@ -611,7 +611,7 @@
 (3, Bool[1, 0], Bool[1, 1])
 
 julia> im^3 * P"Z_" * P"XX" * P"ZZ"
-+ XY
source
QuantumClifford.to_cpuFunction

copies 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
source
QuantumClifford.to_cpuFunction

copies 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
 
@@ -634,7 +634,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

source
QuantumClifford.to_gpuFunction

copies 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

source
QuantumClifford.to_gpuFunction

copies 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
 
@@ -657,4 +657,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

source
+julia> measurements = to_cpu(pf_gpu.measurements);

See also: to_cpu

source
QuantumClifford.trusted_rankFunction

A "trusted" rank which returns rank(state) for Mixed[De]Stabilizer and lenght(state) for [De]Stabilizer.

source
QuantumClifford.zero!Method

Zero-out a given row of a Tableau

source
QuantumClifford.zero!Method

Zero-out the phases and single-qubit operators in a PauliOperator

source
QuantumClifford.@qubitop1Macro

Macro used to define single qubit symbolic gates and their qubit_kernel methods.

source
QuantumClifford.@qubitop2Macro

Macro used to define 2-qubit symbolic gates and their qubit_kernel methods.

source
QuantumClifford.@valbooldispatchMacro

Turns f(Val(x)) into x ? f(Val(true)) : f(Val(false)) in order to avoid dynamic dispatch

See discourse discussion

source
diff --git a/dev/allops/index.html b/dev/allops/index.html index 1340c2d80..224de8b5c 100644 --- a/dev/allops/index.html +++ b/dev/allops/index.html @@ -10,4 +10,4 @@ noise = UnbiasedUncorrelatedNoise(ε) noisy_gate = NoisyGate(SparseGate(tCNOT, [2,4]), noise)Example block output

In circuit diagrams the noise is not depicted, but after each application of the gate defined in noisy_gate, a noise operator will also be applied. The example above is of Pauli Depolarization implemented by UnbiasedUncorrelatedNoise.

One can also apply only the noise operator by using NoiseOp which acts only on specified qubits. Or alternatively, one can use NoiseOpAll in order to apply noise to all qubits.

[NoiseOp(noise, [4,5]), NoiseOpAll(noise)]
Example block output

The machinery behind noise processes and different types of noise is detailed in the section on noise

Coincidence Measurements

Global parity measurements involving single-qubit projections and classical communication are implemented with BellMeasurement. One needs to specify the axes of measurement and the qubits being measured. If the parity is trivial, the circuit continues, if the parity is non-trivial, the circuit ends and reports a detected failure. This operator is frequently used in the simulation of entanglement purification.

BellMeasurement([sMX(1), sMY(3), sMZ(4)])
Example block output

There is also NoisyBellMeasurement that takes the bit-flip probability of a single-qubit measurement as a third argument.

Stabilizer Measurements

A measurement over one or more qubits can also be performed, e.g., a direct stabilizer measurement on multiple qubits without the use of ancillary qubits. When applied to multiple qubits, this differs from BellMeasurement as it performs a single projection, unlike BellMeasurement which performs a separate projection for every single qubit involved. This measurement is implemented in PauliMeasurement which requires a Pauli operator on which to project and the index of the classical bit in which to store the result. Alternatively, there are sMX, sMZ, sMY if you are measuring a single qubit.

[PauliMeasurement(P"XYZ", 1), sMZ(2, 2)]
Example block output

Reset Operations

The Reset operations lets you trace out the specified qubits and set their state to a specific tableau.

new_state = random_stabilizer(3)
 qubit_indices = [1,2,3]
-Reset(new_state, qubit_indices)
Example block output

It can be done anywhere in a circuit, not just at the beginning.

+Reset(new_state, qubit_indices)Example block output

It can be done anywhere in a circuit, not just at the beginning.

diff --git a/dev/canonicalization/index.html b/dev/canonicalization/index.html index ae87064a1..141f0bfd7 100644 --- a/dev/canonicalization/index.html +++ b/dev/canonicalization/index.html @@ -2,13 +2,13 @@ Canonicalization · QuantumClifford.jl

Canonicalization operations

Different types of canonicalization operations are implemented. All of them are types of Gaussian elimination.

canonicalize!

First do elimination on all X components and only then perform elimination on the Z components. Based on (Garcia et al., 2012). It is used in logdot for inner products of stabilizer states.

The final tableaux, if square should look like the following

If the tableaux is shorter than a square, the diagonals might not reach all the way to the right.

using QuantumClifford, CairoMakie
 f=Figure()
 stabilizerplot_axis(f[1,1], canonicalize!(random_stabilizer(20,30)))
-f
Example block output

canonicalize_rref!

Cycle between elimination on X and Z for each qubit. Particularly useful for tracing out qubits. Based on (Audenaert and Plenio, 2005). For convenience reasons, the canonicalization starts from the bottom row, and you can specify as a second argument which columns to be canonicalized (useful for tracing out arbitrary qubits, e.g., in traceout!).

The tableau canonicalization is done in recursive steps, each one of which results in something akin to one of these three options

using QuantumClifford, CairoMakie
+f
Example block output

canonicalize_rref!

Cycle between elimination on X and Z for each qubit. Particularly useful for tracing out qubits. Based on (Audenaert and Plenio, 2005). For convenience reasons, the canonicalization starts from the bottom row, and you can specify as a second argument which columns to be canonicalized (useful for tracing out arbitrary qubits, e.g., in traceout!).

The tableau canonicalization is done in recursive steps, each one of which results in something akin to one of these three options

using QuantumClifford, CairoMakie
 f=Figure()
 stabilizerplot_axis(f[1,1], canonicalize_rref!(random_stabilizer(20,30),1:30)[1])
-f
Example block output

canonicalize_gott!

First do elimination on all X components and only then perform elimination on the Z components, but without touching the qubits that were eliminated during the X pass. Unlike other canonicalization operations, qubit columns are reordered, providing for a straight diagonal in each block. Particularly useful as certain blocks of the new created matrix are related to logical operations of the corresponding code, e.g. computing the logical X and Z operators of a MixedDestabilizer. Based on (Gottesman, 1997).

A canonicalized tableau would look like the following (the right-most block does not exist for square tableaux).

using QuantumClifford, CairoMakie
+f
Example block output

canonicalize_gott!

First do elimination on all X components and only then perform elimination on the Z components, but without touching the qubits that were eliminated during the X pass. Unlike other canonicalization operations, qubit columns are reordered, providing for a straight diagonal in each block. Particularly useful as certain blocks of the new created matrix are related to logical operations of the corresponding code, e.g. computing the logical X and Z operators of a MixedDestabilizer. Based on (Gottesman, 1997).

A canonicalized tableau would look like the following (the right-most block does not exist for square tableaux).

using QuantumClifford, CairoMakie
 f=Figure()
 stabilizerplot_axis(f[1,1], canonicalize_gott!(random_stabilizer(30))[1])
-f
Example block output

canonicalize_clip!

Convert to the "clipped" gauge of a stabilizer state resulting in a "river" of non-identity operators around the diagonal.

using QuantumClifford, CairoMakie
+f
Example block output

canonicalize_clip!

Convert to the "clipped" gauge of a stabilizer state resulting in a "river" of non-identity operators around the diagonal.

using QuantumClifford, CairoMakie
 f=Figure()
 stabilizerplot_axis(f[1,1], canonicalize_clip!(random_stabilizer(30)))
-f
Example block output

The properties of the clipped gauge are:

  1. Each qubit is the left/right "endpoint" of exactly two stabilizer rows.
  2. For the same qubit the two endpoints are always different Pauli operators.

This canonicalization is used to derive the bigram a stabilizer state, which is also related to entanglement entropy in the state.

Introduced in (Nahum et al., 2017), with a more detailed explanation of the algorithm in Appendix A of (Li et al., 2019).

+fExample block output

The properties of the clipped gauge are:

  1. Each qubit is the left/right "endpoint" of exactly two stabilizer rows.
  2. For the same qubit the two endpoints are always different Pauli operators.

This canonicalization is used to derive the bigram a stabilizer state, which is also related to entanglement entropy in the state.

Introduced in (Nahum et al., 2017), with a more detailed explanation of the algorithm in Appendix A of (Li et al., 2019).

diff --git a/dev/commonstates/index.html b/dev/commonstates/index.html index 21645b22c..08a12e5a9 100644 --- a/dev/commonstates/index.html +++ b/dev/commonstates/index.html @@ -72,4 +72,4 @@ + XXXX + ZZ__ + _ZZ_ -+ __ZZ ++ __ZZ diff --git a/dev/datastructures/index.html b/dev/datastructures/index.html index 3f4123eda..d53f7095b 100644 --- a/dev/datastructures/index.html +++ b/dev/datastructures/index.html @@ -1,2 +1,2 @@ -Datastructure Choice · QuantumClifford.jl

Data Structures Options

Choosing Appropriate Tableau Data Structure

There are four different data structures used to represent stabilizer states. If you will never need projective measurements you probably would want to use Stabilizer. If you require projective measurements, but only on pure states, Destabilizer should be the appropriate data structure. If mixed stabilizer states are involved, MixedStabilizer would be necessary.

Stabilizer is simply a list of Pauli operators in a tableau form. As a data structure it does not enforce the requirements for a pure stabilizer state (the rows of the tableau do not necessarily commute, nor are they forced to be Hermitian; the tableau might be underdetermined, redundant, or contradictory). It is up to the user to ensure that the initial values in the tableau are meaningful and consistent.

canonicalize!, project!, and generate! can accept an under determined (mixed state) Stabilizer instance and operate correctly. canonicalize! can also accept a redundant Stabilizer (i.e. not all rows are independent), leaving as many identity rows at the bottom of the canonicalized tableau as the number of redundant stabilizers in the initial tableau.

canonicalize! takes $\mathcal{O}(n^3)$ steps. generate! expects a canonicalized input and then takes $\mathcal{O}(n^2)$ steps. project! takes $\mathcal{O}(n^3)$ for projecting on commuting operators due to the need to call canonicalize! and generate!. If the projections is on an anticommuting operator (or if keep_result=false) then it takes $\mathcal{O}(n^2)$ steps.

MixedStabilizer provides explicit tracking of the rank of the mixed state and works properly when the projection is on a commuting operator not in the stabilizer (see table below for details). Otherwise it has the same performance as Stabilizer.

The canonicalization can be made unnecessary if we track the destabilizer generators. There are two data structures capable of that.

Destabilizer stores both the destabilizer and stabilizer states. project! called on it never requires a stabilizer canonicalization, hence it runs in $\mathcal{O}(n^2)$. However, project! will raise an exception if you try to project on a commuting state that is not in the stabilizer as that would be an expensive $\mathcal{O}(n^3)$ operation.

MixedDestabilizer tracks both the destabilizer operators and the logical operators in addition to the stabilizer generators. It does not require canonicalization for measurements and its project! operations always takes $\mathcal{O}(n^2)$.

For the operation _, anticom_index, result = project!(...) we have the following behavior:

projectionStabilizerMixedStabilizerDestabilizerMixedDestabilizer
on anticommuting operator anticom_index>0 result===nothingcorrect result in $\mathcal{O}(n^2)$ stepssame as Stabilizersame as Stabilizersame as Stabilizer
on commuting operator in the stabilizer anticom_index==0 result!==nothing$\mathcal{O}(n^3)$; or $\mathcal{O}(n^2)$ if keep_result=false$\mathcal{O}(n^3)$$\mathcal{O}(n^2)$ if the state is pure, throws exception otherwise$\mathcal{O}(n^2)$
on commuting operator out of the stabilizer[1] anticom_index==rank result===nothing$\mathcal{O}(n^3)$, but the user needs to manually include the new operator to the stabilizer; or $\mathcal{O}(n^2)$ if keep_result=false but then result indistinguishable from cell above and anticom_index==0$\mathcal{O}(n^3)$ and rank goes up by onenot applicable if the state is pure, throws exception otherwise$\mathcal{O}(n^2)$ and rank goes up by one

Notice the results when the projection operator commutes with the state but is not generated by the stabilizers of the state (the last row of the table). In that case we have _, anticom_index, result = project!(...) where both anticom_index==rank and result===nothing, with rank being the new rank after projection, one more than the number of rows in the tableau before the measurement.

Bit Packing in Integers and Array Order

We do not use boolean arrays to store information about the qubits as this would be wasteful (7 out of 8 bits in the boolean would be unused). Instead, we use all 8 qubits in a byte and peform bitwise logical operations as necessary. Implementation details of the object in RAM can matter for performance. The library permits any of the standard UInt types to be used for packing the bits, and larger UInt types (like UInt64) are usually faster as they permit working on 64 qubits at a time (instead of 1 if we used a boolean, or 8 if we used a byte).

Moreover, how a tableau is stored in memory can affect performance, as a row-major storage usually permits more efficient use of the CPU cache (for the particular algorithms we use).

Both of these parameters are benchmarked (testing the application of a Pauli operator, which is an $\mathcal{O}(n^2)$ operation; and testing the canonicalization of a Stabilizer, which is an $\mathcal{O}(n^3)$ operation). Row-major UInt64 is the best performing and it is used by default in this library.

  • 1This can occur only if the state being projected is mixed. Both Stabilizer and Destabilizer can be used for mixed states by simply providing fewer stabilizer generators than qubits at initialization. This can be useful for low-level code that tries to avoid the extra memory cost of using MixedStabilizer and MixedDestabilizer but should be avoided otherwise. project! works correctly or raises an explicit warning on all 4 data structures.
+Datastructure Choice · QuantumClifford.jl

Data Structures Options

Choosing Appropriate Tableau Data Structure

There are four different data structures used to represent stabilizer states. If you will never need projective measurements you probably would want to use Stabilizer. If you require projective measurements, but only on pure states, Destabilizer should be the appropriate data structure. If mixed stabilizer states are involved, MixedStabilizer would be necessary.

Stabilizer is simply a list of Pauli operators in a tableau form. As a data structure it does not enforce the requirements for a pure stabilizer state (the rows of the tableau do not necessarily commute, nor are they forced to be Hermitian; the tableau might be underdetermined, redundant, or contradictory). It is up to the user to ensure that the initial values in the tableau are meaningful and consistent.

canonicalize!, project!, and generate! can accept an under determined (mixed state) Stabilizer instance and operate correctly. canonicalize! can also accept a redundant Stabilizer (i.e. not all rows are independent), leaving as many identity rows at the bottom of the canonicalized tableau as the number of redundant stabilizers in the initial tableau.

canonicalize! takes $\mathcal{O}(n^3)$ steps. generate! expects a canonicalized input and then takes $\mathcal{O}(n^2)$ steps. project! takes $\mathcal{O}(n^3)$ for projecting on commuting operators due to the need to call canonicalize! and generate!. If the projections is on an anticommuting operator (or if keep_result=false) then it takes $\mathcal{O}(n^2)$ steps.

MixedStabilizer provides explicit tracking of the rank of the mixed state and works properly when the projection is on a commuting operator not in the stabilizer (see table below for details). Otherwise it has the same performance as Stabilizer.

The canonicalization can be made unnecessary if we track the destabilizer generators. There are two data structures capable of that.

Destabilizer stores both the destabilizer and stabilizer states. project! called on it never requires a stabilizer canonicalization, hence it runs in $\mathcal{O}(n^2)$. However, project! will raise an exception if you try to project on a commuting state that is not in the stabilizer as that would be an expensive $\mathcal{O}(n^3)$ operation.

MixedDestabilizer tracks both the destabilizer operators and the logical operators in addition to the stabilizer generators. It does not require canonicalization for measurements and its project! operations always takes $\mathcal{O}(n^2)$.

For the operation _, anticom_index, result = project!(...) we have the following behavior:

projectionStabilizerMixedStabilizerDestabilizerMixedDestabilizer
on anticommuting operator anticom_index>0 result===nothingcorrect result in $\mathcal{O}(n^2)$ stepssame as Stabilizersame as Stabilizersame as Stabilizer
on commuting operator in the stabilizer anticom_index==0 result!==nothing$\mathcal{O}(n^3)$; or $\mathcal{O}(n^2)$ if keep_result=false$\mathcal{O}(n^3)$$\mathcal{O}(n^2)$ if the state is pure, throws exception otherwise$\mathcal{O}(n^2)$
on commuting operator out of the stabilizer[1] anticom_index==rank result===nothing$\mathcal{O}(n^3)$, but the user needs to manually include the new operator to the stabilizer; or $\mathcal{O}(n^2)$ if keep_result=false but then result indistinguishable from cell above and anticom_index==0$\mathcal{O}(n^3)$ and rank goes up by onenot applicable if the state is pure, throws exception otherwise$\mathcal{O}(n^2)$ and rank goes up by one

Notice the results when the projection operator commutes with the state but is not generated by the stabilizers of the state (the last row of the table). In that case we have _, anticom_index, result = project!(...) where both anticom_index==rank and result===nothing, with rank being the new rank after projection, one more than the number of rows in the tableau before the measurement.

Bit Packing in Integers and Array Order

We do not use boolean arrays to store information about the qubits as this would be wasteful (7 out of 8 bits in the boolean would be unused). Instead, we use all 8 qubits in a byte and peform bitwise logical operations as necessary. Implementation details of the object in RAM can matter for performance. The library permits any of the standard UInt types to be used for packing the bits, and larger UInt types (like UInt64) are usually faster as they permit working on 64 qubits at a time (instead of 1 if we used a boolean, or 8 if we used a byte).

Moreover, how a tableau is stored in memory can affect performance, as a row-major storage usually permits more efficient use of the CPU cache (for the particular algorithms we use).

Both of these parameters are benchmarked (testing the application of a Pauli operator, which is an $\mathcal{O}(n^2)$ operation; and testing the canonicalization of a Stabilizer, which is an $\mathcal{O}(n^3)$ operation). Row-major UInt64 is the best performing and it is used by default in this library.

  • 1This can occur only if the state being projected is mixed. Both Stabilizer and Destabilizer can be used for mixed states by simply providing fewer stabilizer generators than qubits at initialization. This can be useful for low-level code that tries to avoid the extra memory cost of using MixedStabilizer and MixedDestabilizer but should be avoided otherwise. project! works correctly or raises an explicit warning on all 4 data structures.
diff --git a/dev/ecc_example_sim/index.html b/dev/ecc_example_sim/index.html index 49704b81b..3d08a3c91 100644 --- a/dev/ecc_example_sim/index.html +++ b/dev/ecc_example_sim/index.html @@ -20,7 +20,7 @@ errors = [PauliError(i,errprob) for i in 1:code_n(code)] fullcircuit = [ecirc..., errors..., scirc...]Example block output

And running this noisy simulation:

frames = pftrajectories(fullcircuit; trajectories=nframes)
 pfmeasurements(frames)
4×6 Matrix{Bool}:
- 0  1  1  0  1  1
- 0  0  0  0  0  0
- 0  0  0  0  0  0
- 1  1  1  1  0  1
+ 0 0 0 0 1 1 + 1 1 1 1 1 0 + 0 1 1 1 0 0 + 0 0 0 0 0 0 diff --git a/dev/graphs/index.html b/dev/graphs/index.html index 067e39cbf..a38ab83fb 100644 --- a/dev/graphs/index.html +++ b/dev/graphs/index.html @@ -43,4 +43,4 @@ + XZZ_ + ZX_Z + Z_XZ -+ _ZZX

Graphs are represented with the Graphs.jl package and plotting can be done both in Plots.jl and Makie.jl (with GraphMakie).

++ _ZZX

Graphs are represented with the Graphs.jl package and plotting can be done both in Plots.jl and Makie.jl (with GraphMakie).

diff --git a/dev/index.html b/dev/index.html index f33b56a2f..fd26c5d92 100644 --- a/dev/index.html +++ b/dev/index.html @@ -15,4 +15,4 @@ julia> tCNOT * S"-XX +ZZ" - X_ -+ _Z

Circuit Simulation

The circuit simulation component of QuantumClifford.jl enables Monte Carlo (or symbolic) simulations of noisy Clifford circuits. It provides three main simulation methods: mctrajectories, pftrajectories, and petrajectories. These methods offer varying levels of efficiency, accuracy, and insight.

Monte Carlo Simulations with Stabilizer Tableaux (mctrajectories)

The mctrajectories method runs Monte Carlo simulations using a Stabilizer tableau representation for the quantum states.

Monte Carlo Simulations with Pauli Frames (pftrajectories)

The pftrajectories method runs Monte Carlo simulations of Pauli frames over a single reference Stabilizer tableau simulation. This approach is much more efficient but supports a smaller class of circuits.

Symbolic Depth-First Traversal of Quantum Trajectories (petrajectories)

The petrajectories method performs a depth-first traversal of the most probable quantum trajectories, providing a fixed-order approximation of the circuit's behavior. This approach gives symbolic expressions for various figures of merit instead of just a numeric value.

++ _Z

Circuit Simulation

The circuit simulation component of QuantumClifford.jl enables Monte Carlo (or symbolic) simulations of noisy Clifford circuits. It provides three main simulation methods: mctrajectories, pftrajectories, and petrajectories. These methods offer varying levels of efficiency, accuracy, and insight.

Monte Carlo Simulations with Stabilizer Tableaux (mctrajectories)

The mctrajectories method runs Monte Carlo simulations using a Stabilizer tableau representation for the quantum states.

Monte Carlo Simulations with Pauli Frames (pftrajectories)

The pftrajectories method runs Monte Carlo simulations of Pauli frames over a single reference Stabilizer tableau simulation. This approach is much more efficient but supports a smaller class of circuits.

Symbolic Depth-First Traversal of Quantum Trajectories (petrajectories)

The petrajectories method performs a depth-first traversal of the most probable quantum trajectories, providing a fixed-order approximation of the circuit's behavior. This approach gives symbolic expressions for various figures of merit instead of just a numeric value.

diff --git a/dev/mixed/index.html b/dev/mixed/index.html index 265b59949..97a8a81f2 100644 --- a/dev/mixed/index.html +++ b/dev/mixed/index.html @@ -57,4 +57,4 @@ + XXX + ZZ_ 𝒵ₗ━━━ -+ Z_Z

Destabilizer and MixedStabilizer do not use any column swaps on instantiation as they do not track the logical operators.

++ Z_Z

Destabilizer and MixedStabilizer do not use any column swaps on instantiation as they do not track the logical operators.

diff --git a/dev/noise/index.html b/dev/noise/index.html index f36c80fbb..28cabbfa9 100644 --- a/dev/noise/index.html +++ b/dev/noise/index.html @@ -1,2 +1,2 @@ -Noise Processes · QuantumClifford.jl
+Noise Processes · QuantumClifford.jl
diff --git a/dev/noisycircuits/index.html b/dev/noisycircuits/index.html index bfcc269c0..61457d991 100644 --- a/dev/noisycircuits/index.html +++ b/dev/noisycircuits/index.html @@ -1,2 +1,2 @@ -Simulation of Noisy Circuits · QuantumClifford.jl

Simulation of Noisy Clifford Circuits

Unstable

This is unfinished experimental functionality that will change significantly.

We have experimental support for simulation of noisy Clifford circuits which can be imported with using QuantumClifford.Experimental.NoisyCircuits.

Both Monte Carlo and Perturbative Expansion approaches are supported. When performing a perturbative expansion in the noise parameter, the expansion can optionally be performed symbolically, to arbitrary high orders.

Multiple notebooks with examples are also available. For instance, see this tutorial on entanglement purification for many examples.

+Simulation of Noisy Circuits · QuantumClifford.jl

Simulation of Noisy Clifford Circuits

Unstable

This is unfinished experimental functionality that will change significantly.

We have experimental support for simulation of noisy Clifford circuits which can be imported with using QuantumClifford.Experimental.NoisyCircuits.

Both Monte Carlo and Perturbative Expansion approaches are supported. When performing a perturbative expansion in the noise parameter, the expansion can optionally be performed symbolically, to arbitrary high orders.

Multiple notebooks with examples are also available. For instance, see this tutorial on entanglement purification for many examples.

diff --git a/dev/noisycircuits_API/index.html b/dev/noisycircuits_API/index.html index 1eb938d01..3ebf167f5 100644 --- a/dev/noisycircuits_API/index.html +++ b/dev/noisycircuits_API/index.html @@ -1,2 +1,2 @@ -API · QuantumClifford.jl

Full API (autogenerated)

Unstable

This is experimental functionality with an unstable API.

+API · QuantumClifford.jl

Full API (autogenerated)

Unstable

This is experimental functionality with an unstable API.

diff --git a/dev/noisycircuits_mc/index.html b/dev/noisycircuits_mc/index.html index 0db06eacf..994c985e0 100644 --- a/dev/noisycircuits_mc/index.html +++ b/dev/noisycircuits_mc/index.html @@ -15,7 +15,7 @@ # then a Bell measurement # followed by checking whether the final result indeed corresponds to the correct Bell pair. circuit = [n,g1,g2,m,v]Example block output

And we can run a Monte Carlo simulation of that circuit with mctrajectories.

mctrajectories(initial_state, circuit, trajectories=500)
Dict{CircuitStatus, Float64} with 4 entries:
-  true_success:CircuitStatus(1)  => 459.0
   failure:CircuitStatus(3)       => 18.0
+  false_success:CircuitStatus(2) => 23.0
   continue:CircuitStatus(0)      => 0.0
-  false_success:CircuitStatus(2) => 23.0

For more examples, see the notebook comparing the Monte Carlo and Perturbative method or this tutorial on entanglement purification for many examples.

Interface for custom operations

If you want to create a custom gate type (e.g. calling it Operation), you need to definite the following methods.

applywstatus!(s::T, g::Operation)::Tuple{T,Symbol} where T is a tableaux type like Stabilizer or a Register. The Symbol is the status of the operation. Predefined statuses are kept in the registered_statuses list, but you can add more. Be sure to expand this list if you want the trajectory simulators using your custom statuses to output all trajectories.

There is also applynoise! which is convenient wait to create a noise model that can then be plugged into the NoisyGate struct, letting you reuse the predefined perfect gates and measurements. However, you can also just make up your own noise operator simply by implementing applywstatus! for it.

You can also consult the list of implemented operators.

+ true_success:CircuitStatus(1) => 459.0

For more examples, see the notebook comparing the Monte Carlo and Perturbative method or this tutorial on entanglement purification for many examples.

Interface for custom operations

If you want to create a custom gate type (e.g. calling it Operation), you need to definite the following methods.

applywstatus!(s::T, g::Operation)::Tuple{T,Symbol} where T is a tableaux type like Stabilizer or a Register. The Symbol is the status of the operation. Predefined statuses are kept in the registered_statuses list, but you can add more. Be sure to expand this list if you want the trajectory simulators using your custom statuses to output all trajectories.

There is also applynoise! which is convenient wait to create a noise model that can then be plugged into the NoisyGate struct, letting you reuse the predefined perfect gates and measurements. However, you can also just make up your own noise operator simply by implementing applywstatus! for it.

You can also consult the list of implemented operators.

diff --git a/dev/noisycircuits_ops/index.html b/dev/noisycircuits_ops/index.html index 635224238..93fc385a9 100644 --- a/dev/noisycircuits_ops/index.html +++ b/dev/noisycircuits_ops/index.html @@ -10,4 +10,4 @@ gate3 = SparseGate(tSWAP, [1,3]) cg = ConditionalGate(gate1, gate2, 2) dg = DecisionGate([gate1,gate2,gate3], bit_register->1) # it will always perform gate1 -[sMX(4,1), sMZ(5,2), cg, dg]Example block output

TODO: Split ConditionalGate into quantum conditional and classical conditional

+[sMX(4,1), sMZ(5,2), cg, dg]Example block output

TODO: Split ConditionalGate into quantum conditional and classical conditional

diff --git a/dev/noisycircuits_perturb/index.html b/dev/noisycircuits_perturb/index.html index f089b4b36..308798b5f 100644 --- a/dev/noisycircuits_perturb/index.html +++ b/dev/noisycircuits_perturb/index.html @@ -18,6 +18,6 @@ circuit = [n,g1,g2,m,v] petrajectories(initial_state, circuit)
Dict{CircuitStatus, Float64} with 3 entries:
-  true_success:CircuitStatus(1)  => 0.903546
   failure:CircuitStatus(3)       => 0.0365069
-  false_success:CircuitStatus(2) => 0.0547604

For more examples, see the notebook comparing the Monte Carlo and Perturbative method or this tutorial on entanglement purification.

Symbolic expansions

The perturbative expansion method works with symbolic variables as well. One can use any of the symbolic libraries available in Julia and simply plug symbolic parameters in lieu of numeric parameters. A detailed example is available as a Jupyter notebook.

Interface for custom operations

If you want to create a custom gate type (e.g. calling it Operation), you need to definite the following methods.

applyop_branches!(s::T, g::Operation; max_order=1)::Vector{Tuple{T,Symbol,Real,Int}} where T is a tableaux type like Stabilizer or a Register. The Symbol is the status of the operation, the Real is the probability for that branch, and the Int is the order of that branch.

There is also applynoise_branches! which is convenient for use in NoisyGate, but you can also just make up your own noise operator simply by implementing applyop_branches! for it.

You can also consult the list of implemented operators.

+ false_success:CircuitStatus(2) => 0.0547604 + true_success:CircuitStatus(1) => 0.903546

For more examples, see the notebook comparing the Monte Carlo and Perturbative method or this tutorial on entanglement purification.

Symbolic expansions

The perturbative expansion method works with symbolic variables as well. One can use any of the symbolic libraries available in Julia and simply plug symbolic parameters in lieu of numeric parameters. A detailed example is available as a Jupyter notebook.

Interface for custom operations

If you want to create a custom gate type (e.g. calling it Operation), you need to definite the following methods.

applyop_branches!(s::T, g::Operation; max_order=1)::Vector{Tuple{T,Symbol,Real,Int}} where T is a tableaux type like Stabilizer or a Register. The Symbol is the status of the operation, the Real is the probability for that branch, and the Int is the order of that branch.

There is also applynoise_branches! which is convenient for use in NoisyGate, but you can also just make up your own noise operator simply by implementing applyop_branches! for it.

You can also consult the list of implemented operators.

diff --git a/dev/plotting/bc13d326.svg b/dev/plotting/06ad6061.svg similarity index 98% rename from dev/plotting/bc13d326.svg rename to dev/plotting/06ad6061.svg index f5993e4df..e9d4adfb4 100644 --- a/dev/plotting/bc13d326.svg +++ b/dev/plotting/06ad6061.svg @@ -1,23 +1,23 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + Visualizations · QuantumClifford.jl

Visualizations

Stabilizers have a plot recipe that can be used with Plots.jl or Makie.jl. It simply displays the corresponding parity check matrix (extracted with stab_to_gf2) as a bitmap image. Circuits can be visualized with Quantikz.jl.

Importing the aforementioned packages together with QuantumClifford is necessary to enable the plotting functionality (implemented as package extensions).

Plots.jl

In Plots.jl we have a simple recipe plot(s::Stabilizer; xzcomponents=...) where xzcomponents=:split plots the tableau heatmap in a wide form, X bits on the left, Z bits on the right; or xzcomponents=:together plots them overlapping, with different colors for I, X, Z, and Y.

using QuantumClifford, Plots
-plot(random_stabilizer(20,30), xzcomponents=:split)
Example block output
using QuantumClifford, Plots
-plot(canonicalize!(random_stabilizer(20,30)))
Example block output
using QuantumClifford, Plots
-plot(canonicalize_gott!(random_stabilizer(30))[1], xzcomponents=:split)
Example block output
using QuantumClifford, Plots
-plot(canonicalize_gott!(random_stabilizer(30))[1]; xzcomponents=:together)
Example block output
using QuantumClifford, Plots
-plot(canonicalize_rref!(random_stabilizer(20,30),1:30)[1]; xzcomponents=:together)
Example block output

Makie.jl

Makie's heatmap can be directly called on Stabilizer.

using QuantumClifford, CairoMakie
+plot(random_stabilizer(20,30), xzcomponents=:split)
Example block output
using QuantumClifford, Plots
+plot(canonicalize!(random_stabilizer(20,30)))
Example block output
using QuantumClifford, Plots
+plot(canonicalize_gott!(random_stabilizer(30))[1], xzcomponents=:split)
Example block output
using QuantumClifford, Plots
+plot(canonicalize_gott!(random_stabilizer(30))[1]; xzcomponents=:together)
Example block output
using QuantumClifford, Plots
+plot(canonicalize_rref!(random_stabilizer(20,30),1:30)[1]; xzcomponents=:together)
Example block output

Makie.jl

Makie's heatmap can be directly called on Stabilizer.

using QuantumClifford, CairoMakie
 s = S"IIXZ
       ZZIZ
       YYIZ
@@ -47,4 +47,4 @@
 f=Figure()
 stabilizerplot_axis(f[1,1],random_stabilizer(100))
 f
Example block output

Quantikz.jl

With the Quantikz library you can visualize gates or sequences of gates.

using QuantumClifford, Quantikz
-circuit = [sCNOT(1,2), SparseGate(random_clifford(4), [1,4,5,6]), sMZ(4)]
Example block output
+circuit = [sCNOT(1,2), SparseGate(random_clifford(4), [1,4,5,6]), sMZ(4)]Example block output diff --git a/dev/references/index.html b/dev/references/index.html index 5741f0724..54966783c 100644 --- a/dev/references/index.html +++ b/dev/references/index.html @@ -1,2 +1,2 @@ -Suggested Readings & References · QuantumClifford.jl

Suggested reading

For the basis of the tableaux methods first read (Gottesman, 1998) followed by the more efficient approach described in (Aaronson and Gottesman, 2004).

The tableaux can be canonicalized (i.e. Gaussian elimination can be performed on them) in a number of different ways, and considering the different approaches provides useful insight. The following methods are implemented in this library:

For the use of these methods in error correction and the subtle overlap between the two fields consider these resources. They are also useful in defining some of the specific constraints in commutation between rows in the tableaux:

These publications describe the uniform sampling of random stabilizer states:

References

+Suggested Readings & References · QuantumClifford.jl

Suggested reading

For the basis of the tableaux methods first read (Gottesman, 1998) followed by the more efficient approach described in (Aaronson and Gottesman, 2004).

The tableaux can be canonicalized (i.e. Gaussian elimination can be performed on them) in a number of different ways, and considering the different approaches provides useful insight. The following methods are implemented in this library:

For the use of these methods in error correction and the subtle overlap between the two fields consider these resources. They are also useful in defining some of the specific constraints in commutation between rows in the tableaux:

These publications describe the uniform sampling of random stabilizer states:

References

diff --git a/dev/stab-algebra-manual/index.html b/dev/stab-algebra-manual/index.html index dfc6d6c11..22488bb60 100644 --- a/dev/stab-algebra-manual/index.html +++ b/dev/stab-algebra-manual/index.html @@ -293,4 +293,4 @@ 𝒮𝓉𝒶𝒷━ + _ZX - _Z_ -- Z_X

Mixed States

Both the Stabilizer and Destabilizer structures have more general forms that enable work with mixed stabilizer states. They are the MixedStabilizer and MixedDestabilizer structures, described in Mixed States. More information that can be seen in the data structures page, which expands upon the algorithms available for each structure.

Random States and Circuits

random_clifford, random_stabilizer, and enumerate_cliffords can be used for the generation of random states.

+- Z_X

Mixed States

Both the Stabilizer and Destabilizer structures have more general forms that enable work with mixed stabilizer states. They are the MixedStabilizer and MixedDestabilizer structures, described in Mixed States. More information that can be seen in the data structures page, which expands upon the algorithms available for each structure.

Random States and Circuits

random_clifford, random_stabilizer, and enumerate_cliffords can be used for the generation of random states.

diff --git a/dev/tutandpub/index.html b/dev/tutandpub/index.html index 6ae1847bb..6df626adb 100644 --- a/dev/tutandpub/index.html +++ b/dev/tutandpub/index.html @@ -1,2 +1,2 @@ -Tutorials and Publications · QuantumClifford.jl
+Tutorials and Publications · QuantumClifford.jl