QuantumSymbolics.jl

A symbolics package for quantum information science. It serves two purposes:

  • It provides for algebraic manipulation of mathematical expressions related to your quantum models. Particularly helpful when having to automatically generate or simplify expressions of significant complexity.
  • An assortment of "expression translators" are provided that can turn a symbolic expression into a numerical one in a variety of formalisms.

Below we list some commonly used expressions, followed by an autogenerated API list.

Symbolic ExampleConversion Example

Qubit Basis States X1, X2, Y1, Y2, Z1, Z2

Z1

\[\left|Z_1\right\rangle\]

express(Z1)
Ket(dim=2)
  basis: Spin(1/2)
 1.0 + 0.0im
 0.0 + 0.0im
express(Y2, CliffordRepr())
𝒟ℯ𝓈𝓉𝒶𝒷
+ Z
𝒮𝓉𝒶𝒷
- Y

Common gates: CNOT, H, etc

CNOT

\hat CNOT

express(H)
Operator(dim=2x2)
  basis: Spin(1/2)
 0.7071067811865475 + 0.0im   0.7071067811865475 + 0.0im
 0.7071067811865475 + 0.0im  -0.7071067811865475 + 0.0im
express(CNOT, CliffordRepr(), UseAsOperation())
QuantumClifford.sCNOT

Tensor products and sums +

(X1⊗Z2 + Y1⊗Y2 ) / √3

\[0.5773502691896258 \left|X_1\right\rangle\otimes\left|Z_2\right\rangle + \left|Y_1\right\rangle\otimes\left|Y_2\right\rangle\]

express(X1⊗Z1)
Ket(dim=4)
  basis: [Spin(1/2) ⊗ Spin(1/2)]
 0.7071067811865475 + 0.0im
 0.7071067811865475 + 0.0im
                0.0 + 0.0im
                0.0 + 0.0im
express(X1⊗Y2, CliffordRepr())
𝒟ℯ𝓈𝓉𝒶𝒷
+ Z_
+ _Z
𝒮𝓉𝒶𝒷
+ X_
- _Y

Projectors, pure density matrices

SProjector(X1⊗Z2)

\[\mathrm{projector}\left( \left|X_1\right\rangle\otimes\left|Z_2\right\rangle \right)\]

express(SProjector(X1⊗Z1))
Operator(dim=4x4)
  basis: [Spin(1/2) ⊗ Spin(1/2)]
 0.5+0.0im  0.5+0.0im  0.0+0.0im  0.0+0.0im
 0.5+0.0im  0.5+0.0im  0.0+0.0im  0.0+0.0im
 0.0+0.0im  0.0+0.0im  0.0+0.0im  0.0+0.0im
 0.0+0.0im  0.0+0.0im  0.0+0.0im  0.0+0.0im
express(SProjector(X1⊗Z1), CliffordRepr())
𝒟ℯ𝓈𝓉𝒶𝒷
+ Z_
+ _X
𝒮𝓉𝒶𝒷
+ X_
+ _Z

Completely depolarized (mixed) state

MixedState(X1)

\mathbb{M}

express(MixedState(X1))
Operator(dim=2x2)
  basis: Spin(1/2)
 0.5 + 0.0im       ⋅     
      ⋅       0.5 + 0.0im
express(MixedState(X1), CliffordRepr())
𝒟ℯ𝓈𝓉𝒶𝒷

𝒳ₗ━
+ X
𝒮𝓉𝒶𝒷

𝒵ₗ━
+ Z

Impure states, represented as sum of density matrices

(MixedState(X1)+SProjector(Z1)) / 2

\[0.5 \mathrm{projector}\left( \left|Z_1\right\rangle \right) + \mathbb{M}\]

express((MixedState(X1)+SProjector(Z1)) / 2)
Operator(dim=2x2)
  basis: Spin(1/2)
 0.75+0.0im   0.0+0.0im
  0.0+0.0im  0.25+0.0im

When a Clifford representation is used, an efficient sampler is generated, and stabilizer states are randomly sampled from the correct distribution:

express(MixedState(X1)/2+SProjector(Z1)/2, CliffordRepr())
𝒟ℯ𝓈𝓉𝒶𝒷
+ X
𝒮𝓉𝒶𝒷
+ Z
Stabilizer state expressions

The state written as $\frac{|Z₁⟩⊗|Z₁⟩+|Z₂⟩⊗|Z₂⟩}{√2}$ is a well known stabilizer state, namely a Bell state. However, automatically expressing it as a stabilizer is a prohibitively expensive computational operation in general. We do not perform that computation automatically. If you want to ensure that states you define can be automatically converted to tableaux for Clifford simulations, avoid using summation of kets. On the other hand, in all of our Clifford Monte-Carlo simulations, is fully supported, as well as projector, MixedState, StabilizerState, and summation of density matrices.

Office Hours

Office hours are held every Friday from 12:30 – 1:30 PM Eastern Time via Zoom. Before joining, make sure to check the Julia community events calendar to confirm whether office hours are happening, rescheduled, or canceled for the week. Feel free to bring any questions or suggestions!

Support

QuantumSymbolics.jl is developed by many volunteers, managed at Prof. Krastanov's lab at University of Massachusetts Amherst.

The development effort is supported by The NSF Engineering and Research Center for Quantum Networks, and by NSF Grant 2346089 "Research Infrastructure: CIRC: New: Full-stack Codesign Tools for Quantum Hardware".

Bounties

We run many bug bounties and encourage submissions from novices (we are happy to help onboard you in the field).