Frameworks

QuantumLattices.Frameworks.AlgorithmType
Algorithm(name::Symbol, frontend::Frontend, parameters::Parameters=Parameters(frontend), map::Function=identity; dir::String=".", timer::TimerOutput=TimerOutput())

Construct an algorithm.

source
QuantumLattices.Frameworks.AlgorithmType
(alg::Algorithm)(assign::Assignment, checkoptions::Bool=true; options...) -> Assignment
(assign::Assignment)(alg::Algorithm, checkoptions::Bool=true; options...) -> Assignment

Run an assignment based on an algorithm.

The difference between these two methods is that the first uses the parameters of assign as the current parameters while the second uses those of alg.

source
QuantumLattices.Frameworks.AlgorithmMethod
(alg::Algorithm)(name::Symbol, action::Action, dependencies::ZeroOrMore{Assignment}; dir::String=alg.dir, delay::Bool=false, options...) -> Assignment
(alg::Algorithm)(name::Symbol, action::Action, parameters::Parameters, dependencies::ZeroOrMore{Assignment}; dir::String=alg.dir, delay::Bool=false, options...) -> Assignment
(alg::Algorithm)(name::Symbol, action::Action, parameters::Parameters=Parameters(), map::Function=identity, dependencies::ZeroOrMore{Assignment}=(); dir::String=alg.dir, delay::Bool=false, options...) -> Assignment

Add an assignment on an algorithm by providing the contents of the assignment, and run this assignment.

source
QuantumLattices.Frameworks.CategorizedGeneratorType
CategorizedGenerator{V, C, A<:NamedTuple, B<:NamedTuple, P<:Parameters, D<:Boundary} <: ParametricGenerator{V}

Parameterized generator that groups the (representations of) quantum operators in a quantum lattice system into three categories, i.e., the constant, the alterable, and the boundary.

source
QuantumLattices.Frameworks.GeneratorMethod
Generator(ops::OperatorSet) -> StaticGenerator
Generator(constops, alterops::NamedTuple, boundops::NamedTuple, parameters::Parameters, boundary::Boundary) -> CategorizedGenerator
Generator(ops::CategorizedGenerator{<:Operators}, bonds::Vector{<:Bond}, hilbert::Hilbert, terms::OneOrMore{Term}, half::Bool) -> OperatorGenerator
Generator(bonds::Vector{<:Bond}, hilbert::Hilbert, terms::OneOrMore{Term}, boundary::Boundary=plain; half::Bool=false) -> OperatorGenerator

Factory constructor for Generator subtypes.

Dispatches on the argument types to construct the appropriate concrete representation. Unlike LatticeModel, this factory only constructs Generator subtypes (not Formula).

source
QuantumLattices.Frameworks.LatticeModelType
LatticeModel

Abstract supertype for all representations of a quantum lattice system.

Subtypes must implement valtype. Parameters and update! should also be implemented as applicable.

source
QuantumLattices.Frameworks.LatticeModelMethod
LatticeModel(expression::Function, parameters::Parameters) -> Formula
LatticeModel(ops::OperatorSet) -> StaticGenerator
LatticeModel(constops, alterops::NamedTuple, boundops::NamedTuple, parameters::Parameters, boundary::Boundary) -> CategorizedGenerator
LatticeModel(ops::CategorizedGenerator{<:Operators}, bonds::Vector{<:Bond}, hilbert::Hilbert, terms::OneOrMore{Term}, half::Bool) -> OperatorGenerator
LatticeModel(bonds::Vector{<:Bond}, hilbert::Hilbert, terms::OneOrMore{Term}, boundary::Boundary=plain; half::Bool=false) -> OperatorGenerator

Unified factory constructor for LatticeModel subtypes.

Dispatches on the argument types to construct the appropriate concrete representation. Frontend subtypes and Algorithm are not constructed via this factory.

source
QuantumLattices.Frameworks.OperatorGeneratorType
OperatorGenerator{V<:Operators, CG<:CategorizedGenerator{V}, B<:Bond, H<:Hilbert, TS<:ZeroAtLeast{Term}} <: ParametricGenerator{V}

A generator of operators based on the terms, bonds and Hilbert space of a quantum lattice system.

source
QuantumLattices.Frameworks.OperatorGeneratorType
OperatorGenerator(bonds::Vector{<:Bond}, hilbert::Hilbert, terms::OneOrMore{Term}, boundary::Boundary=plain; half::Bool=false)

Construct a generator of quantum operators based on the input bonds, Hilbert space, terms and (twisted) boundary condition.

When the boundary condition is plain, the boundary operators will be set to be empty for simplicity and efficiency.

source
QuantumLattices.Frameworks.ParametersMethod
Parameters(model::LatticeModel) -> NamedTuple

Get the parameters of a lattice model.

Returns model.parameters if the type has a :parameters field, otherwise an empty NamedTuple.

source
QuantumLattices.Frameworks.StaticGeneratorType
StaticGenerator{M<:OperatorSet} <: Generator{M}

A LatticeModel that wraps a static OperatorSet.

Unlike ParametricGenerator, the operators have no parameter-update mechanism — they are treated as a fixed set.

source
Base.Filesystem.basenameFunction
basename(model::LatticeModel, target::Symbol=:void; prefix::String="", suffix::String="") -> String

Get the basename of a lattice model file, formed as "prefix-string(model)-suffix.ext".

  • target::Symbol: :data.qld, :cache.qlc, :void (default) → no extension.
  • prefix, suffix: prepended/appended to the base name. The separator "-" is omitted when the corresponding part is empty.
source
Base.Filesystem.dirnameMethod
dirname(model::LatticeModel) -> String

Get the dirname of the data/cache file of a lattice model.

Defaults to "." if the type has no dir field.

source
Base.eltypeMethod
eltype(model::LatticeModel)
eltype(::Type{T}) where {T<:LatticeModel}

Get the eltype of a LatticeModel.

source
Base.emptyMethod
empty(cat::CategorizedGenerator) -> CategorizedGenerator
empty!(cat::CategorizedGenerator) -> CategorizedGenerator

Get an empty copy of a categorized generator or empty a categorized generator of (representations of) quantum operators.

source
Base.emptyMethod
empty(gen::OperatorGenerator) -> OperatorGenerator
empty!(gen::OperatorGenerator) -> OperatorGenerator

Get an empty copy of or empty an operator generator.

source
Base.emptyMethod
empty(gen::StaticGenerator) -> StaticGenerator
empty!(gen::StaticGenerator) -> StaticGenerator

Get an empty copy of a static generator or empty it in place.

source
Base.isemptyMethod
isempty(gen::Generator) -> Bool

Judge whether a Generator is empty after lazy expansion.

source
Base.iterateMethod
iterate(gen::Generator)
iterate(::Generator, state)

Iterate over a Generator lazily.

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

Get the names of the boundary parameters.

source
Base.lengthMethod
length(gen::Generator) -> Int

Get the number of operators after lazy expansion.

source
Base.matchMethod
match(params₁::Parameters, params₂::Parameters; atol=atol, rtol=rtol) -> Bool

Judge whether the second set of parameters matches the first.

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.pathofMethod
pathof(model::LatticeModel, target::Symbol; prefix::String="", suffix::String="") -> String

Get the full path of a lattice model file.

Equivalent to joinpath(dirname(model), basename(model, target; prefix, suffix)).

source
Base.showMethod
show(io::IO, assign::Assignment)

Show an assignment.

source
Base.valtypeMethod
valtype(model::LatticeModel)
valtype(::Type{<:LatticeModel})

Get the valtype of a LatticeModel. Subtypes must implement the type-level method.

source
QuantumLattices.Frameworks.contenttocacheMethod
contenttocache(model::LatticeModel) -> NamedTuple

Return the cacheable content of a lattice model as a NamedTuple.

Returns an empty NamedTuple by default. Subtypes should override this to specify what should be cached.

source
QuantumLattices.Frameworks.contenttoconfigMethod
contenttoconfig(model::LatticeModel) -> Tuple

Return the structural components that characterize a lattice model.

Together with Parameters, these components determine the model's identity. Defaults to an empty Tuple. Subtypes should override this to specify which structural components to include.

source
QuantumLattices.Frameworks.optionsinfoMethod
optionsinfo(::Type{A}; level::Int=1) where {A<:Assignment} -> String

Get the complete info of the options of a certain type of Assignment, including that of its dependencies.

source
QuantumLattices.Frameworks.qlcleanMethod
qlclean(filename::String; age::Real=Inf, maxcount::Int=typemax(Int)) -> Int
qlclean(target::Symbol, dir::String="."; age::Real=Inf, maxcount::Int=typemax(Int)) -> Int

Clean up entries in qld/qlc files.

  • filename: clean a single file.
  • target=:data/:cache: clean all .qld/.qlc files in dir.
  • age: delete entries whose touchtime is older than age seconds (default Inf).
  • maxcount: keep at most maxcount most recent entries per file (default typemax(Int)).

Files that become empty after cleaning are removed. Returns the number of entries deleted.

source
QuantumLattices.Frameworks.qlloadMethod
qlload(filename::String) -> Dict{String, Any}
qlload(filename::String, name::String) -> Any
qlload(filename::String, name₁::String, name₂::String, names::String...) -> Tuple

Load data from a qld/qlc file.

With a single filename argument, returns all entries as a flat Dict. With a key, returns that single entry. With multiple keys, returns a Tuple.

source
QuantumLattices.Frameworks.qlsaveMethod
qlsave(filename::String, args...)

Save arbitrary data as key-value pairs to a file.

If the file does not exist, it is created. If a key already exists, it is replaced.

source
QuantumLattices.Frameworks.qlsaveMethod
qlsave(target::Symbol, model::LatticeModel, models::LatticeModel...; prefix::String="", suffix::String="", ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="")

Save lattice models to data (.qld) or cache (.qlc) files.

  • target::Symbol: :data or :cache.
  • prefix, suffix: passed to pathofbasename.
  • ndecimal, select, front, rear: passed to stampstr(::Parameters).
source
QuantumLattices.Frameworks.stampMethod
stamp(model::LatticeModel; ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="") -> String

Generate a deterministic stamp for a lattice model, formed as "config[-parameters]".

The stamp serves as the internal key in data/cache files. ndecimal, select, front, and rear are passed to str(::Parameters). When str(::Parameters) returns an empty string, the intermediate "-" is omitted.

source
QuantumLattices.Spatials.dlmsaveFunction
dlmsave(assignment::Assignment, delim='	'; prefix::String="", suffix::String="", ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="")

Save the data of an assignment to a delimited file.

source
QuantumLattices.expand!Method
expand!(result, gen::Generator) -> typeof(result)

Expand the generator lazily and add the operators to result.

source
QuantumLattices.expandMethod
expand(gen::Generator) -> valtype(gen)
expand(gen::Generator, ::Eager) -> valtype(gen)
expand(gen::Generator, ::Lazy) -> valtype(gen)

Expand a Generator. Defaults to eager expansion which combines similar terms; pass lazy to preserve separate terms.

Subtypes must implement expand(gen, ::Lazy).

source
QuantumLattices.expandMethod
expand(gen::OperatorGenerator, name::Symbol) -> Operators
expand(gen::OperatorGenerator, i::Int) -> Operators
expand(gen::OperatorGenerator, name::Symbol, i::Int) -> Operators

Expand an operator generator to get:

  1. the operators of a specific term;
  2. the operators on a specific bond;
  3. the operators of a specific term on a specific bond.
source
QuantumLattices.reset!Method
reset!(bound::Boundary, values::AbstractVector{<:Number}) -> Boundary
reset!(bound::Boundary, vectors::AbstractVector{<:AbstractVector{<:Number}}) -> Boundary
reset!(bound::Boundary, values::AbstractVector{<:Number}, vectors::AbstractVector{<:AbstractVector{<:Number}}) -> Boundary

Reset the values or vectors of a twisted boundary condition in-place.

Note

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

source
QuantumLattices.reset!Method
reset!(cat::CategorizedGenerator, transformation::LinearTransformation, source::CategorizedGenerator; kwargs...)

Reset a categorized generator by its source categorized generator of (representations of) quantum operators and the corresponding linear transformation.

source
QuantumLattices.reset!Method
reset!(cat::CategorizedGenerator, transformation::LinearTransformation, source::OperatorGenerator; kwargs...)

Reset a categorized generator by its source operator generator of (representations of) quantum operators and the corresponding linear transformation.

source
QuantumLattices.reset!Method
reset!(gen::OperatorGenerator, bonds::AbstractVector{<:Bond}, hilbert::Hilbert; vectors::AbstractVector{<:AbstractVector}=gen.operators.boundary.vectors) -> OperatorGenerator

Reset an operator generator by a new lattice and the corresponding hilbert space.

source
QuantumLattices.reset!Method
reset!(gen::StaticGenerator, transformation::LinearTransformation, source::StaticGenerator; kwargs...) -> StaticGenerator

Reset a static generator from a source by applying the linear transformation to the source operators.

source
QuantumLattices.strMethod
str(model::LatticeModel; prefix::String="", suffix::String="", ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="") -> String

Get the string representation of a lattice model, formed as basename[-parameters].

  • prefix and suffix: passed to basename(::LatticeModel).
  • ndecimal, select, front, rear: passed to str(::Parameters).
source
QuantumLattices.strMethod
str(params::Parameters; ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="") -> String

Convert a set of Parameters to a string of the form "front-name₁(value₁)name₂(value₂)-rear".

Each parameter nameᵢ(valueᵢ) is included only when select(nameᵢ) returns true. Numeric values are rounded to ndecimal decimal places. If front or rear is empty, the leading/trailing "-" is omitted.

source
QuantumLattices.update!Method
update!(alg::Algorithm; parameters...) -> Algorithm

Update the parameters of an algorithm and its associated frontend.

source
QuantumLattices.update!Method
update!(assign::Assignment; parameters...) -> Assignment

Update the parameters of an assignment and the status of its associated action.

source
QuantumLattices.update!Method
update!(cat::CategorizedGenerator, transformation::LinearTransformation, source::CategorizedGenerator; kwargs...) -> CategorizedGenerator

Update the parameters (including the boundary parameters) of a categorized generator based on its source categorized generator of (representations of) quantum operators and the corresponding linear transformation.

!!! Note The coefficients of boundops are also updated due to the change of the boundary parameters.

source
QuantumLattices.update!Method
update!(cat::CategorizedGenerator, transformation::LinearTransformation, source::OperatorGenerator; kwargs...) -> CategorizedGenerator

Update the parameters (including the boundary parameters) of a categorized generator based on its source operator generator of (representations of) quantum operators and the corresponding linear transformation.

!!! Note The coefficients of boundops are also updated due to the change of the boundary parameters.

source
QuantumLattices.update!Method
update!(cat::CategorizedGenerator{<:OperatorSum}; parameters...) -> CategorizedGenerator

Update the parameters (including the boundary parameters) of a categorized generator of (representations of) quantum operators.

!!! Note The coefficients of boundops are also updated due to the change of the boundary parameters.

source
QuantumLattices.update!Method
update!(formula::Formula; parameters...) -> Formula

Update the parameters of a Formula in place and return itself after update.

source
QuantumLattices.update!Method
update!(gen::OperatorGenerator; parameters...) -> typeof(gen)

Update the coefficients of the terms in a generator.

source
QuantumLattices.update!Method
update!(gen::StaticGenerator, transformation::LinearTransformation, source::StaticGenerator; kwargs...) -> StaticGenerator

Update the parameters of a static generator from a source. Since a static generator has no parameters, this is a no-op that returns the generator unchanged.

source
QuantumLattices.update!Method
update!(gen::StaticGenerator; parameters...) -> StaticGenerator

Update the parameters of a static generator. Since a static generator has no parameters, this is a no-op that returns the generator unchanged.

source
QuantumLattices.updateMethod
update(params::NamedTuple; parameters...) -> Parameters

Update a set of Parameters and return the updated one.

source