Quantum operators

Quantum operators form an algebra over a field, which are vector spaces with a bilinear operation (often called the "multiplication") between vectors defined.

With the help of the structure constants of the algebra, the result of the bilinear operation between any arbitrary two vectors can be expressed by a sum of individual ones. Therefore, in principle, an algebra can be represented by the complete basis set of its corresponding vector space and a rank-3 tensor encapsulating its structure constants. It is noted that the "bilinear operation" is not restricted to the usual multiplication. For example, it is the commutator, which is a composition of the usual multiplication and subtraction (for any A and B, the commutator [A, B] is defined as [A, B]≝AB-BA) that serves as the bilinear operator for Lie algebras.

In general, there are three basic operations on quantum operators, i.e. the scalar multiplication between a scalar and a quantum operator, the usual addition and the usual multiplication between quantum operators. Other complicated operations can be composed from these basic ones. These basic operations are implemented in this module.

OperatorUnit

OperatorUnit is the building block of quantum operators, which specifies the basis of the vector space of the corresponding algebra.

OperatorProd and OperatorSum

OperatorProd defines the product operator as an entity of basis quantum operators while OperatorSum defines the summation as an entity of OperatorProds. Both of them are subtypes of QuantumOperator, which is the abstract type for all quantum operators.

An OperatorProd must have two predefined contents:

  • value::Number: the coefficient of the quantum operator
  • id::ID: the id of the quantum operator

Arithmetic operations (+, -, *, /) between a scalar, an OperatorProd or an OperatorSum is defined. See Manual for details.

Manual

QuantumLattices.QuantumOperators.IDType
ID{U<:OperatorUnit, N}

The id of a composite quantum operator, which is an ordered set of operator units.

Type alias for NTuple{N, U} where {U<:OperatorUnit}.

source
QuantumLattices.QuantumOperators.IDMethod
ID(id::OperatorUnit...)
ID(u::OperatorUnit, id::ID{OperatorUnit})
ID(id::ID{OperatorUnit}, u::OperatorUnit)
ID(id₁::ID{OperatorUnit}, id₂::ID{OperatorUnit})

Get the id from operator units/ids.

source
QuantumLattices.QuantumOperators.OperatorPackType
OperatorPack{V, I<:Tuple} <: QuantumOperator

The entity that represent the pack of a number and several quantum units.

Basically, a concrete subtype should contain two predefined contents:

  • value::V: the coefficient of the pack
  • id::I: the total id of the pack
source
QuantumLattices.QuantumOperators.OperatorUnitType
OperatorUnit <: QuantumOperator

An operator unit is the irreducible symbolic unit to represent a quantum operator.

It plays the role of the symbols as in usual computer algebras while it can host internal structures, which is convenient for quantum operators in representative of the internal degrees of freedom.

source
QuantumLattices.QuantumOperators.PermutationMethod
(permutation::Permutation)(m::OperatorProd; rev::Bool=false, kwargs...) -> OperatorSum

Permute the operator units of an OperatorProd to the descending order according to the table contained in permutation.

Note

To use this function, the user must implement a method of permute, which computes the result of the permutation of two operator units:

permute(u₁::OperatorUnit, u₂::OperatorUnit) -> Union{OperatorProd, OperatorSum}

Here, u₁ and u₂ are two arbitrary operator units contained in id(m).

source
QuantumLattices.QuantumOperators.TabledUnitSubstitutionType
TabledUnitSubstitution{U<:OperatorUnit, S<:OperatorSum, T<:AbstractDict{U, S}} <: UnitSubstitution{U, S}

A concrete "unit substitution" transformation, which stores every substitution of the old OperatorUnits in its table as a dictionary.

source
QuantumLattices.QuantumOperators.UnitSubstitutionType
UnitSubstitution{U<:OperatorUnit, S<:OperatorSum} <: LinearTransformation

The "unit substitution" transformation, which substitutes each OperatorUnit in the old quantum operators to a new expression represented by an OperatorSum.

source
Base.:*Method
*(factor::Number, m::OperatorUnit) -> Operator
*(m::OperatorUnit, factor::Number) -> Operator
*(m₁::OperatorUnit, m₂::OperatorUnit) -> Operator
*(factor::Number, m::OperatorPack) -> OperatorPack
*(m::OperatorPack, factor::Number) -> OperatorPack
*(m₁::OperatorPack, m₂::OperatorUnit) -> OperatorPack
*(m₁::OperatorUnit, m₁::OperatorPack) -> OperatorPack
*(m₁::OperatorPack, m₂::OperatorPack) -> OperatorPack
*(factor::Number, ms::OperatorSum) -> OperatorSum
*(ms::OperatorSum, factor::Number) -> OperatorSum
*(m::OperatorPack, ms::OperatorSum) -> OperatorSum
*(ms::OperatorSum, m::OperatorPack) -> OperatorSum
*(ms₁::OperatorSum, ms₂::OperatorSum) -> OperatorSum

Overloaded * between quantum operators or a quantum operator and a number.

source
Base.:+Method
+(m::QuantumOperator) -> typeof(m)
+(m₁::QuantumOperator, m₂::QuantumOperator) -> OperatorSum
+(factor::Number, m::QuantumOperator) -> OperatorSum
+(m::QuantumOperator, factor::Number) -> OperatorSum

Overloaded + between quantum operators.

source
Base.:-Method
-(m::QuantumOperator) -> QuantumOperator
-(m₁::QuantumOperator, m₂::QuantumOperator) -> OperatorSum
-(factor::Number, m::QuantumOperator) -> OperatorSum
-(m::QuantumOperator, factor::Number) -> OperatorSum

Overloaded - between quantum operators.

source
Base.:/Method
/(m::QuantumOperator, factor::Number) -> QuantumOperator

Overloaded / between a quantum operator and a number.

source
Base.://Method
//(m::QuantumOperator, factor::Number) -> QuantumOperator

Overloaded // between a quantum operator and a number.

source
Base.:^Method
^(m::QuantumOperator, n::Integer) -> QuantumOperator

Overloaded ^ between a quantum operator and an integer.

source
Base.adjointMethod
adjoint(opts::Operators) -> Operators

Get the adjoint of a set of operators.

source
Base.adjointMethod
adjoint(m::Operator) -> Operator

Get the adjoint of an operator.

source
Base.conjMethod
conj(m::OperatorUnit) -> OperatorUnit
conj(m::OperatorPack) -> OperatorPack
conj(m::OperatorSum) -> OperatorSum

Get the conjugation.

source
Base.convertMethod
convert(::Type{M}, m::Number) where {M<:OperatorPack}
convert(::Type{M}, m::OperatorPack) where {M<:OperatorPack}
  1. Convert a number to a quantum operator.
  2. Convert a quantum operator from one type to another.
source
Base.convertMethod
convert(::Type{M}, u::OperatorUnit) where {M<:Operator{<:Number, <:ID{OperatorUnit}}}

Convert an operator unit to an operator.

source
Base.getindexMethod
getindex(m::OperatorProd, i::Integer) -> OperatorUnit
getindex(m::OperatorProd, slice) -> OperatorProd

Overloaded [].

source
Base.getpropertyMethod
getproperty(id::ID{OperatorUnit}, name::Symbol)

Get the property of a composite id.

source
Base.isapproxMethod
isapprox(m₁::OperatorPack, m₂::OperatorPack; atol::Real=atol, rtol::Real=rtol) -> Bool

Compare two OperatorPacks and judge whether they are approximate to each other.

source
Base.isapproxMethod
isapprox(ms₁::OperatorSum, ms₂::OperatorSum; atol::Real=atol, rtol::Real=rtol) -> Bool

Compare two OperatorSums and judge whether they are approximate to each other.

source
Base.lengthMethod
length(m::OperatorProd) -> Int

Get the length of an OperatorProd.

source
Base.map!Method
map!(transformation::LinearTransformation, destination, ms::OperatorSum; kwargs...) -> typeof(destination)

In place map of an OperatorSum by a linear transformation.

source
Base.map!Method
map!(transformation::LinearTransformation, ms::OperatorSum; kwargs...) -> typeof(ms)

In place map of an OperatorSum by a linear transformation.

source
Base.oneMethod
one(::Type{M}) where M<:OperatorPack
one(m::OperatorPack)

Get the identity quantum operator.

source
Base.propertynamesMethod
propertynames(::Type{I}) where I<:ID{OperatorUnit} -> Tuple{Vararg{Symbol}}

Get the property names of a composite id.

source
Base.replaceMethod
replace(m::OperatorPack, v) -> OperatorPack

Replace the value of an OperatorPack.

source
Base.replaceMethod
replace(m::QuantumOperator; kwargs...) -> typeof(m)

Return a copy of a concrete QuantumOperator with some of the field values replaced by the keyword arguments.

source
Base.showMethod
show(io::IO, ::MIME"text/latex", m::QuantumOperator)

Show a quantum operator.

source
Base.splitMethod
split(m::OperatorProd) -> Tuple{valtype(m), Vararg{OperatorUnit}}

Split an OperatorProd into the coefficient and a sequence of OperatorUnits.

source
Base.valtypeMethod
valtype(m::OperatorPack)
valtype(::Type{T}) where {T<:OperatorPack}

Get the type of the value of an OperatorPack.

source
Base.zeroMethod
zero(::Type{M}) where {M<:QuantumOperator} -> OperatorSum

Get the zero sum.

source
LaTeXStrings.latexstringMethod
latexstring(opts::OperatorSum) -> String

Get the string representation of a set of operators in the LaTeX format.

source
LinearAlgebra.mul!Method
mul!(ms::OperatorSum, factor::Number) -> OperatorSum

Get the in-place multiplication of an OperatorSum with a number.

source
LinearAlgebra.rankMethod
rank(m::OperatorPack) -> Int
rank(::Type{M}) where {M<:OperatorPack} -> Int

Get the rank of an OperatorPack.

source
LinearAlgebra.rankMethod
rank(id::ID{OperatorUnit}) -> Int
rank(::Type{<:ID{OperatorUnit}}) -> Any
rank(::Type{<:ID{OperatorUnit, N}}) where N -> Int

Get the rank of an id.

source
QuantumLattices.QuantumOperators.scriptMethod
script(::Val{:BD}, u::OperatorUnit, l::LaTeX) -> Any
script(::Val{:SP}, u::OperatorUnit, l::LaTeX) -> Tuple
script(::Val{:SB}, u::OperatorUnit, l::LaTeX) -> Tuple

Get the body/superscript/subscript of the LaTeX string representation of an operator unit.

source
QuantumLattices.add!Method
add!(destination, transformation::LinearTransformation, op::QuantumOperator; kwargs...) -> typeof(destination)

Add the result of the linear transformation on a quantum operator to the destination.

source
QuantumLattices.add!Method
add!(ms::OperatorSum) -> typeof(ms)
add!(ms::OperatorSum, m::Union{Number, OperatorUnit, OperatorPack}) -> typeof(ms)
add!(ms::OperatorSum, mms::OperatorSum) -> typeof(ms)

Get the in-place addition of quantum operators.

source
QuantumLattices.div!Method
div!(ms::OperatorSum, factor::Number) -> OperatorSum

Get the in-place division of an OperatorSum with a number.

source
QuantumLattices.dtypeMethod
dtype(m::OperatorPack)
dtype(::Type{T}) where {T<:OperatorPack}

The data type of the coefficient of an OperatorPack.

source
QuantumLattices.sub!Method
sub!(ms::OperatorSum) -> typeof(ms)
sub!(ms::OperatorSum, m::Union{Number, OperatorUnit, OperatorPack}) -> typeof(ms)
sub!(ms::OperatorSum, mms::OperatorSum) -> typeof(ms)

Get the in-place subtraction of quantum operators.

source