ExactDiagonalization
Quantum numbers
Quantum numbers can be considered as the conserved labels for the bases of a Hilbert space when a quantum system hosts some symmetries. Here we only implement Abelian quantum numbers because non-Abelian ones are far more complicated yet much less used.
AbelianQuantumNumber
RepresentationSpace
Core of ExactDiagonalization
BinaryBases
AbelianBases
Manual
ExactDiagonalization.GreaterOrLesserKind — Type
GreaterOrLesserKindThe union of GreenFunctionKind(:greater) and GreenFunctionKind(:lesser): the legal kind constraint for the constructors of single-sided Green functions (see GreenFunctionKind).
ExactDiagonalization.basicoptions — Constant
const basicoptions = (
tol = "tolerance of the computation",
maxiter = "maximum iteration of the computation",
v₀ = "initial state",
krylovdim = "maximum dimension of the Krylov subspace that will be constructed",
verbosity = "verbosity level",
release = "release or not the cache for the construction of the sparse matrix representation of the Hamiltonian"
)Basic options of computation tasks for exact diagonalization method.
ExactDiagonalization.edtimer — Constant
const edtimer = TimerOutput()Default shared timer for all exact diagonalization methods.
ExactDiagonalization.notimer — Constant
const notimer = TimerOutput()Shared disabled timer for all exact diagonalization methods: the @timeit instrumentation against it is a no-op. It serves as the default timer of the parallel (ntasks>1) code paths, since TimerOutput is not thread-safe.
ExactDiagonalization.Abelian — Type
const Abelian = AbelianQuantumNumberType alias for AbelianQuantumNumber.
ExactDiagonalization.Abelian — Method
Abelian(bs::AbelianBases)Get the Abelian quantum number of a set of spin bases.
ExactDiagonalization.Abelian — Method
Abelian(bs::BinaryBases)Get the Abelian quantum number of a set of binary bases.
ExactDiagonalization.AbelianBases — Type
AbelianBases{A<:Abelian, N} <: SectorA set of Abelian bases, that is, a set of bases composed from the product of local Abelian Graded spaces.
To improve the efficiency of the product of local Abelian Graded spaces, we adopt a two-step strategy:
- partition the local spaces into several groups in each of which the local spaces are combined via direct product and rearranged according to the Abelian quantum numbers, and then
- glue the results obtained in the previous step so that a sector with a certain Abelian quantum number can be targeted.
In principle, a binary-tree strategy can be more efficient, but our two-step strategy is enough for a quantum system that can be solved by the exact diagonalization method.
The partition of the local Abelian Graded spaces is assigned by a NTuple{N, Vector{Int}}, with each of its element contains the sequences of the grouped local spaces specified by a table.
ExactDiagonalization.AbelianBases — Method
AbelianBases(locals::AbstractVector{Int}, partition::NTuple{N, AbstractVector{Int}}=partition(length(locals))) where NConstruct a set of spin bases that subject to no quantum number conservation.
ExactDiagonalization.AbelianBases — Method
AbelianBases(locals::Vector{Graded{A}}, quantumnumber::A, partition::NTuple{N, AbstractVector{Int}}=partition(length(locals))) where {N, A<:Abelian}Construct a set of spin bases that preserves a certain symmetry specified by the corresponding Abelian quantum number.
ExactDiagonalization.AbelianGradedSpace — Type
AbelianGradedSpace(quantumnumbers::AbstractVector{<:AbelianQuantumNumber}, dimensions::AbstractVector{<:Integer}, dual::Bool=false; ordercheck::Bool=false, duplicatecheck::Bool=false, degeneracycheck::Bool=false)Construct an Abelian graded space.
Here:
quantumnumbersspecifies the Abelian quantum numbers labeling the irreducible representations of the corresponding Abelian group which must be sorted in the ascending order. Such an ordering should be manually guaranteed by the user. When and only when the keyword argumentordercheckistrue, the constructor will check whether this condition is satisfied and raise an error if it doesn't. Besides,quantumnumbersmust not contain duplicate Abelian quantum numbers, manually guaranteed by the user as well. This condition can be checked when and only when bothordercheck==trueandduplicatecheck==true. An error will be raised if this check fails.dimensionsspecifies the degenerate dimensions of the corresponding Abelian quantum numbers. Apparently, each degenerate dimension must be positive, which should also be manually guaranteed by the user. When and only when the keyword argumentdegeneracycheckistrue, the constructor will check whether this condition is satisfied and raise an error if it doesn't.dualspecifies whether the graded space is the dual representation of the corresponding Abelian group, which roughly speaking, can be viewed as the direction of the arrow of the Abelian quantum numbers labeling the irreducible representations. We assumedual==truecorresponds to the in-arrow anddual==falsecorresponds to the out-arrow.
ExactDiagonalization.AbelianGradedSpace — Type
AbelianGradedSpace{QN<:AbelianQuantumNumber} <: RepresentationSpace{QN}A quantum representation space of an Abelian group that has been decomposed into the direct sum of its irreducible representations.
ExactDiagonalization.AbelianGradedSpace — Method
AbelianGradedSpace(pairs; dual::Bool=false)
AbelianGradedSpace(pairs::Pair...; dual::Bool=false)
AbelianGradedSpace{QN}(pairs; dual::Bool=false) where {QN<:AbelianQuantumNumber}
AbelianGradedSpace{QN}(pairs::Pair...; dual::Bool=false) where {QN<:AbelianQuantumNumber}Construct an Abelian graded space.
In this function, the Abelian quantum numbers will be sorted automatically, therefore, their orders need not be worried. Duplicate and dimension checks of the quantum numbers are also carried out and errors will be raised if either such checks fails.
ExactDiagonalization.AbelianGradedSpaceProd — Type
AbelianGradedSpaceProd{N, QN<:AbelianQuantumNumber} <: CompositeAbelianGradedSpace{N, QN}Direct product of Abelian graded spaces.
ExactDiagonalization.AbelianGradedSpaceSum — Type
AbelianGradedSpaceSum{N, QN<:AbelianQuantumNumber} <: CompositeAbelianGradedSpace{N, QN}Direct sum of Abelian graded spaces.
ExactDiagonalization.AbelianQuantumNumber — Type
AbelianQuantumNumberAbstract type of Abelian quantum numbers.
An Abelian quantum number is the label of an irreducible representation of an Abelian group acting on a quantum representation space.
ExactDiagonalization.AbelianQuantumNumberProd — Type
AbelianQuantumNumberProd{T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} <: AbelianQuantumNumberDeligne tensor product of simple Abelian quantum numbers.
ExactDiagonalization.AbelianQuantumNumberProd — Method
AbelianQuantumNumberProd(contents::SimpleAbelianQuantumNumber...)
AbelianQuantumNumberProd(contents::Tuple{Vararg{SimpleAbelianQuantumNumber}})Construct a Deligne tensor product of simple Abelian quantum numbers.
ExactDiagonalization.AbelianQuantumNumberProd — Method
AbelianQuantumNumberProd{T}(vs::Vararg{Number, N}) where {N, T<:NTuple{N, SimpleAbelianQuantumNumber}}
AbelianQuantumNumberProd{T}(vs::NTuple{N, Number}) where {N, T<:NTuple{N, SimpleAbelianQuantumNumber}}Construct a Deligne tensor product of simple Abelian quantum numbers by their values.
ExactDiagonalization.BandLanczosMethod — Type
BandLanczosMethod(
orthᵣ::Orthogonalizer=ModifiedGramSchmidt2(), orthₒ::Orthogonalizer=ModifiedGramSchmidt();
tol::Real=2e-8, tolᵣ::Real=1e-8, keepvecs::Bool=true, maxdim::Integer=200, ntasks::Integer=1
)Construct a BandLanczosMethod for computing the zero-temperature Green function.
orthᵣ:Orthogonalizerused inblock_qr!for rank determination of initial and residual blocks.orthₒ:Orthogonalizerused inblock_reorthogonalize!for reorthogonalization against the Krylov basis during the Lanczos recurrence.tol: Lanczos convergence tolerance — iteration stops whennormres < tol.tolᵣ: QR rank determination tolerance inblock_qr!— a vector with norm <tolᵣis considered numerically zero.ntasks: number of parallel tasks over which theGreenFunctionconstructors distribute the independent target-sector computations (requires Julia to be started with multiple threads, e.g.julia -t auto, to take effect). The default1is serial; the parallel construction gives results identical to the serial one. Note that the peak memory usage grows with the number of concurrent tasks, and that the default timer of the parallel construction is the disablednotimer(TimerOutputis not thread-safe), so the per-sector progress messages may interleave.
ExactDiagonalization.BandLanczosMethod — Type
BandLanczosMethod <: GreenFunctionMethodBand Lanczos method for zero-temperature GreenFunction.
ExactDiagonalization.BinaryBases — Type
BinaryBases{A<:Abelian, B<:BinaryBasis, T<:AbstractVector{B}} <: SectorA set of binary bases.
ExactDiagonalization.BinaryBases — Method
BinaryBases(spindws, spinups, spinfulparticle::Abelian[ℕ ⊠ 𝕊ᶻ])
BinaryBases(spindws, spinups, spinfulparticle::Abelian[𝕊ᶻ ⊠ ℕ])Construct a set of binary bases that preserves both the particle number and the spin z-component conservation.
ExactDiagonalization.BinaryBases — Method
BinaryBases(spindws, spinups, sz::𝕊ᶻ)Construct a set of binary bases that preserves the spin z-component but not the particle number conservation.
ExactDiagonalization.BinaryBases — Method
BinaryBases(states, particle::ℕ)
BinaryBases(nstate::Integer, particle::ℕ)Construct a set of binary bases that preserves the particle number conservation.
ExactDiagonalization.BinaryBases — Method
BinaryBases(states)
BinaryBases(nstate::Integer)Construct a set of binary bases that subject to no quantum number conservation.
ExactDiagonalization.BinaryBasis — Type
BinaryBasis{I<:Unsigned}Binary basis represented by an unsigned integer.
Here, we adopt the following common rules:
- In a binary basis, a bit of an unsigned integer represents a single-particle state that can be occupied (
1) or unoccupied (0). - The position of this bit in the unsigned integer counting from the right corresponds to the sequence of the single-particle state specified by a table.
- When representing a many-body state by creation operators, they are arranged in ascending order according to their sequences.
In this way, any many-body state of canonical fermionic or hardcore bosonic systems can be represented ambiguously by the binary bases, e.g., $c^†_2c^†_3c^†_4|\text{Vacuum}\rangle$ is represented by $1110$.
ExactDiagonalization.BinaryBasis — Method
BinaryBasis(states; filter=index->true)
BinaryBasis{I}(states; filter=index->true) where {I<:Unsigned}Construct a binary basis with the given occupied states.
ExactDiagonalization.BinaryBasisRange — Type
BinaryBasisRange{I<:Unsigned} <: VectorSpace{BinaryBasis{I}}A continuous range of binary basis from 0 to 2^n-1.
ExactDiagonalization.CompositeAbelianGradedSpace — Type
CompositeAbelianGradedSpace{N, QN<:AbelianQuantumNumber} <: RepresentationSpace{QN}Abstract type of composite Abelian graded spaces.
ExactDiagonalization.DiskCSCMatrix — Type
DiskCSCMatrix{V, I<:Integer} <: AbstractSparseMatrix{V, I}A sparse matrix in CSC format whose payload is either held strongly in memory (isnothing(path), for small or uncached matrices, never evicted) or held weakly with backing files on disk: in the latter case the garbage collector may reclaim the payload under memory pressure, and the next access transparently reloads it via memory mapping.
Only read-only access is supported; no mutating methods are defined, so accidental in-place modification of a cached matrix is a MethodError rather than silent corruption of the backing files.
sparse reload is thread-safe (guarded by the per-entry lock). When a DiskCSCMatrix is serialized to another process, the payload is materialized and the received object is a detached in-memory proxy (path=nothing): the session-local backing files never leak across process boundaries.
ExactDiagonalization.DiskCSCMatrix — Method
DiskCSCMatrix(M::SparseMatrixCSC) -> DiskCSCMatrixWrap a sparse matrix into an in-memory DiskCSCMatrix proxy (strongly held, never evicted, nothing written to disk, not entered into any cache).
ExactDiagonalization.DiskCache — Type
DiskCacheA session-scoped disk-backed store of sparse matrices (DiskCSCMatrix) keyed by serialized content (see cachekey), with GC-driven eviction and transparent reload. Since the Dict keys are the full content bytes, distinct contents can never be confused, regardless of hash collisions. The on-disk directories are named by a monotonic counter: deduplication is the dictionary's job, not the file names'.
Entries are accessed exclusively through get! with a lazy default (get!(f, cache, key): f produces the matrix only on a miss) and removed through empty!. Thread-safe: they are serialized by the per-cache lock, and the disk writes of a new entry happen outside the lock under a directory name that is unique by construction. Process-safe by isolation: each process (and each DiskCache instance) writes to its own fresh temporary directory, so no cross-process coordination is needed.
ExactDiagonalization.DiskCache — Method
DiskCache(; parent::AbstractString=tempdir(), threshold::Integer=1<<20) -> DiskCacheCreate a DiskCache whose files live in a fresh subdirectory of parent (use a fast local disk, e.g. an NVMe scratch area, for parent when available; on Unix the default tempdir() honors the TMPDIR environment variable). Matrices smaller than threshold bytes are wrapped in in-memory proxies and never written to disk. The directory is removed (best effort) at the end of the session. The on-disk format is native binary and valid only within the current session.
ExactDiagonalization.ED — Type
ED(
lattice::AbstractLattice, hilbert::Hilbert, terms::OneOrMore{Term}, boundary::Boundary=plain, dtype::Type{<:Number}=valtype(terms);
neighbors::Union{Int, Neighbors}=nneighbor(terms)
)
ED(
lattice::AbstractLattice, hilbert::Hilbert, terms::OneOrMore{Term}, quantumnumbers::OneOrMore{Abelian}, boundary::Boundary=plain, dtype::Type{<:Number}=valtype(terms);
neighbors::Union{Int, Neighbors}=nneighbor(terms)
)Construct the exact diagonalization method for a quantum lattice system with/without quantum numbers.
ExactDiagonalization.ED — Type
ED(system::OperatorGenerator, dtype::Type{<:Number}=scalartype(system))
ED(lattice::Union{AbstractLattice, Nothing}, system::OperatorGenerator, dtype::Type{<:Number}=scalartype(system))
ED(system::OperatorGenerator, quantumnumbers::OneOrMore{Abelian}, dtype::Type{<:Number}=scalartype(system))
ED(lattice::Union{AbstractLattice, Nothing}, system::OperatorGenerator, quantumnumbers::OneOrMore{Abelian}, dtype::Type{<:Number}=scalartype(system))Construct the exact diagonalization method from a pre-built OperatorGenerator with/without quantum numbers.
ExactDiagonalization.ED — Type
ED{K<:EDKind, L<:Union{AbstractLattice, Nothing}, S<:Generator{<:Operators}, M<:EDMatrixization, H<:CategorizedGenerator{<:OperatorSum{<:EDMatrix}}} <: LatticeModelExact diagonalization method of a quantum lattice system.
ExactDiagonalization.EDEigen — Type
EDEigen{S<:Tuple{Vararg{Union{Abelian, Sector}}}}Eigen system by exact diagonalization method.
ExactDiagonalization.EDEigen — Method
EDEigen(sectors::Union{Abelian, Sector}...; nev::Int=1, which::Symbol=:SR)
EDEigen(sectors::Tuple{Vararg{Union{Abelian, Sector}}}; nev::Int=1, which::Symbol=:SR)Construct an EDEigen. nev is the number of eigenvalues to be computed and which the type of eigenvalues to be computed.
ExactDiagonalization.EDEigenData — Type
EDEigenData{V<:Number, T<:Number, S<:Sector} <: DataEigen decomposition in exact diagonalization method.
Compared to the usual eigen decomposition Eigen, EDEigenData contains a :sectors attribute to store the sectors of Hilbert space in which the eigen values and eigen vectors are computed. Furthermore, given that in different sectors the dimensions of the sub-Hilbert spaces can also be different, the :vectors attribute of EDEigenData is a vector of vector instead of a matrix.
ExactDiagonalization.EDKind — Type
EDKind{K}Kind of the exact diagonalization method applied to a quantum lattice system.
ExactDiagonalization.EDKind — Method
EDKind(::Type{<:FockIndex})Kind of the exact diagonalization method applied to a canonical quantum Fock lattice system.
ExactDiagonalization.EDKind — Method
EDKind(::Type{<:SpinIndex})Kind of the exact diagonalization method applied to a canonical quantum spin lattice system.
ExactDiagonalization.EDMatrix — Type
EDMatrix{M<:DiskCSCMatrix, S<:Sector} <: OperatorPack{M, Tuple{S, S}}Matrix representation of quantum operators between a ket Hilbert space and a bra Hilbert space.
ExactDiagonalization.EDMatrix — Method
EDMatrix(m::Union{DiskCSCMatrix, SparseMatrixCSC}, sector::Sector)
EDMatrix(m::Union{DiskCSCMatrix, SparseMatrixCSC}, braket::NTuple{2, Sector})
EDMatrix(m::Union{DiskCSCMatrix, SparseMatrixCSC}, bra::Sector, ket::Sector)Construct a matrix representation when
- the bra and ket Hilbert spaces share the same bases;
- the bra and ket Hilbert spaces may be different;
- the bra and ket Hilbert spaces may or may not be the same.
The sparse matrix payload is wrapped into an in-memory DiskCSCMatrix proxy.
ExactDiagonalization.EDMatrixization — Type
EDMatrixization{D<:Number, T<:AbstractDict, S<:Sector} <: MatrixizationMatrixization of a quantum lattice system on a target Hilbert space.
ExactDiagonalization.EDMatrixization — Method
(matrixization::EDMatrixization)(m::Union{Operator, Operators}; cached::Bool=true, kwargs...) -> OperatorSum{<:EDMatrix}Get the matrix representation of an operator or a set of operators on the target Hilbert space as an OperatorSum of EDMatrix blocks, one per braket of matrixization. With cached=true (the default), each block is memoized in the session-wide DiskCache under its cachekey (see matrix), so that identical systems share the blocks without reconstructing them.
ExactDiagonalization.EDMatrixization — Method
EDMatrixization{D}(table::AbstractDict, sector::S, sectors::S...) where {D<:Number, S<:Sector}
EDMatrixization{D}(table::AbstractDict, brakets::Vector{Tuple{S, S}}) where {D<:Number, S<:Sector}Construct a matrixization.
ExactDiagonalization.ExactMethod — Type
ExactMethod <: GreenFunctionMethodExact diagonalization method for zero-temperature GreenFunction.
Suitable for small Hilbert spaces and as the benchmark of BandLanczosMethod.
ExactDiagonalization.Graded — Type
const Graded = AbelianGradedSpaceType alias for AbelianGradedSpace.
ExactDiagonalization.Graded — Method
Graded{ℤ₁}(spin::Spin)
Graded{𝕊ᶻ}(spin::Spin)Decompose a local spin space into an Abelian graded space that preserves 1) no symmetry, and 2) spin-z component symmetry.
ExactDiagonalization.GreenFunction — Type
GreenFunction(operators::AbstractVector{<:QuantumOperator}, ed::Algorithm{<:ED}, kind::GreenFunctionKind, method::GreenFunctionMethod=BandLanczosMethod(); kwargs...)Construct a GreenFunction from a vector of quantum operators, an exact diagonalization algorithm, a kind marker (GreenFunctionKind), and a Green function method.
The keyword arguments are passed to the underlying constructor.
The default timer is ed.timer for the serial construction (ntasks(method)==1) and the disabled notimer for the parallel one.
ExactDiagonalization.GreenFunction — Type
GreenFunction(
operators::AbstractVector{<:QuantumOperator}, ed::ED, kind::GreaterOrLesserKind, method::Union{ExactMethod, BandLanczosMethod}=BandLanczosMethod();
e₀::Union{Real, Nothing}=nothing, v₀::Union{AbstractVector{<:Number}, Nothing}=nothing, sector₀::Union{Sector, Nothing}=nothing, callback=nothing, timer::Union{TimerOutput, Nothing}=nothing, kwargs...
)Construct a zero-temperature GreenFunction, by full diagonalization of each target sector for ExactMethod and by the band Lanczos method for BandLanczosMethod.
The independent target-sector computations are distributed over ntasks(method) parallel tasks (requires Julia to be started with multiple threads, e.g. julia -t auto, to take effect), with results identical to the serial construction. Note that the peak memory usage grows with the number of concurrent tasks, and that the default timer is edtimer for the serial construction and the disabled notimer for the parallel one (TimerOutput is not thread-safe), in which case the per-sector progress messages may interleave.
When supplied, callback is invoked once with a GreenFunctionInfo after construction. At zero temperature, Ω==e₀ and Z==1.
ExactDiagonalization.GreenFunction — Type
GreenFunction(
operators::AbstractVector{<:QuantumOperator}, ed::ED, kind::GreenFunctionKind{:retarded}, method::Union{BandLanczosMethod, ExactMethod}=BandLanczosMethod();
sign::Bool=false, e₀::Union{Real, Nothing}=nothing, v₀::Union{AbstractVector{<:Number}, Nothing}=nothing, sector₀::Union{Sector, Nothing}=nothing, callback=nothing, timer::Union{TimerOutput, Nothing}=nothing, kwargs...
)Construct the zero-temperature retarded Green function as the single merged pole sum of the greater and lesser parts (via the +/- algebra of GreenFunction), which are constructed by the zero-temperature GreenFunction constructor with the same method (BandLanczosMethod or ExactMethod) and share the same ground state.
With ntasks(method)>1, the greater and lesser parts are constructed concurrently, each distributing its target-sector computations over up to max(1, ntasks(method)÷2) tasks; the results are identical to the serial construction. Note that the peak memory usage grows with the number of concurrent tasks, and that the default timer is edtimer for the serial construction and the disabled notimer for the parallel one (TimerOutput is not thread-safe).
When supplied, callback is invoked once with a GreenFunctionInfo after construction. At zero temperature, Ω==e₀ and Z==1.
ExactDiagonalization.GreenFunction — Type
GreenFunction{T<:Number, V<:Real} <: FunctionGreen function expressed as a sum of simple poles,
G[i, j](ω) = sum(L[i, k]*R[j, k]/(ω-E[k]) for k in eachindex(E)),where L and R are the left and right amplitudes of each pole.
For Green's functions with a single initial state (e.g., the zero-temperature one), R==conj(L) and the pole amplitudes reduce to the single-amplitude-matrix form L[i, k]*conj(L[j, k]).
ExactDiagonalization.GreenFunction — Method
GreenFunction(Q::AbstractMatrix{<:Number}, E::AbstractVector{<:Number})Construct a GreenFunction from the single amplitude matrix Q, equivalent to GreenFunction(Q, conj(Q), E).
ExactDiagonalization.GreenFunction — Method
(gf::GreenFunction)(dest::AbstractMatrix{<:Number}, ω::Number; workspace=nothing) -> typeof(dest)Get the values of a GreenFunction at ω and overwrite dest with the result.
The pole sum is evaluated as L*Diagonal(inv.(ω.-E))*transpose(R) using BLAS. For repeated evaluations, preallocated workspace (size size(gf.L)) can be supplied.
ExactDiagonalization.GreenFunction — Method
GreenFunction(
operators::AbstractVector{<:QuantumOperator}, ed::ED, kind::GreaterOrLesserKind, method::ThermalExactMethod;
E₀::Union{AbstractVector{<:Real}, Nothing}=nothing, U₀::Union{AbstractMatrix{<:Number}, Nothing}=nothing, sector₀::Union{Sector, Nothing}=nothing, callback=nothing, timer::TimerOutput=edtimer, kwargs...
)Construct the finite-temperature Green function at inverse temperature method.β by exact method.
The trace is taken over the ground-state sector only, i.e. the canonical ensemble with all conserved quantum numbers fixed to the ground-state sector's values.
E₀andU₀: the optional precomputed spectrum (all eigen values and eigen vectors) of the ground-state sector, which must be provided together; reused as provided (e.g. shared between the two kinds by theGreenFunctionKind(:retarded)constructor), and computed internally by dense diagonalization ofsector₀when absent.sector₀: the ground-state sector; computed internally when absent. The Boltzmann weights are relative to its lowest eigen energyE₀[1].
When supplied, callback is invoked once with a GreenFunctionInfo after construction. Its Ω is the finite-temperature thermodynamic potential.
ExactDiagonalization.GreenFunction — Method
GreenFunction(
operators::AbstractVector{<:QuantumOperator}, ed::ED, kind::GreaterOrLesserKind, method::ThermalSeedBandLanczosMethod;
e₀::Union{Real, Nothing}=nothing, sector₀::Union{Sector, Nothing}=nothing, callback=nothing, timer::Union{TimerOutput, Nothing}=nothing, kwargs...
)Construct the finite-temperature Green function at inverse temperature method.β by the thermally-weighted seed band Lanczos method.
The trace is taken over the ground-state sector only, i.e. the canonical ensemble with all conserved quantum numbers fixed to the ground-state sector's values.
The Green functions of the individual random vectors are stored in method.samples for statistical analysis (overwritten at each construction).
e₀,sector₀: the ground-state energy and sector; recomputed each call when absent, by a Lanczos eigen solver with a random initial vector (seeThermalSeedBandLanczosMethodfor the reproducibility implications).
The independent random-vector computations are distributed over ntasks(method) parallel tasks (requires Julia to be started with multiple threads, e.g. julia -t auto, to take effect), and the sector computations within each sample over up to max(1, ntasks(method)÷min(ntasks(method), method.nrandom)) nested tasks. The random vectors are drawn from per-sample generators derived from method.seed (see samplerngs), so the results are reproducible for a nonzero seed and identical for the serial and all parallel constructions. Note that the peak memory usage grows with the number of concurrent samples, and that the default timer is edtimer for the serial construction and the disabled notimer for the parallel one (TimerOutput is not thread-safe), in which case the progress messages may interleave.
When supplied, callback is invoked once with a GreenFunctionInfo after construction. Its Ω is estimated from the same random samples.
ExactDiagonalization.GreenFunction — Method
GreenFunction(
operators::AbstractVector{<:QuantumOperator}, ed::ED, kind::GreenFunctionKind{:retarded}, method::ThermalExactMethod;
sign::Bool=false, E₀::Union{AbstractVector{<:Real}, Nothing}=nothing, U₀::Union{AbstractMatrix{<:Number}, Nothing}=nothing, sector₀::Union{Sector, Nothing}=nothing, callback=nothing, timer::TimerOutput=edtimer, kwargs...
)Construct the finite-temperature retarded Green function at inverse temperature method.β by the exact method, as the single merged pole sum of the greater and lesser parts (via the +/- algebra of GreenFunction), which share the same ground-state sector spectrum: computed internally, or reused from E₀ and U₀ provided together.
When supplied, callback is invoked once with a GreenFunctionInfo after construction. Its Ω is the finite-temperature thermodynamic potential.
ExactDiagonalization.GreenFunction — Method
GreenFunction(
operators::AbstractVector{<:QuantumOperator}, ed::ED, kind::GreenFunctionKind{:retarded}, method::ThermalSeedBandLanczosMethod;
sign::Bool=false, e₀::Union{Real, Nothing}=nothing, sector₀::Union{Sector, Nothing}=nothing, callback=nothing, timer::Union{TimerOutput, Nothing}=nothing, kwargs...
)Construct the finite-temperature retarded Green function at inverse temperature method.β by the thermally-weighted seed band Lanczos method, as the single merged pole sum of the greater and lesser parts (via the +/- algebra of GreenFunction), which share the same per-sample data of the first Lanczos runs: each random vector is used for both parts (exactly paired), and the merged per-sample Green functions are stored in method.samples.
The independent random-vector computations are distributed over ntasks(method) parallel tasks (requires Julia to be started with multiple threads, e.g. julia -t auto, to take effect); within each sample, the greater and lesser parts are constructed concurrently, each distributing its sector computations over up to max(1, ntasks(method)÷(2*min(ntasks(method), method.nrandom))) nested tasks. The random vectors are drawn from per-sample generators derived from method.seed (see samplerngs), so the results are reproducible for a nonzero seed and identical for the serial and all parallel constructions. Note that the peak memory usage grows with the number of concurrent samples, and that the default timer is edtimer for the serial construction and the disabled notimer for the parallel one (TimerOutput is not thread-safe), in which case the progress messages may interleave.
When supplied, callback is invoked once with a GreenFunctionInfo after construction. Its Ω is estimated from the same random samples.
ExactDiagonalization.GreenFunction — Method
GreenFunction(sample::ThermalSample, operators::AbstractVector{<:QuantumOperator}, ed::ED, kind::GreaterOrLesserKind, method::ThermalSeedBandLanczosMethod; sector₀::Sector, timer::Union{TimerOutput, Nothing}=nothing) -> GreenFunctionConstruct the Green function for a single random vector (carried by sample) of the thermally-weighted seed method, in the mandatory ground-state sector sector₀.
The operators are grouped by the sectors their adjoints map to from sector₀ (see sectorgroups), and the Hamiltonian and operator matrices of each sector are constructed on the fly inside the loop (cheaply, via the disk caches). The constructed GreenFunction is unnormalized and serves as a data container: divide its L by sample.z for the Green function of the individual sample, or accumulate the poles over the samples and divide by the total partition function for the combined Green function.
The independent target-sector computations are distributed over ntasks(method) parallel tasks (requires Julia to be started with multiple threads, e.g. julia -t auto, to take effect); the default timer is edtimer for the serial construction and the disabled notimer for the parallel one.
ExactDiagonalization.GreenFunction — Method
(gf::GreenFunction)(ω::Number) -> Matrix{promote_type(typeof(ω), eltype(gf))}Get the values of a GreenFunction at ω.
ExactDiagonalization.GreenFunctionInfo — Type
GreenFunctionInfo{T<:Real, S<:Sector}Thermodynamic information collected during a Green-function construction.
Z is the partition function relative to the ground-state energy, Ω is the thermodynamic potential, and sector₀ is the ground-state sector.
Use the callback keyword of a GreenFunction constructor to receive this information once after a successful construction.
ExactDiagonalization.GreenFunctionInfo — Method
GreenFunctionInfo(e₀::Real, Z::Real, sector₀::Sector, β::Real) -> GreenFunctionInfoConstruct finite-temperature information with Ω=e₀-log(Z)/β where e₀ is the ground-state energy and β is the inverse temperature.
ExactDiagonalization.GreenFunctionInfo — Method
GreenFunctionInfo(e₀::Real, sector₀::Sector) -> GreenFunctionInfoConstruct zero-temperature information with Z==1 and Ω==e₀ where e₀ is the ground-state energy.
ExactDiagonalization.GreenFunctionKind — Type
GreenFunctionKind{K}The kind marker of a Green function construction, enabling dispatch on it: GreenFunctionKind(:greater), GreenFunctionKind(:lesser) and GreenFunctionKind(:retarded) select the greater, lesser and retarded Green function, respectively.
ExactDiagonalization.GreenFunctionMethod — Type
GreenFunctionMethodAbstract type for the methods to compute Green's functions.
ExactDiagonalization.GroundStateExpectation — Type
GroundStateExpectation{D<:Number, O<:Array{<:Union{Operator, Operators}}}Ground state expectation of operators.
ExactDiagonalization.GroundStateExpectationData — Type
GroundStateExpectationData{A<:Array{<:Number}} <: DataData of ground state expectation of operators, including:
values::A: values of the ground state expectation.
ExactDiagonalization.RawStderrLogger — Type
RawStderrLogger <: AbstractLoggerA minimal logger that prints messages verbatim to stderr (no level tag, no metadata, no newline), used for the in-place (\r-overwritten) progress display.
ExactDiagonalization.RepresentationSpace — Type
RepresentationSpace{QN<:AbelianQuantumNumber} <: VectorSpace{QN}Abstract type of quantum representation spaces of Abelian groups.
ExactDiagonalization.Sector — Type
Sector(hilbert::Hilbert{<:Fock}, basistype::Type{<:Unsigned}=UInt) -> BinaryBases
Sector(::ℤ₁, hilbert::Hilbert{<:Fock}, basistype::Type{<:Unsigned}=UInt; table::AbstractDict=Table(hilbert, Metric(EDKind(hilbert), hilbert))) -> BinaryBases
Sector(quantumnumber::ℕ, hilbert::Hilbert{<:Fock}, basistype::Type{<:Unsigned}=UInt; table::AbstractDict=Table(hilbert, Metric(EDKind(hilbert), hilbert))) -> BinaryBases
Sector(quantumnumber::Union{𝕊ᶻ, Abelian[ℕ ⊠ 𝕊ᶻ], Abelian[𝕊ᶻ ⊠ ℕ]}, hilbert::Hilbert{<:Fock}, basistype::Type{<:Unsigned}=UInt; table::AbstractDict=Table(hilbert, Metric(EDKind(hilbert), hilbert))) -> BinaryBasesConstruct the binary bases of a Hilbert space with the specified quantum number.
ExactDiagonalization.Sector — Type
Sector(hilbert::Hilbert{<:Spin}, partition::Tuple{Vararg{AbstractVector{Int}}}=partition(length(hilbert))) -> AbelianBases
Sector(
quantumnumber::Abelian, hilbert::Hilbert{<:Spin}, partition::Tuple{Vararg{AbstractVector{Int}}}=partition(length(hilbert));
table::AbstractDict=Table(hilbert, Metric(EDKind(hilbert), hilbert))
) -> AbelianBasesConstruct the Abelian bases of a spin Hilbert space with the specified quantum number.
ExactDiagonalization.Sector — Type
SectorA sector of the Hilbert space which forms the bases of an irreducible representation of the Hamiltonian of a quantum lattice system.
ExactDiagonalization.SectorFilter — Type
SectorFilter{S} <: LinearTransformationFilter the target bra and ket Hilbert spaces.
It is a linear projection on EDMatrix: the matrix is kept if its id is contained in brakets, and zeroed otherwise. Since an OperatorSum never contains zero entries (zeros are always dropped by add!), applied to an OperatorSum{<:EDMatrix} the excluded entries are effectively removed from the result.
ExactDiagonalization.SimpleAbelianQuantumNumber — Type
SimpleAbelianQuantumNumber <: AbelianQuantumNumberAbstract type of simple Abelian quantum numbers. That is, it contains only one label.
ExactDiagonalization.SpinCoherentState — Type
(state::SpinCoherentState)(bases::AbelianBases, table::AbstractDict, dtype=ComplexF64) -> Vector{dtype}Get the vector representation of a spin coherent state with the given Abelian bases and table.
ExactDiagonalization.SpinCoherentState — Type
SpinCoherentState <: CompositeDict{Int, Tuple{Float64, Float64}}Spin coherent state on a block of lattice sites.
The structure of the spin coherent state is specified by a Dict{Int, Tuple{Float64, Float64}}, which contains the site-(θ, ϕ) pairs with site being the site index in a lattice and (θ, ϕ) denoting the polar and azimuth angles in radians of the classical magnetic moment on this site.
ExactDiagonalization.SpinCoherentState — Method
SpinCoherentState(structure::AbstractDict{Int, <:AbstractVector{<:Number}})
SpinCoherentState(structure::AbstractDict{Int, <:NTuple{2, Number}}; unit::Symbol=:radian)Construct a spin coherent state on a block of lattice sites.
ExactDiagonalization.SpinCoherentStateProjection — Type
SpinCoherentStateProjectionProjection of states obtained by exact diagonalization method onto spin coherent states.
ExactDiagonalization.SpinCoherentStateProjection — Method
SpinCoherentStateProjection(configuration::SpinCoherentState, polars::AbstractVector{<:Real}, azimuths::AbstractVector{<:Real})
SpinCoherentStateProjection(configuration::SpinCoherentState, np::Integer, na::Integer)Construct a SpinCoherentStateProjection.
ExactDiagonalization.SpinCoherentStateProjectionData — Type
SpinCoherentStateProjectionData <: DataData of spin coherent state projection, including:
polars::Vector{Float64}: global polar angles of the spin coherent states.azimuths::Vector{Float64}: global azimuth angles of the spin coherent states.values::Matrix{Float64}: projection of the state obtained by exact diagonalization method onto the spin coherent states.
ExactDiagonalization.StaticTwoPointCorrelator — Type
StaticTwoPointCorrelator{O<:Union{Operator, Operators}, R<:ReciprocalSpace}Static two-point correlation function.
ExactDiagonalization.StaticTwoPointCorrelatorData — Type
StaticTwoPointCorrelatorData{R<:ReciprocalSpace, V<:Array{Float64}} <: DataData of static two-point correlation function, including:
reciprocalspace::R: reciprocal space to compute the static two-point correlation function.values::V: values of the static two-point correlation function.
ExactDiagonalization.ThermalExactMethod — Type
ThermalExactMethod <: GreenFunctionMethodExact diagonalization method for the finite-temperature Green function.
The trace is taken over the ground-state sector only, i.e. the canonical ensemble with all conserved quantum numbers fixed to the ground-state sector's values.
Suitable for small Hilbert spaces and as the benchmark of ThermalSeedBandLanczosMethod.
ExactDiagonalization.ThermalExactMethod — Method
ThermalExactMethod(; β::Real, cutoff::Real=0.0)Construct a ThermalExactMethod for computing the finite-temperature Green function at inverse temperature β by exact diagonalization.
β: the inverse temperature.cutoff: Boltzmann weight threshold (dimensionless). Only eigenstates withexp(-β*(Eₙ-e₀))>=cutoffare kept as initial states. The default0.0keeps all eigenstates (strictly exact).
ExactDiagonalization.ThermalSample — Type
ThermalSample{T<:Number, V<:Real}The per-sample data of the first Lanczos run (thermal state preparation) of the thermally-weighted seed method (see ThermalSeedBandLanczosMethod) for a single random vector |r⟩.
Let oᵢ = ⟨r|ψᵢ⟩ denote the overlaps of the random vector with the Ritz states:
φ::Vector{T}: the thermally-weighted state|φ⟩ = ∑ᵢ exp(-βεᵢ/2)conj(oᵢ)|ψᵢ⟩(the TPQ state);energies::Vector{V}: the Ritz energiesεᵢof the kept states (absolute energies);states::Matrix{T}: the kept Ritz states|ψᵢ⟩, stored as columns;weights::Vector{T}: the per-state weightswᵢ = exp(-βεᵢ/2)oᵢ(signed or complex, as they carry the overlapsoᵢ);z::V: the sample partition functionz = ∑ₗ |oₗ|²exp(-βεₗ).
ExactDiagonalization.ThermalSample — Method
ThermalSample(H₀::AbstractMatrix{<:Number}, method::ThermalSeedBandLanczosMethod, e₀::Real; timer::TimerOutput=edtimer, rng::AbstractRNG=default_rng()) -> ThermalSampleConstruct a ThermalSample for a single random vector of the thermally-weighted seed method, by running the first Lanczos (thermal state preparation) on the ground-state-sector Hamiltonian H₀ with ground-state energy e₀.
The random vector is drawn from rng, which defaults to the global RNG; the GreenFunction constructors pass per-sample generators (see samplerngs).
ExactDiagonalization.ThermalSeedBandLanczosMethod — Type
ThermalSeedBandLanczosMethod(
orthᵣ::Orthogonalizer=ModifiedGramSchmidt2(), orthₒ::Orthogonalizer=ModifiedGramSchmidt();
β::Real, cutoff::Real=1e-3, nrandom::Integer=10, maxdim₁::Integer=200, maxdim₂::Integer=200, seed::Integer=0, tol::Real=2e-8, tolᵣ::Real=1e-8, ntasks::Integer=1
)Construct a ThermalSeedBandLanczosMethod for computing the finite-temperature Green function at inverse temperature β.
β: the inverse temperature.cutoff: dimensionless weight threshold for the kept Lanczos eigenstates: only those withexp(-β(εᵢ-e₀)/2)>=cutoffare kept in the thermally-weighted seed, wheree₀is the ground state energy. The discarded states bias the Green function by O(cutoff²) relatively.nrandom: number of random vectors.maxdim₁: number of Lanczos iterations of the first (state-preparing) run.maxdim₂: number of Lanczos iterations of the second (resolvent) run.seed: seed of the random number generator for reproducibility;0means not reseeding (truly random samples). For fully deterministic results, passe₀andsector₀explicitly to the constructors, otherwise they are recomputed each call by a Lanczos eigen solver with a random initial vector, which may flip the signs of some LAPACK eigenvectors in the poles (the Green function values are invariant under these sign flips). An independent generator is derived from(seed, r)for ther-th random vector (seesamplerngs), so for a nonzero seed the results are reproducible and identical for the serial and all parallel constructions.tol: Lanczos convergence tolerance. Iteration stops whennormres < tol.tolᵣ: QR rank determination tolerance inblock_qr!. A vector with norm <tolᵣis considered numerically zero.orthᵣ:Orthogonalizerused inblock_qr!for rank determination of initial and residual blocks.orthₒ:Orthogonalizerused inblock_reorthogonalize!for reorthogonalization against the Krylov basis during the Lanczos recurrence.ntasks: number of parallel tasks over which theGreenFunctionconstructors distribute thenrandomindependent random-vector computations, with the sector computations within each sample nested over up tomax(1, ntasks÷min(ntasks, nrandom))tasks (halved once more for the retarded construction, whose greater and lesser parts are also concurrent). The default1is serial; for a nonzeroseed, the parallel results are reproducible and independent of the number of tasks. Note that the peak memory usage grows with the number of concurrent samples, and that the default timer of the parallel construction is the disablednotimer(TimerOutputis not thread-safe), so the progress messages may interleave.
ExactDiagonalization.ThermalSeedBandLanczosMethod — Type
ThermalSeedBandLanczosMethod{OQ<:Orthogonalizer, OR<:Orthogonalizer} <: GreenFunctionMethodThermally-weighted seed band Lanczos method for the finite-temperature Green function (the Kokalj variant of the low-temperature Lanczos method).
The trace is taken over the ground-state sector only, i.e. the canonical ensemble with all conserved quantum numbers fixed to the ground-state sector's values.
For each of nrandom random vectors, a first Lanczos run prepares the approximate thermally-weighted pure state |TPQ⟩=∑ₗexp(-βεₗ/2)⟨ψₗ|r⟩|ψₗ⟩ and a second band Lanczos run seeded by A†|TPQ⟩ resolves the spectral function. Both runs keep the Krylov basis for full reorthogonalization.
The field samples is lazily initialized: empty at construction; overwritten by each GreenFunction construction with the Green functions of the individual random vectors (of the constructed kind, merged per sample for the GreenFunctionKind(:retarded) construction).
ExactDiagonalization.fℤ₂ — Type
fℤ₂ <: ℤ{2}Fermion parity.
ExactDiagonalization.sℤ₂ — Type
sℤ₂ <: ℤ{2}Spin parity.
ExactDiagonalization.ℕ — Type
ℕ <: 𝕌₁Concrete Abelian quantum number of the particle number.
ExactDiagonalization.ℤ — Type
ℤ{N} <: SimpleAbelianQuantumNumberAbstract type of ℤₙ quantum numbers.
ExactDiagonalization.ℤ₁ — Type
ℤ₁ <: ℤ{1}ℤ₁, i.e., the trivial quantum number.
ExactDiagonalization.𝕊ᶻ — Type
𝕊ᶻ <: 𝕌₁Concrete Abelian quantum number of the z-component of a spin.
ExactDiagonalization.𝕌₁ — Type
𝕌₁ <: SimpleAbelianQuantumNumberAbstract type of 𝕌₁ quantum numbers.
QuantumLattices.DegreesOfFreedom.CompositeIndex — Method
(index::CompositeIndex)(quantumnumber::Abelian) -> AbelianGet the resulting Abelian quantum number after a CompositeIndex acts upon an initial Abelian quantum number.
QuantumLattices.DegreesOfFreedom.Index — Method
(index::Index)(quantumnumber::Abelian) -> AbelianGet the resulting Abelian quantum number after an Index acts upon an initial Abelian quantum number.
QuantumLattices.DegreesOfFreedom.InternalIndex — Method
(index::InternalIndex)(quantumnumber::AbelianQuantumNumberProd) -> AbelianQuantumNumberProdGet the resulting Deligne tensor product of Abelian quantum numbers after an InternalIndex acts upon each component of an AbelianQuantumNumberProd.
QuantumLattices.DegreesOfFreedom.Metric — Method
Metric(::EDKind{:Abelian}, ::Hilbert{<:Spin}) -> OperatorIndexToTupleGet the index-to-tuple metric for a canonical quantum spin lattice system.
QuantumLattices.DegreesOfFreedom.Metric — Method
Metric(::EDKind{:Binary}, ::Hilbert{<:Fock}) -> OperatorIndexToTupleGet the index-to-tuple metric for a canonical quantum Fock lattice system.
QuantumLattices.QuantumOperators.OperatorProd — Method
(op::OperatorProd)(quantumnumber::Abelian) -> AbelianGet the resulting Abelian quantum number after an OperatorProd acts upon an initial Abelian quantum number.
QuantumLattices.QuantumOperators.OperatorSet — Method
(ops::OperatorSet)(quantumnumber::Abelian) -> AbelianGet the resulting Abelian quantum number after an OperatorSet acts upon an initial Abelian quantum number.
QuantumLattices.QuantumSystems.FockIndex — Method
(index::FockIndex)(quantumnumber::ℤ₁) -> ℤ₁
(index::FockIndex)(quantumnumber::ℕ) -> ℕ
(index::FockIndex)(quantumnumber::𝕊ᶻ) -> 𝕊ᶻGet the resulting Abelian quantum number after a FockIndex acts upon an initial Abelian quantum number.
QuantumLattices.QuantumSystems.SpinIndex — Method
(index::SpinIndex)(quantumnumber::ℤ₁) -> ℤ₁
(index::SpinIndex)(quantumnumber::𝕊ᶻ) -> 𝕊ᶻGet the resulting Abelian quantum number after a SpinIndex acts upon an initial Abelian quantum number.
Base.:+ — Method
+(g₁::GreenFunction, g₂::GreenFunction) -> GreenFunction
-(g₁::GreenFunction, g₂::GreenFunction) -> GreenFunction
-(g::GreenFunction) -> GreenFunctionThe algebra of Green functions: addition/subtraction is the concatenation of the pole sets (E = [E₁; E₂], L = [L₁ ±L₂], R = [R₁ R₂]), which is exact since G(ω) is linear in the poles. The ranks must match.
Base.Broadcast.broadcast — Method
broadcast(::Type{Sector}, quantumnumbers::OneAtLeast{Abelian}, hilbert::Hilbert, args...; table::AbstractDict=Table(hilbert, Metric(EDKind(hilbert), hilbert))) -> NTuple{fieldcount(typeof(quantumnumbers)), Sector}Construct a set of sectors based on the quantum numbers and a Hilbert space.
Base.Broadcast.broadcast — Method
broadcast(
::Type{Sector}, quantumnumbers::OneAtLeast{Abelian}, hilbert::Hilbert{<:Spin}, partition::NTuple{N, AbstractVector{Int}}=partition(length(hilbert));
table::AbstractDict=Table(hilbert, Metric(EDKind(hilbert), hilbert))
) where N -> NTuple{fieldcount(typeof(quantumnumbers)), AbelianBases}Construct a set of Abelian bases based on the quantum numbers and a Hilbert space.
Base.adjoint — Method
adjoint(gs::AbelianGradedSpace) -> typeof(gs)Get the dual of an Abelian graded space.
Base.count — Method
count(basis::BinaryBasis) -> Int
count(basis::BinaryBasis, start::Integer, stop::Integer) -> IntCount the number of occupied single-particle states for a binary basis.
Base.count — Method
count(data::EDEigenData) -> IntCount the number of eigen value-vector-sector groups contained in an EDEigenData.
Base.count — Method
count(gf::GreenFunction) -> IntCount the number of poles contributing to a GreenFunction.
Base.cumsum — Method
cumsum(rs::RepresentationSpace, i::Union{Integer, CartesianIndex}) -> IntGet the cumulative degenerate dimension up to the ith Abelian quantum number contained in a representation space.
Base.cumsum — Method
cumsum(gs::AbelianGradedSpace{QN}, qn::QN) where {QN<:AbelianQuantumNumber} -> IntGet the cumulative dimension of an Abelian graded space up to a certain Abelian quantum number contained in an Abelian graded space.
Base.eltype — Method
eltype(gf::GreenFunction)
eltype(::Type{<:GreenFunction{T}}) where {T<:Number}Get the eltype of a GreenFunction.
Base.empty! — Method
empty!(cache::DiskCache) -> DiskCacheRemove all entries of cache and delete their files (best effort), extending Base.empty!. The directory-name counter is deliberately not reset, so that directories whose deletion failed (e.g. due to live memory mappings) are never reused for new contents.
Thread-safe: the entry table is cleared under the per-cache lock, and the files of each entry are deleted under the per-entry lock so that a concurrent sparse reload cannot race the deletion.
Base.get! — Method
get!(f::Function, cache::DiskCache, key::String) -> DiskCSCMatrixGet the proxy cached under key; on a miss, invoke f() to produce the matrix, store it under key, and return its proxy, extending Base.get!. This is the sole entry accessor of DiskCache: the returned value is always the proxy associated with key after the call, so two concurrent calls with the same key both return the winner's proxy. Matrices smaller than cache.threshold bytes are wrapped in an in-memory proxy (strongly held, never evicted) and are not written to disk.
Thread-safe: the key lookup, the allocation of the on-disk directory name, and the registration of the new entry happen under the per-cache lock, while f() and the disk writes happen outside it. Two concurrent calls with the same key may both invoke f() (the expensive construction is deliberately not serialized); the loser discards its files and returns the winner's proxy.
Base.getindex — Method
getindex(gs::AbelianGradedSpace, indexes::AbstractVector{<:Integer}) -> typeof(gs)
getindex(gs::AbelianGradedSpace{QN}, quantumnumbers::AbstractVector{QN}) where {QN<:AbelianQuantumNumber} -> AbelianGradedSpace{QN}Get a subset of an Abelian graded space.
Base.getindex — Method
getindex(gs::AbelianGradedSpace, i::Union{Integer, CartesianIndex})Get the ith Abelian quantum number contained in an Abelian graded space.
Base.getindex — Method
getindex(qn::AbelianQuantumNumberProd, i::Integer) -> SimpleAbelianQuantumNumberGet the ith simple Abelian quantum number in a Deligne tensor product.
Base.getindex — Method
getindex(::Type{Abelian}, ::Type{T}) where {T<:AbelianQuantumNumber} -> Type{T}Overloaded [] for Abelian, i.e., the support of syntax Abelian[T] where T<:AbelianQuantumNumber, which is helpful for the construction of tensor-product Abelian quantum numbers.
Base.isone — Method
isone(basis::BinaryBasis, state::Integer) -> BoolJudge whether the specified single-particle state is occupied for a binary basis.
Base.iszero — Method
iszero(basis::BinaryBasis, state::Integer) -> BoolJudge whether the specified single-particle state is unoccupied for a binary basis.
Base.iterate — Function
iterate(basis::BinaryBasis)
iterate(basis::BinaryBasis, state)Iterate over the numbers of the occupied single-particle states.
Base.length — Method
length(gs::AbelianGradedSpace) -> IntGet the number of inequivalent irreducible representations (i.e., the Abelian quantum numbers) of an Abelian graded space.
Base.length — Method
length(qn::AbelianQuantumNumberProd) -> IntGet the length of a Deligne tensor product.
Base.match — Method
match(sector₁::Sector, sector₂::Sector) -> BoolJudge whether two sectors match each other, that is, whether they can be used together as the bra and ket spaces.
Base.merge — Method
merge(rs::AbelianGradedSpaceProd) -> Tuple{AbelianGradedSpace{eltype(rs)}, Dict{eltype(rs), Vector{NTuple{rank(rs), eltype(rs)}}}}Get the decomposition of the direct product of several Abelian graded spaces and its corresponding fusion processes.
For a set of Abelian graded spaces (gs₁, gs₂, ...), their direct product space can contain several equivalent irreducible representations because for different sets of Abelian quantum numbers (qn₁, qn₂, ...) where qnᵢ∈gsᵢ, the fusion, i.e., ⊗(qn₁, qn₂, ...) may give the same result qn. This function returns the decomposition of the direct product of (gs₁, gs₂, ...) as well as all the fusion processes of each quantum number contained in the decomposition.
Base.pairs — Method
pairs(rs::RepresentationSpace, ::typeof(dimension)) -> RepresentationSpacePairs
pairs(rs::RepresentationSpace, ::typeof(range)) -> RepresentationSpacePairsReturn an iterator that iterates over the pairs of the Abelian quantum numbers and their corresponding (slices of the) degenerate dimensions contained in a representation space.
Base.range — Method
range(bs::AbelianBases) -> AbstractVector{Int}Get the range of the target sector of an AbelianBases in the combined via direct product bases.
Base.range — Method
range(gs::AbelianGradedSpace, qn::Union{Integer, CartesianIndex}) -> UnitRange{Int}
range(gs::AbelianGradedSpace{QN}, qn::QN) where {QN<:AbelianQuantumNumber} -> UnitRange{Int}Get the slice of the degenerate dimension of an Abelian quantum number contained in an Abelian graded space.
Base.range — Method
range(rs::AbelianGradedSpaceProd, i::Union{Integer, CartesianIndex}) -> AbstractVector{Int}Get the slice of the degenerate dimension of the ith Abelian quantum number in the direct product of several Abelian graded spaces.
Base.range — Method
range(rs::AbelianGradedSpaceSum, i::Union{Integer, CartesianIndex}) -> UnitRange{Int}Get the slice of the degenerate dimension of the ith Abelian quantum number in the direct sum of several Abelian graded spaces.
Base.range — Method
range(rs::AbelianGradedSpaceProd{N, QN}, qns::NTuple{N, QN}) where {N, QN<:AbelianQuantumNumber} -> AbstractVector{Int}Get the slice of the degenerate dimension of the Abelian quantum number fused by qns in the direct product of several Abelian graded spaces.
Base.split — Method
split(target::QN, rs::AbelianGradedSpaceProd{N, QN}; nmax::Real=20) where {N, QN<:AbelianQuantumNumber} -> Set{NTuple{N, QN}}Find a set of splittings of the target Abelian quantum number with respect to the direct product of several Abelian graded spaces.
Base.values — Method
values(qn::AbelianQuantumNumberProd) -> NTuple{rank(qn), Number}Get the values of the simple Abelian quantum numbers in a Deligne tensor product.
Base.values — Method
values(qn::SimpleAbelianQuantumNumber) -> Tuple{Number}Get the value of a simple Abelian quantum number and return it as the sole element of a tuple.
ExactDiagonalization.:⊠ — Method
⊠(bs::BinaryBases, another::Abelian) -> BinaryBases
⊠(another::Abelian, bs::BinaryBases) -> BinaryBasesDeligne tensor product the quantum number of a set of binary bases with another quantum number.
ExactDiagonalization.:⊠ — Method
⊠(qn::SimpleAbelianQuantumNumber, qns::SimpleAbelianQuantumNumber...) -> AbelianQuantumNumberProd
⊠(qn₁::SimpleAbelianQuantumNumber, qn₂::AbelianQuantumNumberProd) -> AbelianQuantumNumberProd
⊠(qn₁::AbelianQuantumNumberProd, qn₂::SimpleAbelianQuantumNumber) -> AbelianQuantumNumberProd
⊠(qn₁::AbelianQuantumNumberProd, qn₂::AbelianQuantumNumberProd) -> AbelianQuantumNumberProdDeligne tensor product of Abelian quantum numbers.
ExactDiagonalization.:⊠ — Method
⊠(QN::Type{<:SimpleAbelianQuantumNumber}, QNS::Type{<:SimpleAbelianQuantumNumber}...) -> Type{AbelianQuantumNumberProd{Tuple{QN, QNS...}}}
⊠(::Type{QN}, ::Type{AbelianQuantumNumberProd{T}}) where {QN<:SimpleAbelianQuantumNumber, T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} -> Type{AbelianQuantumNumberProd{Tuple{QN, fieldtypes(T)...}}}
⊠(::Type{AbelianQuantumNumberProd{T}}, ::Type{QN}) where {T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}, QN<:SimpleAbelianQuantumNumber} -> Type{AbelianQuantumNumberProd{Tuple{fieldtypes(T)...}, QN}}
⊠(::Type{AbelianQuantumNumberProd{T₁}}, ::Type{AbelianQuantumNumberProd{T₂}}) where {T₁<:Tuple{Vararg{SimpleAbelianQuantumNumber}}, T₂<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} -> Type{AbelianQuantumNumberProd{Tuple{fieldtypes(T₁)..., fieldtypes(T₂)...}}}Deligne tensor product of Abelian quantum numbers.
ExactDiagonalization.assemble — Method
assemble(blocks, nops::Int, T) -> (L, R, E)Assemble the pole blocks of the sector groups into the full pole arrays of a GreenFunction.
Each block is a tuple (Lₚ, Rₚ, Eₚ, ranks) with the poles of one sector group, where ranks are the global operator indices of the group and nops is the total number of operators.
ExactDiagonalization.basistype — Method
basistype(i::Integer)
basistype(::Type{I}) where {I<:Integer}Get the binary basis type corresponding to an integer or a type of an integer.
ExactDiagonalization.cachekey — Method
cachekey(ops::Union{Operator, Operators}, braket::NTuple{2, Sector}, table::AbstractDict, dtype::Type{<:Number}) -> StringThe content key of the matrix of an operator or a set of operators between the bases of braket, used by the memoized matrix wrapper: the serialized content of the operator(s) (including the coefficients), the defining content of the two bases (type, id, dimension), the index table, and the matrix element type. The key is the raw serialization bytes held in a String container (an opaque binary blob, not valid UTF-8 text; only hash/isequal/dictionary lookups are meaningful on it). Since the full content bytes are the key, distinct contents are never confused, regardless of hash collisions.
For an Operators, the key depends on the iteration order of the set (the insertion order of its OrderedDict contents): identical construction paths yield identical keys, while the same terms assembled in a different order yield a different key (a benign cache miss, never an error).
ExactDiagonalization.diskcache! — Method
diskcache!(cache::DiskCache) -> DiskCacheSet the process-wide default disk cache (e.g., to customize the parent directory of its files or the size threshold). The previous default is discarded (its directory is removed on a best-effort basis).
Thread-safe: the swap of the default is atomic; the previous default is emptied afterwards.
ExactDiagonalization.diskcache — Method
diskcache() -> DiskCacheGet the process-wide default DiskCache, creating it lazily on first use. Since the cache is keyed by serialized content, sharing it across different systems is safe: identical contents map to identical matrices, and distinct contents are never confused.
Thread-safe: the lazy initialization is serialized by a global lock.
ExactDiagonalization.findindex — Method
findindex(position::Integer, gs::AbelianGradedSpace, guess::Integer) -> IntFind the index of an Abelian quantum number in an Abelian graded space beginning at guess whose position in the complete dimension range is position.
ExactDiagonalization.normalize — Method
normalize(term::Term) -> Term
normalize(terms::OneAtLeast{Term}) -> OneAtLeast{Term}Normalize the terms for exact diagonalization.
For a Pairing term, its factor is multiplied by 1//2 because in contrast to the BdG-form convention, the exact diagonalization method does not need to symmetrize the pairing operators, so the coefficient should not be doubled.
ExactDiagonalization.ntasks — Method
ntasks(method::GreenFunctionMethod) -> IntGet the number of parallel tasks over which the GreenFunction constructors distribute the independent computations of method.
This requires Julia to be started with multiple threads, e.g. julia -t auto, to take effect.
The default is 1 (serial); BandLanczosMethod and ThermalSeedBandLanczosMethod carry it as a field that can be specified.
ExactDiagonalization.poles — Method
poles(
S̃::AbstractMatrix{<:Number}, D̃::AbstractMatrix{<:Number}, Ẽ::AbstractVector{<:Real}, weight::Number, ref::Real;
kind::Symbol=:greater
) -> (L, R, E)Assemble the poles of the resolvent for a single initial state with the given weight and reference energy ref, from the amplitudes S̃[a, k] = ⟨seedₐ|ψ̃ₖ⟩ and D̃[a, k] = ⟨probeₐ|ψ̃ₖ⟩ resolved against the (approximate) eigen pairs {(Ẽ[k], ψ̃ₖ)} of the target sector (see resolve).
The pole at k has energy ±(Ẽ[k]-ref) (+ for kind==:greater, - otherwise) and left/right amplitudes
L[a, k] = weight * D̃[a, k],R[a, k] = conj(S̃[a, k])forkind==:greater;L[a, k] = weight * conj(S̃[a, k]),R[a, k] = D̃[a, k]forkind==:lesser.
ExactDiagonalization.poles — Method
poles(
Xs::AbstractVector{<:AbstractMatrix}, states::AbstractMatrix{<:Number}, Ψ̃::AbstractMatrix{<:Number}, Ẽ::AbstractVector{<:Real}, weights::AbstractVector{<:Number}, refs::AbstractVector{<:Real};
kind::Symbol=:greater, S̃::Union{Nothing, AbstractMatrix{<:Number}}=nothing
) -> (Lₚ, Rₚ, Eₚ)Assemble the pole block of one target sector over all kept initial states, calling the single-state poles for each.
states stores the kept initial states as columns, Ψ̃ and Ẽ are the (approximate) eigen vectors and energies of the target sector, and weights/refs give the per-state weights and reference energies. The probe vectors are formed one state at a time, so that the full set of probes is never materialized. The seed amplitudes default to S̃ = D̃ per state (seeds identical to probes, e.g. ThermalExactMethod); pass a fixed S̃ (the amplitudes against the thermally-weighted seeds) for ThermalSeedBandLanczosMethod.
ExactDiagonalization.prepare! — Method
prepare!(ed::ED; timer::TimerOutput=edtimer) -> ED
prepare!(ed::Algorithm{<:ED}; timer::TimerOutput=ed.timer) -> EDPrepare the matrix representation.
ExactDiagonalization.productable — Method
productable(sector₁::Sector, sector₂::Sector) -> BoolJudge whether two sectors can form a direct product.
ExactDiagonalization.regularize! — Method
regularize!(quantumnumbers::Vector{<:AbelianQuantumNumber}, dimensions::Vector{Int}; check::Bool=false) -> Tuple{typeof(quantumnumbers), typeof(dimensions), Vector{Int}}In place regularization of the input Abelian quantum numbers and their corresponding degenerate dimensions.
After the regularization, the Abelian quantum numbers will be sorted in the ascending order and duplicates will be merged together. The degenerate dimensions will be processed accordingly. When check is true, this function also check whether all input degenerate dimensions are positive. The regularized Abelian quantum numbers and degenerate dimensions, as well as the permutation vector that sorts the input Abelian quantum numbers, will be returned.
ExactDiagonalization.regularize — Method
regularize(quantumnumbers::AbstractVector{<:AbelianQuantumNumber}, dimension::AbstractVector{<:Integer}; check::Bool=false) -> Tuple{Vector{eltype(quantumnumbers)}, Vector{Int}, Vector{Int}}Regularize the input Abelian quantum numbers and their corresponding degenerate dimensions.
See regularize!.
ExactDiagonalization.release! — Method
release!(ed::ED; gc::Bool=true) -> ED
release!(ed::Algorithm{<:ED}; gc::Bool=true) -> EDRelease the memory source used in preparing the matrix representation. If gc is true, call the garbage collection immediately.
ExactDiagonalization.resolve — Method
resolve(H::AbstractMatrix{<:Number}, seeds::AbstractVector{<:AbstractVector{<:Number}}, method::ExactMethod) -> (E, S)Exact variant of resolve: the Ritz pairs are the full eigen pairs {(E[k], ψₖ)} of H, and the amplitudes are S[a, k] = ⟨seedsₐ|ψₖ⟩.
ExactDiagonalization.resolve — Method
resolve(H::AbstractMatrix{<:Number}, seeds::AbstractVector{<:AbstractVector{<:Number}}, method::ThermalSeedBandLanczosMethod) -> (Ẽ, Ψ̃)Run the second band Lanczos (resolvent resolution) of the thermally-weighted seed method, seeded by seeds (the operators acting on the thermally-weighted state), returning the Ritz values Ẽ and the Ritz vectors Ψ̃ of H as columns of a dense matrix.
The amplitudes against the individual initial states are not resolved here; they are computed afterwards from Ψ̃, one state at a time, so that the full set of probe vectors is never materialized. The Krylov basis is always kept, as required by the deferred resolution.
ExactDiagonalization.resolve — Method
resolve(H::AbstractMatrix{<:Number}, seeds::AbstractVector{<:AbstractVector{<:Number}}, method::BandLanczosMethod) -> (Ẽ, S̃)Resolve the band seeds against the Ritz pairs {(Ẽ[k], ψ̃ₖ)} of H obtained by the band Lanczos method, returning the Ritz energies Ẽ and the amplitudes S̃[a, k] = ⟨seedsₐ|ψ̃ₖ⟩.
ExactDiagonalization.samplerngs — Method
samplerngs(method::ThermalSeedBandLanczosMethod) -> Vector{Xoshiro}Return the random number generators for the method.nrandom random vectors of the thermally-weighted seed method, one per sample; the r-th sample is drawn from samplerngs(method)[r].
The generators are derived from method.seed independently of the task scheduling: for a nonzero method.seed, the r-th generator is fully determined by (method.seed, r), hence the results are reproducible and identical for the serial and all parallel constructions; for method.seed==0, the seeds are drawn from the global RNG, hence truly random.
ExactDiagonalization.sectorgroups — Method
sectorgroups(operators::AbstractVector{<:QuantumOperator}, ed::ED, sector₀::Sector) -> OrderedDict{typeof(sector₀), Vector{Int}}Decompose the resolvent into independent sector blocks: Aₐ† maps a state in the ground-state sector sector₀ with the quantum number qn₀≣Abelian(sector₀) into the target sector Aₐ†(qn₀), and the Green function is block-diagonal in these target sectors. Return the operator ranks (indices into operators) grouped by their target sector, in order of first appearance.
ExactDiagonalization.sumable — Method
sumable(sector₁::Sector, sector₂::Sector) -> BoolJudge whether two sectors could be direct summed.
ExactDiagonalization.with_ntasks — Method
with_ntasks(method::BandLanczosMethod, ntasks::Integer) -> BandLanczosMethodRebuild method with a different number of parallel tasks, everything else preserved.
Used internally to split the task budget among the concurrently constructed parts of a Green function.
ExactDiagonalization.with_ntasks — Method
with_ntasks(method::ThermalSeedBandLanczosMethod, ntasks::Integer) -> ThermalSeedBandLanczosMethodRebuild method with a different number of parallel tasks, everything else preserved.
Used internally to split the task budget among the concurrently constructed samples of a Green function.
LinearAlgebra.eigen — Method
eigen(ed::ED, sectors::Union{Abelian, Sector}...; timer::TimerOutput=edtimer, release::Bool=false, kwargs...) -> EDEigenData
eigen(ed::Algorithm{<:ED}, sectors::Union{Abelian, Sector}...; timer::TimerOutput=ed.timer, release::Bool=false, kwargs...) -> EDEigenDataSolve the eigen problem by the restarted Lanczos method provided by the KrylovKit package.
LinearAlgebra.eigen — Method
eigen(m::EDMatrix; nev::Int=1, which::Symbol=:SR, tol::Real=1e-12, maxiter::Int=300, v₀::Union{AbstractVector{<:Number}, Int}=dimension(m.bra), krylovdim::Int=max(20, 2*nev+1), verbosity::Int=0) -> EDEigenDataSolve the eigen problem by the restarted Lanczos method provided by the KrylovKit package.
When v₀ is an integer, it is interpreted as the dimension of the Hilbert space and a random initial vector of eltype scalartype(m) is used; when v₀ is a vector, it is used as the initial vector of the restarted Lanczos method and the eltype is inferred from v₀ itself.
LinearAlgebra.eigen — Method
eigen(
ms::OperatorSum{<:EDMatrix};
nev::Int=1,
which::Symbol=:SR,
tol::Real=1e-12,
maxiter::Int=300,
v₀::Union{Dict{<:Abelian, <:Union{AbstractVector{<:Number}, Int}}, Dict{<:Sector, <:Union{AbstractVector{<:Number}, Int}}}=Dict(m.ket=>dimension(m.ket) for m in ms),
krylovdim::Int=max(20, 2*nev+1),
verbosity::Int=0,
timer::TimerOutput=edtimer
) -> EDEigenDataSolve the eigen problem by the restarted Lanczos method provided by the KrylovKit package.
The initial vectors/dimensions of the restarted Lanczos method can be assigned to the individual sectors by v₀, whose keys can be either the sectors or their corresponding Abelian quantum numbers, and whose values can be either vectors (used as the initial vectors) or integers (interpreted as the dimensions of the sectors, in which case random initial vectors are used). Sectors missing from v₀ fall back to random initial vectors. An error is raised if any key of v₀ matches no sector of ms.
LinearAlgebra.inv! — Method
inv!(dest::AbstractMatrix{<:Number}, gf::GreenFunction, ω::Number; kwargs...)Compute the inverse of a GreenFunction at ω into dest, overwriting its previous contents. Workspace keywords are forwarded to gf(dest,ω).
LinearAlgebra.rank — Method
rank(qn::AbelianQuantumNumberProd) -> Int
rank(::Type{<:AbelianQuantumNumberProd}) -> IntGet the rank of a Deligne tensor product of simple Abelian quantum numbers.
LinearAlgebra.rank — Method
rank(rs::CompositeAbelianGradedSpace) -> Int
rank(::Type{<:CompositeAbelianGradedSpace{N}}) where N -> IntGet the number of Abelian graded spaces in the direct sum.
LinearAlgebra.rank — Method
rank(gf::GreenFunction) -> IntGet the rank of a GreenFunction.
QuantumLattices.:⊕ — Method
⊕(gs::AbelianGradedSpace, gses::AbelianGradedSpace...) -> AbelianGradedSpaceSum
⊕(gs::AbelianGradedSpace, rs::AbelianGradedSpaceSum) -> AbelianGradedSpaceSum
⊕(rs::AbelianGradedSpaceSum, gs::AbelianGradedSpace) -> AbelianGradedSpaceSum
⊕(rs₁::AbelianGradedSpaceSum, rs₂::AbelianGradedSpaceSum) -> AbelianGradedSpaceSumGet the direct sum of some Abelian graded spaces.
QuantumLattices.:⊗ — Method
⊗(gs::AbelianGradedSpace, gses::AbelianGradedSpace...) -> AbelianGradedSpaceProd
⊗(gs::AbelianGradedSpace, rs::AbelianGradedSpaceProd) -> AbelianGradedSpaceProd
⊗(rs::AbelianGradedSpaceProd, gs::AbelianGradedSpace) -> AbelianGradedSpaceProd
⊗(rs₁::AbelianGradedSpaceProd, rs₂::AbelianGradedSpaceProd) -> AbelianGradedSpaceProdGet the direct product of some Abelian graded spaces.
QuantumLattices.:⊗ — Method
⊗(qn::AbelianQuantumNumber, qns::AbelianQuantumNumber...) -> eltype(qns)Get the direct product of some AbelianQuantumNumbers.
QuantumLattices.:⊗ — Method
⊗(bs₁::BinaryBases, bs₂::BinaryBases) -> BinaryBasesGet the direct product of two sets of binary bases.
QuantumLattices.:⊗ — Method
⊗(basis₁::BinaryBasis, basis₂::BinaryBasis) -> BinaryBasisGet the direct product of two binary bases.
QuantumLattices.DegreesOfFreedom.partition — Method
partition(n::Int) -> NTuple{2, Vector{Int}}Get the default partition of n local Hilbert spaces.
QuantumLattices.QuantumOperators.matrix — Function
matrix(op::Operator, braket::NTuple{2, Sector}, table::AbstractDict, dtype=scalartype(op); cached::Bool=false) -> DiskCSCMatrix{dtype, Int}Get the sparse matrix representation of an operator between the bases of braket as a DiskCSCMatrix proxy. With cached=false (the default), the proxy is anonymous: it is neither written to disk nor entered into the cache, and neither is anything derived from it by the algebra of DiskCSCMatrix. With cached=true, the matrix is stored in the session-wide DiskCache under its cachekey (on disk when larger than the threshold), and identical (operator, bases, table, element type) contents return the shared proxy without reconstructing. The construction is done by sparse.
Here, table specifies the order of the operator indexes.
QuantumLattices.QuantumOperators.matrix — Function
matrix(index::SpinIndex, graded::Graded, dtype::Type{<:Number}=ComplexF64) -> Matrix{dtype}Get the matrix representation of a SpinIndex on an Abelian graded space.
QuantumLattices.QuantumOperators.matrix — Function
matrix(op::OperatorIndex, braket::NTuple{2, Sector}, table::AbstractDict, dtype=Int; cached::Bool=false) -> DiskCSCMatrix{dtype, Int}Get the sparse matrix representation of an operator index as a DiskCSCMatrix proxy. The keyword cached is forwarded to the memoization wrapper of matrix.
QuantumLattices.QuantumOperators.matrix — Function
matrix(index::OperatorIndex, graded::Graded, dtype::Type{<:Number}=ComplexF64) -> Matrix{dtype}Get the matrix representation of an OperatorIndex on an Abelian graded space.
QuantumLattices.QuantumOperators.matrix — Function
matrix(ops::Operators, braket::NTuple{2, Sector}, table::AbstractDict, dtype=scalartype(ops); cached::Bool=false) -> DiskCSCMatrix{dtype, Int}Get the sparse matrix representation of a set of operators between the bases of braket as a DiskCSCMatrix proxy (the sum of the per-operator proxies; see matrix). The recursive bisection construction is always anonymous: intermediate sums are neither cached nor written to disk. With cached=true, only the final block is memoized: its cachekey is looked up in the session-wide DiskCache before construction (a hit skips the construction entirely), and a miss is stored under that key afterwards. A length-1 set is delegated to the operator-level method so that identical contents share the same key.
Here, table specifies the order of the operator indexes.
QuantumLattices.QuantumOperators.matrix — Method
matrix(ed::ED, sectors::Union{Abelian, Sector}...; timer::TimerOutput=edtimer, release::Bool=false) -> OperatorSum{<:EDMatrix}
matrix(ed::Algorithm{<:ED}, sectors::Union{Abelian, Sector}...; timer::TimerOutput=ed.timer, release::Bool=false) -> OperatorSum{<:EDMatrix}Get the sparse matrix representation of a quantum lattice system in the target space.
QuantumLattices.Spatials.period — Method
period(qn::AbelianQuantumNumberProd, i::Integer) -> Number
period(::Type{AbelianQuantumNumberProd{T}}, i::Integer) where {T<:Tuple{Vararg{SimpleAbelianQuantumNumber}}} -> NumberGet the period of the ith simple Abelian number contained in a Deligne tensor product.
QuantumLattices.Spatials.period — Method
period(qn::SimpleAbelianQuantumNumber) -> Number
period(::Type{QN}) where {QN<:SimpleAbelianQuantumNumber} -> NumberGet the period of a simple Abelian quantum number.
QuantumLattices.Spatials.periods — Method
periods(qn::AbelianQuantumNumber) -> Tuple{Vararg{Number}}
periods(::Type{QN}) where {QN<:AbelianQuantumNumber} -> Tuple{Vararg{Number}}Get the periods of Abelian quantum numbers.
QuantumLattices.add! — Method
add!(destination, transformation::EDMatrixization, ops::OperatorSet; kwargs...)Add the matrix representation of a whole set of operators to destination, specializing the generic element-wise contract of add! for EDMatrixization: the set is matrixized as a whole (the result coincides by linearity), so that the memoization happens at the level of the merged block under the set-level cachekey instead of per operator.
QuantumLattices.decompose — Method
decompose(rs::CompositeAbelianGradedSpace; expand::Bool=true) -> Tuple{AbelianGradedSpace{eltype(rs)}, Vector{Int}}Decompose a composite of several Abelian graded spaces to the canonical one.
When expand is false, the corresponding permutation vector that sorts the Abelian quantum numbers will be returned as well. When expand is true, the expanded dimension indexes of the permutation vector that sorts the Abelian quantum numbers will be returned as well.
QuantumLattices.derivative! — Method
derivative!(dest::AbstractMatrix{<:Number}, gf::GreenFunction, ω::Number; workspace=nothing)Compute ∂G[i,j]/∂ω = -Σₖ L[i,k]R[j,k]/(ω-E[k])² into dest, overwriting its previous contents. Preallocated workspace can be supplied.
QuantumLattices.derivative — Method
derivative(gf::GreenFunction, ω::Number; kwargs...)Compute the frequency derivative of a GreenFunction at ω, forwarding all workspace keywords to the in-place method.
QuantumLattices.dimension — Method
dimension(gs::AbelianGradedSpace, qn::Union{Integer, CartesianIndex}) -> Int
dimension(gs::AbelianGradedSpace{QN}, qn::QN) where {QN<:AbelianQuantumNumber} -> IntGet the degenerate dimension of an Abelian quantum number contained in an Abelian graded space.
QuantumLattices.dimension — Method
dimension(rs::AbelianGradedSpaceProd, i::Union{Integer, CartesianIndex}) -> IntGet the degenerate dimension of the ith Abelian quantum number in the direct product of several Abelian graded spaces.
QuantumLattices.dimension — Method
dimension(rs::AbelianGradedSpaceProd) -> IntGet the total dimension of the direct product of several Abelian graded spaces.
QuantumLattices.dimension — Method
dimension(rs::AbelianGradedSpaceSum, i::Union{Integer, CartesianIndex}) -> IntGet the degenerate dimension of the ith Abelian quantum number in the direct sum of several Abelian graded spaces.
QuantumLattices.dimension — Method
dimension(rs::AbelianGradedSpaceSum) -> IntGet the total dimension of the direct sum of several Abelian graded spaces.
QuantumLattices.dimension — Method
dimension(gs::AbelianGradedSpace) -> IntGet the total dimension of an Abelian graded space.
QuantumLattices.dimension — Method
dimension(rs::AbelianGradedSpaceProd{N, QN}, qns::NTuple{N, QN}) where {N, QN<:AbelianQuantumNumber} -> IntGet the degenerate dimension of the Abelian quantum number fused by qns in the direct product of several Abelian graded spaces.
QuantumLattices.kind — Method
kind(ed::Union{ED, Algorithm{<:ED}}) -> EDKind
kind(::Type{<:ED{K}}) where K -> EDKind
kind(::Type{<:Algorithm{L}}) where {L<:ED} -> EDKindGet the kind of an exact diagonalization method.
QuantumLattices.value — Method
value(qn::AbelianQuantumNumberProd, i::Integer) -> NumberGet the value of the ith simple Abelian quantum number in a Deligne tensor product.
QuantumLattices.value — Method
value(qn::SimpleAbelianQuantumNumber) -> NumberGet the value of a simple Abelian quantum number.
Serialization.deserialize — Method
deserialize(s::AbstractSerializer, ::Type{DiskCSCMatrix{V, I}}) where {V, I} -> DiskCSCMatrix{V, I}Deserialize a DiskCSCMatrix received from another process, extending Serialization.deserialize: the result is a detached in-memory proxy (path=nothing), independent of the sender's backing files (see serialize).
Serialization.serialize — Method
serialize(s::AbstractSerializer, dm::DiskCSCMatrix)Serialize a DiskCSCMatrix for cross-process transfer, extending Serialization.serialize: the payload is materialized and only the dimensions and the content are written, so the received object is a detached in-memory proxy (path=nothing). Serialization.serialize_cycle keeps the object identity of shared proxies within one serialized graph.
SparseArrays.sparse — Method
sparse(ed::ED, sector::Sector; timer::TimerOutput=edtimer) -> SparseMatrixCSCGet the sparse matrix representation of a quantum lattice system in a single sector, extending SparseArrays.sparse. The construction reuses the cached operator blocks from the session-wide DiskCache implicitly.
SparseArrays.sparse — Method
sparse(dm::DiskCSCMatrix) -> SparseMatrixCSCGet the payload of a DiskCSCMatrix as a plain SparseMatrixCSC, extending SparseArrays.sparse. If the payload has been garbage-collected, it is transparently reloaded from disk via memory mapping (without copying).
The returned matrix is the shared payload rather than a copy, so it must not be mutated in place.
Thread-safe: the reload (mmap + WeakRef swap) is serialized by the per-entry lock; the fast paths (strongly held or still-alive payload) are lock-free.
SparseArrays.sparse — Method
sparse(op::Operator{V, <:OneAtLeast{OperatorIndex}}, braket::NTuple{2, AbelianBases}, table::AbstractDict, dtype=V) where V -> SparseMatrixCSC{dtype, Int}Get the sparse matrix representation of an operator between the bases of braket, extending SparseArrays.sparse. For the memoized variant, see matrix.
Here, table specifies the order of the operator indexes.
SparseArrays.sparse — Method
sparse(op::Operator{V, <:OneAtLeast{OperatorIndex}}, braket::NTuple{2, BinaryBases}, table::AbstractDict, dtype=V) where V -> SparseMatrixCSC{dtype, Int}Get the sparse matrix representation of an operator between the bases of braket, extending SparseArrays.sparse. For the memoized variant, see matrix.
Here, table specifies the order of the operator indexes.
SparseArrays.sparse — Method
sparse(op::Operator{V, Tuple{}}, braket::NTuple{2, Sector}, table::AbstractDict, dtype=V) where V -> SparseMatrixCSC{dtype, Int}Get the sparse matrix representation of a scalar operator between the bases of braket, extending SparseArrays.sparse. For the memoized variant, see matrix.