Expressions with creation/annihilation operators of fermions
KeldyshED.Operators — ModuleThis module implements an algebra of fermionic creation/annihilation operators and polynomial expressions built out of such operators.
Canonical operators
KeldyshED.Operators.IndicesType — Typemutable struct Array{Union{Int64, String}, 1} <: DenseVector{Union{Int64, String}}Compound operator index $\alpha$ as a mixed list of String / Int indices.
KeldyshED.Operators.CanonicalOperator — TypeThis structure represents a single creation operator $c^\dagger_\alpha$ or an annihilation operator $c_\alpha$.
Fields
dagger::Bool: Creation operator iftrue, annihilation operator otherwiseindices::Vector{Union{Int64, String}}: Compound index α carried by the operator
Canonical operators are less-comparable and are ordered according to the following rule,
$c^\dagger_\alpha < c^\dagger_\beta < c^\dagger_\gamma < c_\gamma < c_\beta < c_\alpha,$
where compound indices satisfy $\alpha < \beta < \gamma$.
KeldyshED.Operators.dagger — Methoddagger(
op::KeldyshED.Operators.CanonicalOperator
) -> KeldyshED.Operators.CanonicalOperator
Hermitian conjugate of a canonical operator.
KeldyshED.Operators.isconjugate — Methodisconjugate(
op1::KeldyshED.Operators.CanonicalOperator,
op2::KeldyshED.Operators.CanonicalOperator
) -> Bool
Check if op2 is a Hermitian conjugate of op1.
Base.show — Methodshow(io::IO, op::KeldyshED.Operators.CanonicalOperator)
Print a canonical operator.
Monomials
KeldyshED.Operators.Monomial — TypeAn ordered product of canonical operators.
Fields
ops::Vector{KeldyshED.Operators.CanonicalOperator}: List of canonical operators in the product, left-to-right.
Monomials are less-comparable, with a shorter monomial being always considered lesser than a longer one.
Base.length — Methodlength(m::KeldyshED.Operators.Monomial) -> Int64
Number of canonical operators in a given monomial.
Base.isempty — Methodisempty(m::KeldyshED.Operators.Monomial) -> Any
Check if a given monomial is 1, i.e. a product of zero canonical operators.
KeldyshED.Operators.dagger — Methoddagger(
m::KeldyshED.Operators.Monomial
) -> KeldyshED.Operators.Monomial
Hermitian conjugate of a monomial.
Base.show — Methodshow(io::IO, m::KeldyshED.Operators.Monomial)
Print a monomial.
Polynomial expressions
KeldyshED.Operators.OperatorExpr — TypePolynomial expression built out of canonical operators and numeric coefficients,
$M^{(0)} + \sum_\alpha M^{(1)}_\alpha o_\alpha + \sum_{\alpha\beta} M^{(2)}_{\alpha\beta} o_\alpha o_\beta + \sum_{\alpha\beta\gamma} M^{(3)}_{\alpha\beta\gamma} o_\alpha o_\beta o_\gamma + \ldots,$
where $o_\alpha$ are canonical operators $c^\dagger_\alpha$ / $c_\alpha$, and $M^{(n)}$ are the coefficients.
Fields
monomials::DataStructures.SortedDict{KeldyshED.Operators.Monomial, ScalarType} where ScalarType<:Number: Sorted list of monomials with numeric coefficients $M^{(n)}$ in front of them.
Polynomial expressions support the following arithmetic operations.
- Addition / subtraction of two expressions with the same coefficient type.
- Multiplication of two expressions with the same coefficient type.
- Addition / subtraction of a constant.
- Multiplication / division by a constant.
- Unary minus.
They also support the iteration interface with iteration element type being Pair{Monomial, ScalarType}.
KeldyshED.Operators.OperatorExpr — MethodOperatorExpr{S}(x::S) where {S <: Number}Construct a polynomial expression with coefficient type S identically equal to x.
KeldyshED.Operators.RealOperatorExpr — Typestruct OperatorExpr{Float64}Polynomial expression with real coefficients.
KeldyshED.Operators.ComplexOperatorExpr — Typestruct OperatorExpr{ComplexF64}Polynomial expression with complex coefficients.
KeldyshED.Operators.scalartype — Functionscalartype(_::KeldyshED.Operators.OperatorExpr{S}) -> Any
Determine the type of monomial coefficients of a given polynomial expression.
scalartype(
_::Type{KeldyshED.Operators.OperatorExpr{S}}
) -> Any
Determine the type of monomial coefficients of a given polynomial expression type.
KeldyshED.Operators.dagger — Methoddagger(
op::KeldyshED.Operators.OperatorExpr{S}
) -> KeldyshED.Operators.OperatorExpr
Hermitian conjugate of a polynomial expression.
Base.iszero — Methodiszero(op::KeldyshED.Operators.OperatorExpr{S}) -> Bool
Check if a given polynomial expression is identically zero.
Base.length — Methodlength(op::KeldyshED.Operators.OperatorExpr) -> Int64
Number of monomials in a given polynomial expression op.
Base.isempty — Methodisempty(op::KeldyshED.Operators.OperatorExpr) -> Bool
Check if a given polynomial expression is identically zero.
Base.map — Methodmap(
f,
op::KeldyshED.Operators.OperatorExpr{S}
) -> KeldyshED.Operators.OperatorExpr
Transform a given polynomial expression op by applying a function f to coefficients of all monomials in the expression. If f applied to a coefficient returns zero, the corresponding monomial is omitted from the resulting expression.
Base.real — Methodreal(
op::KeldyshED.Operators.OperatorExpr
) -> KeldyshED.Operators.OperatorExpr
Return a version of a polynomial expression op with all coefficients replaced by their real parts.
Base.imag — Methodimag(
op::KeldyshED.Operators.OperatorExpr
) -> KeldyshED.Operators.OperatorExpr
Return a version of a polynomial expression op with all coefficients replaced by their imaginary parts.
Base.show — Methodshow(io::IO, op::KeldyshED.Operators.OperatorExpr{S}) -> Any
Print a polynomial expression.
Factory functions for polynomial expressions
KeldyshED.Operators.c — Functionc(
indices...;
scalar_type
) -> KeldyshED.Operators.RealOperatorExpr
Make an annihilation operator $c_\alpha$ with indices... being components of the compound index $\alpha$. Coefficient type of the resulting polynomial expression can be specified via scalar_type (defaults to Float64).
KeldyshED.Operators.c_dag — Functionc_dag(
indices...;
scalar_type
) -> KeldyshED.Operators.RealOperatorExpr
Make an creation operator $c^\dagger_\alpha$ with indices... being components of the compound index $\alpha$. Coefficient type of the resulting polynomial expression can be specified via scalar_type (defaults to Float64).
KeldyshED.Operators.n — Functionn(
indices...;
scalar_type
) -> KeldyshED.Operators.RealOperatorExpr
Make a particle number operator $n_\alpha = c^\dagger_\alpha c_\alpha$ with indices... being components of the compound index $\alpha$. Coefficient type of the resulting polynomial expression can be specified via scalar_type (defaults to Float64).