diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 6275a96..021dbbe 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-22T17:40:10","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-01T04:16:11","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/API/index.html b/dev/API/index.html index 9d3ab72..b44c279 100644 --- a/dev/API/index.html +++ b/dev/API/index.html @@ -4,12 +4,12 @@ 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 âꜛ - there is no unicode dagger superscript, so we use the uparrow

source
QuantumSymbolics.DestroyConstant

Annihilation operator, also available as the constant

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

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

Single-qubit dephasing CPTP map

source
QuantumSymbolics.GateCPTPType

A unitary gate followed by a CPTP map

source
QuantumSymbolics.IdentityOpType

The identity operator for a given basis

julia> IdentityOp(X1⊗X2)
+

Autogenerated API list

QuantumSymbolics.CreateConstant

Creation operator, also available as the constant âꜛ - there is no unicode dagger superscript, so we use the uparrow

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₃)
@@ -17,7 +17,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))
@@ -34,29 +34,29 @@
 
 𝒵ₗ━━
 + Z_
-+ _Z
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.SAddType

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

julia> @ket k₁; @ket k₂;
+ 0.0+0.0im  0.5+0.0im
source
QuantumSymbolics.SAddType

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

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

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

julia> @ket k
 |k⟩
 
 julia> 2*k
@@ -66,10 +66,10 @@
 A 
 
 julia> 2*A
-2A
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
+S[A]
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")
 𝒮₂
@@ -78,22 +78,22 @@
 Ket(dim=2)
   basis: Spin(1/2)
   0.7071067811865475 + 0.0im
- -0.7071067811865475 + 0.0im
source
Base.conjMethod

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

julia> @op A; @ket k;
+ -0.7071067811865475 + 0.0im
source
Base.conjMethod

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

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

Exponential of a symbolic operator.

julia> @op A; @op B;
+|k⟩ˣ
source
Base.expMethod

Exponential of a symbolic operator.

julia> @op A; @op B;
 
 julia> exp(A)
-exp(A)
source
Base.invMethod

Inverse of an operator.

julia> @op A;
 
 julia> inv(A)
 A⁻¹
 
 julia> inv(A)*A
-𝕀
source
Base.transposeMethod

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

julia> @op A; @op B; @ket k;
+𝕀
source
Base.transposeMethod

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

julia> @op A; @op B; @ket k;
 
 julia> transpose(A)
 Aᵀ
@@ -102,13 +102,13 @@
 (Aᵀ+Bᵀ)
 
 julia> transpose(k)
-|k⟩ᵀ
source
Base.vecMethod

Vectorization of a symbolic operator.

julia> @op A; @op B;
+|k⟩ᵀ
source
Base.vecMethod

Vectorization of a symbolic operator.

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

Trace of an operator

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

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†
@@ -135,14 +135,14 @@
 ℋ
 
 julia> dagger(U)
-U⁻¹
source
QuantumInterface.projectorMethod

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
QuantumInterface.ptraceMethod

Partial trace over system i of a composite quantum system

julia> @op 𝒪 SpinBasis(1//2)⊗SpinBasis(1//2);
+ -0.5+0.0im   0.5+0.0im
source
QuantumInterface.ptraceMethod

Partial trace over system i of a composite quantum system

julia> @op 𝒪 SpinBasis(1//2)⊗SpinBasis(1//2);
 
 julia> op = ptrace(𝒪, 1)
 tr1(𝒪)
@@ -173,16 +173,16 @@
 ((0 + ⟨b||k⟩)B+(tr(A))|k⟩⟨b|)
 
 julia> ptrace(mixed_state, 2)
-((0 + ⟨b||k⟩)A+(tr(B))|k⟩⟨b|)
source
QuantumSymbolics.expressFunction
express(s, repr::AbstractRepresentation=QuantumOpticsRepr()[, use::AbstractUse])

The main interface for expressing quantum objects in various representations.

julia> express(X1)
+𝟎
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
@@ -202,7 +202,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)
@@ -213,20 +213,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/bibliography/index.html b/dev/bibliography/index.html index 5889999..f4c90ca 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 4670709..678792a 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}((QuantumOpticsRepr(), 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}((CliffordRepr(), UseAsState()) => MixedDestablizer 1×1, (QuantumOpticsRepr(), UseAsState()) => Ket(dim=2)
   basis: Spin(1/2)
  1.0 + 0.0im
- 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
+ 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
 tp = σˣ⊗σʸ
 express(tp*bellstate)
Ket(dim=4)
   basis: [Spin(1/2) ⊗ Spin(1/2)]
@@ -22,4 +22,4 @@
 + Y
 
 julia> express(σʸ, CliffordRepr(), UseAsOperation())
-sY
+sY diff --git a/dev/index.html b/dev/index.html index 018d7a7..b32f6d3 100644 --- a/dev/index.html +++ b/dev/index.html @@ -65,14 +65,18 @@

Impure states, represented as sum of density matrices

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

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

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

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

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

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

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

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

+
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 f504f4d..b3238e0 100644 --- a/dev/introduction/index.html +++ b/dev/introduction/index.html @@ -104,4 +104,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/qubit_basis/index.html b/dev/qubit_basis/index.html index 34ee983..2330c62 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