Frameworks
QuantumLattices.Frameworks.eager — Constant
const eager = Eager()Singleton instance of Eager.
QuantumLattices.Frameworks.lazy — Constant
const lazy = Lazy()Singleton instance of Lazy.
Core.Tuple — Method
Tuple(data::Data)Convert Data to Tuple.
QuantumLattices.Frameworks.Action — Type
ActionAbstract type for all actions.
QuantumLattices.Frameworks.Algorithm — Type
(alg::Algorithm)(assign::Assignment, checkoptions::Bool=true; options...) -> Assignment
(assign::Assignment)(alg::Algorithm, checkoptions::Bool=true; options...) -> AssignmentRun 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.
QuantumLattices.Frameworks.Algorithm — Type
Algorithm(name::Symbol, frontend::Frontend, parameters::Parameters=Parameters(frontend), map::Function=identity; dir::String=".", timer::TimerOutput=TimerOutput())Construct an algorithm.
QuantumLattices.Frameworks.Algorithm — Type
Algorithm{F<:Frontend, P<:Parameters, M<:Function} <: LatticeModelAn algorithm associated with a frontend.
QuantumLattices.Frameworks.Algorithm — Method
(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...) -> AssignmentAdd an assignment on an algorithm by providing the contents of the assignment, and run this assignment.
QuantumLattices.Frameworks.Assignment — Type
Assignment{A<:Action, P<:Parameters, M<:Function, T<:Tuple, D<:Data} <: LatticeModelAn assignment associated with an action.
QuantumLattices.Frameworks.Boundary — Type
Boundary{Names}(values::AbstractVector{<:Number}, vectors::AbstractVector{<:AbstractVector{<:Number}}) where NamesBoundary twist of operators.
QuantumLattices.Frameworks.Boundary — Method
(bound::Boundary)(operator::Operator; origin::Union{AbstractVector, Nothing}=nothing) -> OperatorGet the boundary twisted operator.
QuantumLattices.Frameworks.CategorizedGenerator — Type
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.
QuantumLattices.Frameworks.Data — Type
DataAbstract type for the data of an action.
QuantumLattices.Frameworks.Eager — Type
Eager <: ExpansionStyleEager expansion style with eager computation so that similar terms are combined in the final result.
QuantumLattices.Frameworks.ExpansionStyle — Type
ExpansionStyleExpansion style of a generator of (representations of) quantum operators. It has two singleton subtypes, Eager and Lazy.
QuantumLattices.Frameworks.Formula — Type
Formula{V, F<:Function, P<:Parameters}Representation of a quantum lattice system with an explicit analytical formula.
QuantumLattices.Frameworks.Formula — Method
(formula::Formula)(args...; kwargs...) -> valtype(formula)Get the result of a Formula.
QuantumLattices.Frameworks.Frontend — Type
Frontend <: LatticeModelFrontend of algorithms applied to a quantum lattice system.
QuantumLattices.Frameworks.Generator — Type
Generator{V} <: LatticeModelAbstract supertype for lattice models that are represented by generators of operators.
It has three branches: StaticGenerator, and ParametricGenerator (which includes CategorizedGenerator and OperatorGenerator).
Generator also serves as a constructor factory, dispatching to the appropriate concrete subtype based on the arguments.
QuantumLattices.Frameworks.Generator — Method
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) -> OperatorGeneratorFactory 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).
QuantumLattices.Frameworks.LatticeModel — Type
LatticeModelAbstract supertype for all representations of a quantum lattice system.
Subtypes must implement valtype. Parameters and update! should also be implemented as applicable.
QuantumLattices.Frameworks.LatticeModel — Method
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) -> OperatorGeneratorUnified 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.
QuantumLattices.Frameworks.Lazy — Type
Lazy <: ExpansionStyleLazy expansion style with lazy computation so that similar terms are not combined in the final result.
QuantumLattices.Frameworks.OperatorGenerator — Type
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.
QuantumLattices.Frameworks.OperatorGenerator — Type
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.
QuantumLattices.Frameworks.Parameters — Type
Parameters{Names}(values::Number...) where NamesA NamedTuple that contains the key-value pairs.
QuantumLattices.Frameworks.Parameters — Method
Parameters(bound::Boundary)Get the parameters of the twisted boundary condition.
QuantumLattices.Frameworks.Parameters — Method
Parameters(cat::CategorizedGenerator)Get the complete set of parameters of a categorized generator of (representations of) quantum operators.
QuantumLattices.Frameworks.Parameters — Method
Parameters(model::LatticeModel) -> NamedTupleGet the parameters of a lattice model.
Returns model.parameters if the type has a :parameters field, otherwise an empty NamedTuple.
QuantumLattices.Frameworks.Parameters — Method
Parameters(gen::OperatorGenerator) -> ParametersGet the parameters of an OperatorGenerator.
QuantumLattices.Frameworks.ParametricGenerator — Type
ParametricGenerator{V} <: Generator{V}Abstract supertype for generators that carry parameters and support update!.
Its concrete subtypes are CategorizedGenerator and OperatorGenerator.
QuantumLattices.Frameworks.StaticGenerator — Type
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.
QuantumLattices.QuantumOperators.LinearTransformation — Method
(transformation::LinearTransformation)(cat::CategorizedGenerator; kwargs...) -> CategorizedGeneratorApply a linear transformation to a categorized generator of (representations of) quantum operators.
QuantumLattices.QuantumOperators.LinearTransformation — Method
(transformation::LinearTransformation)(gen::OperatorGenerator; kwargs...) -> CategorizedGeneratorGet the transformation applied to a generator of quantum operators.
QuantumLattices.QuantumOperators.LinearTransformation — Method
(transformation::LinearTransformation)(gen::StaticGenerator; kwargs...) -> StaticGeneratorApply a linear transformation to a static generator of (representations of) quantum operators.
Base.Filesystem.basename — Function
basename(model::LatticeModel, target::Symbol=:void; prefix::String="", suffix::String="") -> StringGet 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.
Base.Filesystem.dirname — Method
dirname(model::LatticeModel) -> StringGet the dirname of the data/cache file of a lattice model.
Defaults to "." if the type has no dir field.
Base.eltype — Method
eltype(model::LatticeModel)
eltype(::Type{T}) where {T<:LatticeModel}Get the eltype of a LatticeModel.
Base.empty — Method
empty(cat::CategorizedGenerator) -> CategorizedGenerator
empty!(cat::CategorizedGenerator) -> CategorizedGeneratorGet an empty copy of a categorized generator or empty a categorized generator of (representations of) quantum operators.
Base.empty — Method
empty(gen::OperatorGenerator) -> OperatorGenerator
empty!(gen::OperatorGenerator) -> OperatorGeneratorGet an empty copy of or empty an operator generator.
Base.empty — Method
empty(gen::StaticGenerator) -> StaticGenerator
empty!(gen::StaticGenerator) -> StaticGeneratorGet an empty copy of a static generator or empty it in place.
Base.isempty — Method
isempty(gen::Generator) -> BoolJudge whether a Generator is empty after lazy expansion.
Base.iterate — Method
iterate(gen::Generator)
iterate(::Generator, state)Iterate over a Generator lazily.
Base.length — Method
length(gen::Generator) -> IntGet the number of operators after lazy expansion.
Base.match — Method
match(params₁::Parameters, params₂::Parameters; atol=atol, rtol=rtol) -> BoolJudge whether the second set of parameters matches the first.
Base.merge! — Method
merge!(bound::Boundary, another::Boundary) -> typeof(bound)Merge the values and vectors of the twisted boundary condition from another one.
Base.pathof — Method
pathof(model::LatticeModel, target::Symbol; prefix::String="", suffix::String="") -> StringGet the full path of a lattice model file.
Equivalent to joinpath(dirname(model), basename(model, target; prefix, suffix)).
Base.summary — Method
summary(alg::Algorithm)Provide a summary of an algorithm.
Base.valtype — Method
valtype(model::LatticeModel)
valtype(::Type{<:LatticeModel})Get the valtype of a LatticeModel. Subtypes must implement the type-level method.
QuantumLattices.Frameworks.checkoptions — Method
checkoptions(::Type{A}; options...) where {A<:Assignment}Check whether the keyword arguments are legal options of a certain type of Assignment.
QuantumLattices.Frameworks.config — Method
config(alg::Algorithm) -> StringGet the configuration label of an algorithm, inherited from its frontend.
QuantumLattices.Frameworks.config — Method
config(model::LatticeModel) -> StringGet the configuration fingerprint: the SHA-512 digest of contenttoconfig.
QuantumLattices.Frameworks.contenttocache — Method
contenttocache(model::LatticeModel) -> NamedTupleReturn 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.
QuantumLattices.Frameworks.contenttoconfig — Method
contenttoconfig(model::LatticeModel) -> TupleReturn 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.
QuantumLattices.Frameworks.datatype — Method
datatype(::Type{A}, ::Type{F}) where {A<:Action, F<:Frontend}Get the concrete subtype of Data according to the types of an Action and a Frontend.
QuantumLattices.Frameworks.hasoption — Method
hasoption(::Type{A}, option::Symbol) where {A<:Assignment} -> BoolJudge whether a certain type of Assignment has an option.
QuantumLattices.Frameworks.options — Method
options(::Type{<:Assignment}) -> NamedTupleGet the options of a certain type of Assignment.
QuantumLattices.Frameworks.optionsinfo — Method
optionsinfo(::Type{A}; level::Int=1) where {A<:Assignment} -> StringGet the complete info of the options of a certain type of Assignment, including that of its dependencies.
QuantumLattices.Frameworks.plain — Function
plainPlain boundary condition without any twist.
QuantumLattices.Frameworks.qlcclean — Function
qlcclean(dir::String="."; kwargs...) -> IntShortcut for qlclean(:cache, dir; kwargs...).
QuantumLattices.Frameworks.qlclean — Method
qlclean(filename::String; age::Real=Inf, maxcount::Int=typemax(Int)) -> Int
qlclean(target::Symbol, dir::String="."; age::Real=Inf, maxcount::Int=typemax(Int)) -> IntClean up entries in qld/qlc files.
filename: clean a single file.target=:data/:cache: clean all.qld/.qlcfiles indir.age: delete entries whosetouchtimeis older thanageseconds (defaultInf).maxcount: keep at mostmaxcountmost recent entries per file (defaulttypemax(Int)).
Files that become empty after cleaning are removed. Returns the number of entries deleted.
QuantumLattices.Frameworks.qlcsave — Method
qlcsave(model::LatticeModel, models::LatticeModel...; kwargs...) -> StringShortcut for qlsave(:cache, model, models...; kwargs...).
QuantumLattices.Frameworks.qldclean — Function
qldclean(dir::String="."; kwargs...) -> IntShortcut for qlclean(:data, dir; kwargs...).
QuantumLattices.Frameworks.qldsave — Method
qldsave(model::LatticeModel, models::LatticeModel...; kwargs...) -> StringShortcut for qlsave(:data, model, models...; kwargs...).
QuantumLattices.Frameworks.qlload — Method
qlload(filename::String) -> Dict{String, Any}
qlload(filename::String, name::String) -> Any
qlload(filename::String, name₁::String, name₂::String, names::String...) -> TupleLoad 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.
QuantumLattices.Frameworks.qlsave — Method
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.
QuantumLattices.Frameworks.qlsave — Method
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::dataor:cache.prefix,suffix: passed topathof→basename.ndecimal,select,front,rear: passed tostamp→str(::Parameters).
QuantumLattices.Frameworks.run! — Function
run!(alg::Algorithm, assign::Assignment; options...)Run an assignment based on an algorithm.
QuantumLattices.Frameworks.stamp — Method
stamp(model::LatticeModel; ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="") -> StringGenerate 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.
QuantumLattices.QuantumOperators.scalartype — Method
scalartype(model::LatticeModel)
scalartype(::Type{T}) where {T<:LatticeModel}Get the scalar type of a LatticeModel.
QuantumLattices.Spatials.dlmsave — Function
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.
QuantumLattices.expand! — Method
expand!(result, gen::Generator) -> typeof(result)Expand the generator lazily and add the operators to result.
QuantumLattices.expand — Method
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).
QuantumLattices.expand — Method
expand(gen::OperatorGenerator, name::Symbol) -> Operators
expand(gen::OperatorGenerator, i::Int) -> Operators
expand(gen::OperatorGenerator, name::Symbol, i::Int) -> OperatorsExpand an operator generator to get:
- the operators of a specific term;
- the operators on a specific bond;
- the operators of a specific term on a specific bond.
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}}) -> BoundaryReset the values or vectors of a twisted boundary condition in-place.
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.
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.
QuantumLattices.reset! — Method
reset!(gen::OperatorGenerator, bonds::AbstractVector{<:Bond}, hilbert::Hilbert; vectors::AbstractVector{<:AbstractVector}=gen.operators.boundary.vectors) -> OperatorGeneratorReset an operator generator by a new lattice and the corresponding hilbert space.
QuantumLattices.reset! — Method
reset!(gen::StaticGenerator, transformation::LinearTransformation, source::StaticGenerator; kwargs...) -> StaticGeneratorReset a static generator from a source by applying the linear transformation to the source operators.
QuantumLattices.str — Method
str(model::LatticeModel; prefix::String="", suffix::String="", ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="") -> StringGet the string representation of a lattice model, formed as basename[-parameters].
prefixandsuffix: passed tobasename(::LatticeModel).ndecimal,select,front,rear: passed tostr(::Parameters).
QuantumLattices.str — Method
str(params::Parameters; ndecimal::Int=10, select::Function=name::Symbol->true, front::String="", rear::String="") -> StringConvert 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.
QuantumLattices.update! — Method
update!(action::Action; parameters...) -> ActionUpdate the parameters of an action.
QuantumLattices.update! — Method
update!(alg::Algorithm; parameters...) -> AlgorithmUpdate the parameters of an algorithm and its associated frontend.
QuantumLattices.update! — Method
update!(assign::Assignment; parameters...) -> AssignmentUpdate the parameters of an assignment and the status of its associated action.
QuantumLattices.update! — Method
update!(bound::Boundary; parameters...) -> BoundaryUpdate the values of the boundary twisted phase.
QuantumLattices.update! — Method
update!(cat::CategorizedGenerator, transformation::LinearTransformation, source::CategorizedGenerator; kwargs...) -> CategorizedGeneratorUpdate 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.
QuantumLattices.update! — Method
update!(cat::CategorizedGenerator, transformation::LinearTransformation, source::OperatorGenerator; kwargs...) -> CategorizedGeneratorUpdate 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.
QuantumLattices.update! — Method
update!(cat::CategorizedGenerator{<:OperatorSum}; parameters...) -> CategorizedGeneratorUpdate 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.
QuantumLattices.update! — Method
update!(formula::Formula; parameters...) -> FormulaUpdate the parameters of a Formula in place and return itself after update.
QuantumLattices.update! — Method
update!(gen::OperatorGenerator; parameters...) -> typeof(gen)Update the coefficients of the terms in a generator.
QuantumLattices.update! — Method
update!(gen::StaticGenerator, transformation::LinearTransformation, source::StaticGenerator; kwargs...) -> StaticGeneratorUpdate 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.
QuantumLattices.update! — Method
update!(gen::StaticGenerator; parameters...) -> StaticGeneratorUpdate the parameters of a static generator. Since a static generator has no parameters, this is a no-op that returns the generator unchanged.
QuantumLattices.update — Method
update(params::NamedTuple; parameters...) -> ParametersUpdate a set of Parameters and return the updated one.