Degrees of freedom

QuantumLattices.DegreesOfFreedom.AllEqualType
AllEqual{Fields} <: Function

All-equal constraint for the direct product of homogenous simple internal indexes that for every specified field the values of the internal indexes should be all equal.

source
QuantumLattices.DegreesOfFreedom.AllEqualMethod
(constraint::AllEqual{fields})(index::InternalIndexProd{NTuple{N, I}}) where {fields, N, I<:SimpleInternalIndex} -> Bool

Judge whether the direct product of a set of homogenous simple internal indexes is subject to an all-equal constraint.

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

Construct a Coupling with the input sites and the fields of a kind of simple 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 simple internal index.

source
QuantumLattices.DegreesOfFreedom.HilbertMethod
Hilbert(internals::Internal...)
Hilbert(internals::Tuple{Vararg{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::SimpleInternalIndex)

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.InternalPatternType
InternalPattern(index::InternalIndexProd, constraint::Function, representation::String=string(constraint))
InternalPattern{P}(index::InternalIndexProd, constraints::NTuple{N, Function}, representations::NTuple{N, String}=map(string, constraints))  where {P, N}

Construct an internal pattern for the direct product of a set of simple internal indexes with 1) only one constraint function, and 2) several constraint functions.

source
QuantumLattices.DegreesOfFreedom.InternalPatternMethod
InternalPattern(index::SimpleInternalIndex)
InternalPattern(index::InternalIndexProd{<:Tuple{Vararg{I}}}) where {I<:SimpleInternalIndex}

Construct an internal pattern whose constraint is an AllEqual function for the direct product of a homogeneous set of simple internal indexes.

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

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.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
*(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(ii::SimpleInternalIndex, ci::CompositeInternal) -> Union{Nothing, SimpleInternal, CompositeInternal}
filter(::Type{I}, ci::CompositeInternal) where {I<:SimpleInternalIndex} -> Union{Nothing, SimpleInternal, CompositeInternal}

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

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

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

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

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

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

Filter the type of a simple internal space with respect to the input simple internal index or the type of a simple 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(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(pattern::InternalPattern, index::InternalIndexProd) -> Bool

Judge whether the direct product of a set of simple internal indexes satisfies an internal pattern.

source
Base.matchMethod
match(ii::SimpleInternalIndex, i::SimpleInternal) -> Bool
match(::Type{I}, i::SimpleInternal) where {I<:SimpleInternalIndex} -> Bool
match(ii::SimpleInternalIndex, ::Type{SI}) where {SI<:SimpleInternal} -> Bool
match(::Type{I}, ::Type{SI}) where {I<:SimpleInternalIndex, SI<:SimpleInternal} -> Bool

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

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

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(ci::CompositeInternal) -> Int
rank(::Type{<:CompositeInternal{T}}) where {T<:Tuple{Vararg{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(cii::InternalIndexProd) -> Int
rank(::Type{<:InternalIndexProd{T}}) where {T<:Tuple{Vararg{SimpleInternalIndex}}} -> Int

Get the number of simple internal indexes in a direct product.

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

Get the rank of the direct product of the simple internal indexes that the ith constraint in an internal pattern can apply.

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

Get the rank of the direct product of the simple internal indexes that an internal pattern can apply.

source
LinearAlgebra.rankMethod
rank(pattern::Pattern) -> Int
rank(::Type{<:Pattern{<:InternalPattern, S}}) where {S<:Tuple{Vararg{Union{Ordinal, Colon}}}} -> Int

Get the rank of a coupling pattern.

source
QuantumLattices.:⊕Method
⊕(is::SimpleInternal...) -> InternalSum
⊕(i::SimpleInternal, ci::InternalSum) -> InternalSum
⊕(ci::InternalSum, i::SimpleInternal) -> InternalSum
⊕(ci₁::InternalSum, ci₂::InternalSum) -> InternalSum

Direct sum between simple internal spaces and composite internal spaces.

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

Get the multiplication between two coupling.

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

Get the combination of two internal patterns.

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

Get the combination of two coupling patterns.

source
QuantumLattices.:⊗Method
⊗(iis::SimpleInternalIndex...) -> InternalIndexProd
⊗(ii::SimpleInternalIndex, cii::InternalIndexProd) -> InternalIndexProd
⊗(cii::InternalIndexProd, ii::SimpleInternalIndex) -> InternalIndexProd
⊗(cii₁::InternalIndexProd, cii₂::InternalIndexProd) -> InternalIndexProd

Direct product between internal indexes.

source
QuantumLattices.:⊗Method
⊗(is::SimpleInternal...) -> InternalProd
⊗(i::SimpleInternal, ci::InternalProd) -> InternalProd
⊗(ci::InternalProd, i::SimpleInternal) -> InternalProd
⊗(ci₁::InternalProd, ci₂::InternalProd) -> InternalProd

Direct product between simple internal spaces and composite internal spaces.

source
QuantumLattices.DegreesOfFreedom.isdefiniteMethod
isdefinite(indexes::Tuple{Vararg{Index}}) -> Bool
isdefinite(::Type{T}) where {T<:Tuple{Vararg{Index}}} -> Bool

Determine whether a tuple of indexes denotes a definite degree of freedom.

source
QuantumLattices.DegreesOfFreedom.partitionMethod
partition(pattern::InternalPattern) -> Tuple{Vararg{Int}}
partition(::Type{<:InternalPattern{I, P} where I}) where P -> P

Get the partition of the direct product of a set of simple internal indexes on which the extra constraints operate independently.

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.patternruleMethod
patternrule(index::InternalIndexProd{T}, ::Val{Name}) where {N, T<:NTuple{N, SimpleInternalIndex}, Name} -> InternalIndexProd

Define the default rule for the internal index in an internal pattern.

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.Toolkit.shapeMethod
shape(internal::SimpleInternal, index::SimpleInternalIndex) -> OrdinalRange{Int, Int}

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

A constrained internal space need this function to generate all the internal indexes that match the internal pattern, which gets a default implementation, i.e.,

shape(internal::SimpleInternal, index::SimpleInternalIndex) = shape(internal)

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

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