From b545a16641cdddb136e79dc15ee260127536de4c Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 17 Sep 2024 01:41:08 +0000 Subject: [PATCH] build based on c41ff6b --- dev/.documenter-siteinfo.json | 2 +- dev/API/index.html | 80 ++++++++++++++++++---------------- dev/QHO/index.html | 14 +++--- dev/bibliography/index.html | 2 +- dev/express/index.html | 6 +-- dev/index.html | 2 +- dev/introduction/index.html | 2 +- dev/objects.inv | Bin 1631 -> 1644 bytes dev/qubit_basis/index.html | 2 +- dev/search_index.js | 2 +- 10 files changed, 58 insertions(+), 54 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index d3f5797..e8dcd3b 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-12T13:45:44","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-17T01:41:05","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/API/index.html b/dev/API/index.html index 9e33fb5..674ea7e 100644 --- a/dev/API/index.html +++ b/dev/API/index.html @@ -4,33 +4,33 @@ padding-top: 0 !important; padding-bottom: 0 !important; } -

Autogenerated API list

QuantumSymbolics.CNOTConstant

CNOT gate

source
QuantumSymbolics.CPHASEConstant

CPHASE gate

source
QuantumSymbolics.CreateConstant

Creation operator, also available as the constant âꜛ, in an infinite dimension Fock basis. There is no unicode dagger superscript, so we use the uparrow

source
QuantumSymbolics.DestroyConstant

Annihilation operator, also available as the constant , in an infinite dimension Fock basis.

source
QuantumSymbolics.F₁Constant

Single photon basis state of n

source
QuantumSymbolics.HConstant

Hadamard gate

source
QuantumSymbolics.IConstant

Identity operator in qubit basis

source
QuantumSymbolics.NConstant

Number operator, also available as the constant , in an infinite dimension Fock basis.

source
QuantumSymbolics.PmConstant

Pauli "minus" operator, also available as the constant σ₋

source
QuantumSymbolics.PpConstant

Pauli "plus" operator, also available as the constant σ₊

source
QuantumSymbolics.XConstant

Pauli X operator, also available as the constant σˣ

source
QuantumSymbolics.X1Constant

Basis state of σˣ

source
QuantumSymbolics.X2Constant

Basis state of σˣ

source
QuantumSymbolics.YConstant

Pauli Y operator, also available as the constant σʸ

source
QuantumSymbolics.Y1Constant

Basis state of σʸ

source
QuantumSymbolics.Y2Constant

Basis state of σʸ

source
QuantumSymbolics.ZConstant

Pauli Z operator, also available as the constant σᶻ

source
QuantumSymbolics.Z1Constant

Basis state of σᶻ

source
QuantumSymbolics.Z2Constant

Basis state of σᶻ

source
QuantumSymbolics.vacConstant

Vacuum basis state of n

source
QuantumSymbolics.AbstractRepresentationType

An abstract type for the supported representation of quantum objects.

source
QuantumSymbolics.CliffordReprType

Representation using tableaux governed by QuantumClifford.jl

source
QuantumSymbolics.CoherentStateType

Coherent state in defined Fock basis.

source
QuantumSymbolics.CreateOpType

Creation (raising) operator.

julia> f = FockState(2)
+

Autogenerated API list

QuantumSymbolics.CreateConstant

Creation operator, also available as the constant âꜛ, in an infinite dimension Fock basis. There is no unicode dagger superscript, so we use the uparrow

source
QuantumSymbolics.NConstant

Number operator, also available as the constant , in an infinite dimension Fock basis.

source
QuantumSymbolics.CreateOpType

Creation (raising) operator.

julia> f = FockState(2)
 |2⟩
 
 julia> create = CreateOp()
 a†
 
 julia> qsimplify(create*f, rewriter=qsimplify_fock)
-(sqrt(3))|3⟩
source
QuantumSymbolics.DestroyOpType

Annihilation (lowering or destroy) operator in defined Fock basis.

julia> f = FockState(2)
 |2⟩
 
 julia> destroy = DestroyOp()
 a
 
 julia> qsimplify(destroy*f, rewriter=qsimplify_fock)
-(sqrt(2))|1⟩
source
QuantumSymbolics.DisplaceOpType

Displacement operator in defined Fock basis.

julia> f = FockState(0)
 |0⟩
 
 julia> displace = DisplaceOp(im)
 D(im)
 
 julia> qsimplify(displace*f, rewriter=qsimplify_fock)
-|im⟩
source
QuantumSymbolics.IdentityOpType

The identity operator for a given basis

julia> IdentityOp(X1⊗X2)
 𝕀
 
 julia> express(IdentityOp(Z2))
 Operator(dim=2x2)
-  basis: Spin(1/2)sparse([1, 2], [1, 2], ComplexF64[1.0 + 0.0im, 1.0 + 0.0im], 2, 2)
source
QuantumSymbolics.KrausReprType

Kraus representation of a quantum channel

julia> @op A₁; @op A₂; @op A₃;
+  basis: Spin(1/2)sparse([1, 2], [1, 2], ComplexF64[1.0 + 0.0im, 1.0 + 0.0im], 2, 2)
source
QuantumSymbolics.KrausReprType

Kraus representation of a quantum channel

julia> @op A₁; @op A₂; @op A₃;
 
 julia> K = kraus(A₁, A₂, A₃)
 𝒦(A₁,A₂,A₃)
@@ -38,7 +38,7 @@
 julia> @op ρ;
 
 julia> K*ρ
-(A₁ρA₁†+A₂ρA₂†+A₃ρA₃†)
source
QuantumSymbolics.MixedStateType

Completely depolarized state

julia> MixedState(X1⊗X2)
 𝕄
 
 julia> express(MixedState(X1⊗X2))
@@ -55,52 +55,52 @@
 
 𝒵ₗ━━
 + Z_
-+ _Z
source
QuantumSymbolics.NumberOpType

Number operator.

julia> f = FockState(2)
 |2⟩
 
 julia> num = NumberOp()
 n
 
 julia> qsimplify(num*f, rewriter=qsimplify_fock)
-2|2⟩
source
QuantumSymbolics.PauliNoiseCPTPType

Single-qubit Pauli noise CPTP map

julia> apply!(express(Z1), [1], express(PauliNoiseCPTP(1/4,1/4,1/4)))
 Operator(dim=2x2)
   basis: Spin(1/2)
  0.5+0.0im  0.0+0.0im
- 0.0+0.0im  0.5+0.0im
source
QuantumSymbolics.PhaseShiftOpType

Phase-shift operator in defined Fock basis.

julia> c = CoherentState(im)
 |im⟩
 
 julia> phase = PhaseShiftOp(pi)
 U(π)
 
 julia> qsimplify(phase*c, rewriter=qsimplify_fock)
-|1.2246467991473532e-16 - 1.0im⟩
source
QuantumSymbolics.SAddType

Addition of quantum objects (kets, operators, or bras).

julia> @ket k₁; @ket k₂;
+|1.2246467991473532e-16 - 1.0im⟩
source
QuantumSymbolics.SAddType

Addition of quantum objects (kets, operators, or bras).

julia> @ket k₁; @ket k₂;
 
 julia> k₁ + k₂
-(|k₁⟩+|k₂⟩)
source
QuantumSymbolics.SConjugateType

Complex conjugate of quantum objects (kets, bras, operators).

julia> @op A; @ket k;
 
 julia> conj(A)
 Aˣ
 
 julia> conj(k)
-|k⟩ˣ
source
QuantumSymbolics.SDaggerType

Dagger, i.e., adjoint of quantum objects (kets, bras, operators).

julia> @ket a; @op A;
 
 julia> dagger(2*im*A*a)
 (0 - 2im)|a⟩†A†
@@ -116,22 +116,22 @@
 ℋ
 
 julia> dagger(U)
-U⁻¹
source
QuantumSymbolics.SPartialTraceType

Partial trace over system i of a composite quantum system

julia> @op 𝒪 SpinBasis(1//2)⊗SpinBasis(1//2);
 
 julia> op = ptrace(𝒪, 1)
 tr1(𝒪)
@@ -162,14 +162,14 @@
 ((0 + ⟨b||k⟩)B+(tr(A))|k⟩⟨b|)
 
 julia> ptrace(mixed_state, 2)
-((0 + ⟨b||k⟩)A+(tr(B))|k⟩⟨b|)
source
QuantumSymbolics.SProjectorType

Projector for a given ket.

julia> projector(X1⊗X2)
 𝐏[|X₁⟩|X₂⟩]
 
 julia> express(projector(X2))
 Operator(dim=2x2)
   basis: Spin(1/2)
   0.5+0.0im  -0.5-0.0im
- -0.5+0.0im   0.5+0.0im
source
QuantumSymbolics.SScaledType

Scaling of a quantum object (ket, operator, or bra) by a number.

julia> @ket k
 |k⟩
 
 julia> 2*k
@@ -179,10 +179,10 @@
 A
 
 julia> 2*A
-2A
source
QuantumSymbolics.STraceType

Trace of an operator

julia> @op A; @op B;
 
 julia> tr(A)
 tr(A)
@@ -193,7 +193,7 @@
 julia> @bra b; @ket k;
 
 julia> tr(k*b)
-⟨b||k⟩
source
QuantumSymbolics.STransposeType

Transpose of quantum objects (kets, bras, operators).

julia> @op A; @op B; @ket k;
 
 julia> transpose(A)
 Aᵀ
@@ -202,13 +202,17 @@
 (Aᵀ+Bᵀ)
 
 julia> transpose(k)
-|k⟩ᵀ
source
QuantumSymbolics.SVecType

Vectorization of a symbolic operator.

julia> @op A; @op B;
 
 julia> vec(A)
 |A⟩⟩
 
 julia> vec(A+B)
-(|A⟩⟩+|B⟩⟩)
source
QuantumSymbolics.StabilizerStateType

State defined by a stabilizer tableau

For full functionality you also need to import the QuantumClifford library.

julia> using QuantumClifford, QuantumOptics # needed for the internal representation of the stabilizer tableaux and the conversion to a ket
+(|A⟩⟩+|B⟩⟩)
source
QuantumSymbolics.SqueezeOpType

Squeezing operator in defined Fock basis.

julia> S = SqueezeOp(pi)
+S(π)
+
+julia> qsimplify(S*vac, rewriter=qsimplify_fock)
+|0,π⟩
source
QuantumSymbolics.StabilizerStateType

State defined by a stabilizer tableau

For full functionality you also need to import the QuantumClifford library.

julia> using QuantumClifford, QuantumOptics # needed for the internal representation of the stabilizer tableaux and the conversion to a ket
 
 julia> StabilizerState(S"XX ZZ")
 𝒮₂
@@ -217,12 +221,12 @@
 Ket(dim=2)
   basis: Spin(1/2)
   0.7071067811865475 + 0.0im
- -0.7071067811865475 + 0.0im
source
Base.conjMethod
conj(x::Symbolic{AbstractKet})
+ -0.7071067811865475 + 0.0im
source
Base.conjMethod
conj(x::Symbolic{AbstractKet})
 conj(x::Symbolic{AbstractBra})
 conj(x::Symbolic{AbstractOperator})
-conj(x::Symbolic{AbstractSuperOperator})

Symbolic transpose operation. See also SConjugate.

source
Base.transposeMethod
transpose(x::Symbolic{AbstractKet})
+conj(x::Symbolic{AbstractSuperOperator})

Symbolic transpose operation. See also SConjugate.

source
Base.transposeMethod
transpose(x::Symbolic{AbstractKet})
 transpose(x::Symbolic{AbstractBra})
-transpose(x::Symbolic{AbstractOperator})

Symbolic transpose operation. See also STranspose.

source
Base.vecMethod
vec(x::Symbolic{AbstractOperator})

Symbolic vector representation of an operator. See also SVec.

source
QuantumSymbolics.expressFunction
express(s, repr::AbstractRepresentation=QuantumOpticsRepr()[, use::AbstractUse])

The main interface for expressing quantum objects in various representations.

julia> express(X1)
+transpose(x::Symbolic{AbstractOperator})

Symbolic transpose operation. See also STranspose.

source
Base.vecMethod
vec(x::Symbolic{AbstractOperator})

Symbolic vector representation of an operator. See also SVec.

source
QuantumSymbolics.expressFunction
express(s, repr::AbstractRepresentation=QuantumOpticsRepr()[, use::AbstractUse])

The main interface for expressing quantum objects in various representations.

julia> express(X1)
 Ket(dim=2)
   basis: Spin(1/2)
  0.7071067811865475 + 0.0im
@@ -242,7 +246,7 @@
 sX
 
 julia> express(QuantumSymbolics.X, CliffordRepr(), UseAsObservable())
-+ X
source
QuantumSymbolics.qexpandMethod
qexpand(s)

Manually expand a symbolic expression of quantum objects.

julia> @op A; @op B; @op C;
 
 julia> qexpand(commutator(A, B))
 (-1BA+AB)
@@ -253,20 +257,20 @@
 julia> @ket k₁; @ket k₂;
 
 julia> qexpand(A*(k₁+k₂))
-(A|k₁⟩+A|k₂⟩)
source
QuantumSymbolics.qsimplifyMethod
qsimplify(s; rewriter=nothing)

Manually simplify a symbolic expression of quantum objects.

If the keyword rewriter is not specified, then qsimplify will apply every defined rule to the expression. For performance or single-purpose motivations, the user has the option to define a specific rewriter for qsimplify to apply to the expression. The defined rewriters for simplification are the following objects: - qsimplify_pauli - qsimplify_commutator - qsimplify_anticommutator

julia> qsimplify(σʸ*commutator(σˣ*σᶻ, σᶻ))
+(A|k₁⟩+A|k₂⟩)
source
QuantumSymbolics.qsimplifyMethod
qsimplify(s; rewriter=nothing)

Manually simplify a symbolic expression of quantum objects.

If the keyword rewriter is not specified, then qsimplify will apply every defined rule to the expression. For performance or single-purpose motivations, the user has the option to define a specific rewriter for qsimplify to apply to the expression. The defined rewriters for simplification are the following objects: - qsimplify_pauli - qsimplify_commutator - qsimplify_anticommutator

julia> qsimplify(σʸ*commutator(σˣ*σᶻ, σᶻ))
 (0 - 2im)Z
 
 julia> qsimplify(anticommutator(σˣ, σˣ), rewriter=qsimplify_anticommutator)
-2𝕀
source
QuantumSymbolics.@braMacro
@bra(name, basis=SpinBasis(1//2))

Define a symbolic bra of type SBra. By default, the defined basis is the spin-1/2 basis.

julia> @bra b₁
+2𝕀
source
QuantumSymbolics.@braMacro
@bra(name, basis=SpinBasis(1//2))

Define a symbolic bra of type SBra. By default, the defined basis is the spin-1/2 basis.

julia> @bra b₁
 ⟨b₁|
 
 julia> @bra b₂ FockBasis(2)
-⟨b₂|
source
QuantumSymbolics.@ketMacro
@ket(name, basis=SpinBasis(1//2))

Define a symbolic ket of type SKet. By default, the defined basis is the spin-1/2 basis.

julia> @ket k₁
+⟨b₂|
source
QuantumSymbolics.@ketMacro
@ket(name, basis=SpinBasis(1//2))

Define a symbolic ket of type SKet. By default, the defined basis is the spin-1/2 basis.

julia> @ket k₁
 |k₁⟩
 
 julia> @ket k₂ FockBasis(2)
-|k₂⟩
source
QuantumSymbolics.@opMacro
@op(name, basis=SpinBasis(1//2))

Define a symbolic ket of type SOperator. By default, the defined basis is the spin-1/2 basis.

julia> @op A
+|k₂⟩
source
QuantumSymbolics.@opMacro
@op(name, basis=SpinBasis(1//2))

Define a symbolic ket of type SOperator. By default, the defined basis is the spin-1/2 basis.

julia> @op A
 A
 
 julia> @op B FockBasis(2)
-B
source
+Bsource diff --git a/dev/QHO/index.html b/dev/QHO/index.html index 4601d09..b8cdbf0 100644 --- a/dev/QHO/index.html +++ b/dev/QHO/index.html @@ -1,7 +1,7 @@ -Quantum Harmonic Oscillators · QuantumSymbolics.jl

Quantum Harmonic Oscillators

In this section, we describe symbolic representations of bosonic systems in QuantumSymbolics, which can be numerically translated to QuantumOptics.jl.

States

A Fock state is a state with well defined number of excitation quanta of a single quantum harmonic oscillator (an eigenstate of the number operator). In the following example, we create a FockState with 3 quanta in an infinite-dimension Fock space:

julia> f = FockState(3)
-|3⟩

Both vacuum (ground) and single-photon states are defined as constants in both unicode and ASCII for convenience:

  • vac = F₀ = F0 $=|0\rangle$ in the number state representation,
  • F₁ = F1 $=|1\rangle$ in the number state representation.

To create quantum analogues of a classical harmonic oscillator, or monochromatic electromagnetic waves, we can define a coherent (a.k.a. semi-classical) state $|\alpha\rangle$, where $\alpha$ is a complex amplitude, with CoherentState(α::Number):

julia> c = CoherentState(im)
-|im⟩
Naming convention for quantum harmonic oscillator bases

The defined basis for arbitrary symbolic bosonic states is a FockBasis object, due to a shared naming interface for Quantum physics packages. For instance, the command basis(CoherentState(im)) will output Fock(cutoff=Inf). This may lead to confusion, as not all bosonic states are Fock states. However, this is simply a naming convention for the basis, and symbolic and numerical results are not affected by it.

Operators

Operations on bosonic states are supported, and can be simplified with qsimplify and its rewriter qsimplify_fock. For instance, we can apply the raising (creation) $\hat{a}^{\dagger}$ and lowering (annihilation or destroy) $\hat{a}$ operators on a Fock state as follows:

julia> f = FockState(3);
+Quantum Harmonic Oscillators · QuantumSymbolics.jl

Quantum Harmonic Oscillators

In this section, we describe symbolic representations of bosonic systems in QuantumSymbolics, which can be numerically translated to QuantumOptics.jl.

States

A Fock state is a state with well defined number of excitation quanta of a single quantum harmonic oscillator (an eigenstate of the number operator). In the following example, we create a FockState with 3 quanta in an infinite-dimension Fock space:

julia> f = FockState(3)
+|3⟩

Both vacuum (ground) and single-photon states are defined as constants in both unicode and ASCII for convenience:

  • vac = F₀ = F0 $=|0\rangle$ in the number state representation,
  • F₁ = F1 $=|1\rangle$ in the number state representation.

To create quantum analogues of a classical harmonic oscillator, or monochromatic electromagnetic waves, we can define a coherent (a.k.a. semi-classical) state $|\alpha\rangle$, where $\alpha$ is a complex amplitude, with CoherentState:

julia> c = CoherentState(im)
+|im⟩
Naming convention for quantum harmonic oscillator bases

The defined basis for arbitrary symbolic bosonic states is a FockBasis object, due to a shared naming interface for Quantum physics packages. For instance, the command basis(CoherentState(im)) will output Fock(cutoff=Inf). This may lead to confusion, as not all bosonic states are Fock states. However, this is simply a naming convention for the basis, and symbolic and numerical results are not affected by it.

Summarized below are supported bosonic states.

  • Fock state: FockState(idx::Int),
  • Coherent state: CoherentState(alpha::Number),
  • Squeezed vacuum state: SqueezedState(z::Number).

Operators

Operations on bosonic states are supported, and can be simplified with qsimplify and its rewriter qsimplify_fock. For instance, we can apply the raising (creation) $\hat{a}^{\dagger}$ and lowering (annihilation or destroy) $\hat{a}$ operators on a Fock state as follows:

julia> f = FockState(3);
 
 julia> raise = Create*f
 a†|3⟩
@@ -19,7 +19,7 @@
 n|3⟩
 
 julia> qsimplify(num, rewriter=qsimplify_fock)
-3|3⟩

Constants are defined for number and ladder operators in unicode and ASCII:

  • N = n̂ $=\hat{n}$,
  • Create = âꜛ $=\hat{a}^{\dagger}$,
  • Destroy = â $=\hat{a}$.

Phase-shift $U(\theta)$ and displacement $D(\alpha)$ operators, defined respectively as $U(\theta) = \exp\left(-i\theta\hat{n}\right) \quad \text{and} \quad D(\alpha) = \exp\left(\alpha\hat{a}^{\dagger} - \alpha\hat{a}\right),$ can be defined with usual simplification rules. Consider the following example:

julia> displace = DisplaceOp(im)
+3|3⟩

Constants are defined for number and ladder operators in unicode and ASCII:

  • N = n̂ $=\hat{n}$,
  • Create = âꜛ $=\hat{a}^{\dagger}$,
  • Destroy = â $=\hat{a}$.

Phase-shift $U(\theta)$ and displacement $D(\alpha)$ operators, defined respectively as

\[U(\theta) = \exp\left(-i\theta\hat{n}\right) \quad \text{and} \quad D(\alpha) = \exp\left(\alpha\hat{a}^{\dagger} - \alpha\hat{a}\right),\]

can be defined with usual simplification rules. Consider the following example:

julia> displace = DisplaceOp(im)
 D(im)
 
 julia> c = qsimplify(displace*vac, rewriter=qsimplify_fock)
@@ -29,7 +29,7 @@
 U(π)
 
 julia> qsimplify(phase*c, rewriter=qsimplify_fock)
-|1.2246467991473532e-16 - 1.0im⟩

Here, we generated a coherent state $|i\rangle$ from the vacuum state $|0\rangle$ by applying the displacement operator defined by DisplaceOp. Then, we shifted its phase by $\pi$ with the phase shift operator (which is called with PhaseShiftOp) to get the result $|-i\rangle$.

Summarized below are supported bosonic operators.

  • Number operator: NumberOp(),
  • Creation operator: CreateOp(),
  • Annihilation operator: DestroyOp(),
  • Phase-shift operator: PhaseShiftOp(phase::Number),
  • Displacement operator: DisplaceOp(alpha::Number).

Numerical Conversions to QuantumOptics.jl

Bosonic systems can be translated to the ket representation with express. For instance:

julia> f = FockState(1);
+|1.2246467991473532e-16 - 1.0im⟩

Here, we generated a coherent state $|i\rangle$ from the vacuum state $|0\rangle$ by applying the displacement operator defined by DisplaceOp. Then, we shifted its phase by $\pi$ with the phase shift operator (which is called with PhaseShiftOp) to get the result $|-i\rangle$.

Summarized below are supported bosonic operators.

  • Number operator: NumberOp(),
  • Creation operator: CreateOp(),
  • Annihilation operator: DestroyOp(),
  • Phase-shift operator: PhaseShiftOp(phase::Number),
  • Displacement operator: DisplaceOp(alpha::Number),
  • Squeezing operator: SqueezeOp(z::Number).

Numerical Conversions to QuantumOptics.jl

Bosonic systems can be translated to the ket representation with express. For instance:

julia> f = FockState(1);
 
 julia> express(f)
 Ket(dim=3)
@@ -57,7 +57,7 @@
   basis: Fock(cutoff=2)
  1.0 + 0.0im
  0.0 + 0.0im
- 0.0 + 0.0im
Cutoff specifications for numerical representations of quantum harmonic oscillators

Symbolic bosonic states and operators are naturally represented in an infinite dimension basis. For numerical conversions of such quantum objects, a finite cutoff of the highest allowed state must be defined. By default, the basis dimension of numerical conversions is set to 3 (so the number representation cutoff is 2), as demonstrated above. To define a different cutoff, one must customize the QuantumOpticsRepr instance, e.g. provide QuantumOpticsRepr(cutoff=n::Int) to express.

If we wish to specify a different numerical cutoff, say 4, to the previous examples, then we rewrite them as follows:

julia> f = FockState(1);
+ 0.0 + 0.0im
Cutoff specifications for numerical representations of quantum harmonic oscillators

Symbolic bosonic states and operators are naturally represented in an infinite dimension basis. For numerical conversions of such quantum objects, a finite cutoff of the highest allowed state must be defined. By default, the basis dimension of numerical conversions is set to 3 (so the number representation cutoff is 2), as demonstrated above. To define a different cutoff, one must customize the QuantumOpticsRepr instance, e.g. provide QuantumOpticsRepr(cutoff=n::Int) to express.

If we wish to specify a different numerical cutoff, say 4, to the previous examples, then we rewrite them as follows:

julia> f = FockState(1);
 
 julia> express(f, QuantumOpticsRepr(cutoff=4))
 Ket(dim=5)
@@ -75,4 +75,4 @@
  1.0+0.0im      0.0+0.0im      0.0+0.0im  0.0+0.0im  0.0+0.0im
  0.0+0.0im  1.41421+0.0im      0.0+0.0im  0.0+0.0im  0.0+0.0im
  0.0+0.0im      0.0+0.0im  1.73205+0.0im  0.0+0.0im  0.0+0.0im
- 0.0+0.0im      0.0+0.0im      0.0+0.0im  2.0+0.0im  0.0+0.0im
+ 0.0+0.0im 0.0+0.0im 0.0+0.0im 2.0+0.0im 0.0+0.0im
diff --git a/dev/bibliography/index.html b/dev/bibliography/index.html index bb52568..d5850b3 100644 --- a/dev/bibliography/index.html +++ b/dev/bibliography/index.html @@ -1,2 +1,2 @@ -Bibliography · QuantumSymbolics.jl
+Bibliography · QuantumSymbolics.jl
diff --git a/dev/express/index.html b/dev/express/index.html index 5973715..7268d2d 100644 --- a/dev/express/index.html +++ b/dev/express/index.html @@ -8,10 +8,10 @@ 0.0 + 0.0im))

The caching feature of express prevents a specific representation for a symbolic quantum object from being computed more than once. This becomes handy for translations of more complex operations, which can become computationally expensive. We also have the ability to express $|Z_1\rangle$ in the Clifford formalism with QuantumClifford.jl:

express(ψ, CliffordRepr())
𝒟ℯ𝓈𝓉𝒶𝒷
 + X
 𝒮𝓉𝒶𝒷
-+ Z

Here, we specified an instance of CliffordRepr in the second argument to convert ψ into a tableau of Pauli operators containing its stabilizer and destabilizer states. Now, both the state vector and Clifford representation of ψ have been cached:

ψ.metadata
QuantumSymbolics.Metadata(Dict{Tuple{AbstractRepresentation, AbstractUse}, Any}((CliffordRepr(), UseAsState()) => MixedDestablizer 1×1, (QuantumOpticsRepr(2), UseAsState()) => Ket(dim=2)
++ Z

Here, we specified an instance of CliffordRepr in the second argument to convert ψ into a tableau of Pauli operators containing its stabilizer and destabilizer states. Now, both the state vector and Clifford representation of ψ have been cached:

ψ.metadata
QuantumSymbolics.Metadata(Dict{Tuple{AbstractRepresentation, AbstractUse}, Any}((QuantumOpticsRepr(2), UseAsState()) => Ket(dim=2)
   basis: Spin(1/2)
  1.0 + 0.0im
- 0.0 + 0.0im))

More involved examples can be explored. For instance, say we want to apply the tensor product $X\otimes Y$ of the Pauli operators $X$ and $Y$ to the Bell state $|\Phi^{+}\rangle = \dfrac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle\right)$, and numerically express the result in the quantum optics formalism. This would be done as follows:

bellstate = (Z1⊗Z1+Z2⊗Z2)/√2
+ 0.0 + 0.0im, (CliffordRepr(), UseAsState()) => MixedDestablizer 1×1))

More involved examples can be explored. For instance, say we want to apply the tensor product $X\otimes Y$ of the Pauli operators $X$ and $Y$ to the Bell state $|\Phi^{+}\rangle = \dfrac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle\right)$, and numerically express the result in the quantum optics formalism. This would be done as follows:

bellstate = (Z1⊗Z1+Z2⊗Z2)/√2
 tp = σˣ⊗σʸ
 express(tp*bellstate)
Ket(dim=4)
   basis: [Spin(1/2) ⊗ Spin(1/2)]
@@ -36,4 +36,4 @@
  0.0+0.0im  1.0+0.0im  0.0+0.0im  0.0+0.0im  0.0+0.0im
  0.0+0.0im  0.0+0.0im  2.0+0.0im  0.0+0.0im  0.0+0.0im
  0.0+0.0im  0.0+0.0im  0.0+0.0im  3.0+0.0im  0.0+0.0im
- 0.0+0.0im  0.0+0.0im  0.0+0.0im  0.0+0.0im  4.0+0.0im
+ 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 4.0+0.0im diff --git a/dev/index.html b/dev/index.html index b88a622..e99e1fb 100644 --- a/dev/index.html +++ b/dev/index.html @@ -79,4 +79,4 @@ + 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.

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

diff --git a/dev/introduction/index.html b/dev/introduction/index.html index 29b2771..bd4714f 100644 --- a/dev/introduction/index.html +++ b/dev/introduction/index.html @@ -132,4 +132,4 @@ 𝒟ℯ𝓈𝓉𝒶𝒷 + Z 𝒮𝓉𝒶𝒷 -+ X

For more details on using express, refer to the express functionality page.

++ X

For more details on using express, refer to the express functionality page.

diff --git a/dev/objects.inv b/dev/objects.inv index 95624ebc436d663135c05c7cc532ff2256f57db2..c943a51f1766cc29774b408d18d67321062fa7cf 100644 GIT binary patch delta 1308 zcmV+%1>^eP4D1Y$O93>IOgw+vZrer>edkv!kmxNN+e(WRK_4vBc5LJ#rBsT6~hnhr}j%a%Zo%xBsFyGq6G}eBB`X$EVsYLl3$BIF zLORw=#-J8%Q#GZ9gXn*7a>;$OL-5`^KTFCZu@sMjlhPWa#WtA9KD}i%hP*#bkKWw3}1ctDtIjgv5yb>8Efq19;4H8 z5>%BG36ps`O_>U{^HxaCG#!L9KGBSVmya}ypV2qmz$b);4kHe(Yy434b-kEg-%SPC z?~@b)N)VGUq(!x@xNW@wlYN+$-CL7x0w@_HF$sm5X%@{lGIUaUl11v|hJiPDZ0r3b zldl3)K)p#UsdFx4!@?X=TTe!}E7*f-hf*h(;VZL@I9VyHp*^=$zOw41X{Gdj=RQiL zRgWSpS}@QSu-QugxsN{V6_Y~)D}Tl#jdP%@7K_AKyu~RPoejJbd>{u=6fWC?bS?q5 zrp)Kh12&s+ojbA+^3jM81m#z^TTFvVY@nGM$ilm3&(|vf$JeWY2W^Vdrd}JZV-7@W z+2kOLq0fc9zNd{vYpgT0D*9fQ72=!CyJmie*arbF2anT`;AjUD`g6COWq(^NC1f}T{-Z>+!Y%f9z9xc$4k9jnQ4kBmnXgtDVfV@m*fHHODX@J&N@Qo*n)a>b3ZlQKIy%1doKos*fs}bqFQI% zc8V2Nx06+zk>x{bzp=0JA{F!hc$}N!w{iaedl2gj^$ZOhpYRy-PTX|q7;iL7V)Q!u z8pNXK-b4F>^FDC5;(x>8-DkXW@*D45`~p9=LlxD3a$xail`+hjaBY!@AICqt8ZPMUD|5(IP z2x*30bMh%8U5?SHne}hn>lc=U;=K|vzPWtH&+>K^!4^lpa$y~FF0Z>SIU}YaZ^B(o zr7qX*vtSo6VoQj}kR#cz5IC5Sv4{=ue9;x|+6rr5*muZ6R$aqho6d{Z+<&YWXe-f= S1mLI2|Jqo({{;Z7;G(t^&4JGV delta 1294 zcmV+p1@Zdq4BrfpO93;HOgw*EZ`(E$e%G%c(E6=x8h1mBVh?eYqzT&8?&J5zH<&EWWaAoY=Sp|@(JB13mBj!hD&qSX8)5kM}?md?AM^jXPJu=g!B|VVNAh?iB|jr%W%D z6h0Zoz6e8Rl#ZRj=&Z~DU-#@U2TsLg0LIb$d~mYtBq5vdaLX4@o{|*{DX};ok_Feo zXCWPHCSyw|NUf)dx z+0T;`0!k2)Fr-Dbt+;Ky0h4{1mfd@kZ2~A6Loo@3nrRlzH!^fmdXq)!_=bTucx>za zIFqgdR6u=5EU9xQW5dE6Qd>_(w=39#YKKxMSK%A8j5t{-tD!x!RKBw6q-mw}e&aq$ zq*ae1ELt$o7O>e$f6+%D_8XHz11o>ZBaL&Qs}_sISiHq47@ZEhV|*Y7Q4}uQgLEbV zwx-PI&jU7_ah*G|5c0{05CrAlZnu~Qlh{BrHIRjO&7QAU0*^xSWpn) zc?tNV@Ci!OXS{PpTG?KN6g*m>B_Hu<4jn|!+|hW1#Q=Gg%m8KT$kV(6w0f+RU5S3s zlzkvjX*>PHBg^jk%kZ?l;jZOIRx1Bd)1Q&no>s5!hwbmXz5a{lt~i1m=iXdQ4YD(O zpQL~}ZP}@wzs31D-?6z@*${v2y+d`U{RL|@tRS5X_PSADa;>n_-z9#c^3Id6`$4*K z7&Z~1_=D?oy2j0~0f$avu+G24+v~xW#c|E@avv@BKt=1kEmbk|wQ9`W-cK)7RLR>N zl?V&<#J0)C-T`O5qELNG-nJsq_zs{Zqkuoj_c_;`jDLBPu{MGR43~e;NaI_`&X%`D z%CwMFhJdCXwl)!bwiExx8NO$ZEvQ!yU!;cHH@%l`@8zHn+vb2wRO`grPO(DXcCv~y zvV2JGH}+C4QZfIJ$GItf8|VMO2eH0TPtm~f8ILjN;)Vx!2z{qn5~G*Xw;&ch#U9w} z%KO0GiVuf(7kKC756*vG{5n3iBNT49D;9`H-j_G@Jp9T$igq~kfo6Fqv43Zbx3yeY zn_Z9Rx8r~_kFbZ-t9YyhWS9UG#1nh*c8|sTwH7oE0AqaJ*Bl7s3c8J59Lmhv68H`1s-6RkpQBg9mo~BN0a-q#1T;$)}8T z)kULb*1vI=DJ%)a2PI;BbGg9J@^%%$7Ke8xue+@+Bc>q}!d-2mE_?2?02jbui-N}x z_3Xa{xWbpQhz;<3(G~96nrUCCcgRB4QNyO1PJq|kf2<3xmFP!;@~ diff --git a/dev/qubit_basis/index.html b/dev/qubit_basis/index.html index 9013865..247f96b 100644 --- a/dev/qubit_basis/index.html +++ b/dev/qubit_basis/index.html @@ -102,4 +102,4 @@ Ket(dim=2) basis: Spin(1/2) 0.7071067811865475 + 0.0im - 0.0 - 0.7071067811865475im + 0.0 - 0.7071067811865475im diff --git a/dev/search_index.js b/dev/search_index.js index 1f6170e..3d6c2f9 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"QHO/#Quantum-Harmonic-Oscillators","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"DocTestSetup = quote\n using QuantumSymbolics, QuantumOptics\nend","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"In this section, we describe symbolic representations of bosonic systems in QuantumSymbolics, which can be numerically translated to QuantumOptics.jl.","category":"page"},{"location":"QHO/#States","page":"Quantum Harmonic Oscillators","title":"States","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"A Fock state is a state with well defined number of excitation quanta of a single quantum harmonic oscillator (an eigenstate of the number operator). In the following example, we create a FockState with 3 quanta in an infinite-dimension Fock space:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(3)\n|3⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Both vacuum (ground) and single-photon states are defined as constants in both unicode and ASCII for convenience:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"vac = F₀ = F0 =0rangle in the number state representation,\nF₁ = F1 =1rangle in the number state representation.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"To create quantum analogues of a classical harmonic oscillator, or monochromatic electromagnetic waves, we can define a coherent (a.k.a. semi-classical) state alpharangle, where alpha is a complex amplitude, with CoherentState(α::Number):","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> c = CoherentState(im)\n|im⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"note: Naming convention for quantum harmonic oscillator bases\nThe defined basis for arbitrary symbolic bosonic states is a FockBasis object, due to a shared naming interface for Quantum physics packages. For instance, the command basis(CoherentState(im)) will output Fock(cutoff=Inf). This may lead to confusion, as not all bosonic states are Fock states. However, this is simply a naming convention for the basis, and symbolic and numerical results are not affected by it.","category":"page"},{"location":"QHO/#Operators","page":"Quantum Harmonic Oscillators","title":"Operators","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Operations on bosonic states are supported, and can be simplified with qsimplify and its rewriter qsimplify_fock. For instance, we can apply the raising (creation) hata^dagger and lowering (annihilation or destroy) hata operators on a Fock state as follows:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(3);\n\njulia> raise = Create*f\na†|3⟩\n\njulia> qsimplify(raise, rewriter=qsimplify_fock)\n(sqrt(4))|4⟩\n\njulia> lower = Destroy*f\na|3⟩\n\njulia> qsimplify(lower, rewriter=qsimplify_fock)\n(sqrt(3))|2⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Or, we can apply the number operator hatn to our Fock state:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(3);\n\njulia> num = N*f\nn|3⟩\n\njulia> qsimplify(num, rewriter=qsimplify_fock)\n3|3⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Constants are defined for number and ladder operators in unicode and ASCII:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"N = n̂ =hatn,\nCreate = âꜛ =hata^dagger,\nDestroy = â =hata.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Phase-shift U(theta) and displacement D(alpha) operators, defined respectively as U(theta) = expleft(-ithetahatnright) quad textand quad D(alpha) = expleft(alphahata^dagger - alphahataright) can be defined with usual simplification rules. Consider the following example:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> displace = DisplaceOp(im)\nD(im)\n\njulia> c = qsimplify(displace*vac, rewriter=qsimplify_fock)\n|im⟩\n\njulia> phase = PhaseShiftOp(pi)\nU(π)\n\njulia> qsimplify(phase*c, rewriter=qsimplify_fock)\n|1.2246467991473532e-16 - 1.0im⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Here, we generated a coherent state irangle from the vacuum state 0rangle by applying the displacement operator defined by DisplaceOp. Then, we shifted its phase by pi with the phase shift operator (which is called with PhaseShiftOp) to get the result -irangle.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Summarized below are supported bosonic operators.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Number operator: NumberOp(),\nCreation operator: CreateOp(),\nAnnihilation operator: DestroyOp(),\nPhase-shift operator: PhaseShiftOp(phase::Number),\nDisplacement operator: DisplaceOp(alpha::Number).","category":"page"},{"location":"QHO/#Numerical-Conversions-to-QuantumOptics.jl","page":"Quantum Harmonic Oscillators","title":"Numerical Conversions to QuantumOptics.jl","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Bosonic systems can be translated to the ket representation with express. For instance:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(1);\n\njulia> express(f)\nKet(dim=3)\n basis: Fock(cutoff=2)\n 0.0 + 0.0im\n 1.0 + 0.0im\n 0.0 + 0.0im\n\njulia> express(Create) |> dense\nOperator(dim=3x3)\n basis: Fock(cutoff=2)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 1.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.41421+0.0im 0.0+0.0im\n\njulia> express(Create*f)\nKet(dim=3)\n basis: Fock(cutoff=2)\n 0.0 + 0.0im\n 0.0 + 0.0im\n 1.4142135623730951 + 0.0im\n\njulia> express(Destroy*f)\nKet(dim=3)\n basis: Fock(cutoff=2)\n 1.0 + 0.0im\n 0.0 + 0.0im\n 0.0 + 0.0im","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"warning: Cutoff specifications for numerical representations of quantum harmonic oscillators\nSymbolic bosonic states and operators are naturally represented in an infinite dimension basis. For numerical conversions of such quantum objects, a finite cutoff of the highest allowed state must be defined. By default, the basis dimension of numerical conversions is set to 3 (so the number representation cutoff is 2), as demonstrated above. To define a different cutoff, one must customize the QuantumOpticsRepr instance, e.g. provide QuantumOpticsRepr(cutoff=n::Int) to express.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"If we wish to specify a different numerical cutoff, say 4, to the previous examples, then we rewrite them as follows:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(1);\n\njulia> express(f, QuantumOpticsRepr(cutoff=4))\nKet(dim=5)\n basis: Fock(cutoff=4)\n 0.0 + 0.0im\n 1.0 + 0.0im\n 0.0 + 0.0im\n 0.0 + 0.0im\n 0.0 + 0.0im\n\njulia> express(Create, QuantumOpticsRepr(4)) |> dense\nOperator(dim=5x5)\n basis: Fock(cutoff=4)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 1.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.41421+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 1.73205+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 2.0+0.0im 0.0+0.0im","category":"page"},{"location":"introduction/#Getting-Started-with-QuantumSymbolics.jl","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"DocTestSetup = quote\n using QuantumSymbolics\nend","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"QuantumSymbolics is designed for manipulation and numerical translation of symbolic quantum objects. This tutorial introduces basic features of the package.","category":"page"},{"location":"introduction/#Installation","page":"Getting Started with QuantumSymbolics.jl","title":"Installation","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"QuantumSymbolics.jl can be installed through the Julia package system in the standard way:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"using Pkg\nPkg.add(\"QuantumSymbolics\")","category":"page"},{"location":"introduction/#Literal-Symbolic-Quantum-Objects","page":"Getting Started with QuantumSymbolics.jl","title":"Literal Symbolic Quantum Objects","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Basic objects of type SBra, SKet, SOperator, and SSuperOperator represent symbolic quantum objects with name and basis properties. Each type can be generated with a straightforward macro:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using QuantumSymbolics\n\njulia> @bra b # object of type SBra\n⟨b|\n\njulia> @ket k # object of type SKet\n|k⟩\n\njulia> @op A # object of type SOperator\nA\n\njulia> @superop S # object of type SSuperOperator\nS","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"By default, each of the above macros defines a symbolic quantum object in the spin-1/2 basis. One can simply choose a different basis, such as the Fock basis or a tensor product of several bases, by passing an object of type Basis to the second argument in the macro call:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op B FockBasis(Inf, 0.0)\nB\n\njulia> basis(B)\nFock(cutoff=Inf)\n\njulia> @op C SpinBasis(1//2)⊗SpinBasis(5//2)\nC\n\njulia> basis(C)\n[Spin(1/2) ⊗ Spin(5/2)]","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Here, we extracted the basis of the defined symbolic operators using the basis function.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Symbolic quantum objects with additional properties can be defined, such as a Hermitian operator, or the zero ket (i.e., a symbolic ket equivalent to the zero vector bm0).","category":"page"},{"location":"introduction/#Basic-Operations","page":"Getting Started with QuantumSymbolics.jl","title":"Basic Operations","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Expressions containing symbolic quantum objects can be built with a variety of functions. Let us consider the most fundamental operations: multiplication *, addition +, and the tensor product ⊗. ","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"We can multiply, for example, a ket by a scalar value, or apply an operator to a ket:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @ket k; @op A;\n\njulia> 2*k\n2|k⟩\n\njulia> A*k\nA|k⟩","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Similar scaling procedures can be performed on bras and operators. Addition between symbolic objects is also available, for instance:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op A₁; @op A₂;\n\njulia> A₁+A₂\n(A₁+A₂)\n\njulia> @bra b;\n\njulia> 2*b + 5*b\n7⟨b|","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Built into the package are straightforward automatic simplification rules, as shown in the last example, where 2⟨b|+5⟨b| evaluates to 7⟨b|. ","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Tensor products of symbolic objects can be performed, with basis information transferred:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @ket k₁; @ket k₂;\n\njulia> tp = k₁⊗k₂\n|k₁⟩|k₂⟩\n\njulia> basis(tp)\n[Spin(1/2) ⊗ Spin(1/2)]","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Inner and outer products of bras and kets can be generated:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @bra b; @ket k;\n\njulia> b*k\n⟨b||k⟩\n\njulia> k*b\n|k⟩⟨b|","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"More involved combinations of operations can be explored. Here are few other straightforward examples:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @bra b; @ket k; @op A; @op B;\n\njulia> 3*A*B*k\n3AB|k⟩\n\njulia> A⊗(k*b + B)\n(A⊗(B+|k⟩⟨b|))\n\njulia> A-A\n𝟎","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"In the last example, a zero operator, denoted 𝟎, was returned by subtracting a symbolic operator from itself. Such an object is of the type SZeroOperator, and similar objects SZeroBra and SZeroKet correspond to zero bras and zero kets, respectively.","category":"page"},{"location":"introduction/#Linear-Algebra-on-Bras,-Kets,-and-Operators","page":"Getting Started with QuantumSymbolics.jl","title":"Linear Algebra on Bras, Kets, and Operators","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"QuantumSymbolics supports a wide variety of linear algebra on symbolic bras, kets, and operators. For instance, the commutator and anticommutator of two operators, can be generated:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op A; @op B;\n\njulia> commutator(A, B)\n[A,B]\n\njulia> anticommutator(A, B)\n{A,B}\n\njulia> commutator(A, A)\n𝟎","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Or, one can take the dagger of a quantum object with the dagger function:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @ket k; @op A; @op B;\n\njulia> dagger(A)\nA†\n\njulia> dagger(A*k)\n|k⟩†A†\n\njulia> dagger(A*B)\nB†A†","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Below, we state all of the supported linear algebra operations on quantum objects:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"commutator of two operators: commutator,\nanticommutator of two operators: anticommutator,\ncomplex conjugate: conj,\ntranspose: transpose,\nprojection of a ket: projector,\nadjoint or dagger: dagger,\ntrace: tr,\npartial trace: ptrace,\ninverse of an operator: inv,\nexponential of an operator: exp,\nvectorization of an operator: vec.","category":"page"},{"location":"introduction/#Predefined-Quantum-Objects","page":"Getting Started with QuantumSymbolics.jl","title":"Predefined Quantum Objects","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"So far in this tutorial, we have considered arbitrary kets, bras, operators, and their corresponding operations. This package supports predefined quantum objects and operations in several formalisms, which are discussed in detail in other sections (see, for example, the quantum harmonic oscillators or qubit basis pages). To get a taste of what's available, let us consider a few symbolic examples. For a complete description, see the full API page.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Quantum gates and their basis states can be represented symbolically:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> CNOT # CNOT Gate\nCNOT\n\njulia> X, Y, Z, I # Pauli operators\n(X, Y, Z, 𝕀)\n\njulia> X1, X2 # Eigenstates of the Pauli X operator\n(|X₁⟩, |X₂⟩)\n\njulia> CPHASE * (Z1 ⊗ Z2) # Application of CPHASE gate on |01⟩\nCPHASE|Z₁⟩|Z₂⟩","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"We also have symbolic representations of bosonic systems:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> FockState(4) # Fock state with 4 excitation quanta\n|4⟩\n\njulia> Create, Destroy # creation and annihilation operators\n(a†, a)\n\njulia> DisplaceOp(im) # Displacement operator for single bosonic mode\nD(im)\n\njulia> N * vac # Application of number operator on vacuum state\nn|0⟩","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"If we want to substitute a predefined quantum object into a general symbolic expression, we can use the substitute command from Symbolics.jl:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using Symbolics\n\njulia> @op A; @ket k;\n\njulia> ex = 2*A + projector(k)\n(2A+𝐏[|k⟩])\n\njulia> substitute(ex, Dict([A => X, k => X1]))\n(2X+𝐏[|X₁⟩])","category":"page"},{"location":"introduction/#Simplifying-Expressions","page":"Getting Started with QuantumSymbolics.jl","title":"Simplifying Expressions","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"For predefined objects such as the Pauli operators X, Y, and Z, additional simplification can be performed with the qsimplify function. Take the following example:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> qsimplify(X*Z)\n(0 - 1im)Y","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Here, we have the relation XZ = -iY, so calling qsimplify on the expression X*Z will rewrite the expression as -im*Y.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Note that simplification rewriters used in QuantumSymbolics are built from the interface of SymbolicUtils.jl. By default, when called on an expression, qsimplify will iterate through every defined simplification rule in the QuantumSymbolics package until the expression can no longer be simplified. ","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Now, suppose we only want to use a specific subset of rules. For instance, say we wish to simplify commutators, but not anticommutators. Then, we can pass the keyword argument rewriter=qsimplify_commutator to qsimplify, as done in the following example:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> qsimplify(commutator(X, Y), rewriter=qsimplify_commutator)\n(0 + 2im)Z\n\njulia> qsimplify(anticommutator(X, Y), rewriter=qsimplify_commutator)\n{X,Y}","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"As shown above, we apply qsimplify to two expressions: commutator(X, Y) and anticommutator(X, Y). We specify that only commutator rules will be applied, thus the first expression is rewritten to (0 + 2im)Z while the second expression is simply returned. This feature can greatly reduce the time it takes for an expression to be simplified.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Below, we state all of the simplification rule subsets that can be passed to qsimplify:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"qsimplify_pauli for Pauli multiplication,\nqsimplify_commutator for commutators of Pauli operators,\nqsimplify_anticommutator for anticommutators of Pauli operators.","category":"page"},{"location":"introduction/#Expanding-Expressions","page":"Getting Started with QuantumSymbolics.jl","title":"Expanding Expressions","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Symbolic expressions containing quantum objects can be expanded with the qexpand function. We demonstrate this capability with the following examples.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op A; @op B; @op C;\n\njulia> qexpand(A⊗(B+C))\n((A⊗B)+(A⊗C))\n\njulia> qexpand((B+C)*A)\n(BA+CA)\n\njulia> @ket k₁; @ket k₂; @ket k₃;\n\njulia> qexpand(k₁⊗(k₂+k₃))\n(|k₁⟩|k₂⟩+|k₁⟩|k₃⟩)\n\njulia> qexpand((A*B)*(k₁+k₂))\n(AB|k₁⟩+AB|k₂⟩)","category":"page"},{"location":"introduction/#Numerical-Translation-of-Symbolic-Objects","page":"Getting Started with QuantumSymbolics.jl","title":"Numerical Translation of Symbolic Objects","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Symbolic expressions containing predefined objects can be converted to numerical representations with express. Numerics packages supported by this translation capability are QuantumOptics.jl and QuantumClifford.jl.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"By default, express converts an object to the quantum optics state vector representation. For instance, we can represent the exponential of the Pauli operator X numerically as follows:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using QuantumOptics\n\njulia> express(exp(X))\nOperator(dim=2x2)\n basis: Spin(1/2)sparse([1, 2, 1, 2], [1, 1, 2, 2], ComplexF64[1.5430806327160496 + 0.0im, 1.1752011684303352 + 0.0im, 1.1752011684303352 + 0.0im, 1.5430806327160496 + 0.0im], 2, 2)","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"To convert to the Clifford representation, an instance of CliffordRepr must be passed to express. For instance, we can represent the projection of the basis state X1 of the Pauli operator X as follows:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using QuantumClifford\n\njulia> express(projector(X1), CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ X","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"For more details on using express, refer to the express functionality page.","category":"page"},{"location":"express/#Express-functionality","page":"Express Functionality","title":"Express functionality","text":"","category":"section"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"DocTestSetup = quote\n using QuantumSymbolics, QuantumOptics, QuantumClifford\nend","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"A principle feature of QuantumSymbolics is to numerically represent symbolic quantum expressions in various formalisms using express. In particular, one can translate symbolic logic to back-end toolboxes such as QuantumOptics.jl or QuantumClifford.jl for simulating quantum systems with great flexibiity.","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"As a straightforward example, consider the spin-up state uparrowrangle = 0rangle, the eigenstate of the Pauli operator Z, which can be expressed in QuantumSymbolics as follows:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"using QuantumSymbolics, QuantumClifford, QuantumOptics # hide\nψ = Z1","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"Using express, we can translate this symbolic object into its numerical state vector form in QuantumOptics.jl.","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"express(ψ)","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"By default, express converts a quantum object with QuantumOpticRepr. It should be noted that express automatically caches this particular conversion of ψ. Thus, after running the above example, the numerical representation of the spin-up state is stored in the metadata of ψ.","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"ψ.metadata","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"The caching feature of express prevents a specific representation for a symbolic quantum object from being computed more than once. This becomes handy for translations of more complex operations, which can become computationally expensive. We also have the ability to express Z_1rangle in the Clifford formalism with QuantumClifford.jl:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"express(ψ, CliffordRepr())","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"Here, we specified an instance of CliffordRepr in the second argument to convert ψ into a tableau of Pauli operators containing its stabilizer and destabilizer states. Now, both the state vector and Clifford representation of ψ have been cached:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"ψ.metadata","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"More involved examples can be explored. For instance, say we want to apply the tensor product Xotimes Y of the Pauli operators X and Y to the Bell state Phi^+rangle = dfrac1sqrt2left(00rangle + 11rangleright), and numerically express the result in the quantum optics formalism. This would be done as follows:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"using QuantumSymbolics, QuantumClifford, QuantumOptics # hide\nbellstate = (Z1⊗Z1+Z2⊗Z2)/√2\ntp = σˣ⊗σʸ\nexpress(tp*bellstate)","category":"page"},{"location":"express/#Examples-of-Edge-Cases","page":"Express Functionality","title":"Examples of Edge Cases","text":"","category":"section"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"For Pauli operators, additional flexibility is given for translations to the Clifford formalism. Users have the option to convert a multi-qubit Pauli operator to an observable or operation with instances of UseAsObservable and UseAsOperation, respectively. Take the Pauli operator Y, for example, which in QuantumSymbolics is the constants Y or σʸ:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"julia> express(σʸ, CliffordRepr(), UseAsObservable())\n+ Y\n\njulia> express(σʸ, CliffordRepr(), UseAsOperation())\nsY","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"Another edge case is translations with QuantumOpticsRepr, where we can additionally define a finite cutoff for bosonic states and operators, as discussed in the quantum harmonic oscillators page. The default cutoff for such objects is 2, however a different cutoff can be specified by passing an integer to QuantumOpticsRepr in an express call. Let us see an example with the number operator:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"julia> express(N) |> dense\nOperator(dim=3x3)\n basis: Fock(cutoff=2)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 2.0+0.0im\n\njulia> express(N, QuantumOpticsRepr(cutoff=4)) |> dense\nOperator(dim=5x5)\n basis: Fock(cutoff=4)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 2.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 3.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 4.0+0.0im","category":"page"},{"location":"qubit_basis/#Typical-Qubit-Bases","page":"Qubit Basis Choice","title":"Typical Qubit Bases","text":"","category":"section"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"DocTestSetup = quote\n using QuantumSymbolics, QuantumOptics\nend","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"Here are some common conventions for representing a qubit in a physical system. This reference is provided as the conventions matter to the correct choice of noise processes and bases in which they are represented.","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"In monospaced code format we give the symbols by which these objects are callable in QuantumSymbolics. We provide unicode and ASCII names for convenience of typing.","category":"page"},{"location":"qubit_basis/#Spin-\\frac{1}{2}-qubits","page":"Qubit Basis Choice","title":"Spin frac12 qubits","text":"","category":"section"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"First we introduce the Pauli matrices:","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"julia> express(σᶻ) |> dense # or `Z`\nOperator(dim=2x2)\n basis: Spin(1/2)\n 1.0+0.0im 0.0+0.0im\n 0.0+0.0im -1.0+0.0im\n\njulia> express(σˣ) |> dense # or `X`\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.0+0.0im 1.0+0.0im\n 1.0+0.0im 0.0+0.0im\n\njulia> express(σʸ) |> dense # or `Y`\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.0+0.0im -0.0-1.0im\n 0.0+1.0im 0.0+0.0im","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"Above dense is from QuantumOptics, used to convert their representation to a dense matrix.","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"The eigenvectors of each one of them provides for a convenient basis. The σᶻ basis is also called the computational basis. As mentioned, we have both unicode and ASCII names for convenience of typing. For these basis vectors we also have two sets of names: one based on which operator they are eigenvectors of and one in terms of typical logical representation (with prefix L).","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"Z1 = Z₁ = L0 = L₀ = 0rangle = beginpmatrix10endpmatrix = uparrowrangle with eigenvalue +1 for σᶻ\nZ2 = Z₂ = L1 = L₁ = 1rangle = beginpmatrix01endpmatrix = downarrowrangle with eigenvalue +1 for σᶻ\nX1 = X₁ = Lp = L₊ = +rangle = frac1sqrt 2beginpmatrix11endpmatrix with eigenvalue +1 for σˣ\nX2 = X₂ = Lm = L₋ = -rangle = frac1sqrt 2beginpmatrix1-1endpmatrix with eigenvalue -1 for σˣ\nY1 = Y₁ = Lpi = L₊ᵢ = +irangle = frac1sqrt 2beginpmatrix1 iendpmatrix with eigenvalue +1 for σʸ\nY2 = Y₂ = Lmi = L₋ᵢ = -irangle = frac1sqrt 2beginpmatrix1-iendpmatrix with eigenvalue -1 for σʸ","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"The Y vectors occasionally are denoted with R and L (stemming from the vector notation for right and left polarized light), but there is no established notation choice or ordering.","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"warning: Talking about ground/excited and spin-up/spin-down states can lead to confusion\nWe specifically avoid using notation with \"ground\" and \"excited\" states. For physicist usually the excited state is the \"up\" states (erangle=uparrowrangle), but that historical choice clashes with the logical state notation as we have the logical zero be the \"excited\" state. This clash becomes particularly confusing when noise processes and relaxation process are taken into account. E.g. one might think the operator usually denoted hatsigma_- would be the one corresponding to decay but we actually have hatsigma_-0rangle=1rangle. To avoid this confusion we strive to not use the notation uparrowrangle, downarrowrangle, erangle, and grangle. Similarly we strongly prefer to never use hatsigma_- and hatsigma_+, rather only use 1rangle langle0 and its conjugate. If we were instead talking about single-rail photonic qubits, we do not have the same issue (because the diagonal of the number operator is growing, instead of decreasing like the diagonal of the Pauli Z).","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"The basis states can be easily expressed both as kets and as tableaux (In the tableau representation below the top half corresponds to the destabilizer, while the bottom is the stabilizer):","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"julia> express(L0, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n+ Z\n\n\njulia> express(L1, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n- Z\n\n\njulia> express(L₀, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n+ Z\n\n\njulia> express(L₁, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n- Z\n\n\njulia> express(L₊, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ X\n\n\njulia> express(L₋, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n- X\n\n\njulia> express(L₊ᵢ, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ Y\n\n\njulia> express(L₋ᵢ, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n- Y","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"julia> express(L₀)\nKet(dim=2)\n basis: Spin(1/2)\n 1.0 + 0.0im\n 0.0 + 0.0im\n\njulia> express(L₁)\nKet(dim=2)\n basis: Spin(1/2)\n 0.0 + 0.0im\n 1.0 + 0.0im\n\njulia> express(L₊)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.7071067811865475 + 0.0im\n\njulia> express(L₋)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n -0.7071067811865475 + 0.0im\n\njulia> express(L₊ᵢ)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.0 + 0.7071067811865475im\n\njulia> express(L₋ᵢ)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.0 - 0.7071067811865475im","category":"page"},{"location":"bibliography/#Bibliography","page":"Bibliography","title":"Bibliography","text":"","category":"section"},{"location":"bibliography/","page":"Bibliography","title":"Bibliography","text":"","category":"page"},{"location":"#QuantumSymbolics.jl","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"section"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"DocTestSetup = quote\n using QuantumSymbolics\nend","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"A symbolics package for quantum information science. It serves two purposes:","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"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.\nAn assortment of \"expression translators\" are provided that can turn a symbolic expression into a numerical one in a variety of formalisms.","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Below we list some commonly used expressions, followed by an autogenerated API list.","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"using QuantumSymbolics","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n
Symbolic ExampleConversion Example
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Qubit Basis States X1, X2, Y1, Y2, Z1, Z2","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Z1","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(Z1)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(Y2, CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Common gates: CNOT, H, etc","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"CNOT","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(H)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(CNOT, CliffordRepr(), UseAsOperation())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Tensor products ⊗ and sums +","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"(X1⊗Z2 + Y1⊗Y2 ) / √3","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(X1⊗Z1)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(X1⊗Y2, CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Projectors, pure density matrices","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"SProjector(X1⊗Z2)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(SProjector(X1⊗Z1))","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(SProjector(X1⊗Z1), CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Completely depolarized (mixed) state","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"MixedState(X1)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(MixedState(X1))","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(MixedState(X1), CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Impure states, represented as sum of density matrices","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"(MixedState(X1)+SProjector(Z1)) / 2","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express((MixedState(X1)+SProjector(Z1)) / 2)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"When a Clifford representation is used, an efficient sampler is generated, and stabilizer states are randomly sampled from the correct distribution:","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(MixedState(X1)/2+SProjector(Z1)/2, CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"warning: Stabilizer state expressions\nThe state written as fracZ₁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.","category":"page"},{"location":"API/#Full-API","page":"API","title":"Full API","text":"","category":"section"},{"location":"API/","page":"API","title":"API","text":"","category":"page"},{"location":"API/#Autogenerated-API-list","page":"API","title":"Autogenerated API list","text":"","category":"section"},{"location":"API/","page":"API","title":"API","text":"Modules = [QuantumSymbolics, QuantumInterface]\nPrivate = false","category":"page"},{"location":"API/#QuantumSymbolics.CNOT","page":"API","title":"QuantumSymbolics.CNOT","text":"CNOT gate\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.CPHASE","page":"API","title":"QuantumSymbolics.CPHASE","text":"CPHASE gate\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Create","page":"API","title":"QuantumSymbolics.Create","text":"Creation operator, also available as the constant âꜛ, in an infinite dimension Fock basis. There is no unicode dagger superscript, so we use the uparrow\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Destroy","page":"API","title":"QuantumSymbolics.Destroy","text":"Annihilation operator, also available as the constant â, in an infinite dimension Fock basis.\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.F₁","page":"API","title":"QuantumSymbolics.F₁","text":"Single photon basis state of n\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.H","page":"API","title":"QuantumSymbolics.H","text":"Hadamard gate\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.I","page":"API","title":"QuantumSymbolics.I","text":"Identity operator in qubit basis\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.N","page":"API","title":"QuantumSymbolics.N","text":"Number operator, also available as the constant n̂, in an infinite dimension Fock basis.\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Pm","page":"API","title":"QuantumSymbolics.Pm","text":"Pauli \"minus\" operator, also available as the constant σ₋\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Pp","page":"API","title":"QuantumSymbolics.Pp","text":"Pauli \"plus\" operator, also available as the constant σ₊\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.X","page":"API","title":"QuantumSymbolics.X","text":"Pauli X operator, also available as the constant σˣ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.X1","page":"API","title":"QuantumSymbolics.X1","text":"Basis state of σˣ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.X2","page":"API","title":"QuantumSymbolics.X2","text":"Basis state of σˣ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Y","page":"API","title":"QuantumSymbolics.Y","text":"Pauli Y operator, also available as the constant σʸ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Y1","page":"API","title":"QuantumSymbolics.Y1","text":"Basis state of σʸ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Y2","page":"API","title":"QuantumSymbolics.Y2","text":"Basis state of σʸ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Z","page":"API","title":"QuantumSymbolics.Z","text":"Pauli Z operator, also available as the constant σᶻ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Z1","page":"API","title":"QuantumSymbolics.Z1","text":"Basis state of σᶻ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Z2","page":"API","title":"QuantumSymbolics.Z2","text":"Basis state of σᶻ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.vac","page":"API","title":"QuantumSymbolics.vac","text":"Vacuum basis state of n\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.AbstractRepresentation","page":"API","title":"QuantumSymbolics.AbstractRepresentation","text":"An abstract type for the supported representation of quantum objects.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.CliffordRepr","page":"API","title":"QuantumSymbolics.CliffordRepr","text":"Representation using tableaux governed by QuantumClifford.jl\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.CoherentState","page":"API","title":"QuantumSymbolics.CoherentState","text":"Coherent state in defined Fock basis.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.CreateOp","page":"API","title":"QuantumSymbolics.CreateOp","text":"Creation (raising) operator.\n\njulia> f = FockState(2)\n|2⟩\n\njulia> create = CreateOp()\na†\n\njulia> qsimplify(create*f, rewriter=qsimplify_fock)\n(sqrt(3))|3⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.DephasingCPTP","page":"API","title":"QuantumSymbolics.DephasingCPTP","text":"Single-qubit dephasing CPTP map\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.DestroyOp","page":"API","title":"QuantumSymbolics.DestroyOp","text":"Annihilation (lowering or destroy) operator in defined Fock basis.\n\njulia> f = FockState(2)\n|2⟩\n\njulia> destroy = DestroyOp()\na\n\njulia> qsimplify(destroy*f, rewriter=qsimplify_fock)\n(sqrt(2))|1⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.DisplaceOp","page":"API","title":"QuantumSymbolics.DisplaceOp","text":"Displacement operator in defined Fock basis.\n\njulia> f = FockState(0)\n|0⟩\n\njulia> displace = DisplaceOp(im)\nD(im)\n\njulia> qsimplify(displace*f, rewriter=qsimplify_fock)\n|im⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.FockState","page":"API","title":"QuantumSymbolics.FockState","text":"Fock state in defined Fock basis.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.GateCPTP","page":"API","title":"QuantumSymbolics.GateCPTP","text":"A unitary gate followed by a CPTP map\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.IdentityOp","page":"API","title":"QuantumSymbolics.IdentityOp","text":"The identity operator for a given basis\n\njulia> IdentityOp(X1⊗X2)\n𝕀\n\njulia> express(IdentityOp(Z2))\nOperator(dim=2x2)\n basis: Spin(1/2)sparse([1, 2], [1, 2], ComplexF64[1.0 + 0.0im, 1.0 + 0.0im], 2, 2)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.KrausRepr","page":"API","title":"QuantumSymbolics.KrausRepr","text":"Kraus representation of a quantum channel\n\njulia> @op A₁; @op A₂; @op A₃;\n\njulia> K = kraus(A₁, A₂, A₃)\n𝒦(A₁,A₂,A₃)\n\njulia> @op ρ;\n\njulia> K*ρ\n(A₁ρA₁†+A₂ρA₂†+A₃ρA₃†)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.MixedState","page":"API","title":"QuantumSymbolics.MixedState","text":"Completely depolarized state\n\njulia> MixedState(X1⊗X2)\n𝕄\n\njulia> express(MixedState(X1⊗X2))\nOperator(dim=4x4)\n basis: [Spin(1/2) ⊗ Spin(1/2)]sparse([1, 2, 3, 4], [1, 2, 3, 4], ComplexF64[0.25 + 0.0im, 0.25 + 0.0im, 0.25 + 0.0im, 0.25 + 0.0im], 4, 4)\n\njulia> express(MixedState(X1⊗X2), CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n\n𝒳ₗ━━\n+ X_\n+ _X\n𝒮𝓉𝒶𝒷\n\n𝒵ₗ━━\n+ Z_\n+ _Z\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.NumberOp","page":"API","title":"QuantumSymbolics.NumberOp","text":"Number operator.\n\njulia> f = FockState(2)\n|2⟩\n\njulia> num = NumberOp()\nn\n\njulia> qsimplify(num*f, rewriter=qsimplify_fock)\n2|2⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.PauliNoiseCPTP","page":"API","title":"QuantumSymbolics.PauliNoiseCPTP","text":"Single-qubit Pauli noise CPTP map\n\njulia> apply!(express(Z1), [1], express(PauliNoiseCPTP(1/4,1/4,1/4)))\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.5+0.0im 0.0+0.0im\n 0.0+0.0im 0.5+0.0im\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.PhaseShiftOp","page":"API","title":"QuantumSymbolics.PhaseShiftOp","text":"Phase-shift operator in defined Fock basis.\n\njulia> c = CoherentState(im)\n|im⟩\n\njulia> phase = PhaseShiftOp(pi)\nU(π)\n\njulia> qsimplify(phase*c, rewriter=qsimplify_fock)\n|1.2246467991473532e-16 - 1.0im⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.QuantumMCRepr","page":"API","title":"QuantumSymbolics.QuantumMCRepr","text":"Similar to QuantumOpticsRepr, but using trajectories instead of superoperators.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.QuantumOpticsRepr","page":"API","title":"QuantumSymbolics.QuantumOpticsRepr","text":"Representation using kets, bras, density matrices, and superoperators governed by QuantumOptics.jl.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SAdd","page":"API","title":"QuantumSymbolics.SAdd","text":"Addition of quantum objects (kets, operators, or bras).\n\njulia> @ket k₁; @ket k₂;\n\njulia> k₁ + k₂\n(|k₁⟩+|k₂⟩)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SAnticommutator","page":"API","title":"QuantumSymbolics.SAnticommutator","text":"Symbolic anticommutator of two operators.\n\njulia> @op A; @op B;\n\njulia> anticommutator(A, B)\n{A,B}\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SApplyBra","page":"API","title":"QuantumSymbolics.SApplyBra","text":"Symbolic application of an operator on a bra (from the right).\n\njulia> @bra b; @op A;\n\njulia> b*A\n⟨b|A\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SApplyKet","page":"API","title":"QuantumSymbolics.SApplyKet","text":"Symbolic application of an operator on a ket (from the left).\n\njulia> @ket k; @op A;\n\njulia> A*k\nA|k⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SBra","page":"API","title":"QuantumSymbolics.SBra","text":"Symbolic bra\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SBraKet","page":"API","title":"QuantumSymbolics.SBraKet","text":"Symbolic inner product of a bra and a ket.\n\njulia> @bra b; @ket k;\n\njulia> b*k\n⟨b||k⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SCommutator","page":"API","title":"QuantumSymbolics.SCommutator","text":"Symbolic commutator of two operators.\n\njulia> @op A; @op B;\n\njulia> commutator(A, B)\n[A,B]\n\njulia> commutator(A, A)\n𝟎\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SConjugate","page":"API","title":"QuantumSymbolics.SConjugate","text":"Complex conjugate of quantum objects (kets, bras, operators).\n\njulia> @op A; @ket k;\n\njulia> conj(A)\nAˣ\n\njulia> conj(k)\n|k⟩ˣ\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SDagger","page":"API","title":"QuantumSymbolics.SDagger","text":"Dagger, i.e., adjoint of quantum objects (kets, bras, operators).\n\njulia> @ket a; @op A;\n\njulia> dagger(2*im*A*a)\n(0 - 2im)|a⟩†A†\n\njulia> @op B;\n\njulia> dagger(A*B)\nB†A†\n\njulia> ℋ = SHermitianOperator(:ℋ); U = SUnitaryOperator(:U);\n\njulia> dagger(ℋ)\nℋ\n\njulia> dagger(U)\nU⁻¹\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SExpOperator","page":"API","title":"QuantumSymbolics.SExpOperator","text":"Exponential of a symbolic operator.\n\njulia> @op A; @op B;\n\njulia> exp(A)\nexp(A)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SHermitianOperator","page":"API","title":"QuantumSymbolics.SHermitianOperator","text":"Symbolic Hermitian operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SHermitianUnitaryOperator","page":"API","title":"QuantumSymbolics.SHermitianUnitaryOperator","text":"Symbolic Hermitian and unitary operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SInvOperator","page":"API","title":"QuantumSymbolics.SInvOperator","text":"Inverse of an operator.\n\njulia> @op A;\n\njulia> inv(A)\nA⁻¹\n\njulia> inv(A)*A\n𝕀\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SKet","page":"API","title":"QuantumSymbolics.SKet","text":"Symbolic ket\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SMulOperator","page":"API","title":"QuantumSymbolics.SMulOperator","text":"Symbolic application of operator on operator.\n\njulia> @op A; @op B;\n\njulia> A*B\nAB\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SOperator","page":"API","title":"QuantumSymbolics.SOperator","text":"Symbolic operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SOuterKetBra","page":"API","title":"QuantumSymbolics.SOuterKetBra","text":"Symbolic outer product of a ket and a bra.\n\njulia> @bra b; @ket k;\n\njulia> k*b \n|k⟩⟨b|\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SPartialTrace","page":"API","title":"QuantumSymbolics.SPartialTrace","text":"Partial trace over system i of a composite quantum system\n\njulia> @op 𝒪 SpinBasis(1//2)⊗SpinBasis(1//2);\n\njulia> op = ptrace(𝒪, 1)\ntr1(𝒪)\n\njulia> QuantumSymbolics.basis(op)\nSpin(1/2)\n\njulia> @op A; @op B;\n\njulia> ptrace(A⊗B, 1)\n(tr(A))B\n\njulia> @ket k; @bra b;\n\njulia> factorizable = A ⊗ (k*b)\n(A⊗|k⟩⟨b|)\n\njulia> ptrace(factorizable, 1)\n(tr(A))|k⟩⟨b|\n\njulia> ptrace(factorizable, 2)\n(⟨b||k⟩)A\n\njulia> mixed_state = (A⊗(k*b)) + ((k*b)⊗B)\n((A⊗|k⟩⟨b|)+(|k⟩⟨b|⊗B))\n\njulia> ptrace(mixed_state, 1)\n((0 + ⟨b||k⟩)B+(tr(A))|k⟩⟨b|)\n\njulia> ptrace(mixed_state, 2)\n((0 + ⟨b||k⟩)A+(tr(B))|k⟩⟨b|)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SProjector","page":"API","title":"QuantumSymbolics.SProjector","text":"Projector for a given ket.\n\njulia> projector(X1⊗X2)\n𝐏[|X₁⟩|X₂⟩]\n\njulia> express(projector(X2))\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.5+0.0im -0.5-0.0im\n -0.5+0.0im 0.5+0.0im\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SScaled","page":"API","title":"QuantumSymbolics.SScaled","text":"Scaling of a quantum object (ket, operator, or bra) by a number.\n\njulia> @ket k\n|k⟩\n\njulia> 2*k\n2|k⟩\n\njulia> @op A\nA\n\njulia> 2*A\n2A\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SSuperOpApply","page":"API","title":"QuantumSymbolics.SSuperOpApply","text":"Symbolic application of a superoperator on an operator\n\njulia> @op A; @superop S;\n\njulia> S*A\nS[A]\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SSuperOperator","page":"API","title":"QuantumSymbolics.SSuperOperator","text":"Symbolic superoperator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.STrace","page":"API","title":"QuantumSymbolics.STrace","text":"Trace of an operator\n\njulia> @op A; @op B;\n\njulia> tr(A)\ntr(A)\n\njulia> tr(commutator(A, B))\n0\n\njulia> @bra b; @ket k;\n\njulia> tr(k*b)\n⟨b||k⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.STranspose","page":"API","title":"QuantumSymbolics.STranspose","text":"Transpose of quantum objects (kets, bras, operators).\n\njulia> @op A; @op B; @ket k;\n\njulia> transpose(A)\nAᵀ\n\njulia> transpose(A+B)\n(Aᵀ+Bᵀ)\n\njulia> transpose(k)\n|k⟩ᵀ\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SUnitaryOperator","page":"API","title":"QuantumSymbolics.SUnitaryOperator","text":"Symbolic unitary operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SVec","page":"API","title":"QuantumSymbolics.SVec","text":"Vectorization of a symbolic operator.\n\njulia> @op A; @op B;\n\njulia> vec(A)\n|A⟩⟩\n\njulia> vec(A+B)\n(|A⟩⟩+|B⟩⟩)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SZeroBra","page":"API","title":"QuantumSymbolics.SZeroBra","text":"Symbolic zero bra\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SZeroKet","page":"API","title":"QuantumSymbolics.SZeroKet","text":"Symbolic zero ket\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SZeroOperator","page":"API","title":"QuantumSymbolics.SZeroOperator","text":"Symbolic zero operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.StabilizerState","page":"API","title":"QuantumSymbolics.StabilizerState","text":"State defined by a stabilizer tableau\n\nFor full functionality you also need to import the QuantumClifford library.\n\njulia> using QuantumClifford, QuantumOptics # needed for the internal representation of the stabilizer tableaux and the conversion to a ket\n\njulia> StabilizerState(S\"XX ZZ\")\n𝒮₂\n\njulia> express(StabilizerState(S\"-X\"))\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n -0.7071067811865475 + 0.0im\n\n\n\n\n\n","category":"type"},{"location":"API/#Base.conj-Union{Tuple{SymbolicUtils.Symbolic{T}}, Tuple{T}} where T<:Union{QuantumInterface.AbstractBra, QuantumInterface.AbstractKet, QuantumInterface.AbstractOperator, QuantumInterface.AbstractSuperOperator}","page":"API","title":"Base.conj","text":"conj(x::Symbolic{AbstractKet})\nconj(x::Symbolic{AbstractBra})\nconj(x::Symbolic{AbstractOperator})\nconj(x::Symbolic{AbstractSuperOperator})\n\nSymbolic transpose operation. See also SConjugate.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.exp-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"Base.exp","text":"exp(x::Symbolic{AbstractOperator})\n\nSymbolic inverse of an operator. See also SExpOperator.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.inv-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"Base.inv","text":"inv(x::Symbolic{AbstractOperator})\n\nSymbolic inverse of an operator. See also SInvOperator.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.transpose-Union{Tuple{SymbolicUtils.Symbolic{T}}, Tuple{T}} where T<:Union{QuantumInterface.AbstractBra, QuantumInterface.AbstractKet, QuantumInterface.AbstractOperator}","page":"API","title":"Base.transpose","text":"transpose(x::Symbolic{AbstractKet})\ntranspose(x::Symbolic{AbstractBra})\ntranspose(x::Symbolic{AbstractOperator})\n\nSymbolic transpose operation. See also STranspose.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.vec-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"Base.vec","text":"vec(x::Symbolic{AbstractOperator})\n\nSymbolic vector representation of an operator. See also SVec.\n\n\n\n\n\n","category":"method"},{"location":"API/#LinearAlgebra.tr-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"LinearAlgebra.tr","text":"tr(x::Symbolic{AbstractOperator})\n\nSymbolic trace operation. See also STrace.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.dagger-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractBra}}","page":"API","title":"QuantumInterface.dagger","text":"dagger(x::Symbolic{AbstractBra})\n\nSymbolic transpose operation. See also SDagger.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.dagger-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractKet}}","page":"API","title":"QuantumInterface.dagger","text":"dagger(x::Symbolic{AbstractKet})\n\nSymbolic transpose operation. See also SDagger.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.dagger-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"QuantumInterface.dagger","text":"dagger(x::Symbolic{AbstractOperator})\n\nSymbolic transpose operation. See also SDagger.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.projector-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractKet}}","page":"API","title":"QuantumInterface.projector","text":"projector(x::Symbolic{AbstractKet})\n\nSymbolic projection operation. See also SProjector.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.ptrace-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}, Any}","page":"API","title":"QuantumInterface.ptrace","text":"ptrace(x::Symbolic{AbstractOperator})\n\nSymbolic partial trace operation. See also SPartialTrace.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.anticommutator","page":"API","title":"QuantumSymbolics.anticommutator","text":"The anticommutator of two operators.\n\n\n\n\n\n","category":"function"},{"location":"API/#QuantumSymbolics.commutator","page":"API","title":"QuantumSymbolics.commutator","text":"The commutator of two operators.\n\n\n\n\n\n","category":"function"},{"location":"API/#QuantumSymbolics.consistent_representation-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.consistent_representation","text":"Pick a representation that is consistent with given representations and appropriate for the given state.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.express","page":"API","title":"QuantumSymbolics.express","text":"express(s, repr::AbstractRepresentation=QuantumOpticsRepr()[, use::AbstractUse])\n\nThe main interface for expressing quantum objects in various representations.\n\njulia> express(X1)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.7071067811865475 + 0.0im\n\njulia> express(X1, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ X\n\njulia> express(QuantumSymbolics.X)\nOperator(dim=2x2)\n basis: Spin(1/2)sparse([2, 1], [1, 2], ComplexF64[1.0 + 0.0im, 1.0 + 0.0im], 2, 2)\n\njulia> express(QuantumSymbolics.X, CliffordRepr(), UseAsOperation())\nsX\n\njulia> express(QuantumSymbolics.X, CliffordRepr(), UseAsObservable())\n+ X\n\n\n\n\n\n","category":"function"},{"location":"API/#QuantumSymbolics.qexpand-Tuple{Any}","page":"API","title":"QuantumSymbolics.qexpand","text":"qexpand(s)\n\nManually expand a symbolic expression of quantum objects. \n\njulia> @op A; @op B; @op C;\n\njulia> qexpand(commutator(A, B))\n(-1BA+AB)\n\njulia> qexpand(A⊗(B+C))\n((A⊗B)+(A⊗C))\n\njulia> @ket k₁; @ket k₂;\n\njulia> qexpand(A*(k₁+k₂))\n(A|k₁⟩+A|k₂⟩)\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.qsimplify-Tuple{Any}","page":"API","title":"QuantumSymbolics.qsimplify","text":"qsimplify(s; rewriter=nothing)\n\nManually simplify a symbolic expression of quantum objects. \n\nIf the keyword rewriter is not specified, then qsimplify will apply every defined rule to the expression. For performance or single-purpose motivations, the user has the option to define a specific rewriter for qsimplify to apply to the expression. The defined rewriters for simplification are the following objects: - qsimplify_pauli - qsimplify_commutator - qsimplify_anticommutator\n\njulia> qsimplify(σʸ*commutator(σˣ*σᶻ, σᶻ))\n(0 - 2im)Z\n\njulia> qsimplify(anticommutator(σˣ, σˣ), rewriter=qsimplify_anticommutator)\n2𝕀\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.@bra-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.@bra","text":"@bra(name, basis=SpinBasis(1//2))\n\nDefine a symbolic bra of type SBra. By default, the defined basis is the spin-1/2 basis.\n\njulia> @bra b₁\n⟨b₁|\n\njulia> @bra b₂ FockBasis(2)\n⟨b₂|\n\n\n\n\n\n","category":"macro"},{"location":"API/#QuantumSymbolics.@ket-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.@ket","text":"@ket(name, basis=SpinBasis(1//2))\n\nDefine a symbolic ket of type SKet. By default, the defined basis is the spin-1/2 basis.\n\njulia> @ket k₁\n|k₁⟩\n\njulia> @ket k₂ FockBasis(2)\n|k₂⟩\n\n\n\n\n\n","category":"macro"},{"location":"API/#QuantumSymbolics.@op-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.@op","text":"@op(name, basis=SpinBasis(1//2))\n\nDefine a symbolic ket of type SOperator. By default, the defined basis is the spin-1/2 basis.\n\njulia> @op A\nA\n\njulia> @op B FockBasis(2)\nB\n\n\n\n\n\n","category":"macro"}] +[{"location":"QHO/#Quantum-Harmonic-Oscillators","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"DocTestSetup = quote\n using QuantumSymbolics, QuantumOptics\nend","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"In this section, we describe symbolic representations of bosonic systems in QuantumSymbolics, which can be numerically translated to QuantumOptics.jl.","category":"page"},{"location":"QHO/#States","page":"Quantum Harmonic Oscillators","title":"States","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"A Fock state is a state with well defined number of excitation quanta of a single quantum harmonic oscillator (an eigenstate of the number operator). In the following example, we create a FockState with 3 quanta in an infinite-dimension Fock space:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(3)\n|3⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Both vacuum (ground) and single-photon states are defined as constants in both unicode and ASCII for convenience:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"vac = F₀ = F0 =0rangle in the number state representation,\nF₁ = F1 =1rangle in the number state representation.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"To create quantum analogues of a classical harmonic oscillator, or monochromatic electromagnetic waves, we can define a coherent (a.k.a. semi-classical) state alpharangle, where alpha is a complex amplitude, with CoherentState:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> c = CoherentState(im)\n|im⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"note: Naming convention for quantum harmonic oscillator bases\nThe defined basis for arbitrary symbolic bosonic states is a FockBasis object, due to a shared naming interface for Quantum physics packages. For instance, the command basis(CoherentState(im)) will output Fock(cutoff=Inf). This may lead to confusion, as not all bosonic states are Fock states. However, this is simply a naming convention for the basis, and symbolic and numerical results are not affected by it.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Summarized below are supported bosonic states.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Fock state: FockState(idx::Int),\nCoherent state: CoherentState(alpha::Number),\nSqueezed vacuum state: SqueezedState(z::Number).","category":"page"},{"location":"QHO/#Operators","page":"Quantum Harmonic Oscillators","title":"Operators","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Operations on bosonic states are supported, and can be simplified with qsimplify and its rewriter qsimplify_fock. For instance, we can apply the raising (creation) hata^dagger and lowering (annihilation or destroy) hata operators on a Fock state as follows:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(3);\n\njulia> raise = Create*f\na†|3⟩\n\njulia> qsimplify(raise, rewriter=qsimplify_fock)\n(sqrt(4))|4⟩\n\njulia> lower = Destroy*f\na|3⟩\n\njulia> qsimplify(lower, rewriter=qsimplify_fock)\n(sqrt(3))|2⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Or, we can apply the number operator hatn to our Fock state:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(3);\n\njulia> num = N*f\nn|3⟩\n\njulia> qsimplify(num, rewriter=qsimplify_fock)\n3|3⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Constants are defined for number and ladder operators in unicode and ASCII:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"N = n̂ =hatn,\nCreate = âꜛ =hata^dagger,\nDestroy = â =hata.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Phase-shift U(theta) and displacement D(alpha) operators, defined respectively as","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"U(theta) = expleft(-ithetahatnright) quad textand quad D(alpha) = expleft(alphahata^dagger - alphahataright)","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"can be defined with usual simplification rules. Consider the following example:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> displace = DisplaceOp(im)\nD(im)\n\njulia> c = qsimplify(displace*vac, rewriter=qsimplify_fock)\n|im⟩\n\njulia> phase = PhaseShiftOp(pi)\nU(π)\n\njulia> qsimplify(phase*c, rewriter=qsimplify_fock)\n|1.2246467991473532e-16 - 1.0im⟩","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Here, we generated a coherent state irangle from the vacuum state 0rangle by applying the displacement operator defined by DisplaceOp. Then, we shifted its phase by pi with the phase shift operator (which is called with PhaseShiftOp) to get the result -irangle.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Summarized below are supported bosonic operators.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Number operator: NumberOp(),\nCreation operator: CreateOp(),\nAnnihilation operator: DestroyOp(),\nPhase-shift operator: PhaseShiftOp(phase::Number),\nDisplacement operator: DisplaceOp(alpha::Number),\nSqueezing operator: SqueezeOp(z::Number).","category":"page"},{"location":"QHO/#Numerical-Conversions-to-QuantumOptics.jl","page":"Quantum Harmonic Oscillators","title":"Numerical Conversions to QuantumOptics.jl","text":"","category":"section"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"Bosonic systems can be translated to the ket representation with express. For instance:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(1);\n\njulia> express(f)\nKet(dim=3)\n basis: Fock(cutoff=2)\n 0.0 + 0.0im\n 1.0 + 0.0im\n 0.0 + 0.0im\n\njulia> express(Create) |> dense\nOperator(dim=3x3)\n basis: Fock(cutoff=2)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 1.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.41421+0.0im 0.0+0.0im\n\njulia> express(Create*f)\nKet(dim=3)\n basis: Fock(cutoff=2)\n 0.0 + 0.0im\n 0.0 + 0.0im\n 1.4142135623730951 + 0.0im\n\njulia> express(Destroy*f)\nKet(dim=3)\n basis: Fock(cutoff=2)\n 1.0 + 0.0im\n 0.0 + 0.0im\n 0.0 + 0.0im","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"warning: Cutoff specifications for numerical representations of quantum harmonic oscillators\nSymbolic bosonic states and operators are naturally represented in an infinite dimension basis. For numerical conversions of such quantum objects, a finite cutoff of the highest allowed state must be defined. By default, the basis dimension of numerical conversions is set to 3 (so the number representation cutoff is 2), as demonstrated above. To define a different cutoff, one must customize the QuantumOpticsRepr instance, e.g. provide QuantumOpticsRepr(cutoff=n::Int) to express.","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"If we wish to specify a different numerical cutoff, say 4, to the previous examples, then we rewrite them as follows:","category":"page"},{"location":"QHO/","page":"Quantum Harmonic Oscillators","title":"Quantum Harmonic Oscillators","text":"julia> f = FockState(1);\n\njulia> express(f, QuantumOpticsRepr(cutoff=4))\nKet(dim=5)\n basis: Fock(cutoff=4)\n 0.0 + 0.0im\n 1.0 + 0.0im\n 0.0 + 0.0im\n 0.0 + 0.0im\n 0.0 + 0.0im\n\njulia> express(Create, QuantumOpticsRepr(4)) |> dense\nOperator(dim=5x5)\n basis: Fock(cutoff=4)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 1.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.41421+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 1.73205+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 2.0+0.0im 0.0+0.0im","category":"page"},{"location":"introduction/#Getting-Started-with-QuantumSymbolics.jl","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"DocTestSetup = quote\n using QuantumSymbolics\nend","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"QuantumSymbolics is designed for manipulation and numerical translation of symbolic quantum objects. This tutorial introduces basic features of the package.","category":"page"},{"location":"introduction/#Installation","page":"Getting Started with QuantumSymbolics.jl","title":"Installation","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"QuantumSymbolics.jl can be installed through the Julia package system in the standard way:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"using Pkg\nPkg.add(\"QuantumSymbolics\")","category":"page"},{"location":"introduction/#Literal-Symbolic-Quantum-Objects","page":"Getting Started with QuantumSymbolics.jl","title":"Literal Symbolic Quantum Objects","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Basic objects of type SBra, SKet, SOperator, and SSuperOperator represent symbolic quantum objects with name and basis properties. Each type can be generated with a straightforward macro:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using QuantumSymbolics\n\njulia> @bra b # object of type SBra\n⟨b|\n\njulia> @ket k # object of type SKet\n|k⟩\n\njulia> @op A # object of type SOperator\nA\n\njulia> @superop S # object of type SSuperOperator\nS","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"By default, each of the above macros defines a symbolic quantum object in the spin-1/2 basis. One can simply choose a different basis, such as the Fock basis or a tensor product of several bases, by passing an object of type Basis to the second argument in the macro call:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op B FockBasis(Inf, 0.0)\nB\n\njulia> basis(B)\nFock(cutoff=Inf)\n\njulia> @op C SpinBasis(1//2)⊗SpinBasis(5//2)\nC\n\njulia> basis(C)\n[Spin(1/2) ⊗ Spin(5/2)]","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Here, we extracted the basis of the defined symbolic operators using the basis function.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Symbolic quantum objects with additional properties can be defined, such as a Hermitian operator, or the zero ket (i.e., a symbolic ket equivalent to the zero vector bm0).","category":"page"},{"location":"introduction/#Basic-Operations","page":"Getting Started with QuantumSymbolics.jl","title":"Basic Operations","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Expressions containing symbolic quantum objects can be built with a variety of functions. Let us consider the most fundamental operations: multiplication *, addition +, and the tensor product ⊗. ","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"We can multiply, for example, a ket by a scalar value, or apply an operator to a ket:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @ket k; @op A;\n\njulia> 2*k\n2|k⟩\n\njulia> A*k\nA|k⟩","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Similar scaling procedures can be performed on bras and operators. Addition between symbolic objects is also available, for instance:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op A₁; @op A₂;\n\njulia> A₁+A₂\n(A₁+A₂)\n\njulia> @bra b;\n\njulia> 2*b + 5*b\n7⟨b|","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Built into the package are straightforward automatic simplification rules, as shown in the last example, where 2⟨b|+5⟨b| evaluates to 7⟨b|. ","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Tensor products of symbolic objects can be performed, with basis information transferred:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @ket k₁; @ket k₂;\n\njulia> tp = k₁⊗k₂\n|k₁⟩|k₂⟩\n\njulia> basis(tp)\n[Spin(1/2) ⊗ Spin(1/2)]","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Inner and outer products of bras and kets can be generated:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @bra b; @ket k;\n\njulia> b*k\n⟨b||k⟩\n\njulia> k*b\n|k⟩⟨b|","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"More involved combinations of operations can be explored. Here are few other straightforward examples:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @bra b; @ket k; @op A; @op B;\n\njulia> 3*A*B*k\n3AB|k⟩\n\njulia> A⊗(k*b + B)\n(A⊗(B+|k⟩⟨b|))\n\njulia> A-A\n𝟎","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"In the last example, a zero operator, denoted 𝟎, was returned by subtracting a symbolic operator from itself. Such an object is of the type SZeroOperator, and similar objects SZeroBra and SZeroKet correspond to zero bras and zero kets, respectively.","category":"page"},{"location":"introduction/#Linear-Algebra-on-Bras,-Kets,-and-Operators","page":"Getting Started with QuantumSymbolics.jl","title":"Linear Algebra on Bras, Kets, and Operators","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"QuantumSymbolics supports a wide variety of linear algebra on symbolic bras, kets, and operators. For instance, the commutator and anticommutator of two operators, can be generated:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op A; @op B;\n\njulia> commutator(A, B)\n[A,B]\n\njulia> anticommutator(A, B)\n{A,B}\n\njulia> commutator(A, A)\n𝟎","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Or, one can take the dagger of a quantum object with the dagger function:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @ket k; @op A; @op B;\n\njulia> dagger(A)\nA†\n\njulia> dagger(A*k)\n|k⟩†A†\n\njulia> dagger(A*B)\nB†A†","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Below, we state all of the supported linear algebra operations on quantum objects:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"commutator of two operators: commutator,\nanticommutator of two operators: anticommutator,\ncomplex conjugate: conj,\ntranspose: transpose,\nprojection of a ket: projector,\nadjoint or dagger: dagger,\ntrace: tr,\npartial trace: ptrace,\ninverse of an operator: inv,\nexponential of an operator: exp,\nvectorization of an operator: vec.","category":"page"},{"location":"introduction/#Predefined-Quantum-Objects","page":"Getting Started with QuantumSymbolics.jl","title":"Predefined Quantum Objects","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"So far in this tutorial, we have considered arbitrary kets, bras, operators, and their corresponding operations. This package supports predefined quantum objects and operations in several formalisms, which are discussed in detail in other sections (see, for example, the quantum harmonic oscillators or qubit basis pages). To get a taste of what's available, let us consider a few symbolic examples. For a complete description, see the full API page.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Quantum gates and their basis states can be represented symbolically:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> CNOT # CNOT Gate\nCNOT\n\njulia> X, Y, Z, I # Pauli operators\n(X, Y, Z, 𝕀)\n\njulia> X1, X2 # Eigenstates of the Pauli X operator\n(|X₁⟩, |X₂⟩)\n\njulia> CPHASE * (Z1 ⊗ Z2) # Application of CPHASE gate on |01⟩\nCPHASE|Z₁⟩|Z₂⟩","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"We also have symbolic representations of bosonic systems:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> FockState(4) # Fock state with 4 excitation quanta\n|4⟩\n\njulia> Create, Destroy # creation and annihilation operators\n(a†, a)\n\njulia> DisplaceOp(im) # Displacement operator for single bosonic mode\nD(im)\n\njulia> N * vac # Application of number operator on vacuum state\nn|0⟩","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"If we want to substitute a predefined quantum object into a general symbolic expression, we can use the substitute command from Symbolics.jl:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using Symbolics\n\njulia> @op A; @ket k;\n\njulia> ex = 2*A + projector(k)\n(2A+𝐏[|k⟩])\n\njulia> substitute(ex, Dict([A => X, k => X1]))\n(2X+𝐏[|X₁⟩])","category":"page"},{"location":"introduction/#Simplifying-Expressions","page":"Getting Started with QuantumSymbolics.jl","title":"Simplifying Expressions","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"For predefined objects such as the Pauli operators X, Y, and Z, additional simplification can be performed with the qsimplify function. Take the following example:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> qsimplify(X*Z)\n(0 - 1im)Y","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Here, we have the relation XZ = -iY, so calling qsimplify on the expression X*Z will rewrite the expression as -im*Y.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Note that simplification rewriters used in QuantumSymbolics are built from the interface of SymbolicUtils.jl. By default, when called on an expression, qsimplify will iterate through every defined simplification rule in the QuantumSymbolics package until the expression can no longer be simplified. ","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Now, suppose we only want to use a specific subset of rules. For instance, say we wish to simplify commutators, but not anticommutators. Then, we can pass the keyword argument rewriter=qsimplify_commutator to qsimplify, as done in the following example:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> qsimplify(commutator(X, Y), rewriter=qsimplify_commutator)\n(0 + 2im)Z\n\njulia> qsimplify(anticommutator(X, Y), rewriter=qsimplify_commutator)\n{X,Y}","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"As shown above, we apply qsimplify to two expressions: commutator(X, Y) and anticommutator(X, Y). We specify that only commutator rules will be applied, thus the first expression is rewritten to (0 + 2im)Z while the second expression is simply returned. This feature can greatly reduce the time it takes for an expression to be simplified.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Below, we state all of the simplification rule subsets that can be passed to qsimplify:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"qsimplify_pauli for Pauli multiplication,\nqsimplify_commutator for commutators of Pauli operators,\nqsimplify_anticommutator for anticommutators of Pauli operators.","category":"page"},{"location":"introduction/#Expanding-Expressions","page":"Getting Started with QuantumSymbolics.jl","title":"Expanding Expressions","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Symbolic expressions containing quantum objects can be expanded with the qexpand function. We demonstrate this capability with the following examples.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> @op A; @op B; @op C;\n\njulia> qexpand(A⊗(B+C))\n((A⊗B)+(A⊗C))\n\njulia> qexpand((B+C)*A)\n(BA+CA)\n\njulia> @ket k₁; @ket k₂; @ket k₃;\n\njulia> qexpand(k₁⊗(k₂+k₃))\n(|k₁⟩|k₂⟩+|k₁⟩|k₃⟩)\n\njulia> qexpand((A*B)*(k₁+k₂))\n(AB|k₁⟩+AB|k₂⟩)","category":"page"},{"location":"introduction/#Numerical-Translation-of-Symbolic-Objects","page":"Getting Started with QuantumSymbolics.jl","title":"Numerical Translation of Symbolic Objects","text":"","category":"section"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"Symbolic expressions containing predefined objects can be converted to numerical representations with express. Numerics packages supported by this translation capability are QuantumOptics.jl and QuantumClifford.jl.","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"By default, express converts an object to the quantum optics state vector representation. For instance, we can represent the exponential of the Pauli operator X numerically as follows:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using QuantumOptics\n\njulia> express(exp(X))\nOperator(dim=2x2)\n basis: Spin(1/2)sparse([1, 2, 1, 2], [1, 1, 2, 2], ComplexF64[1.5430806327160496 + 0.0im, 1.1752011684303352 + 0.0im, 1.1752011684303352 + 0.0im, 1.5430806327160496 + 0.0im], 2, 2)","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"To convert to the Clifford representation, an instance of CliffordRepr must be passed to express. For instance, we can represent the projection of the basis state X1 of the Pauli operator X as follows:","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"julia> using QuantumClifford\n\njulia> express(projector(X1), CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ X","category":"page"},{"location":"introduction/","page":"Getting Started with QuantumSymbolics.jl","title":"Getting Started with QuantumSymbolics.jl","text":"For more details on using express, refer to the express functionality page.","category":"page"},{"location":"express/#Express-functionality","page":"Express Functionality","title":"Express functionality","text":"","category":"section"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"DocTestSetup = quote\n using QuantumSymbolics, QuantumOptics, QuantumClifford\nend","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"A principle feature of QuantumSymbolics is to numerically represent symbolic quantum expressions in various formalisms using express. In particular, one can translate symbolic logic to back-end toolboxes such as QuantumOptics.jl or QuantumClifford.jl for simulating quantum systems with great flexibiity.","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"As a straightforward example, consider the spin-up state uparrowrangle = 0rangle, the eigenstate of the Pauli operator Z, which can be expressed in QuantumSymbolics as follows:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"using QuantumSymbolics, QuantumClifford, QuantumOptics # hide\nψ = Z1","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"Using express, we can translate this symbolic object into its numerical state vector form in QuantumOptics.jl.","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"express(ψ)","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"By default, express converts a quantum object with QuantumOpticRepr. It should be noted that express automatically caches this particular conversion of ψ. Thus, after running the above example, the numerical representation of the spin-up state is stored in the metadata of ψ.","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"ψ.metadata","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"The caching feature of express prevents a specific representation for a symbolic quantum object from being computed more than once. This becomes handy for translations of more complex operations, which can become computationally expensive. We also have the ability to express Z_1rangle in the Clifford formalism with QuantumClifford.jl:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"express(ψ, CliffordRepr())","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"Here, we specified an instance of CliffordRepr in the second argument to convert ψ into a tableau of Pauli operators containing its stabilizer and destabilizer states. Now, both the state vector and Clifford representation of ψ have been cached:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"ψ.metadata","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"More involved examples can be explored. For instance, say we want to apply the tensor product Xotimes Y of the Pauli operators X and Y to the Bell state Phi^+rangle = dfrac1sqrt2left(00rangle + 11rangleright), and numerically express the result in the quantum optics formalism. This would be done as follows:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"using QuantumSymbolics, QuantumClifford, QuantumOptics # hide\nbellstate = (Z1⊗Z1+Z2⊗Z2)/√2\ntp = σˣ⊗σʸ\nexpress(tp*bellstate)","category":"page"},{"location":"express/#Examples-of-Edge-Cases","page":"Express Functionality","title":"Examples of Edge Cases","text":"","category":"section"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"For Pauli operators, additional flexibility is given for translations to the Clifford formalism. Users have the option to convert a multi-qubit Pauli operator to an observable or operation with instances of UseAsObservable and UseAsOperation, respectively. Take the Pauli operator Y, for example, which in QuantumSymbolics is the constants Y or σʸ:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"julia> express(σʸ, CliffordRepr(), UseAsObservable())\n+ Y\n\njulia> express(σʸ, CliffordRepr(), UseAsOperation())\nsY","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"Another edge case is translations with QuantumOpticsRepr, where we can additionally define a finite cutoff for bosonic states and operators, as discussed in the quantum harmonic oscillators page. The default cutoff for such objects is 2, however a different cutoff can be specified by passing an integer to QuantumOpticsRepr in an express call. Let us see an example with the number operator:","category":"page"},{"location":"express/","page":"Express Functionality","title":"Express Functionality","text":"julia> express(N) |> dense\nOperator(dim=3x3)\n basis: Fock(cutoff=2)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 2.0+0.0im\n\njulia> express(N, QuantumOpticsRepr(cutoff=4)) |> dense\nOperator(dim=5x5)\n basis: Fock(cutoff=4)\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 1.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 2.0+0.0im 0.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 3.0+0.0im 0.0+0.0im\n 0.0+0.0im 0.0+0.0im 0.0+0.0im 0.0+0.0im 4.0+0.0im","category":"page"},{"location":"qubit_basis/#Typical-Qubit-Bases","page":"Qubit Basis Choice","title":"Typical Qubit Bases","text":"","category":"section"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"DocTestSetup = quote\n using QuantumSymbolics, QuantumOptics\nend","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"Here are some common conventions for representing a qubit in a physical system. This reference is provided as the conventions matter to the correct choice of noise processes and bases in which they are represented.","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"In monospaced code format we give the symbols by which these objects are callable in QuantumSymbolics. We provide unicode and ASCII names for convenience of typing.","category":"page"},{"location":"qubit_basis/#Spin-\\frac{1}{2}-qubits","page":"Qubit Basis Choice","title":"Spin frac12 qubits","text":"","category":"section"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"First we introduce the Pauli matrices:","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"julia> express(σᶻ) |> dense # or `Z`\nOperator(dim=2x2)\n basis: Spin(1/2)\n 1.0+0.0im 0.0+0.0im\n 0.0+0.0im -1.0+0.0im\n\njulia> express(σˣ) |> dense # or `X`\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.0+0.0im 1.0+0.0im\n 1.0+0.0im 0.0+0.0im\n\njulia> express(σʸ) |> dense # or `Y`\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.0+0.0im -0.0-1.0im\n 0.0+1.0im 0.0+0.0im","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"Above dense is from QuantumOptics, used to convert their representation to a dense matrix.","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"The eigenvectors of each one of them provides for a convenient basis. The σᶻ basis is also called the computational basis. As mentioned, we have both unicode and ASCII names for convenience of typing. For these basis vectors we also have two sets of names: one based on which operator they are eigenvectors of and one in terms of typical logical representation (with prefix L).","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"Z1 = Z₁ = L0 = L₀ = 0rangle = beginpmatrix10endpmatrix = uparrowrangle with eigenvalue +1 for σᶻ\nZ2 = Z₂ = L1 = L₁ = 1rangle = beginpmatrix01endpmatrix = downarrowrangle with eigenvalue +1 for σᶻ\nX1 = X₁ = Lp = L₊ = +rangle = frac1sqrt 2beginpmatrix11endpmatrix with eigenvalue +1 for σˣ\nX2 = X₂ = Lm = L₋ = -rangle = frac1sqrt 2beginpmatrix1-1endpmatrix with eigenvalue -1 for σˣ\nY1 = Y₁ = Lpi = L₊ᵢ = +irangle = frac1sqrt 2beginpmatrix1 iendpmatrix with eigenvalue +1 for σʸ\nY2 = Y₂ = Lmi = L₋ᵢ = -irangle = frac1sqrt 2beginpmatrix1-iendpmatrix with eigenvalue -1 for σʸ","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"The Y vectors occasionally are denoted with R and L (stemming from the vector notation for right and left polarized light), but there is no established notation choice or ordering.","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"warning: Talking about ground/excited and spin-up/spin-down states can lead to confusion\nWe specifically avoid using notation with \"ground\" and \"excited\" states. For physicist usually the excited state is the \"up\" states (erangle=uparrowrangle), but that historical choice clashes with the logical state notation as we have the logical zero be the \"excited\" state. This clash becomes particularly confusing when noise processes and relaxation process are taken into account. E.g. one might think the operator usually denoted hatsigma_- would be the one corresponding to decay but we actually have hatsigma_-0rangle=1rangle. To avoid this confusion we strive to not use the notation uparrowrangle, downarrowrangle, erangle, and grangle. Similarly we strongly prefer to never use hatsigma_- and hatsigma_+, rather only use 1rangle langle0 and its conjugate. If we were instead talking about single-rail photonic qubits, we do not have the same issue (because the diagonal of the number operator is growing, instead of decreasing like the diagonal of the Pauli Z).","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"The basis states can be easily expressed both as kets and as tableaux (In the tableau representation below the top half corresponds to the destabilizer, while the bottom is the stabilizer):","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"julia> express(L0, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n+ Z\n\n\njulia> express(L1, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n- Z\n\n\njulia> express(L₀, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n+ Z\n\n\njulia> express(L₁, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ X\n𝒮𝓉𝒶𝒷\n- Z\n\n\njulia> express(L₊, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ X\n\n\njulia> express(L₋, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n- X\n\n\njulia> express(L₊ᵢ, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ Y\n\n\njulia> express(L₋ᵢ, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n- Y","category":"page"},{"location":"qubit_basis/","page":"Qubit Basis Choice","title":"Qubit Basis Choice","text":"julia> express(L₀)\nKet(dim=2)\n basis: Spin(1/2)\n 1.0 + 0.0im\n 0.0 + 0.0im\n\njulia> express(L₁)\nKet(dim=2)\n basis: Spin(1/2)\n 0.0 + 0.0im\n 1.0 + 0.0im\n\njulia> express(L₊)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.7071067811865475 + 0.0im\n\njulia> express(L₋)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n -0.7071067811865475 + 0.0im\n\njulia> express(L₊ᵢ)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.0 + 0.7071067811865475im\n\njulia> express(L₋ᵢ)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.0 - 0.7071067811865475im","category":"page"},{"location":"bibliography/#Bibliography","page":"Bibliography","title":"Bibliography","text":"","category":"section"},{"location":"bibliography/","page":"Bibliography","title":"Bibliography","text":"","category":"page"},{"location":"#QuantumSymbolics.jl","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"section"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"DocTestSetup = quote\n using QuantumSymbolics\nend","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"A symbolics package for quantum information science. It serves two purposes:","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"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.\nAn assortment of \"expression translators\" are provided that can turn a symbolic expression into a numerical one in a variety of formalisms.","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Below we list some commonly used expressions, followed by an autogenerated API list.","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"using QuantumSymbolics","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n\n\n\n\n","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"\n
Symbolic ExampleConversion Example
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Qubit Basis States X1, X2, Y1, Y2, Z1, Z2","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Z1","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(Z1)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(Y2, CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Common gates: CNOT, H, etc","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"CNOT","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(H)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(CNOT, CliffordRepr(), UseAsOperation())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Tensor products ⊗ and sums +","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"(X1⊗Z2 + Y1⊗Y2 ) / √3","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(X1⊗Z1)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(X1⊗Y2, CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Projectors, pure density matrices","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"SProjector(X1⊗Z2)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(SProjector(X1⊗Z1))","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(SProjector(X1⊗Z1), CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Completely depolarized (mixed) state","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"MixedState(X1)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(MixedState(X1))","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(MixedState(X1), CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"Impure states, represented as sum of density matrices","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"(MixedState(X1)+SProjector(Z1)) / 2","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express((MixedState(X1)+SProjector(Z1)) / 2)","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"When a Clifford representation is used, an efficient sampler is generated, and stabilizer states are randomly sampled from the correct distribution:","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"express(MixedState(X1)/2+SProjector(Z1)/2, CliffordRepr())","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"
","category":"page"},{"location":"","page":"QuantumSymbolics.jl","title":"QuantumSymbolics.jl","text":"warning: Stabilizer state expressions\nThe state written as fracZ₁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.","category":"page"},{"location":"API/#Full-API","page":"API","title":"Full API","text":"","category":"section"},{"location":"API/","page":"API","title":"API","text":"","category":"page"},{"location":"API/#Autogenerated-API-list","page":"API","title":"Autogenerated API list","text":"","category":"section"},{"location":"API/","page":"API","title":"API","text":"Modules = [QuantumSymbolics, QuantumInterface]\nPrivate = false","category":"page"},{"location":"API/#QuantumSymbolics.CNOT","page":"API","title":"QuantumSymbolics.CNOT","text":"CNOT gate\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.CPHASE","page":"API","title":"QuantumSymbolics.CPHASE","text":"CPHASE gate\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Create","page":"API","title":"QuantumSymbolics.Create","text":"Creation operator, also available as the constant âꜛ, in an infinite dimension Fock basis. There is no unicode dagger superscript, so we use the uparrow\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Destroy","page":"API","title":"QuantumSymbolics.Destroy","text":"Annihilation operator, also available as the constant â, in an infinite dimension Fock basis.\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.F₁","page":"API","title":"QuantumSymbolics.F₁","text":"Single photon basis state of n\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.H","page":"API","title":"QuantumSymbolics.H","text":"Hadamard gate\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.I","page":"API","title":"QuantumSymbolics.I","text":"Identity operator in qubit basis\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.N","page":"API","title":"QuantumSymbolics.N","text":"Number operator, also available as the constant n̂, in an infinite dimension Fock basis.\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Pm","page":"API","title":"QuantumSymbolics.Pm","text":"Pauli \"minus\" operator, also available as the constant σ₋\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Pp","page":"API","title":"QuantumSymbolics.Pp","text":"Pauli \"plus\" operator, also available as the constant σ₊\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.X","page":"API","title":"QuantumSymbolics.X","text":"Pauli X operator, also available as the constant σˣ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.X1","page":"API","title":"QuantumSymbolics.X1","text":"Basis state of σˣ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.X2","page":"API","title":"QuantumSymbolics.X2","text":"Basis state of σˣ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Y","page":"API","title":"QuantumSymbolics.Y","text":"Pauli Y operator, also available as the constant σʸ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Y1","page":"API","title":"QuantumSymbolics.Y1","text":"Basis state of σʸ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Y2","page":"API","title":"QuantumSymbolics.Y2","text":"Basis state of σʸ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Z","page":"API","title":"QuantumSymbolics.Z","text":"Pauli Z operator, also available as the constant σᶻ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Z1","page":"API","title":"QuantumSymbolics.Z1","text":"Basis state of σᶻ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.Z2","page":"API","title":"QuantumSymbolics.Z2","text":"Basis state of σᶻ\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.vac","page":"API","title":"QuantumSymbolics.vac","text":"Vacuum basis state of n\n\n\n\n\n\n","category":"constant"},{"location":"API/#QuantumSymbolics.AbstractRepresentation","page":"API","title":"QuantumSymbolics.AbstractRepresentation","text":"An abstract type for the supported representation of quantum objects.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.CliffordRepr","page":"API","title":"QuantumSymbolics.CliffordRepr","text":"Representation using tableaux governed by QuantumClifford.jl\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.CoherentState","page":"API","title":"QuantumSymbolics.CoherentState","text":"Coherent state in defined Fock basis.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.CreateOp","page":"API","title":"QuantumSymbolics.CreateOp","text":"Creation (raising) operator.\n\njulia> f = FockState(2)\n|2⟩\n\njulia> create = CreateOp()\na†\n\njulia> qsimplify(create*f, rewriter=qsimplify_fock)\n(sqrt(3))|3⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.DephasingCPTP","page":"API","title":"QuantumSymbolics.DephasingCPTP","text":"Single-qubit dephasing CPTP map\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.DestroyOp","page":"API","title":"QuantumSymbolics.DestroyOp","text":"Annihilation (lowering or destroy) operator in defined Fock basis.\n\njulia> f = FockState(2)\n|2⟩\n\njulia> destroy = DestroyOp()\na\n\njulia> qsimplify(destroy*f, rewriter=qsimplify_fock)\n(sqrt(2))|1⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.DisplaceOp","page":"API","title":"QuantumSymbolics.DisplaceOp","text":"Displacement operator in defined Fock basis.\n\njulia> f = FockState(0)\n|0⟩\n\njulia> displace = DisplaceOp(im)\nD(im)\n\njulia> qsimplify(displace*f, rewriter=qsimplify_fock)\n|im⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.FockState","page":"API","title":"QuantumSymbolics.FockState","text":"Fock state in defined Fock basis.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.GateCPTP","page":"API","title":"QuantumSymbolics.GateCPTP","text":"A unitary gate followed by a CPTP map\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.IdentityOp","page":"API","title":"QuantumSymbolics.IdentityOp","text":"The identity operator for a given basis\n\njulia> IdentityOp(X1⊗X2)\n𝕀\n\njulia> express(IdentityOp(Z2))\nOperator(dim=2x2)\n basis: Spin(1/2)sparse([1, 2], [1, 2], ComplexF64[1.0 + 0.0im, 1.0 + 0.0im], 2, 2)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.KrausRepr","page":"API","title":"QuantumSymbolics.KrausRepr","text":"Kraus representation of a quantum channel\n\njulia> @op A₁; @op A₂; @op A₃;\n\njulia> K = kraus(A₁, A₂, A₃)\n𝒦(A₁,A₂,A₃)\n\njulia> @op ρ;\n\njulia> K*ρ\n(A₁ρA₁†+A₂ρA₂†+A₃ρA₃†)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.MixedState","page":"API","title":"QuantumSymbolics.MixedState","text":"Completely depolarized state\n\njulia> MixedState(X1⊗X2)\n𝕄\n\njulia> express(MixedState(X1⊗X2))\nOperator(dim=4x4)\n basis: [Spin(1/2) ⊗ Spin(1/2)]sparse([1, 2, 3, 4], [1, 2, 3, 4], ComplexF64[0.25 + 0.0im, 0.25 + 0.0im, 0.25 + 0.0im, 0.25 + 0.0im], 4, 4)\n\njulia> express(MixedState(X1⊗X2), CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n\n𝒳ₗ━━\n+ X_\n+ _X\n𝒮𝓉𝒶𝒷\n\n𝒵ₗ━━\n+ Z_\n+ _Z\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.NumberOp","page":"API","title":"QuantumSymbolics.NumberOp","text":"Number operator.\n\njulia> f = FockState(2)\n|2⟩\n\njulia> num = NumberOp()\nn\n\njulia> qsimplify(num*f, rewriter=qsimplify_fock)\n2|2⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.PauliNoiseCPTP","page":"API","title":"QuantumSymbolics.PauliNoiseCPTP","text":"Single-qubit Pauli noise CPTP map\n\njulia> apply!(express(Z1), [1], express(PauliNoiseCPTP(1/4,1/4,1/4)))\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.5+0.0im 0.0+0.0im\n 0.0+0.0im 0.5+0.0im\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.PhaseShiftOp","page":"API","title":"QuantumSymbolics.PhaseShiftOp","text":"Phase-shift operator in defined Fock basis.\n\njulia> c = CoherentState(im)\n|im⟩\n\njulia> phase = PhaseShiftOp(pi)\nU(π)\n\njulia> qsimplify(phase*c, rewriter=qsimplify_fock)\n|1.2246467991473532e-16 - 1.0im⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.QuantumMCRepr","page":"API","title":"QuantumSymbolics.QuantumMCRepr","text":"Similar to QuantumOpticsRepr, but using trajectories instead of superoperators.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.QuantumOpticsRepr","page":"API","title":"QuantumSymbolics.QuantumOpticsRepr","text":"Representation using kets, bras, density matrices, and superoperators governed by QuantumOptics.jl.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SAdd","page":"API","title":"QuantumSymbolics.SAdd","text":"Addition of quantum objects (kets, operators, or bras).\n\njulia> @ket k₁; @ket k₂;\n\njulia> k₁ + k₂\n(|k₁⟩+|k₂⟩)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SAnticommutator","page":"API","title":"QuantumSymbolics.SAnticommutator","text":"Symbolic anticommutator of two operators.\n\njulia> @op A; @op B;\n\njulia> anticommutator(A, B)\n{A,B}\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SApplyBra","page":"API","title":"QuantumSymbolics.SApplyBra","text":"Symbolic application of an operator on a bra (from the right).\n\njulia> @bra b; @op A;\n\njulia> b*A\n⟨b|A\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SApplyKet","page":"API","title":"QuantumSymbolics.SApplyKet","text":"Symbolic application of an operator on a ket (from the left).\n\njulia> @ket k; @op A;\n\njulia> A*k\nA|k⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SBra","page":"API","title":"QuantumSymbolics.SBra","text":"Symbolic bra\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SBraKet","page":"API","title":"QuantumSymbolics.SBraKet","text":"Symbolic inner product of a bra and a ket.\n\njulia> @bra b; @ket k;\n\njulia> b*k\n⟨b||k⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SCommutator","page":"API","title":"QuantumSymbolics.SCommutator","text":"Symbolic commutator of two operators.\n\njulia> @op A; @op B;\n\njulia> commutator(A, B)\n[A,B]\n\njulia> commutator(A, A)\n𝟎\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SConjugate","page":"API","title":"QuantumSymbolics.SConjugate","text":"Complex conjugate of quantum objects (kets, bras, operators).\n\njulia> @op A; @ket k;\n\njulia> conj(A)\nAˣ\n\njulia> conj(k)\n|k⟩ˣ\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SDagger","page":"API","title":"QuantumSymbolics.SDagger","text":"Dagger, i.e., adjoint of quantum objects (kets, bras, operators).\n\njulia> @ket a; @op A;\n\njulia> dagger(2*im*A*a)\n(0 - 2im)|a⟩†A†\n\njulia> @op B;\n\njulia> dagger(A*B)\nB†A†\n\njulia> ℋ = SHermitianOperator(:ℋ); U = SUnitaryOperator(:U);\n\njulia> dagger(ℋ)\nℋ\n\njulia> dagger(U)\nU⁻¹\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SExpOperator","page":"API","title":"QuantumSymbolics.SExpOperator","text":"Exponential of a symbolic operator.\n\njulia> @op A; @op B;\n\njulia> exp(A)\nexp(A)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SHermitianOperator","page":"API","title":"QuantumSymbolics.SHermitianOperator","text":"Symbolic Hermitian operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SHermitianUnitaryOperator","page":"API","title":"QuantumSymbolics.SHermitianUnitaryOperator","text":"Symbolic Hermitian and unitary operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SInvOperator","page":"API","title":"QuantumSymbolics.SInvOperator","text":"Inverse of an operator.\n\njulia> @op A;\n\njulia> inv(A)\nA⁻¹\n\njulia> inv(A)*A\n𝕀\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SKet","page":"API","title":"QuantumSymbolics.SKet","text":"Symbolic ket\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SMulOperator","page":"API","title":"QuantumSymbolics.SMulOperator","text":"Symbolic application of operator on operator.\n\njulia> @op A; @op B;\n\njulia> A*B\nAB\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SOperator","page":"API","title":"QuantumSymbolics.SOperator","text":"Symbolic operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SOuterKetBra","page":"API","title":"QuantumSymbolics.SOuterKetBra","text":"Symbolic outer product of a ket and a bra.\n\njulia> @bra b; @ket k;\n\njulia> k*b \n|k⟩⟨b|\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SPartialTrace","page":"API","title":"QuantumSymbolics.SPartialTrace","text":"Partial trace over system i of a composite quantum system\n\njulia> @op 𝒪 SpinBasis(1//2)⊗SpinBasis(1//2);\n\njulia> op = ptrace(𝒪, 1)\ntr1(𝒪)\n\njulia> QuantumSymbolics.basis(op)\nSpin(1/2)\n\njulia> @op A; @op B;\n\njulia> ptrace(A⊗B, 1)\n(tr(A))B\n\njulia> @ket k; @bra b;\n\njulia> factorizable = A ⊗ (k*b)\n(A⊗|k⟩⟨b|)\n\njulia> ptrace(factorizable, 1)\n(tr(A))|k⟩⟨b|\n\njulia> ptrace(factorizable, 2)\n(⟨b||k⟩)A\n\njulia> mixed_state = (A⊗(k*b)) + ((k*b)⊗B)\n((A⊗|k⟩⟨b|)+(|k⟩⟨b|⊗B))\n\njulia> ptrace(mixed_state, 1)\n((0 + ⟨b||k⟩)B+(tr(A))|k⟩⟨b|)\n\njulia> ptrace(mixed_state, 2)\n((0 + ⟨b||k⟩)A+(tr(B))|k⟩⟨b|)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SProjector","page":"API","title":"QuantumSymbolics.SProjector","text":"Projector for a given ket.\n\njulia> projector(X1⊗X2)\n𝐏[|X₁⟩|X₂⟩]\n\njulia> express(projector(X2))\nOperator(dim=2x2)\n basis: Spin(1/2)\n 0.5+0.0im -0.5-0.0im\n -0.5+0.0im 0.5+0.0im\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SScaled","page":"API","title":"QuantumSymbolics.SScaled","text":"Scaling of a quantum object (ket, operator, or bra) by a number.\n\njulia> @ket k\n|k⟩\n\njulia> 2*k\n2|k⟩\n\njulia> @op A\nA\n\njulia> 2*A\n2A\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SSuperOpApply","page":"API","title":"QuantumSymbolics.SSuperOpApply","text":"Symbolic application of a superoperator on an operator\n\njulia> @op A; @superop S;\n\njulia> S*A\nS[A]\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SSuperOperator","page":"API","title":"QuantumSymbolics.SSuperOperator","text":"Symbolic superoperator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.STrace","page":"API","title":"QuantumSymbolics.STrace","text":"Trace of an operator\n\njulia> @op A; @op B;\n\njulia> tr(A)\ntr(A)\n\njulia> tr(commutator(A, B))\n0\n\njulia> @bra b; @ket k;\n\njulia> tr(k*b)\n⟨b||k⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.STranspose","page":"API","title":"QuantumSymbolics.STranspose","text":"Transpose of quantum objects (kets, bras, operators).\n\njulia> @op A; @op B; @ket k;\n\njulia> transpose(A)\nAᵀ\n\njulia> transpose(A+B)\n(Aᵀ+Bᵀ)\n\njulia> transpose(k)\n|k⟩ᵀ\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SUnitaryOperator","page":"API","title":"QuantumSymbolics.SUnitaryOperator","text":"Symbolic unitary operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SVec","page":"API","title":"QuantumSymbolics.SVec","text":"Vectorization of a symbolic operator.\n\njulia> @op A; @op B;\n\njulia> vec(A)\n|A⟩⟩\n\njulia> vec(A+B)\n(|A⟩⟩+|B⟩⟩)\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SZeroBra","page":"API","title":"QuantumSymbolics.SZeroBra","text":"Symbolic zero bra\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SZeroKet","page":"API","title":"QuantumSymbolics.SZeroKet","text":"Symbolic zero ket\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SZeroOperator","page":"API","title":"QuantumSymbolics.SZeroOperator","text":"Symbolic zero operator\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SqueezeOp","page":"API","title":"QuantumSymbolics.SqueezeOp","text":"Squeezing operator in defined Fock basis.\n\njulia> S = SqueezeOp(pi)\nS(π)\n\njulia> qsimplify(S*vac, rewriter=qsimplify_fock)\n|0,π⟩\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.SqueezedState","page":"API","title":"QuantumSymbolics.SqueezedState","text":"Squeezed vacuum state in defined Fock basis.\n\n\n\n\n\n","category":"type"},{"location":"API/#QuantumSymbolics.StabilizerState","page":"API","title":"QuantumSymbolics.StabilizerState","text":"State defined by a stabilizer tableau\n\nFor full functionality you also need to import the QuantumClifford library.\n\njulia> using QuantumClifford, QuantumOptics # needed for the internal representation of the stabilizer tableaux and the conversion to a ket\n\njulia> StabilizerState(S\"XX ZZ\")\n𝒮₂\n\njulia> express(StabilizerState(S\"-X\"))\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n -0.7071067811865475 + 0.0im\n\n\n\n\n\n","category":"type"},{"location":"API/#Base.conj-Union{Tuple{SymbolicUtils.Symbolic{T}}, Tuple{T}} where T<:Union{QuantumInterface.AbstractBra, QuantumInterface.AbstractKet, QuantumInterface.AbstractOperator, QuantumInterface.AbstractSuperOperator}","page":"API","title":"Base.conj","text":"conj(x::Symbolic{AbstractKet})\nconj(x::Symbolic{AbstractBra})\nconj(x::Symbolic{AbstractOperator})\nconj(x::Symbolic{AbstractSuperOperator})\n\nSymbolic transpose operation. See also SConjugate.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.exp-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"Base.exp","text":"exp(x::Symbolic{AbstractOperator})\n\nSymbolic inverse of an operator. See also SExpOperator.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.inv-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"Base.inv","text":"inv(x::Symbolic{AbstractOperator})\n\nSymbolic inverse of an operator. See also SInvOperator.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.transpose-Union{Tuple{SymbolicUtils.Symbolic{T}}, Tuple{T}} where T<:Union{QuantumInterface.AbstractBra, QuantumInterface.AbstractKet, QuantumInterface.AbstractOperator}","page":"API","title":"Base.transpose","text":"transpose(x::Symbolic{AbstractKet})\ntranspose(x::Symbolic{AbstractBra})\ntranspose(x::Symbolic{AbstractOperator})\n\nSymbolic transpose operation. See also STranspose.\n\n\n\n\n\n","category":"method"},{"location":"API/#Base.vec-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"Base.vec","text":"vec(x::Symbolic{AbstractOperator})\n\nSymbolic vector representation of an operator. See also SVec.\n\n\n\n\n\n","category":"method"},{"location":"API/#LinearAlgebra.tr-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"LinearAlgebra.tr","text":"tr(x::Symbolic{AbstractOperator})\n\nSymbolic trace operation. See also STrace.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.dagger-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractBra}}","page":"API","title":"QuantumInterface.dagger","text":"dagger(x::Symbolic{AbstractBra})\n\nSymbolic transpose operation. See also SDagger.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.dagger-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractKet}}","page":"API","title":"QuantumInterface.dagger","text":"dagger(x::Symbolic{AbstractKet})\n\nSymbolic transpose operation. See also SDagger.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.dagger-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}}","page":"API","title":"QuantumInterface.dagger","text":"dagger(x::Symbolic{AbstractOperator})\n\nSymbolic transpose operation. See also SDagger.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.projector-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractKet}}","page":"API","title":"QuantumInterface.projector","text":"projector(x::Symbolic{AbstractKet})\n\nSymbolic projection operation. See also SProjector.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumInterface.ptrace-Tuple{SymbolicUtils.Symbolic{QuantumInterface.AbstractOperator}, Any}","page":"API","title":"QuantumInterface.ptrace","text":"ptrace(x::Symbolic{AbstractOperator})\n\nSymbolic partial trace operation. See also SPartialTrace.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.anticommutator","page":"API","title":"QuantumSymbolics.anticommutator","text":"The anticommutator of two operators.\n\n\n\n\n\n","category":"function"},{"location":"API/#QuantumSymbolics.commutator","page":"API","title":"QuantumSymbolics.commutator","text":"The commutator of two operators.\n\n\n\n\n\n","category":"function"},{"location":"API/#QuantumSymbolics.consistent_representation-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.consistent_representation","text":"Pick a representation that is consistent with given representations and appropriate for the given state.\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.express","page":"API","title":"QuantumSymbolics.express","text":"express(s, repr::AbstractRepresentation=QuantumOpticsRepr()[, use::AbstractUse])\n\nThe main interface for expressing quantum objects in various representations.\n\njulia> express(X1)\nKet(dim=2)\n basis: Spin(1/2)\n 0.7071067811865475 + 0.0im\n 0.7071067811865475 + 0.0im\n\njulia> express(X1, CliffordRepr())\n𝒟ℯ𝓈𝓉𝒶𝒷\n+ Z\n𝒮𝓉𝒶𝒷\n+ X\n\njulia> express(QuantumSymbolics.X)\nOperator(dim=2x2)\n basis: Spin(1/2)sparse([2, 1], [1, 2], ComplexF64[1.0 + 0.0im, 1.0 + 0.0im], 2, 2)\n\njulia> express(QuantumSymbolics.X, CliffordRepr(), UseAsOperation())\nsX\n\njulia> express(QuantumSymbolics.X, CliffordRepr(), UseAsObservable())\n+ X\n\n\n\n\n\n","category":"function"},{"location":"API/#QuantumSymbolics.qexpand-Tuple{Any}","page":"API","title":"QuantumSymbolics.qexpand","text":"qexpand(s)\n\nManually expand a symbolic expression of quantum objects. \n\njulia> @op A; @op B; @op C;\n\njulia> qexpand(commutator(A, B))\n(-1BA+AB)\n\njulia> qexpand(A⊗(B+C))\n((A⊗B)+(A⊗C))\n\njulia> @ket k₁; @ket k₂;\n\njulia> qexpand(A*(k₁+k₂))\n(A|k₁⟩+A|k₂⟩)\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.qsimplify-Tuple{Any}","page":"API","title":"QuantumSymbolics.qsimplify","text":"qsimplify(s; rewriter=nothing)\n\nManually simplify a symbolic expression of quantum objects. \n\nIf the keyword rewriter is not specified, then qsimplify will apply every defined rule to the expression. For performance or single-purpose motivations, the user has the option to define a specific rewriter for qsimplify to apply to the expression. The defined rewriters for simplification are the following objects: - qsimplify_pauli - qsimplify_commutator - qsimplify_anticommutator\n\njulia> qsimplify(σʸ*commutator(σˣ*σᶻ, σᶻ))\n(0 - 2im)Z\n\njulia> qsimplify(anticommutator(σˣ, σˣ), rewriter=qsimplify_anticommutator)\n2𝕀\n\n\n\n\n\n","category":"method"},{"location":"API/#QuantumSymbolics.@bra-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.@bra","text":"@bra(name, basis=SpinBasis(1//2))\n\nDefine a symbolic bra of type SBra. By default, the defined basis is the spin-1/2 basis.\n\njulia> @bra b₁\n⟨b₁|\n\njulia> @bra b₂ FockBasis(2)\n⟨b₂|\n\n\n\n\n\n","category":"macro"},{"location":"API/#QuantumSymbolics.@ket-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.@ket","text":"@ket(name, basis=SpinBasis(1//2))\n\nDefine a symbolic ket of type SKet. By default, the defined basis is the spin-1/2 basis.\n\njulia> @ket k₁\n|k₁⟩\n\njulia> @ket k₂ FockBasis(2)\n|k₂⟩\n\n\n\n\n\n","category":"macro"},{"location":"API/#QuantumSymbolics.@op-Tuple{Any, Any}","page":"API","title":"QuantumSymbolics.@op","text":"@op(name, basis=SpinBasis(1//2))\n\nDefine a symbolic ket of type SOperator. By default, the defined basis is the spin-1/2 basis.\n\njulia> @op A\nA\n\njulia> @op B FockBasis(2)\nB\n\n\n\n\n\n","category":"macro"}] }