Useful States and Operators

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.

Below are convenience constructors for common types of states and operators, already implemented in this library.

Pauli Operators

Single qubit PauliOperator is implemented in [single_z] and [single_x].

julia> single_z(4,2)+ _Z__julia> single_x(4,3)+ __X_

All identity operators use zero.

julia> zero(PauliOperator, 3)+ ___julia> zero(P"XYZXYZ")+ ______

Random Pauli operators are implemented as well (with or without a random phase).

julia> using StableRNGs; rng = StableRNG(42);julia> random_pauli(rng, 4)+ ZYY_julia> random_pauli(rng, 4; nophase=false)- YZ_X

Stabilizer States

An all-identity stabilizer can be created with zero.

julia> zero(Stabilizer, 3)+ ___+ ___+ ___julia> zero(Stabilizer, 2, 3)+ ___+ ___julia> zero(S"XIZ              YZX")+ ___+ ___

Diagonal stabilizers in different bases are available as well, through one.

julia> one(Stabilizer, 3)+ Z__+ _Z_+ __Zjulia> one(Stabilizer, 3; basis=:Y)+ Y__+ _Y_+ __Yjulia> one(S"XX             ZZ")+ Z_+ _Z

A random stabilizer (or destabilizers or Clifford operators) can be created as well. We use the algorithm described in (Bravyi and Maslov, 2021).

julia> random_stabilizer(rng, 2,5)+ YZXZZ- XZYYY

Mixed States

Similarly, one can create a diagonal mixed state.

julia> one(MixedDestabilizer, 2, 3)𝒟ℯ𝓈𝓉𝒶𝒷+ X__+ _X_𝒳ₗ━━━+ __X𝒮𝓉𝒶𝒷━+ Z__+ _Z_𝒵ₗ━━━+ __Z

Enumerating all Clifford Operations

The algorithm from (Koenig and Smolin, 2014) can be used to enumerate all Clifford operations on a given number of qubits through enumerate_cliffords. Or one can use random_clifford, random_stabilizer to directly sample from that set.

julia> length(enumerate_cliffords(1))6julia> length(enumerate_cliffords(2))720

To also enumerate possible phases, you can use enumerate_phases.

julia> length(collect(enumerate_phases(tCNOT)))16julia> length(collect(enumerate_phases(enumerate_cliffords(2))))11520

Common entangled states

Bell states and GHZ states have convenience constructors:

julia> bell()+ XX+ ZZjulia> bell(2)+ XX__+ ZZ__+ __XX+ __ZZjulia> ghz(4)+ XXXX+ ZZ__+ _ZZ_+ __ZZ