Degrees of freedom

QuantumLattices.DegreesOfFreedom.CouplingMethod
Coupling(indexes::Index...)
Coupling(value::Number, indexes::Index...)
Coupling(value::Number, indexes::Tuple{Vararg{Index}})

Construct a coupling with the input indexes as the pattern.

source
QuantumLattices.DegreesOfFreedom.CouplingMethod
Coupling(sites::Union{NTuple{N, Ordinal}, Colon}, ::Type{I}, fields::Union{NTuple{N}, Colon}...) where {N, I<:InternalIndex}
Coupling(value::Number, sites::Union{NTuple{N, Ordinal}, Colon}, ::Type{I}, fields::Union{NTuple{N}, Colon}...) where {N, I<:InternalIndex}
Coupling{N}(sites::Union{NTuple{N, Ordinal}, Colon}, ::Type{I}, fields::Union{NTuple{N}, Colon}...) where {N, I<:InternalIndex}
Coupling{N}(value::Number, sites::Union{NTuple{N, Ordinal}, Colon}, ::Type{I}, fields::Union{NTuple{N}, Colon}...) where {N, I<:InternalIndex}

Construct a Coupling with the input sites and the fields of a kind of internal index.

source
QuantumLattices.DegreesOfFreedom.CouplingMethod
Coupling(f::Union{Function, Type{<:Function}}, sites::Union{NTuple{N, Ordinal}, Colon}, fields::Union{NTuple{N}, Colon}...) where N
Coupling(value::Number, f::Union{Function, Type{<:Function}}, sites::Union{NTuple{N, Ordinal}, Colon}, fields::Union{NTuple{N}, Colon}...) where N
Coupling{N}(f::Union{Function, Type{<:Function}}, sites::Union{NTuple{N, Ordinal}, Colon}, fields::Union{NTuple{N}, Colon}...) where N
Coupling{N}(value::Number, f::Union{Function, Type{<:Function}}, sites::Union{NTuple{N, Ordinal}, Colon}, fields::Union{NTuple{N}, Colon}...) where N

Construct a Coupling by a function that can construct an Index with the input sites and the fields of a kind of internal index.

source
QuantumLattices.DegreesOfFreedom.HilbertMethod
Hilbert(internals::Internal...)
Hilbert(internals::OneAtLeast{Internal})
Hilbert(internals::AbstractVector{<:Internal})

Construct a Hilbert space with the given internal spaces.

source
QuantumLattices.DegreesOfFreedom.IndexType
Index(site::Union{Int, Ordinal, Colon}, internal::InternalIndex)

Index of a degree of freedom, which consist of the spatial part (i.e., the site index) and the internal part (i.e., the internal index).

source
QuantumLattices.DegreesOfFreedom.MatrixCouplingType
MatrixCoupling{I}(sites::Union{NTuple{2, Ordinal}, NTuple{2, Colon}}, contents::Tuple{Vararg{Component}}) where {I<:InternalIndex}
MatrixCoupling(sites::Union{NTuple{2, Ordinal}, Colon}, ::Type{I}, contents::Component...) where {I<:InternalIndex}

Matrix coupling, i.e., a set of couplings whose coefficients are specified by matrices acting on separated internal spaces.

source
QuantumLattices.DegreesOfFreedom.MetricType
Metric <: Function

Rules for measuring an operator index so that different operator indexes can be compared.

As a function, every instance should accept only one positional argument, i.e. the operator index to be measured.

source
QuantumLattices.DegreesOfFreedom.OperatorIndexToTupleType
OperatorIndexToTuple{Fields} <: Metric

A rule that converts an operator index into a tuple based on the specified type parameter Fields.

Here, Fields must be a tuple of Union{Symbol, Function}, which determines the elements of the converted tuple on an element-by-element basis.

For the ith element of Fields:

  1. If it is a Symbol, it represents the name of a single index of an OperatorIndex, and its value will become the corresponding element in the converted tuple.
  2. If it is a Function, it should be a trait function of an OperatorIndex, and its return value will become the corresponding element in the converted tuple.
source
QuantumLattices.DegreesOfFreedom.PatternType
Pattern(indexes::OneAtLeast{Index}, constraint::Function, representation::String=string(constraint))
Pattern{P}(indexes::OneAtLeast{Index}, constraints::NTuple{N, Function}, representations::NTuple{N, String}=map(string, constraints))  where {P, N}

Construct a coupling pattern with 1) only one constraint function, and 2) several constraint functions.

source
QuantumLattices.DegreesOfFreedom.PatternMethod
Pattern(indexes::OneAtLeast{Index})
Pattern(index::Index, indexes::Index...)

Construct a coupling pattern subject to the "diagonal" constraint for a homogeneous set of indexes.

source
QuantumLattices.DegreesOfFreedom.TableType
Table(indexes::AbstractVector{<:OperatorIndex}, by::Metric=OperatorIndexToTuple(eltype(indexes)))

Convert a set of operator units to the corresponding table of operator index vs. sequence pairs.

The input operator units are measured by the input by function with the duplicates removed. The resulting unique values are sorted, which determines the sequence of the input indexes. Note that two operator units have the same sequence if their converted values are equal to each other.

source
QuantumLattices.DegreesOfFreedom.TermMethod
Term{K}(id::Symbol, value, bondkind, coupling, ishermitian::Bool; amplitude::Union{Function, Nothing}=nothing, ismodulatable::Bool=true) where K

Construct a term.

source
QuantumLattices.DegreesOfFreedom.@patternMacro
@pattern index₁ index₂ ...
@pattern(index₁, index₂, ...; constraint=...)

Construct a coupling pattern according to the pattern of the input indexes and an optional constraint.

source
Base.:*Method
*(cp₁::Coupling, cp₂::Coupling) -> Coupling

Get the multiplication between two coupling.

source
Base.:*Method
*(mc₁::MatrixCoupling, mc₂::MatrixCoupling) -> MatrixCouplingProd
*(mc::MatrixCoupling, mcp::MatrixCouplingProd) -> MatrixCouplingProd
*(mcp::MatrixCouplingProd, mc::MatrixCoupling) -> MatrixCouplingProd
*(mcp₁::MatrixCouplingProd, mcp₂::MatrixCouplingProd) -> MatrixCouplingProd
*(mc::MatrixCoupling, factor::Number) -> MatrixCouplingProd
*(factor::Number, mc::MatrixCoupling) -> MatrixCouplingProd
*(factor::Number, mcp::MatrixCouplingProd) -> MatrixCouplingProd
*(mcp::MatrixCouplingProd, factor::Number) -> MatrixCouplingProd
*(mcs::MatrixCouplingSum, element::Union{Number, MatrixCoupling, MatrixCouplingProd}) -> MatrixCouplingSum
*(element::Union{Number, MatrixCoupling, MatrixCouplingProd}, mcs::MatrixCouplingSum) -> MatrixCouplingSum
*(mcs₁::MatrixCouplingSum, mcs₂::MatrixCouplingSum) -> MatrixCouplingSum

Product between MatrixCouplings and MatrixCouplingProds.

source
Base.:+Method
+(mc₁::Union{MatrixCoupling, MatrixCouplingProd}, mc₂::Union{MatrixCoupling, MatrixCouplingProd}) -> MatrixCouplingSum
+(mc::Union{MatrixCoupling, MatrixCouplingProd}, mcs::MatrixCouplingSum) -> MatrixCouplingSum
+(mcs::MatrixCouplingSum, mc::Union{MatrixCoupling, MatrixCouplingProd}) -> MatrixCouplingSum
+(mcs₁::MatrixCouplingSum, mcs₂::MatrixCouplingSum) -> MatrixCouplingSum

Addition between MatrixCouplings and MatrixCouplingProds.

source
Base.:/Method
/(mcp::MatrixCouplingProd, factor::Number) -> MatrixCouplingProd
/(mcs::MatrixCouplingSum, factor::Number) -> MatrixCouplingSum
/(mc::MatrixCoupling, factor::Number) -> MatrixCouplingProd
//(mcp::MatrixCouplingProd, factor::Number) -> MatrixCouplingProd
//(mcs::MatrixCouplingSum, factor::Number) -> MatrixCouplingSum
//(mc::MatrixCoupling, factor::Number) -> MatrixCouplingProd
-(mc::MatrixCoupling) -> MatrixCouplingProd
-(mcp::MatrixCouplingProd) -> MatrixCouplingProd
-(mcs::MatrixCouplingSum) -> MatrixCouplingSum
-(mc₁::Union{MatrixCoupling, MatrixCouplingProd}, mc₂::Union{MatrixCoupling, MatrixCouplingProd}) -> MatrixCouplingSum
-(mc::Union{MatrixCoupling, MatrixCouplingProd}, mcs::MatrixCouplingSum) -> MatrixCouplingSum
-(mcs::MatrixCouplingSum, mc::Union{MatrixCoupling, MatrixCouplingProd}) -> MatrixCouplingSum
-(mcs₁::MatrixCouplingSum, mcs₂::MatrixCouplingSum) -> MatrixCouplingSum

Define right-division, minus and subtraction operator for a MatrixCoupling/MatrixCouplingProd/MatrixCouplingSum.

source
Base.:^Method
^(mc::Union{MatrixCoupling, MatrixCouplingProd, MatrixCouplingSum}, n::Integer) -> Union{MatrixCoupling, MatrixCouplingProd, MatrixCouplingSum}

Get the nth power of a MatrixCoupling/MatrixCouplingProd/MatrixCouplingSum.

source
Base.adjointMethod
adjoint(index::CoordinatedIndex) -> typeof(index)

Get the adjoint of a coordinated index.

source
Base.adjointMethod
adjoint(index::Index) -> typeof(index)

Get the adjoint of an index.

source
Base.filterMethod
filter(index::InternalIndex, internal::CompositeInternal) -> Union{Nothing, SimpleInternal, CompositeInternal}
filter(::Type{I}, internal::CompositeInternal) where {I<:InternalIndex} -> Union{Nothing, SimpleInternal, CompositeInternal}

Filter the composite internal space and select those that match the input internal index or the type of an internal index.

source
Base.filterMethod
filter(index::InternalIndex, internal::SimpleInternal) -> Union{Nothing, typeof(internal)}
filter(::Type{I}, internal::SimpleInternal) where {I<:InternalIndex} -> Union{Nothing, typeof(internal)}

Filter a simple internal space with respect to the input internal index or the type of an internal index.

source
Base.filterMethod
filter(index::InternalIndex, ::Type{CI}) where {CI<:CompositeInternal}
filter(::Type{I}, ::Type{CI}) where {I<:InternalIndex, CI<:CompositeInternal}

Filter the type of a composite internal space and select those that match the input internal index or the type of an internal index.

source
Base.filterMethod
filter(index::InternalIndex, ::Type{SI}) where {SI<:SimpleInternal}
filter(::Type{I}, ::Type{SI}) where {I<:InternalIndex, SI<:SimpleInternal}

Filter the type of a simple internal space with respect to the input internal index or the type of an internal index.

source
Base.findallMethod
findall(select::Function, hilbert::Hilbert, table::Table) -> Vector{Int}

Find all the sequences of indexes contained in a Hilbert space according to a table and a select function.

source
Base.getindexMethod
getindex(pattern::Pattern, slice)

Get the indexes specified by slice in a coupling pattern.

source
Base.getindexMethod
getindex(table::Table, index::OperatorIndex) -> Int

Inquiry the sequence of an operator index.

source
Base.haskeyMethod
haskey(table::Table, index::OperatorIndex) -> Bool
haskey(table::Table, indexes::ID{OperatorIndex}) -> Tuple{Vararg{Bool}}

Judge whether a single operator index or a set of operator indexes have been assigned with sequences in table.

source
Base.keysMethod
keys(bound::Boundary) -> Tuple{Vararg{Symbol}}
keys(::Type{<:Boundary{Names}}) where Names -> Names

Get the names of the boundary parameters.

source
Base.keysMethod
keys(::OperatorIndexToTuple{Fields}) where Fields -> Fields
keys(::Type{<:OperatorIndexToTuple{Fields}}) where Fields -> Fields

Get the values of the type parameter Fields.

source
Base.matchMethod
match(index::InternalIndex, internal::SimpleInternal) -> Bool
match(::Type{I}, internal::SimpleInternal) where {I<:InternalIndex} -> Bool
match(index::InternalIndex, ::Type{SI}) where {SI<:SimpleInternal} -> Bool
match(::Type{I}, ::Type{SI}) where {I<:InternalIndex, SI<:SimpleInternal} -> Bool

Judge whether a simple internal space or the type of a simple internal space matches an internal index or the type of an internal index.

Here, "match" means that the eltype of the simple internal space is consistent with the type of the internal index, which usually means that they share the same type name.

source
Base.matchMethod
match(pattern::Pattern, indexes::OneAtLeast{InternalIndex}) -> Bool

Judge whether a set of internal indexes satisfies a coupling pattern.

source
Base.merge!Method
merge!(bound::Boundary, another::Boundary) -> typeof(bound)

Merge the values and vectors of the twisted boundary condition from another one.

source
Base.replaceMethod
replace(bound::Boundary; values=bound.values, vectors=bound.vectors) -> Boundary

Replace the values or vectors of a twisted boundary condition and get the new one.

Note

The plain boundary condition keeps plain even when replaced with new values or new vectors.

source
Base.replaceMethod
replace(term::Term, value) -> Term

Replace the value of a term.

source
Base.stringMethod
string(term::Term, bond::Bond, hilbert::Hilbert) -> String

Get the string representation of a term on a bond with a given Hilbert space.

source
Base.unionMethod
union(tables::Table...) -> Table

Unite several operator index vs. sequence tables.

source
Base.valtypeMethod
valtype(term::Term)
valtype(::Type{<:Term)

Get the value type of a term.

source
Base.valtypeMethod
valtype(terms::Tuple{Term, Vararg{Term}})
valtype(::Type{<:T}) where {T<:Tuple{Term, Vararg{Term}}}

Get the common value type of a set of terms.

source
Base.valtypeMethod
valtype(::Type{<:OperatorIndexToTuple}, ::Type{<:Index})

Get the valtype of applying an OperatorIndexToTuple rule to an Index.

source
LinearAlgebra.rankMethod
rank(internal::CompositeInternal) -> Int
rank(::Type{<:CompositeInternal{T}}) where {T<:OneAtLeast{SimpleInternal}} -> Int

Get the number of simple internal spaces in a composite internal space.

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

Get the rank of a coupling.

source
LinearAlgebra.rankMethod
rank(pattern::Pattern, i::Integer) -> Int
rank(::Type{P}, i::Integer) where {P<:Pattern} -> Int

Get the ith rank of the coupling pattern where the ith constraint can apply.

source
LinearAlgebra.rankMethod
rank(pattern::Pattern) -> Int
rank(::Type{P}) where {P<:Pattern} -> Int

Get the total rank of the coupling pattern.

source
QuantumLattices.:⊕Method
⊕(internal::SimpleInternal, internals::SimpleInternal...) -> InternalSum
⊕(internal::SimpleInternal, internals::InternalSum) -> InternalSum
⊕(internals::InternalSum, internal::SimpleInternal) -> InternalSum
⊕(internals₁::InternalSum, internals₂::InternalSum) -> InternalSum

Direct sum between simple internal spaces and composite internal spaces.

source
QuantumLattices.:⊗Method
⊗(pattern₁::Pattern, pattern₂::Pattern) -> Pattern

Get the combination of two coupling patterns.

source
QuantumLattices.:⊗Method
⊗(internal::SimpleInternal, internals::SimpleInternal...) -> InternalProd
⊗(internal::SimpleInternal, internals::InternalProd) -> InternalProd
⊗(internals::InternalProd, internal::SimpleInternal) -> InternalProd
⊗(internals₁::InternalProd, internals₂::InternalProd) -> InternalProd

Direct product between simple internal spaces and composite internal spaces.

source
QuantumLattices.DegreesOfFreedom.isdefiniteMethod
isdefinite(index::InternalIndex) -> Bool
isdefinite(::Type{<:InternalIndex}) -> Bool

Judge whether an internal index or a type of an internal index denotes a definite internal degree of freedom.

source
QuantumLattices.DegreesOfFreedom.isdefiniteMethod
isdefinite(indexes::OneAtLeast{InternalIndex}) -> Bool
isdefinite(::Type{T}) where {T<:OneAtLeast{InternalIndex}} -> Bool

Judge whether all of a set of internal indexes denote definite internal degrees of freedom.

source
QuantumLattices.DegreesOfFreedom.patternruleFunction
patternrule(value, ::Val{Name}, args...; kwargs...) where Name

By overriding this function, a named rule for the value of some attributes in a pattern can be defined so that the value can be transformed into the desired one.

In most cases, such overridden functions define the default rules for the attributes in a pattern when they take on the default value :.

source
QuantumLattices.DegreesOfFreedom.showablefieldsMethod
showablefields(index::InternalIndex) -> Tuple{Vararg{Symbol}}
showablefields(::Type{I}) where {I<:InternalIndex} -> Tuple{Vararg{Symbol}}

Get the showable fields of an internal index or a type of internal index.

source
QuantumLattices.QuantumOperators.scriptMethod
script(index::CoordinatedIndex, ::Val{:rcoordinate}; kwargs...) -> String
script(index::CoordinatedIndex, ::Val{:icoordinate}; kwargs...) -> String

Get the rcoordinate/icoordinate script of a coordinated index.

source
QuantumLattices.Spatials.nneighborMethod
nneighbor(term::Term) -> Int
nneighbor(terms::Tuple{Term, Vararg{Term}}) -> Int

Get the

  1. order of neighbor in a single term;
  2. highest order of neighbors in a set of terms.
source
QuantumLattices.expand!Method
expand!(operators::Operators, term::Term, bond::Bond, hilbert::Hilbert; half::Bool=false) -> Operators
expand!(operators::Operators, term::Term, bonds, hilbert::Hilbert; half::Bool=false) -> Operators

Expand the operators of a term on a bond/set-of-bonds with a given Hilbert space.

The half parameter determines the behavior of generating operators, which falls into the following two categories

  • true: "Hermitian half" of the generated operators
  • false: "Hermitian whole" of the generated operators
source
QuantumLattices.expandMethod
expand(term::Term, bond::Bond, hilbert::Hilbert; half::Bool=false) -> Operators
expand(term::Term, bonds, hilbert::Hilbert; half::Bool=false) -> Operators

Expand the operators of a term on a bond/set-of-bonds with a given Hilbert space.

source
QuantumLattices.expandMethod
expand(coupling::Coupling, ::Val{Rule}, bond::Bond, hilbert::Hilbert) where Rule

Expand a coupling with the given bond and Hilbert space under a given named pattern rule.

source
QuantumLattices.permuteMethod
permute(index₁::CoordinatedIndex, index₂::CoordinatedIndex) -> Tuple{Vararg{Operator}}

Get the permutation of two coordinated indexes.

source
QuantumLattices.reset!Method
reset!(table::Table, indexes::AbstractVector{<:OperatorIndex}) -> Table

Reset a table by a new set of indexes.

source
QuantumLattices.shapeMethod
shape(internal::SimpleInternal, index::InternalIndex) -> OrdinalRange{Int, Int}

Get the shape of a simple internal space when a labeled internal index is considered.

It can be overloaded to restrict the shape of a simple internal space based on the input internal index to significantly improve efficiency, but this is not necessary.

source