Skip to content

Library documentation

MPSKit.QP Type
julia
QP{S, T1, T2}

Union of the quasiparticle excitation ansätze LeftGaugedQP and RightGaugedQP. It is used for dispatch and to share their gauge-independent interface; it is not a concrete type and cannot be constructed on its own. The internal aliases FiniteQP and InfiniteQP further restrict the ground-state type to FiniteMPS or InfiniteMPS respectively.

source
MPSKit.WI Constant
julia
const WI = TaylorCluster(; N = 1, extension = false, compression = false)

First order Taylor expansion for a time-evolution MPO.

source
MPSKit.AbstractMPO Type
julia
abstract type AbstractMPO{O} <: AbstractVector{O} end

Abstract supertype for Matrix Product Operators (MPOs).

source
MPSKit.AbstractMPSEnvironments Type
julia
abstract type AbstractEnvironments end

Abstract supertype for all environment types.

source
MPSKit.Algorithm Type
julia
abstract type Algorithm

Abstract supertype for all algorithm structs. These can be thought of as NamedTuples that hold the settings for a given algorithm, which can be used for dispatch. Additionally, the constructors can be used to provide default values and input sanitation.

source
MPSKit.BUG Type
julia
struct BUG{A, O, G, F, B} <: MPSKit.Algorithm

Single-site time-evolution algorithm for finite MPS, based on the Basis-Update & Galerkin (BUG) integrator, an unconventional robust integrator for dynamical low-rank approximation with an observed second-order convergence.

Unlike TDVP, BUG advances both the basis (K-step) and the core (Galerkin C-step) tensors forward in time, with no backward-in-time substep. This makes it a more natural choice for imaginary-time (dissipative) evolution, where the backward core step of the conventional projector-splitting integrator TDVP can become unstable for large timesteps.

Fields

  • integrator::Any: algorithm used in the exponential solvers

  • alg_orth::Any: algorithm used to orthonormalize the augmented basis [U₀ │ K₁] after each local update

  • alg_gauge::Any: factorization used to gauge and truncate the bond ahead of each local update

  • finalize::Any: callback function applied after each iteration, of signature finalize(t, ψ, H, envs) -> ψ, envs

  • backend::Any: backend for tensor contractions and index manipulations

Algorithm

Each half-sweep visits every site in turn and, at each site, (i) splits off the bond ahead of it (in the sweep direction) with alg_gauge, truncating it back to trunc, (ii) evolves the connecting tensor over dt/2, and (iii) augments the basis with the new directions discovered by the evolved tensor (old basis first, [U₀ │ K₁], orthonormalized with alg_orth)

Notably, this last step does not include any truncation, and is meant to truncate the previous half-sweep's augmentation. As a result, a truncation scheme truncrank(D) will result in a final MPS of dimension 2D. To restore a maximal dimension of D, apply changebonds with an SvdCut algorithm.

Note

By default the state is not renormalized, as the (loss of) norm might accumulate useful information, such as the accumulated truncation error in real time, or the decaying weight in imaginary time. Pass normalize = true to timestep/time_evolve to renormalize after every half-sweep instead.

Tip

Pass a TimerOutputs.TimerOutput as timeroutput to timestep/timestep! to obtain a breakdown of the time spent in the three steps above (cut_bond, AC_integrate, augment) over all local updates.

References

source
MPSKit.ChepigaAnsatz Type
julia
struct ChepigaAnsatz{A<:KrylovKit.KrylovAlgorithm, B} <: MPSKit.Algorithm

Single-site optimization algorithm for excitations on top of MPS groundstates.

Constructors

julia
ChepigaAnsatz()
ChepigaAnsatz(; kwargs...)
ChepigaAnsatz(alg)

Create a ChepigaAnsatz algorithm with the given eigensolver, or by passing the keyword arguments to Arnoldi.

Fields

  • alg::KrylovKit.KrylovAlgorithm: algorithm used for the eigenvalue solvers

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of excitations.

References

source
MPSKit.ChepigaAnsatz2 Type
julia
struct ChepigaAnsatz2{A<:KrylovKit.KrylovAlgorithm, B} <: MPSKit.Algorithm

Two-site optimization algorithm for excitations on top of MPS groundstates.

Constructors

julia
ChepigaAnsatz2()
ChepigaAnsatz2(; kwargs...)
ChepigaAnsatz2(alg, trunc)

Create a ChepigaAnsatz2 algorithm with the given eigensolver and truncation, or by passing the keyword arguments to Arnoldi.

Fields

  • alg::KrylovKit.KrylovAlgorithm: algorithm used for the eigenvalue solvers, defaults to Arnoldi(; krylovdim = 30, tol = 1.0e-10, eager = true)

  • trunc::Any: truncation strategy used when splitting the optimized two-site tensor, defaults to notrunc()

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of excitations.

References

source
MPSKit.DDMRG_Flavour Type
julia
abstract type DDMRG_Flavour

Abstract supertype for the different flavours of dynamical DMRG.

source
MPSKit.DMRG Type
julia
struct DMRG{A, F, E, G, B} <: MPSKit.Algorithm

Density Matrix Renormalization Group algorithm for finding the dominant eigenvector.

Each site update is, in order: (1) an optional bond expansion (alg_expand), (2) a single-site eigensolve, and (3) a gauge step (alg_gauge). With the defaults (alg_expand = nothing and alg_gauge = nothing, a non-truncating QR gauge derived from trunc = notrunc()) this is textbook single-site DMRG, which cannot change the bond dimension. Setting alg_expand to a bond-expansion algorithm (e.g. OptimalExpand, RandExpand, SketchedExpand) expands the bond with directions orthogonal to the current state ahead of each eigensolve, recovering Controlled Bond Expansion (CBE) DMRG. Setting alg_gauge to a bond-expanding gauge algorithm (e.g. DMRG3S) instead expands the bond as part of the gauge step, after the eigensolve. Either way, a truncating gauge (see below) is then desirable to cut the enlarged bond back down.

Choosing the gauge

By default, alg_gauge is built for you from trunc/alg_svd/alg_orth: trunc = notrunc() (the default) gives a QR decomposition (alg_orth, Householder by default), any other trunc gives a truncated SVD (alg_svd with that trunc).

julia
DMRG()                            # QR gauge, no truncation
DMRG(; trunc = truncdim(50))   # truncated SVD gauge

To use a bond-expanding gauge such as DMRG3S, pass it directly as alg_gauge; trunc etc. are still routed through to build the inner gauge it wraps, exactly as above:

julia
DMRG(; alg_gauge = DMRG3S(0.1, ExponentialDecay(0.7)), trunc = truncdim(50))

If alg_gauge is instead given with its inner gauge already set (e.g. DMRG3S(0.1, sched, some_gauge)), trunc/alg_svd/alg_orth must be left at their defaults — passing both is an error, since it leaves two conflicting sources for the same setting.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_eigsolve::Any: algorithm used for the eigenvalue solvers

  • finalize::Any: callback function applied after each iteration, of signature finalize(iter, ψ, H, envs) -> ψ, envs

  • alg_expand::Any: algorithm used to expand the bond ahead of each local update, or nothing for none

  • alg_gauge::Any: gauge algorithm applied after each local update: NoExpand for a plain gauge step (a QR algorithm with no truncation, or a truncated SVD), or an algorithm that additionally expands the bond beforehand (e.g. DMRG3S)

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of find_groundstate and approximate.

source
MPSKit.DMRG2 Type
julia
struct DMRG2{A, G, F, B} <: MPSKit.Algorithm

Two-site DMRG algorithm for finding the dominant eigenvector.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_eigsolve::Any: algorithm used for the eigenvalue solvers

  • alg_gauge::Any: factorization used for the post-update gauge: a truncated SVD (alg_svd with trunc)

  • finalize::Any: callback function applied after each iteration, of signature finalize(iter, ψ, H, envs) -> ψ, envs

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of find_groundstate and approximate.

source
MPSKit.DMRG3S Type
julia
struct DMRG3S{N, S<:NoiseSchedule, A} <: MPSKit.Algorithm

Gauge algorithm wrapper that, at every site update, injects a Hamiltonian-derived perturbation of the just-optimized tensor before gauging — the "strictly single-site DMRG with subspace expansion" scheme. This lets single-site DMRG introduce basis states/quantum-number sectors absent from the initial state, helping it escape local minima that plain single-site DMRG can get stuck in.

Constructors

julia
DMRG3S(noise, schedule::NoiseSchedule)

noise is the initial perturbation amplitude; schedule (see ExponentialDecay, Warmup) controls how it evolves across outer iterations, and once it decays to exactly zero the gauge step reverts to a plain gauge shift for the remainder of the run. The actual factorization used to gauge the expanded tensor is filled in by DMRG's constructor, not supplied here directly — see DMRG's docstring for the calling convention:

julia
DMRG(; alg_gauge = DMRG3S(0.1, ExponentialDecay(0.7)), trunc = truncdim(50))

A truncating trunc is strongly recommended alongside DMRG3S, to cut the perturbed bond back down each sweep — DMRG's constructor warns if none is given.

Fields

  • noise::Any: initial perturbation amplitude, before schedule is applied

  • schedule::NoiseSchedule: NoiseSchedule controlling how the amplitude evolves across outer iterations

  • alg_gauge::Any: factorization used to gauge the expanded tensor; nothing until DMRG's constructor fills it in

See also

Used as the alg_gauge argument of DMRG.

References

source
MPSKit.DerivativeOperator Type
julia
DerivativeOperator

Abstract supertype for derivative operators acting on MPS. These operators are used to represent the effective local operators obtained from taking the partial derivative of an MPS-MPO-MPS sandwich.

source
MPSKit.DynamicalDMRG Type
julia
struct DynamicalDMRG{F<:MPSKit.DDMRG_Flavour, S, B} <: MPSKit.Algorithm

A dynamical DMRG method for calculating dynamical properties and excited states, based on a variational principle for dynamical correlation functions.

Fields

  • flavour::MPSKit.DDMRG_Flavour: flavour of the algorithm to use, either of type NaiveInvert or Jeckelmann

  • solver::Any: algorithm used for the linear solvers

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of propagator.

References

source
MPSKit.ExponentialDecay Type
julia
ExponentialDecay(decay_rate; threshold = 0.0)

Noise schedule that shrinks geometrically: noise -> noise * decay_rate^iter, snapped to exactly zero once it falls below threshold. Use decay_rate < 1 for a standalone DMRG3S run that gradually turns the expansion off as the state converges; a nonzero threshold avoids running the (cheap, but non-free) expansion step indefinitely on a noise amplitude too small to matter.

source
MPSKit.FiniteChainStyle Type
julia
abstract type GeometryStyle
GeometryStyle(x)
GeometryStyle(::Type{T})

Trait to describe the geometry of the input x or type T, which can be either

  • FiniteChainStyle(): object is defined on a finite chain;

  • InfiniteChainStyle(): object is defined on an infinite chain.

source
MPSKit.FiniteEnvironments Type
julia
struct FiniteEnvironments <: AbstractMPSEnvironments

Environment manager for FiniteMPS and WindowMPS. This structure is responsible for automatically checking if the queried environment is still correctly cached and if not recalculates.

source
MPSKit.FiniteExcited Type
julia
struct FiniteExcited{A} <: MPSKit.Algorithm

Variational optimization algorithm for excitations of finite MPS by minimizing the energy of

Fields

  • gsalg::Any: optimization algorithm

  • weight::Float64: energy penalty for enforcing orthogonality with previous states

See also

Used as the algorithm argument of excitations.

source
MPSKit.FiniteMPO Type
julia
FiniteMPO(Os::Vector{O}) -> FiniteMPO{O}
FiniteMPO(O::AbstractTensorMap{S, N, N}) where {S, N} -> FiniteMPO{O <: MPOTensor}

Matrix Product Operator (MPO) acting on a finite tensor product space with a linear order.

source
MPSKit.FiniteMPOHamiltonian Method
julia
FiniteMPOHamiltonian(Ws::Vector{<:AbstractMatrix})

Create a FiniteMPOHamiltonian from a vector of matrices, such that Ws[i][j, k] represents the operator at site i, left level j and right level k. Here, the entries can be either MPOTensor, Missing or Number.

source
MPSKit.FiniteMPS Type
julia
struct FiniteMPS{A<:(TensorKit.AbstractTensorMap{T, S, N, 1} where {S, N, T}), B<:(TensorKit.AbstractTensorMap{T, S, 1, 1} where {S, T})} <: MPSKit.AbstractFiniteMPS

Type that represents a finite Matrix Product State.

Constructors

julia
FiniteMPS(
    [f, eltype], physicalspaces::Vector{<:Union{S, CompositeSpace{S}}},
    maxvirtualspaces::Union{S, Vector{S}};
    normalize = true, left = unitspace(S), right = unitspace(S)
) where {S <: ElementarySpace}
FiniteMPS(
    [f, eltype], N::Int, physicalspace::Union{S, CompositeSpace{S}},
    maxvirtualspaces::Union{S, Vector{S}};
    normalize = true, left = unitspace(S), right = unitspace(S)
) where {S <: ElementarySpace}
FiniteMPS(As::Vector{<:GenericMPSTensor}; normalize = false, overwrite = false)

Construct an MPS via a specification of physical and virtual spaces, or from a list of tensors As. All cases reduce to the latter. In particular, a state with a non-trivial total charge can be constructed by passing a non-trivially charged vector space as the left or right virtual spaces.

Arguments

  • As: vector of site tensors

  • f = rand: initializer function for the tensor data

  • eltype = ComplexF64: scalar type of the tensors

  • physicalspaces: list of physical spaces

  • N: number of sites

  • physicalspace: local physical space, repeated for every site

  • maxvirtualspaces: maximal virtual space(s), truncated to what symmetry allows

Keyword Arguments

  • normalize: normalize the constructed state

  • overwrite = false: overwrite the given input tensors

  • left = unitspace(S): left-most virtual space

  • right = unitspace(S): right-most virtual space

Properties

  • AL: left-gauged MPS tensors

  • AR: right-gauged MPS tensors

  • AC: center-gauged MPS tensors

  • C: gauge (bond) tensors

  • center: location of the gauge center

The center property returns a center::HalfInt that indicates the location of the MPS center:

  • isinteger(center)center is a whole number and indicates the location of the first AC tensor present in the underlying ψ.ACs field.

  • ishalfodd(center)center is a half-odd-integer, meaning that there are no AC tensors, and indicating between which sites the bond tensor lives.

For example, mps.center = 7/2 means that the bond tensor is to the right of the 3rd site and can be accessed via mps.C[3].

Notes

By convention, we have that:

  • AL[i] * C[i] = AC[i] = C[i-1] * AR[i]

  • AL[i]' * AL[i] = 1

  • AR[i] * AR[i]' = 1

Examples

Building a 3-site spin-1/2 MPS from a dense array and checking that its left-gauged tensors are isometries (the state is kept in canonical form even though the raw data is not normalized):

julia
julia> ψ = FiniteMPS(ones(Float64, (ℂ^2)^3));

julia> length(ψ)
3

julia> ψ.AL[1]' * ψ.AL[1]  id(left_virtualspace(ψ, 2))
true
source
MPSKit.FunctionalSchedule Type
julia
FunctionalSchedule(f) <: NoiseSchedule

Wrap an arbitrary callable f(noise, iter, ϵ) -> noise as a NoiseSchedule. Used internally by to compose schedules, but can also be constructed directly for ad hoc schedules that don't warrant their own named type.

source
MPSKit.GeometryStyle Type
julia
abstract type GeometryStyle
GeometryStyle(x)
GeometryStyle(::Type{T})

Trait to describe the geometry of the input x or type T, which can be either

  • FiniteChainStyle(): object is defined on a finite chain;

  • InfiniteChainStyle(): object is defined on an infinite chain.

source
MPSKit.GradientGrassmann Type
julia
struct GradientGrassmann{O<:OptimKit.OptimizationAlgorithm, F, B} <: MPSKit.Algorithm

Variational gradient-based optimization algorithm that keeps the MPS in left-canonical form, as points on a Grassmann manifold. The optimization is then a Riemannian gradient descent with a preconditioner to induce the metric from the Hilbert space inner product.

Constructors

julia
GradientGrassmann(; kwargs...)

Keyword Arguments

  • method = ConjugateGradient: instance of optimization algorithm, or type of optimization algorithm to construct

  • finalize!: finalizer algorithm

  • tol = Defaults.tol: tolerance for convergence criterium

  • maxiter = Defaults.maxiter: maximum amount of iterations

  • verbosity = Defaults.verbosity - 1: level of information display

  • backend = Defaults.backend(): backend for tensor contractions and index manipulations

Fields

  • method::OptimKit.OptimizationAlgorithm: optimization algorithm

  • finalize!::Any: callback function applied after each iteration, of signature finalize!(x, f, g, numiter) -> x, f, g

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of find_groundstate and leading_boundary.

References

source
MPSKit.HamiltonianStyle Type
julia
abstract type OperatorStyle
OperatorStyle(x)
OperatorStyle(::Type{T})

Trait to describe the operator behavior of the input x or type T, which can be either

  • MPOStyle(): product of local factors;

  • HamiltonianStyle(): sum of local terms.

source
MPSKit.IDMRG Type
julia
struct IDMRG{A, B} <: MPSKit.Algorithm

Single site infinite DMRG algorithm for finding the dominant eigenvector.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_gauge::Any: algorithm used for gauging the MPS

  • alg_eigsolve::Any: algorithm used for the eigenvalue solvers

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of find_groundstate, leading_boundary, and approximate.

source
MPSKit.IDMRG2 Type
julia
struct IDMRG2{A, S, B} <: MPSKit.Algorithm

Two-site infinite DMRG algorithm for finding the dominant eigenvector.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_gauge::Any: algorithm used for gauging the MPS

  • alg_eigsolve::Any: algorithm used for the eigenvalue solvers

  • alg_svd::Any: algorithm used for the singular value decomposition

  • trunc::MatrixAlgebraKit.TruncationStrategy: algorithm used for truncation of the two-site update

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of find_groundstate, leading_boundary, and approximate.

source
MPSKit.InfiniteChainStyle Type
julia
abstract type GeometryStyle
GeometryStyle(x)
GeometryStyle(::Type{T})

Trait to describe the geometry of the input x or type T, which can be either

  • FiniteChainStyle(): object is defined on a finite chain;

  • InfiniteChainStyle(): object is defined on an infinite chain.

source
MPSKit.InfiniteEnvironments Type
julia
InfiniteEnvironments <: AbstractMPSEnvironments

Environments for an infinite MPS-MPO-MPS combination. These solve the corresponding fixedpoint equations:

where T_LL and T_RR are the (regularized) transfer matrix operators on a give site for AL-O-AL and AR-O-AR respectively.

source
MPSKit.InfiniteMPO Type
julia
InfiniteMPO(Os::PeriodicVector{O}) -> InfiniteMPO{O}

Matrix Product Operator (MPO) acting on an infinite tensor product space with a linear order.

source
MPSKit.InfiniteMPOHamiltonian Method
julia
InfiniteMPOHamiltonian(Ws::Vector{<:AbstractMatrix})

Create an InfiniteMPOHamiltonian from a vector of matrices, such that Ws[i][j, k] represents the operator at site i, left level j and right level k. Here, the entries can be either MPOTensor, Missing or Number.

source
MPSKit.InfiniteMPS Type
julia
struct InfiniteMPS{A<:(TensorKit.AbstractTensorMap{T, S, N, 1} where {S, N, T}), B<:(TensorKit.AbstractTensorMap{T, S, 1, 1} where {S, T})} <: MPSKit.AbstractMPS

Type that represents an infinite Matrix Product State.

Constructors

julia
InfiniteMPS(
    [f, eltype], physicalspaces::Vector{<:Union{S, CompositeSpace{S}}},
    virtualspaces::Vector{<:Union{S, CompositeSpace{S}}};
    kwargs...
) where {S <: ElementarySpace}
InfiniteMPS(As::AbstractVector{<:GenericMPSTensor}; kwargs...)
InfiniteMPS(ALs::AbstractVector{<:GenericMPSTensor}, C₀::MPSBondTensor; kwargs...)

Construct an MPS via a specification of physical and virtual spaces, or from a list of tensors As, or a list of left-gauged tensors ALs.

Arguments

  • As: vector of site tensors

  • ALs: vector of left-gauged site tensors

  • C₀: initial gauge tensor

  • f = rand: initializer function for the tensor data

  • eltype = ComplexF64: scalar type of the tensors

  • physicalspaces: list of physical spaces

  • virtualspaces: list of virtual spaces

Keyword Arguments

  • tol: gauge fixing tolerance

  • maxiter: gauge fixing maximum iterations

Properties

  • AL: left-gauged MPS tensors

  • AR: right-gauged MPS tensors

  • AC: center-gauged MPS tensors

  • C: gauge (bond) tensors

Notes

By convention, we have that:

  • AL[i] * C[i] = AC[i] = C[i-1] * AR[i]

  • AL[i]' * AL[i] = 1

  • AR[i] * AR[i]' = 1

Examples

A one-site unit cell built from an explicit (V_left ⊗ P ← V_right) tensor. Here the bond dimension is one, so this is the |+⟩ product state, for which ⟨X⟩ = 1:

julia
julia> A = TensorMap(ones(Float64, 2, 1), ℂ^1^2, ℂ^1);

julia> ψ = InfiniteMPS([A]);

julia> length(ψ)
1

julia> X = TensorMap(Float64[0 1; 1 0], ℂ^2, ℂ^2);

julia> round(real(expectation_value(ψ, 1 => X)); digits = 6)
1.0
source
MPSKit.InfiniteQPEnvironments Type
julia
InfiniteQPEnvironments <: AbstractMPSEnvironments

Environments for an infinite QP-MPO-QP combination. These solve the corresponding fixedpoint equations:

where T_BL, T_BR, T_RL and T_LR are the (regularized) transfer matrix operators on a given site for B-O-AL, B-O-AR, AR-O-AL and AL-O-AR respectively.

source
MPSKit.Jeckelmann Type
julia
struct Jeckelmann <: MPSKit.DDMRG_Flavour

The original flavour of dynamical DMRG, which minimizes functional (14) from Jeckelmann2002. Writing   and  , this is

which attains its minimum at

Together with equation (11) from that same paper we can determine the full propagator  .

Returns the approximation of    and  .

See also

NaiveInvert for a less costly but less accurate alternative.

References

source
MPSKit.JordanMPOTensor Type
julia
struct JordanMPOTensor{T<:Number, S, A<:DenseArray{T<:Number, 1}} <: BlockTensorKit.AbstractBlockTensorMap{T<:Number, S, 2, 2}

A single tensor of a matrix product operator (MPO) in upper triangular (Jordan) block form, as used to represent the local tensors of an MPOHamiltonian. The virtual (row, column) structure is

where A is the bulk of interacting operators, C/B are the operators that start/finish an interaction, D is the on-site term, and the diagonal 1s are identities.

Type parameters

  • T <: Number: the scalartype of the tensors.

  • S: the spacetype of the tensors.

  • A <: DenseVector{T}: the storage type of the underlying tensors.

Properties

The reduced-leg A, B, C and D blocks are exposed as properties (W.A, W.B, W.C, W.D), reconstructed on demand from the stored tensors and scalars.

Notes

Rather than storing the dense block matrix, the genuine operators and the identities are kept separately:

  • tensors::SparseBlockTensorMap holds the non-identity operators over the full virtual space (so A, B, C and D all live at their (row, 1, 1, col) position).

  • scalars::Dict{CartesianIndex{4}, T} holds the scalar multiples of the identity, keyed by their (row, 1, 1, col) virtual position; the diagonal corner 1s are stored here as well.

An index is never present in both tensors and scalars. This keeps the ubiquitous identity blocks free of dense storage and lets identities be materialized lazily only when needed.

source
MPSKit.JordanMPO_AC2_Hamiltonian Type
julia
JordanMPO_AC2_Hamiltonian{O1, O2, O3, O4}

Efficient operator for representing the single-site derivative of a MPOHamiltonian sandwiched between two MPSs. In particular, this operator aims to make maximal use of the structure of the MPOHamiltonian to reduce the number of operations required to apply the operator to a tensor.

source
MPSKit.JordanMPO_AC_Hamiltonian Type
julia
JordanMPO_AC_Hamiltonian{O1, O2, O3}

Efficient operator for representing the single-site derivative of a MPOHamiltonian sandwiched between two MPSs. In particular, this operator aims to make maximal use of the structure of the MPOHamiltonian to reduce the number of operations required to apply the operator to a tensor.

source
MPSKit.LazySum Type
julia
struct LazySum{O} <: AbstractArray{O, 1}

Type that represents a lazy sum, i.e. explicit summation is only done when needed. This type is basically an AbstractVector with some extra functionality to calculate things efficiently.

Constructors

julia
LazySum(x::Vector)
LazySum(ops::AbstractVector, fs::AbstractVector)

Fields

  • ops::Vector: vector of summable objects
source
MPSKit.LeftCanonical Type
julia
struct LeftCanonical <: MPSKit.Algorithm

Algorithm for bringing an InfiniteMPS into the left-canonical form.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_orth::Any: algorithm used for orthogonalization of the tensors

  • alg_eigsolve::Any: algorithm used for the eigensolver

  • eig_miniter::Int64: minimal amount of iterations before using the eigensolver steps

See also

Used as the alg argument of gaugefix!.

source
MPSKit.LeftGaugedQP Type
julia
struct LeftGaugedQP{S, T1, T2, E<:Number}

Left-gauged quasiparticle excitation ansatz on top of a matrix product state ground state. The excitation is parametrized through the left-gauge nullspace of the ground-state tensors, and the object behaves as a vector so it can be handed directly to the iterative eigensolvers used by excitations.

For a FiniteMPS ground state this represents a finite (localized) quasiparticle; for an InfiniteMPS ground state it represents a momentum eigenstate with the given momentum. When left_gs !== right_gs the ansatz describes a domain wall between the two ground states.

Constructors

julia
LeftGaugedQP(datfun, left_gs, right_gs = left_gs; sector, momentum = 0.0)

These states are normally produced by excitations with a QuasiparticleAnsatz rather than constructed directly. When constructing manually, datfun initializes the variational tensors (e.g. rand/randn), sector selects the charge sector of the excitation, and momentum sets the momentum for infinite ground states.

Fields

  • left_gs, right_gs: the ground state(s) the excitation lives on; distinct values yield a domain wall.

  • VLs: left-nullspace tensors of the ground-state AL (satisfying AL' * VL == 0).

  • Xs: the variational parameters of the ansatz.

  • momentum: the excitation momentum (used for infinite ground states).

See also

RightGaugedQP, QP

source
MPSKit.MPO Type
julia
struct MPO{TO, V <: AbstractVector{TO}} <: AbstractMPO{TO}

Matrix Product Operator (MPO) acting on a tensor product space with a linear order.

See also: FiniteMPO, InfiniteMPO

source
MPSKit.MPODerivativeOperator Type
julia
struct MPODerivativeOperator{L, O <: Tuple, R, B, A}

Effective local operator obtained from taking the partial derivative of an MPS-MPO-MPS sandwich.

The backend and allocator fields are the ones used by the application of the operator. They default to DefaultBackend() and DefaultAllocator(), i.e. this operator does not hold on to any scratch space of its own unless it is explicitly given some.

source
MPSKit.MPOHamiltonian Type
julia
struct MPOHamiltonian{TO<:JordanMPOTensor, V<:AbstractArray{TO<:JordanMPOTensor, 1}} <: AbstractMPO{TO<:JordanMPOTensor}

MPO representation of a Hamiltonian. This is a specific form of an AbstractMPO, where all the sites are represented by an upper triangular block matrix of the following form:

where A, B, C, and D are MPOTensors, or (sparse) blocks thereof.

Constructors

The finite and infinite variants, FiniteMPOHamiltonian and InfiniteMPOHamiltonian, are constructed from a lattice of physical spaces together with a set of inds => operator pairs describing the local terms:

julia
FiniteMPOHamiltonian(lattice::AbstractArray{<:VectorSpace}, local_operators...)
InfiniteMPOHamiltonian(lattice::AbstractArray{<:VectorSpace}, local_operators...)

Properties

  • A: bulk block of interacting operators at each site

  • B: operators that finish an interaction

  • C: operators that start an interaction

  • D: on-site terms

Examples

A nearest-neighbour term is a two-element index tuple (i, i + 1) => O₁₂; an on-site term is a one-element tuple (i,) => O. For the finite variant the lattice lists every site; for the infinite variant it is a single unit cell and indices wrap around it periodically.

julia
julia> X = TensorMap(Float64[0 1; 1 0], ℂ^2, ℂ^2);

julia> Hf = FiniteMPOHamiltonian(fill(ℂ^2, 3), ((i, i + 1) => X  X for i in 1:2));

julia> Hf isa FiniteMPOHamiltonian, length(Hf)
(true, 3)

julia> Hi = InfiniteMPOHamiltonian(fill(ℂ^2, 1), (1, 2) => X  X, (1,) => X);

julia> Hi isa InfiniteMPOHamiltonian, length(Hi)
(true, 1)

See also

instantiate_operator is responsible for instantiating the local operators in a form that is compatible with this constructor.

source
MPSKit.MPOStyle Type
julia
abstract type OperatorStyle
OperatorStyle(x)
OperatorStyle(::Type{T})

Trait to describe the operator behavior of the input x or type T, which can be either

  • MPOStyle(): product of local factors;

  • HamiltonianStyle(): sum of local terms.

source
MPSKit.MPOTensor Type
julia
MPOTensor{S}

Tensor type for representing local MPO tensors, with the index convention W ⊗ S ← N ⊗ E, where N, E, S and W denote the north, east, south and west virtual spaces respectively.

source
MPSKit.MixedCanonical Type
julia
struct MixedCanonical <: MPSKit.Algorithm

Algorithm for bringing an InfiniteMPS into the mixed-canonical form.

Fields

  • alg_leftcanonical::MPSKit.LeftCanonical: algorithm for bringing an InfiniteMPS into left-canonical form.

  • alg_rightcanonical::MPSKit.RightCanonical: algorithm for bringing an InfiniteMPS into right-canonical form.

  • order::Symbol: order in which to apply the canonicalizations, should be :L, :R, :LR or :RL

See also

Used as the alg argument of gaugefix!.

source
MPSKit.Multiline Type
julia
struct Multiline{T}

Object that represents multiple lines of objects of type T. Typically used to represent multiple lines of InfiniteMPS (MultilineMPS) or MPO (Multiline{<:AbstractMPO}).

Fields

  • data::PeriodicArray{T, 1}: the data of the multiline object

See also

MultilineMPS and MultilineMPO

source
MPSKit.MultilineMPO Type
julia
const MultilineMPO = Multiline{<:AbstractMPO}

Type that represents multiple lines of MPO objects.

Constructors

julia
MultilineMPO(mpos::AbstractVector{<:Union{SparseMPO, DenseMPO}})
MultilineMPO(Os::AbstractMatrix{<:MPOTensor})

See also

Multiline, AbstractMPO

source
MPSKit.MultilineMPS Type
julia
const MultilineMPS = Multiline{<:InfiniteMPS}

Type that represents multiple lines of InfiniteMPS objects.

Constructors

julia
MultilineMPS(mpss::AbstractVector{<:InfiniteMPS})
MultilineMPS(
    [f, eltype], physicalspaces::Matrix{<:Union{S, CompositeSpace{S}}},
    virtualspaces::Matrix{<:Union{S, CompositeSpace{S}}}
) where {S <: ElementarySpace}
MultilineMPS(As::AbstractMatrix{<:GenericMPSTensor}; kwargs...)
MultilineMPS(
    ALs::AbstractMatrix{<:GenericMPSTensor},
    C₀::AbstractVector{<:MPSBondTensor}; kwargs...
)

Properties

  • AL: left-gauged MPS tensors

  • AR: right-gauged MPS tensors

  • AC: center-gauged MPS tensors

  • C: gauge (bond) tensors

See also

Multiline

source
MPSKit.MultipliedOperator Type
julia
Structure representing a multiplied operator. Consists of
    - An operator op (MPO, Hamiltonian, ...)
    - An object f that gets multiplied with the operator (Number, function, ...)
source
MPSKit.NaiveInvert Type
julia
struct NaiveInvert <: MPSKit.DDMRG_Flavour

An alternative approach to the dynamical DMRG algorithm, without quadratic terms but with a less controlled approximation. This algorithm minimizes the following cost function

Returns the approximation of    and  .

See also

Jeckelmann for the original approach.

source
MPSKit.NoiseSchedule Type
julia
NoiseSchedule

Supertype for controlling how a bond-expansion algorithm's noise/perturbation amplitude evolves across DMRG sweeps. A schedule s is called as s(noise, iter, ϵ) -> noise, given the current noise amplitude, the outer iteration count, and the current global convergence error, and returns the amplitude to use for the next iteration. Schedules can be composed with ; see ExponentialDecay, Warmup, FunctionalSchedule.

source
MPSKit.OperatorStyle Type
julia
abstract type OperatorStyle
OperatorStyle(x)
OperatorStyle(::Type{T})

Trait to describe the operator behavior of the input x or type T, which can be either

  • MPOStyle(): product of local factors;

  • HamiltonianStyle(): sum of local terms.

source
MPSKit.OptimalExpand Type
julia
struct OptimalExpand{S, B} <: MPSKit.Algorithm

An algorithm that expands the given mps as described in Zauner-Stauber et al. Phys. Rev. B 97 (2018), by selecting the dominant contributions of a two-site updated MPS tensor, orthogonal to the original ψ.

The expansion is state-preserving: the added directions are connected through a zero block, so that the expanded state represents the same physical state as the original one (as required for e.g. TDVP).

Note

trunc bounds how much is added to each bond, not the total bond dimension that is kept. It is applied to the two-site update projected onto the orthogonal complement of the current state, so truncrank(k) grows every bond by at most k — capped by the dimension of the local two-site complement, which is why a bond can grow by less than k, or not at all. The trunc of SvdCut, and of the drivers DMRG and TDVP, has the other meaning: it bounds what is kept.

Note

The projected block is normalized before the decomposition, so a value-based strategy (trunctol, truncerror) selects a fraction of the complement weight rather than an absolute error on the state, and the retained fraction does not shrink as the state converges. truncrank and truncspace are the strategies with a robust meaning here.

Note

changebonds! is only defined for FiniteMPS, and modifies both the state and its environment.

Fields

  • alg_svd::Any: algorithm used for the singular value decomposition

  • trunc::MatrixAlgebraKit.TruncationStrategy: truncation strategy selecting how many directions are added to each bond, rather than how much of the bond is kept

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of changebonds and changebonds!.

source
MPSKit.PeriodicArray Type
julia
struct PeriodicArray{T, N} <: AbstractArray{T, N}

Array wrapper with periodic boundary conditions.

Fields

  • data::Array{T, N}: the data of the array

Examples

julia
A = PeriodicArray([1, 2, 3])
A[0], A[2], A[4]

# output

(3, 2, 1)
julia
A = PeriodicArray([1 2; 3 4])
A[-1, 1], A[1, 1], A[4, 5]

# output

(1, 1, 3)

See also

PeriodicVector, PeriodicMatrix

source
MPSKit.PeriodicMatrix Type
julia
PeriodicMatrix{T}

Two-dimensional dense array with elements of type T and periodic boundary conditions. Alias for PeriodicArray{T, 2}.

source
MPSKit.PeriodicVector Type
julia
PeriodicVector{T}

One-dimensional dense array with elements of type T and periodic boundary conditions. Alias for PeriodicArray{T, 1}.

source
MPSKit.ProjectionDerivativeOperator Type
julia
struct ProjectionDerivativeOperator{L, O <: Tuple, R, B, A}

Effective local operator obtained from taking the partial derivative of the projector |ψ⟩⟨ψ| onto an MPS.

The backend and allocator fields are the ones used by the application of the operator. They default to DefaultBackend() and DefaultAllocator(), i.e. this operator does not hold on to any scratch space of its own unless it is explicitly given some.

source
MPSKit.QuasiparticleAnsatz Type
julia
struct QuasiparticleAnsatz{A, E} <: MPSKit.Algorithm

Optimization algorithm for quasi-particle excitations on top of MPS groundstates.

Constructors

julia
QuasiparticleAnsatz()
QuasiparticleAnsatz(; kwargs...)
QuasiparticleAnsatz(alg)

Create a QuasiparticleAnsatz algorithm with the given eigensolver, or by passing the keyword arguments to Arnoldi.

Fields

  • alg::Any: algorithm used for the eigenvalue solvers

  • alg_environments::Any: algorithm used for the quasiparticle environments

See also

Used as the algorithm argument of excitations.

References

source
MPSKit.RandExpand Type
julia
struct RandExpand{S} <: MPSKit.Algorithm

An algorithm that expands the bond dimension by adding random unitary vectors that are orthogonal to the existing state. This means that additional directions are added to AL and AR that are contained in the nullspace of both. Note that this happens in parallel, and therefore the expansion will never go beyond the local two-site subspace.

trunc bounds how much is added to each bond, not the total bond dimension that is kept, and it acts on a spectrum that carries no physical information: for an InfiniteMPS the weights are drawn uniformly at random, one per candidate direction, while for a FiniteMPS they are the singular values of a randomized two-site update restricted to the orthogonal complement. Only truncrank and truncspace therefore have a robust meaning — trunctol(; atol = x) keeps the directions whose random weight happens to exceed x. The trunc of SvdCut, and of the drivers DMRG and TDVP, has the other meaning: it bounds what is kept.

Note

The environments are not used here, but changebonds! modifies both the state and environment so they remain consistent.

Fields

  • alg_svd::Any: algorithm used for the singular value decomposition

  • trunc::MatrixAlgebraKit.TruncationStrategy: truncation strategy selecting how many directions are added to each bond, rather than how much of the bond is kept

See also

Used as the algorithm argument of changebonds and changebonds!.

source
MPSKit.RightCanonical Type
julia
struct RightCanonical <: MPSKit.Algorithm

Algorithm for bringing an InfiniteMPS into the right-canonical form.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_orth::Any: algorithm used for orthogonalization of the tensors

  • alg_eigsolve::Any: algorithm used for the eigensolver

  • eig_miniter::Int64: minimal amount of iterations before using the eigensolver steps

See also

Used as the alg argument of gaugefix!.

source
MPSKit.RightGaugedQP Type
julia
struct RightGaugedQP{S, T1, T2, E<:Number}

Right-gauged counterpart of LeftGaugedQP: the same quasiparticle excitation ansatz, but parametrized through the right-gauge nullspace of the ground-state tensors. It is most often obtained via convert(RightGaugedQP, ϕ) from a LeftGaugedQP rather than constructed directly.

Constructors

julia
RightGaugedQP(datfun, left_gs, right_gs = left_gs; sector, momentum = 0.0)

Fields

  • left_gs, right_gs: the ground state(s) the excitation lives on; distinct values yield a domain wall.

  • Xs: the variational parameters of the ansatz.

  • VRs: right-nullspace tensors of the ground-state AR.

  • momentum: the excitation momentum (used for infinite ground states).

See also

LeftGaugedQP, QP

source
MPSKit.SketchedExpand Type
julia
struct SketchedExpand{S, B} <: MPSKit.Algorithm

An algorithm that expands the bond dimension like OptimalExpand — selecting the dominant directions of the projected two-site update orthogonal to the current state — but at single-site cost using the randomized "shrewd selection" of Controlled Bond Expansion. A random sketch of the orthogonal complement is folded into the effective environment, collapsing the large bond before the two-site update is ever formed, and the dominant directions are read off a small singular value decomposition.

The state-preserving behaviour matches OptimalExpand.

Note

trunc bounds how much is added to each bond, not the total bond dimension that is kept: it sizes the sketch target Vk within the orthogonal complement (see sketch_space), so truncrank(k) aims to grow every bond by k, capped by the dimension of the local complement. Because that target space is selected from uniformly random weights rather than from a spectrum, its per-sector split is drawn at random rather than ordered by importance — unlike OptimalExpand, where the decomposition itself picks out the dominant sectors — so only truncrank and truncspace have a robust meaning here. The trunc of SvdCut, and of the drivers DMRG and TDVP, has the other meaning: it bounds what is kept.

Note

Only defined for FiniteMPS (through changebond!), so it can be used standalone or as the alg_expand strategy of DMRG. The reported ϵ_2site is a randomized estimate, and the folded application does not exploit JordanMPO sparsity.

Fields

  • alg_orth::Any: algorithm used to orthonormalize the sketched complement (passed as the alg of left_orth!/right_orth!); nothing selects QR without oversampling and an SVD-based decomposition otherwise

  • trunc::MatrixAlgebraKit.TruncationStrategy: truncation strategy selecting how many directions are added to each bond, rather than how much of the bond is kept

  • oversampling::Int64: number of extra sketch columns drawn beyond the target rank (range-finder oversampling)

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of changebonds and changebonds!.

References

source
MPSKit.SvdCut Type
julia
struct SvdCut{S} <: MPSKit.Algorithm

An algorithm that uses truncated SVD to change the bond dimension of a state or operator. This is achieved by a sweeping algorithm that locally performs (optimal) truncations in a gauged basis.

changedbonds! is only defined for FiniteMPS and FiniteMPO.

Fields

  • alg_svd::Any: algorithm used for the singular value decomposition

  • trunc::MatrixAlgebraKit.TruncationStrategy: algorithm used for truncation of the gauge tensors

See also

Used as the algorithm argument of changebonds and changebonds!.

References

source
MPSKit.TDVP Type
julia
struct TDVP{A, E, G, F, B} <: MPSKit.Algorithm

Single site MPS time-evolution algorithm based on the Time-Dependent Variational Principle.

For finite MPS, setting alg_expand to a bond-expansion algorithm (e.g. OptimalExpand, SketchedExpand) expands the bond with directions orthogonal to the current state ahead of each local integration, recovering Controlled Bond Expansion (CBE) TDVP and lifting the fixed-bond limitation of plain single-site TDVP. A truncating trunc is then required to cut the enlarged bond back down (selecting the truncated-SVD gauge). The expansion is state-preserving, as required for a consistent time evolution.

Note

By default the norm is not preserved: neither the bond expansion nor the truncation renormalizes, so the state norm keeps useful information (the accumulated truncation error in real time, or the decaying weight in imaginary time). Pass normalize = true to timestep/time_evolve to renormalize at every step instead, like a ground-state search. This is independent of imaginary_evolution. CBE is only available for finite MPS.

Fields

  • integrator::Any: algorithm used in the exponential solvers

  • tolgauge::Float64: tolerance for gauging algorithm

  • gaugemaxiter::Int64: maximal amount of iterations for gauging algorithm

  • alg_expand::Any: algorithm used to expand the bond ahead of each local update, or nothing for none (finite CBE-TDVP)

  • alg_gauge::Any: factorization used for the post-update gauge: a QR algorithm (no truncation) or a truncated SVD

  • finalize::Any: callback function applied after each iteration, of signature finalize(t, ψ, H, envs) -> ψ, envs

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of timestep, timestep! and time_evolve.

References

source
MPSKit.TDVP2 Type
julia
struct TDVP2{A, S, F, B} <: MPSKit.Algorithm

Two-site MPS time-evolution algorithm based on the Time-Dependent Variational Principle.

Fields

  • integrator::Any: algorithm used in the exponential solvers

  • tolgauge::Float64: tolerance for gauging algorithm

  • gaugemaxiter::Int64: maximal amount of iterations for gauging algorithm

  • alg_svd::Any: algorithm used for the singular value decomposition

  • trunc::MatrixAlgebraKit.TruncationStrategy: algorithm used for truncation of the two-site update

  • finalize::Any: callback function applied after each iteration, of signature finalize(t, ψ, H, envs) -> ψ, envs

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of timestep, timestep! and time_evolve.

References

source
MPSKit.TaylorCluster Type
julia
struct TaylorCluster <: MPSKit.Algorithm

Algorithm for constructing the Nth order time evolution MPO using the Taylor cluster expansion.

Fields

  • N::Int64: order of the Taylor expansion

  • extension::Bool: include higher-order corrections

  • compression::Bool: approximate compression of corrections, accurate up to order N

See also

Used as the algorithm argument of make_time_mpo.

References

source
MPSKit.TimedOperator Type
julia
Structure representing a time-dependent operator. Consists of
    - An operator op (MPO, Hamiltonian, ...)
    - An function f that gives the time-dependence according to op(t) = f(t)*op
source
MPSKit.UnionAlg Type
julia
struct UnionAlg{A, B} <: MPSKit.Algorithm

Algorithm wrapper representing the sequential application of two algorithms, as produced by alg1 & alg2.

Fields

  • alg1::Any: first algorithm

  • alg2::Any: second algorithm

See also

Used as the algorithm argument of find_groundstate and changebonds.

source
MPSKit.UntimedOperator Type
julia
Structure representing a time-independent operator that will be multiplied with a constant coefficient. Consists of
    - An operator (MPO, Hamiltonian, ...)
    - A number f that gets multiplied with the operator
source
MPSKit.VOMPS Type
julia
struct VOMPS{F, B} <: MPSKit.Algorithm

Power method algorithm for finding dominant eigenvectors of infinite MPOs. This method works by iteratively approximating the product of an operator and a state with a new state of the same bond dimension.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_gauge::Any: algorithm used for gauging the InfiniteMPS

  • alg_environments::Any: algorithm used for the MPS environments

  • finalize::Any: callback function applied after each iteration, of signature finalize(iter, ψ, H, envs) -> ψ, envs

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of leading_boundary and approximate.

References

source
MPSKit.VUMPS Type
julia
struct VUMPS{F, B} <: MPSKit.Algorithm

Variational optimization algorithm for uniform matrix product states, based on the combination of DMRG with matrix product state tangent space concepts.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal amount of iterations

  • verbosity::Int64: setting for how much information is displayed

  • alg_gauge::Any: algorithm used for gauging the InfiniteMPS

  • alg_eigsolve::Any: algorithm used for the eigenvalue solvers

  • alg_environments::Any: algorithm used for the MPS environments

  • finalize::Any: callback function applied after each iteration, of signature finalize(iter, ψ, H, envs) -> ψ, envs

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of find_groundstate and leading_boundary.

References

source
MPSKit.VUMPSSvdCut Type
julia
struct VUMPSSvdCut{B} <: MPSKit.Algorithm

An algorithm that uses a two-site update step to change the bond dimension of a state.

Note

changebonds! is not defined.

Fields

  • alg_gauge::Any: algorithm used for gauging the InfiniteMPS

  • alg_eigsolve::Any: algorithm used for the eigenvalue solvers

  • alg_svd::Any: algorithm used for the singular value decomposition

  • trunc::MatrixAlgebraKit.TruncationStrategy: algorithm used for truncation of the two-site update

  • backend::Any: backend for tensor contractions and index manipulations

See also

Used as the algorithm argument of changebonds.

source
MPSKit.WII Type
julia
struct WII <: MPSKit.Algorithm

Generalization of the Euler approximation of the operator exponential for MPOs.

Fields

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int64: maximal number of iterations

See also

Used as the algorithm argument of make_time_mpo.

References

source
MPSKit.Warmup Type
julia
Warmup(iters::Int)

Noise schedule that keeps the noise amplitude constant for the first iters outer iterations, then drops it to exactly zero. Useful composed with a decaying schedule (e.g. ExponentialDecay(0.7) ∘ Warmup(5)) to hold the perturbation at full strength for a few sweeps before starting to taper it off.

source
MPSKit.WindowArray Type
julia
WindowArray{T} <: AbstractVector{T}

A vector embedded in a periodic environment to the left and right, which can be accessed with arbitrary integer indices. The middle part is a regular Vector{T} and the left and right parts are PeriodicVector{T}s.

This vector inherits most of its properties from the middle part, including its length and axes. Nevertheless, indexing operations are overloaded to allow for out-of-bounds access, which is resolved by the periodic environments.

See also PeriodicVector.

source
MPSKit.WindowMPOHamiltonian Type
julia
struct WindowMPOHamiltonian{O} <: AbstractMPO{O}

The Hamiltonian counterpart of a WindowMPS: a finite region embedded between an infinite environment to the left and to the right. It consists of an infinite Hamiltonian to the left, a finite Hamiltonian in the middle, and an infinite Hamiltonian to the right.

Acts similar to just a finite Hamiltonian, but we "remember" the boundary Hamiltonians.

Constructors

julia
WindowMPOHamiltonian(ham::InfiniteMPOHamiltonian, interval::UnitRange)

Construct a WindowMPOHamiltonian by carving a finite interval out of an infinite Hamiltonian ham. The finite window consists of the sites in interval, while the left and right environments are copies of ham whose unit cells are circshifted so that they line up with the window boundaries.

Fields

  • left_ham::MPOHamiltonian{O, PeriodicVector{O}} where O: Hamiltonian acting on the infinite environment to the left of the window

  • finite_ham::MPOHamiltonian{O, Vector{O}} where O: Hamiltonian acting on the finite window

  • right_ham::MPOHamiltonian{O, PeriodicVector{O}} where O: Hamiltonian acting on the infinite environment to the right of the window

source
MPSKit.WindowMPS Type
julia
struct WindowMPS{A<:(TensorKit.AbstractTensorMap{T, S, N, 1} where {S, N, T}), B<:(TensorKit.AbstractTensorMap{T, S, 1, 1} where {S, T})} <: MPSKit.AbstractFiniteMPS

Type that represents a finite Matrix Product State embedded in an infinite Matrix Product State.

Constructors

julia
WindowMPS(left_gs::InfiniteMPS, window_state::FiniteMPS, [right_gs::InfiniteMPS])
WindowMPS(left_gs::InfiniteMPS, window_tensors::AbstractVector, [right_gs::InfiniteMPS])
WindowMPS(
    [f, eltype], physicalspaces::Vector{<:Union{S, CompositeSpace{S}}},
    virtualspaces::Vector{<:Union{S, CompositeSpace{S}}}, left_gs::InfiniteMPS,
    [right_gs::InfiniteMPS]
)
WindowMPS(
    [f, eltype], physicalspaces::Vector{<:Union{S, CompositeSpace{S}}},
    maxvirtualspace::S, left_gs::InfiniteMPS, [right_gs::InfiniteMPS]
)
WindowMPS::InfiniteMPS, L::Int)

Construct a WindowMPS via a specification of left and right infinite environment, and either a window state or a vector of tensors to construct the window. Alternatively, it is possible to supply the same arguments as for the constructor of FiniteMPS, followed by a left (and right) environment to construct the WindowMPS in one step. Finally, a WindowMPS can be constructed from an InfiniteMPS by promoting a region of length L to a FiniteMPS.

Note

By default, the right environment is chosen to be equal to the left, however no copy is made. In this case, changing the left state will also affect the right state.

Properties

  • left_gs::InfiniteMPS: left infinite environment

  • window::FiniteMPS: finite window Matrix Product State

  • right_gs::InfiniteMPS: right infinite environment

  • AL: left-gauged MPS tensors

  • AR: right-gauged MPS tensors

  • AC: center-gauged MPS tensors

  • C: gauge (bond) tensors

source
MPSKit.WindowMPS Method
julia
WindowMPS::InfiniteMPS, L::Int)
WindowMPS::InfiniteMPS, interval::UnitRange)

Construct a WindowMPS from an infinite MPS ψ by promoting the sites in interval (or 1:L) to the finite window while keeping ψ as the left and right infinite environments. The environment unit cells are circshifted so that they line up with the window boundaries.

source
MPSKit.Zipup Type
julia
struct Zipup{U<:MatrixAlgebraKit.TruncatedAlgorithm, D<:Union{Nothing, MatrixAlgebraKit.TruncatedAlgorithm}} <: MPSKit.Algorithm

Algorithm that approximates an open-boundary finite MPO-MPS product using a zip-up sweep, optionally followed by a zip-down sweep in the opposite direction. The MPO and MPS are contracted one site at a time, and the enlarged virtual bond is truncated immediately. The sweep direction is selected by left_to_right.

julia
approximate((O, ϕ), alg::Zipup) -> ψ, ϵ
approximate!(ψ, (O, ϕ), alg::Zipup) -> ψ, ϵ

Contrary to the variational algorithms, this algorithm requires no initial guess: the in-place version simply uses ψ as the destination of the sweep, overwriting its contents, and may alias ϕ. The out-of-place version allocates a destination with the promoted scalar type of O and ϕ. Both return the truncation error ϵ alongside the approximated state.

Constructors

julia
Zipup(; trunc, alg_svd = Defaults.alg_svd(), left_to_right = true)
Zipup(alg_zipup, [alg_zipdown]; left_to_right = true)

Create a Zipup algorithm with the given truncated gauge algorithm, or by passing a truncation scheme and singular value decomposition algorithm. The keyword trunc can be either one truncation strategy for a single zip-up sweep, or a tuple (zipup_trunc, zipdown_trunc) for a zip-up sweep followed by a zip-down sweep. Equivalently, one can pass the corresponding truncated gauge algorithms directly as alg_zipup and alg_zipdown. The keyword left_to_right selects the direction of the zip-up sweep, the zip-down sweep always running in the opposite direction.

Following Paeckel et al., if the desired final bond dimension is D, one can use a more permissive zip-up truncation, e.g. rank 2D with stricter tolerances, and use alg_zipdown to impose the final truncation.

Fields

  • alg_zipup::MatrixAlgebraKit.TruncatedAlgorithm: algorithm used for gauging and truncating the local tensors during the zip-up sweep

  • alg_zipdown::Union{Nothing, MatrixAlgebraKit.TruncatedAlgorithm}: algorithm used for the final locally gauged truncation pass; nothing skips this pass

  • left_to_right::Bool: if true, zip up from left to right and truncate from right to left, and vice versa

References

source
Base.:∘ Method
julia
s1::NoiseSchedule s2::NoiseSchedule

Compose two noise schedules: s2 is applied first, and its result is fed through s1, i.e. (s1 ∘ s2)(noise, iter, ϵ) == s1(s2(noise, iter, ϵ), iter, ϵ) — the same convention as function composition in Base.

source
MPSKit.AC2 Function
julia
AC2::AbstractMPS, i; kind = :ACAR)

Obtain the two-site (center) gauge tensor at site i of the MPS ψ. If this hasn't been computed before, this can be computed as:

  • kind = :ACAR: AC[i] * AR[i+1]

  • kind = :ALAC: AL[i] * AC[i+1]

source
MPSKit.AC2_hamiltonian Function
julia
AC2_hamiltonian(site, below, operator, above, envs)

Effective two-site local operator acting at site.

julia
 ┌──        ──┐ 
 │   │    │   │ 
┌┴┐┌─┴─┐┌─┴─┐┌┴┐
│ ├┤   ├┤   ├┤ │
└┬┘└─┬─┘└─┬─┘└┬┘
 │   │    │   │ 
 └──        ──┘

See also AC2_projection.

source
MPSKit.AC2_projection Function
julia
AC2_projection(site, below, operator, above, envs)

Application of the effective two-site local operator at a given site.

julia
    ┌──────┐    
 ┌──┤      ├──┐ 
 │  └┬────┬┘  │ 
┌┴┐┌─┴─┐┌─┴─┐┌┴┐
│ ├┤   ├┤   ├┤ │
└┬┘└─┬─┘└─┬─┘└┬┘
 │   │    │   │ 
 └──        ──┘

See also AC2_hamiltonian.

source
MPSKit.AC_hamiltonian Function
julia
AC_hamiltonian(site, below, operator, above, envs)::DerivativeOperator

Effective one-site local operator acting at site.

julia
 ┌───   ───┐ 
 │    │    │ 
┌┴┐ ┌─┴─┐ ┌┴┐
│ ├─┤   ├─┤ │
└┬┘ └─┬─┘ └┬┘
 │    │    │ 
 └───   ───┘

See also AC_projection.

source
MPSKit.AC_projection Function
julia
AC_projection(site, below, operator, above, envs)

Application of the effective one-site local operator at a given site.

julia
    ┌───┐    
 ┌──┤   ├──┐ 
 │  └─┬─┘  │ 
┌┴┐ ┌─┴─┐ ┌┴┐
│ ├─┤   ├─┤ │
└┬┘ └─┬─┘ └┬┘
 │    │    │ 
 └──     ──┘

See also AC_hamiltonian.

source
MPSKit.C_hamiltonian Function
julia
C_hamiltonian(site, below, operator, above, envs)::DerivativeOperator

Effective zero-site local operator acting at site.

julia
 ┌─   ─┐ 
 │     │ 
┌┴┐   ┌┴┐
│ ├───┤ │
└┬┘   └┬┘
 │     │ 
 └─   ─┘

See also C_projection.

source
MPSKit.C_projection Function
julia
C_projection(site, below, operator, above, envs)

Application of the effective zero-site local operator at a given site.

julia
   ┌─┐   
 ┌─┤ ├─┐ 
 │ └─┘ │ 
┌┴┐   ┌┴┐
│ ├───┤ │
└┬┘   └┬┘
 │     │ 
 └─   ─┘

See also C_hamiltonian.

source
MPSKit._fuse_mpo_mps Method

Fuse the left and right virtual legs of the product of MPO-MPS tensors

julia
---A---
    1 --Fl  |  Fr-- 3   =>  A′[1 2; 3]
---O---
            |
            2
source
MPSKit._fuse_mpo_mps_left Method

Fuse the left virtual legs of the product of MPO-MPS tensors

julia
---A--- 3
    1 --Fl  |       =>  A′[1 2; 3 4]
---O--- 4
            |
            2
source
MPSKit._fuse_mpo_mps_right Method

Fuse the right virtual legs of the product of MPO-MPS tensors

julia
    1 --A---
        |  Fr-- 3   =>  A′[1 2; 3 4]
    2 --O---
        |
        4
source
MPSKit._gaugecenter Method
julia
_gaugecenter::FiniteMPS)::HalfInt

Return the location of the MPS center.

center::HalfInt:

  • isinteger(center)center is a whole number and indicates the location of the first AC tensor present in ψ.ACs

  • ishalfodd(center)center is a half-odd-integer, meaning that there are no AC tensors, and indicating between which sites the bond tensor lives.

Examples

julia
ψ = FiniteMPS(3, ℂ^2, ℂ^16)
ψ.center # returns 7/2, bond tensor is to the right of the 3rd site
ψ.AC[1]   # moves center to first site
ψ.center # returns 1
source
MPSKit.add_util_leg Method
julia
add_util_leg(tensor::AbstractTensorMap{T, S, N1, N2}) where {T, S, N1, N2}
    -> AbstractTensorMap{T, S, N1+1, N2+1}

Add trivial one-dimensional utility spaces with trivial sector to the left and right of a given tensor map, i.e. as the first space of the codomain and the last space of the domain.

source
MPSKit.approx_angles Method

Find the closest fractions of π, differing at most tol_angle

source
MPSKit.approximate Function
julia
approximate(ψ₀, (O, ψ), [environments]; kwargs...) -> (ψ, environments, ϵ)
approximate(ψ₀, (O, ψ), algorithm, [environments]) -> (ψ, environments, ϵ)
approximate!(ψ₀, (O, ψ), algorithm, [environments]) -> (ψ, environments, ϵ)
approximate(ψ₀, ψ, algorithm, [environments]) -> (ψ, environments, ϵ)
approximate!(ψ₀, ψ, algorithm, [environments]) -> (ψ, environments, ϵ)
approximate((O, ψ), algorithm) -> (ψ′, ϵ)
approximate!(ψ₀, (O, ψ), algorithm) -> (ψ, ϵ)

Compute an approximation to the application of an operator O to the state ψ in the form of an MPS, using initial guess ψ₀. If only a state ψ is supplied instead of the (O, ψ) pair, ψ₀ is approximated directly to ψ (i.e. O is taken to be the identity).

Not every algorithm supports every combination of arguments below — see the per-algorithm notes at the end of this docstring before picking one.

Arguments

  • ψ₀::AbstractMPS: initial guess of the approximated state

  • (O::AbstractMPO, ψ::AbstractMPS): operator O and state ψ to be approximated

  • ψ::AbstractMPS: state to be approximated directly (without an operator)

  • algorithm: approximation algorithm. See below for a list of available algorithms.

  • [environments]: MPS environment manager

Keyword Arguments

The keyword-based call (no explicit algorithm) is a convenience method that picks an algorithm for you based on the type of ψ₀ (DMRG/DMRG2 for a finite MPS, VOMPS/IDMRG/ IDMRG2 for an infinite MPS) and only accepts the (O, ψ) tuple form of toapprox. Once you pass an explicit algorithm, keywords are no longer accepted here — configure the algorithm struct itself instead (e.g. DMRG(; tol, maxiter, verbosity)).

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int: maximum amount of iterations

  • verbosity::Int: display progress information

  • trunc: if supplied, a truncated two-site sweep (DMRG2/IDMRG2) is prepended to refine the bond dimension before the single-site algorithm polishes the result.

Algorithms

Each algorithm below only supports a subset of the general interface. Check this table before picking one — in particular, note that only DMRG/DMRG2 accept a bare state ψ; the infinite algorithms always require an explicit (O, ψ) tuple, and VOMPS has no in-place approximate! at all. Zipup is a single sweep rather than an iterative optimization, so it uses no environments and returns (ψ, ϵ); its ψ₀ is a write destination, not an initial guess, and it may be omitted.

AlgorithmSchemeState ψ₀bare ψ allowed?approximate!
DMRGsingle-site, fixes bond dimAbstractFiniteMPS
DMRG2two-site, truncates via truncAbstractFiniteMPS
Zipupstreaming MPO-MPS compressionFiniteMPS destination, optional❌ (tuple only)
IDMRGsingle-site, thermodynamic limitInfiniteMPS / MultilineMPS❌ (tuple only)
IDMRG2two-site, thermodynamic limit, needs unit cell ≥ 2InfiniteMPS / MultilineMPS❌ (tuple only)
VOMPStangent-space truncationInfiniteMPS / MultilineMPS❌ (tuple only)❌ (out-of-place only)

InfiniteMPS/InfiniteMPO inputs are converted internally to MultilineMPS/MultilineMPO for IDMRG, IDMRG2, and VOMPS; you can also pass those types directly.

source
MPSKit.approximate! Function
julia
approximate(ψ₀, (O, ψ), [environments]; kwargs...) -> (ψ, environments, ϵ)
approximate(ψ₀, (O, ψ), algorithm, [environments]) -> (ψ, environments, ϵ)
approximate!(ψ₀, (O, ψ), algorithm, [environments]) -> (ψ, environments, ϵ)
approximate(ψ₀, ψ, algorithm, [environments]) -> (ψ, environments, ϵ)
approximate!(ψ₀, ψ, algorithm, [environments]) -> (ψ, environments, ϵ)
approximate((O, ψ), algorithm) -> (ψ′, ϵ)
approximate!(ψ₀, (O, ψ), algorithm) -> (ψ, ϵ)

Compute an approximation to the application of an operator O to the state ψ in the form of an MPS, using initial guess ψ₀. If only a state ψ is supplied instead of the (O, ψ) pair, ψ₀ is approximated directly to ψ (i.e. O is taken to be the identity).

Not every algorithm supports every combination of arguments below — see the per-algorithm notes at the end of this docstring before picking one.

Arguments

  • ψ₀::AbstractMPS: initial guess of the approximated state

  • (O::AbstractMPO, ψ::AbstractMPS): operator O and state ψ to be approximated

  • ψ::AbstractMPS: state to be approximated directly (without an operator)

  • algorithm: approximation algorithm. See below for a list of available algorithms.

  • [environments]: MPS environment manager

Keyword Arguments

The keyword-based call (no explicit algorithm) is a convenience method that picks an algorithm for you based on the type of ψ₀ (DMRG/DMRG2 for a finite MPS, VOMPS/IDMRG/ IDMRG2 for an infinite MPS) and only accepts the (O, ψ) tuple form of toapprox. Once you pass an explicit algorithm, keywords are no longer accepted here — configure the algorithm struct itself instead (e.g. DMRG(; tol, maxiter, verbosity)).

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int: maximum amount of iterations

  • verbosity::Int: display progress information

  • trunc: if supplied, a truncated two-site sweep (DMRG2/IDMRG2) is prepended to refine the bond dimension before the single-site algorithm polishes the result.

Algorithms

Each algorithm below only supports a subset of the general interface. Check this table before picking one — in particular, note that only DMRG/DMRG2 accept a bare state ψ; the infinite algorithms always require an explicit (O, ψ) tuple, and VOMPS has no in-place approximate! at all. Zipup is a single sweep rather than an iterative optimization, so it uses no environments and returns (ψ, ϵ); its ψ₀ is a write destination, not an initial guess, and it may be omitted.

AlgorithmSchemeState ψ₀bare ψ allowed?approximate!
DMRGsingle-site, fixes bond dimAbstractFiniteMPS
DMRG2two-site, truncates via truncAbstractFiniteMPS
Zipupstreaming MPO-MPS compressionFiniteMPS destination, optional❌ (tuple only)
IDMRGsingle-site, thermodynamic limitInfiniteMPS / MultilineMPS❌ (tuple only)
IDMRG2two-site, thermodynamic limit, needs unit cell ≥ 2InfiniteMPS / MultilineMPS❌ (tuple only)
VOMPStangent-space truncationInfiniteMPS / MultilineMPS❌ (tuple only)❌ (out-of-place only)

InfiniteMPS/InfiniteMPO inputs are converted internally to MultilineMPS/MultilineMPO for IDMRG, IDMRG2, and VOMPS; you can also pass those types directly.

source
MPSKit.bond_type Method
julia
bond_type::AbstractMPS)
bond_type(ψtype::Type{<:AbstractMPS})

Return the type of the bond tensors of an AbstractMPS.

source
MPSKit.braille Method
julia
braille(io::IO, H::Union{SparseMPO, MPOHamiltonian})
braille(H::Union{SparseMPO, MPOHamiltonian})

Prints a compact, human-readable "braille" visualization of a sparseMPO or MPOHamiltonian. Each site of the MPO is represented as a block of Unicode braille characters, with sites separated by dashes. This visualization is useful for quickly inspecting the structure and sparsity pattern of MPOs.

Arguments

  • io::IO: The output stream to print to (e.g., stdout).

  • H::Union{SparseMPO, MPOHamiltonian}: The SparseMPO or MPOHamiltonian to visualize.

If called without an io argument, output is printed to stdout.

source
MPSKit.calc_galerkin Method
julia
calc_galerkin(below, operator, above, envs; kwargs...)
calc_galerkin(pos, below, operator, above, envs; kwargs...)

Calculate the Galerkin error, which is the error between the solution of the original problem, and the solution of the problem projected on the tangent space. Concretely, this is the overlap of the current state with the single-site derivative, projected onto the nullspace of the current state:

Keyword Arguments

  • backend = DefaultBackend(): backend for the tensor contractions of the derivative.

  • allocator = DefaultAllocator(): allocator serving their scratch space. A sweep that already holds one should pass it, rather than leaving this contraction to the garbage collector.

source
MPSKit.changebond Function
julia
changebond(site, dir, ψ, [H], alg, [envs]) -> ψ
changebond!(site, dir, ψ, [H], alg, [envs]) -> ψ

Expand a single bond of ψ by adding directions orthogonal to the current state, keeping the state in mixed-canonical form around the expanded bond. The sweep direction dir is a Val(:right) or Val(:left) used for dispatch. For Val(:right) the bond (site, site + 1) is expanded on the right tensor (ψ.AR[site + 1]) with zero weight added at ψ.AC[site], so that a subsequent single-site optimization of site sees the new directions; for Val(:left) the mirror is applied to bond (site - 1, site).

See also changebonds, changebonds!.

source
MPSKit.changebond! Function
julia
changebond(site, dir, ψ, [H], alg, [envs]) -> ψ
changebond!(site, dir, ψ, [H], alg, [envs]) -> ψ

Expand a single bond of ψ by adding directions orthogonal to the current state, keeping the state in mixed-canonical form around the expanded bond. The sweep direction dir is a Val(:right) or Val(:left) used for dispatch. For Val(:right) the bond (site, site + 1) is expanded on the right tensor (ψ.AR[site + 1]) with zero weight added at ψ.AC[site], so that a subsequent single-site optimization of site sees the new directions; for Val(:left) the mirror is applied to bond (site - 1, site).

See also changebonds, changebonds!.

source
MPSKit.changebonds Function
julia
changebonds::AbstractMPS, H, alg, envs) -> ψ′, envs′
changebonds::AbstractMPS, alg) -> ψ′

Change the bond dimension of ψ using the algorithm alg, and return the new ψ and the new envs. For AbstractInfiniteMPS, changebonds returns new environments without modifying the one provided. changedbonds! can modify both the provided state and environments, depending on the algorithm. For FiniteMPS, changebonds also modifies the environments.

See also: SvdCut, RandExpand, VUMPSSvdCut, OptimalExpand

Examples

Growing the bond dimension of a product state with OptimalExpand, which expands each bond with directions orthogonal to the current state (using the environments of H):

julia
julia> Z = TensorMap(Float64[1 0; 0 -1], ℂ^2, ℂ^2);

julia> ψ = FiniteMPS(ones(Float64, (ℂ^2)^4));

julia> H = FiniteMPOHamiltonian(fill(ℂ^2, 4), ((i, i + 1) => Z  Z for i in 1:3));

julia> dim(left_virtualspace(ψ, 3))
1

julia> ψ′, envs = changebonds(ψ, H, OptimalExpand(; trunc = truncrank(4)));

julia> dim(left_virtualspace(ψ′, 3))
2

Note

A bond is only expanded if there is something to expand it with. If the projection of the two-site update onto the orthogonal complement of the current state vanishes — for instance when the state is already an exact eigenstate of the local terms, or when the operator does not couple into a symmetry sector yet — that bond is left untouched. Replacing Z ⊗ Z by X ⊗ X above illustrates this: ones(Float64, (ℂ^2)^4) is an eigenstate of every X ⊗ X term, so every bond stays at dimension 1.

source
MPSKit.changebonds! Function
julia
changebonds::AbstractMPS, H, alg, envs) -> ψ′, envs′
changebonds::AbstractMPS, alg) -> ψ′

Change the bond dimension of ψ using the algorithm alg, and return the new ψ and the new envs. For AbstractInfiniteMPS, changebonds returns new environments without modifying the one provided. changedbonds! can modify both the provided state and environments, depending on the algorithm. For FiniteMPS, changebonds also modifies the environments.

See also: SvdCut, RandExpand, VUMPSSvdCut, OptimalExpand

Examples

Growing the bond dimension of a product state with OptimalExpand, which expands each bond with directions orthogonal to the current state (using the environments of H):

julia
julia> Z = TensorMap(Float64[1 0; 0 -1], ℂ^2, ℂ^2);

julia> ψ = FiniteMPS(ones(Float64, (ℂ^2)^4));

julia> H = FiniteMPOHamiltonian(fill(ℂ^2, 4), ((i, i + 1) => Z  Z for i in 1:3));

julia> dim(left_virtualspace(ψ, 3))
1

julia> ψ′, envs = changebonds(ψ, H, OptimalExpand(; trunc = truncrank(4)));

julia> dim(left_virtualspace(ψ′, 3))
2

Note

A bond is only expanded if there is something to expand it with. If the projection of the two-site update onto the orthogonal complement of the current state vanishes — for instance when the state is already an exact eigenstate of the local terms, or when the operator does not couple into a symmetry sector yet — that bond is left untouched. Replacing Z ⊗ Z by X ⊗ X above illustrates this: ones(Float64, (ℂ^2)^4) is an eigenstate of every X ⊗ X term, so every bond stays at dimension 1.

source
MPSKit.check_unambiguous_braiding Method
julia
check_unambiguous_braiding(::Type{Bool}, V::VectorSpace)::Bool
check_unambiguous_braiding(V::VectorSpace)

Verify that the braiding of a vector space is unambiguous. This is the case if the braiding is symmetric or if all sectors are trivial. The signature with Type{Bool} is used to check while the signature without is used to throw an error if the braiding is ambiguous.

source
MPSKit.correlation_length Method
julia
correlation_length(above::InfiniteMPS; sector = nothing, kwargs...)

Compute the correlation length of a given InfiniteMPS based on the next-to-leading eigenvalue of the transfer matrix.

By default this returns a TensorKit.SectorDict mapping each sector of the transfer spectrum to its correlation length. Passing a specific sector returns only that sector's correlation length as a scalar. The remaining kwargs are passed on to transfer_spectrum.

source
MPSKit.correlator Function
julia
correlator(ψ, O1, O2, i, j)
correlator(ψ, O12, i, j)

Compute the 2-point correlator <ψ|O1[i]O2[j]|ψ> for inserting O1 at i and O2 at j. Also accepts ranges for j. The sites must be ordered as i < j; other orderings throw an ArgumentError.

source
MPSKit.default_allocator Method
julia
default_allocator(x, scheduler) -> allocator

The allocator that serves the scratch space of local updates on x, for work scheduled with scheduler.

x is anything with a storagetype, typically the state being operated on. Host memory gets a TensorOperations.BufferAllocator, which serves intermediates from a reusable buffer, when a single task owns the allocator, and a TensorOperations.ManualAllocator, which mallocs and frees them one by one, when the allocator is shared between tasks - a buffer is not thread-safe, whereas a manual allocator holds no state at all. Any other storage type falls back on TensorOperations.DefaultAllocator, which allocates through the storage type itself and is therefore correct on any device, at the cost of leaving intermediates to the garbage collector.

Extend this function to serve a storage type that MPSKit does not know about. Dedicated scratch space can be turned off altogether with MPSKit.Defaults.set_buffering!.

Warning

An allocator obtained for a SerialScheduler must not be shared between tasks. Sites that spawn should pass the scheduler they spawn with, so that the allocator matches the concurrency.

source
MPSKit.eachsite Method
julia
eachsite(state::AbstractMPS)

Return an iterator over the sites of the MPS state.

source
MPSKit.entanglement_spectrum Function
julia
entanglement_spectrum(ψ, site::Int) -> SectorVector{T, sectortype(ψ), AbstractVector{T}}

Compute the entanglement spectrum across the cut that splits the chain between sites site and site + 1, i.e. the singular values of the gauge tensor ψ.C[site]. The contributions from specific sectors can be viewed by indexing accordingly, i.e. entanglement_spectrum(ψ, site)[sector].

site runs over 0:length(ψ). For FiniteMPS, 0 and length(ψ) are the cuts at the left and right edge of the chain. No default is given for FiniteMPS; it is up to the user to specify. For WindowMPS and InfiniteMPS, site defaults to 0.

source
MPSKit.entanglementplot Function
julia
entanglementplot(state; site = 0[, kwargs...])

Plot the entanglement spectrum (see entanglement_spectrum) of a given MPS state.

Arguments

  • state: the MPS for which to compute the entanglement spectrum.

Keyword Arguments

  • site::Int = 0: MPS index for multisite unit cells. The spectrum is computed for the bond between site and site + 1.

  • expand_symmetry = false: add quantum dimension degeneracies.

  • sortby = maximum: the method of sorting the sectors.

  • sector_margin = 1 // 10: the amount of whitespace between sectors.

  • sector_formatter = string: how to convert sectors to strings.

  • kwargs...: other kwargs are passed on to the plotting backend.

Note

You will need to manually import Plots.jl to be able to use this function. MPSKit.jl defines its plots based on RecipesBase.jl, but the user still has to add using Plots to be able to actually produce the plots.

source
MPSKit.entropy Method
julia
entropy(state, [site::Int])
entropy(spectrum::SectorVector)

Calculate the von Neumann entanglement entropy. The entropy can be computed from either an MPS state or directly from an entanglement spectrum as obtained from entanglement_spectrum.

When called on an MPS with an integer site, the entropy is computed for the bipartition that splits the chain between sites site and site + 1. site = 0 therefore denotes the cut to the left of the first site. For InfiniteMPS, omitting site returns a vector of entropies, one for each site. For FiniteMPS and WindowMPS, site is required.

source
MPSKit.environment_alg Method
julia
environment_alg(below, operator, above; kwargs...)

Determine an appropriate algorithm for computing the environments, based on the given kwargs....

source
MPSKit.environments Function
julia
environments(below, operator, above, [alg]; kwargs...)
environments(below, above)

Construct the environments for the operator sandwiched between the states below (bra) and above (ket). The keyword arguments or alg struct can be used to control the settings needed for computing the environments.

The two-argument form environments(below, above) (with two states) constructs the overlap environments, i.e. the operator-free environments between the bra below and the ket above.

Note

The operator form requires an explicit above; there is no two-argument environments(below, operator) shorthand. Because a two-argument call is the overlap form, the second argument cannot be disambiguated between a ket (overlap) and an operator — this is genuinely undecidable for density matrices, where states and operators share a representation.

source
MPSKit.exact_diagonalization Method
julia
exact_diagonalization(
        H::FiniteMPOHamiltonian;
        sector = rightunit(H), num::Int = 1, which::Symbol = :SR,
        alg = Defaults.alg_eigsolve(; dynamic_tols = false),
        backend = Defaults.backend()
    ) -> vals, state_vecs, convhist

Use KrylovKit.eigsolve to perform exact diagonalization on a FiniteMPOHamiltonian to find its eigenvectors as FiniteMPS of maximal rank, essentially equivalent to dense eigenvectors.

Arguments

  • H::FiniteMPOHamiltonian: the Hamiltonian to diagonalize.

Keyword Arguments

  • sector = rightunit(H): the total charge of the eigenvectors, which is chosen trivial by default.

  • num::Int = 1: the number of eigenvectors to find.

  • which::Symbol = :SR: the kind eigenvalues to find, see KrylovKit.eigsolve.

  • alg = Defaults.alg_eigsolve(; dynamic_tols = false): the diagonalization algorithm to use, see KrylovKit.eigsolve.

  • backend = Defaults.backend(): backend for tensor contractions and index manipulations.

Valid sector values

The total charge of the eigenvectors is imposed by adding a charged auxiliary space as the leftmost virtualspace of each eigenvector. Specifically, this is achieved by passing left = Vect[typeof(sector)](sector => 1) to the FiniteMPS constructor. As such, the only valid sector values (i.e. sector values for which the corresponding eigenstates have valid fusion channels) are those that occur in the dual of the fusion of all the physical spaces in the system.

source
MPSKit.excitations Function
julia
excitations(
        H, algorithm::QuasiparticleAnsatz, left_ψ::FiniteMPS, [left_environment],
        [right_ψ::FiniteMPS], [right_environment]; kwargs...
    ) -> (energies, states)

Create and optimize finite quasiparticle states.

Arguments

  • H::AbstractMPO: operator for which to find the excitations

  • algorithm::QuasiparticleAnsatz: optimization algorithm

  • left_ψ::FiniteMPS: left ground state

  • [left_environment]: left ground state environment

  • [right_ψ::FiniteMPS]: right ground state

  • [right_environment]: right ground state environment

Keyword Arguments

  • num::Int: number of excited states to compute

  • sector = leftunit(lmps): charge of the quasiparticle state

source
MPSKit.excitations Function
julia
excitations(
        H, algorithm::QuasiparticleAnsatz, ψ::FiniteQP, [left_environments],
        [right_environments]; num = 1
    ) -> (energies, states)
excitations(
        H, algorithm::QuasiparticleAnsatz, ψ::InfiniteQP, [left_environments],
        [right_environments]; num = 1
    ) -> (energies, states)
excitations(
        H, algorithm::FiniteExcited, ψs::NTuple{<:Any, <:FiniteMPS};
        num = 1, init
    ) -> (energies, states)
excitations(
        H, algorithm::ChepigaAnsatz, ψ::FiniteMPS, [envs];
        num = 1, pos = length(ψ) ÷ 2
    ) -> (energies, states)
excitations(
        H, algorithm::ChepigaAnsatz2, ψ::FiniteMPS, [envs];
        num = 1, pos = length(ψ) ÷ 2
    ) -> (energies, states)

Compute the first excited states and their energy gap above a ground state.

Arguments

  • H::AbstractMPO: operator for which to find the excitations

  • algorithm: optimization algorithm

  • ψ::QP: initial quasiparticle guess

  • ψs::NTuple{N, <:FiniteMPS}: N first excited states

  • [left_environments]: left ground state environment

  • [right_environments]: right ground state environment

Keyword Arguments

  • num::Int: number of excited states to compute

  • solver: algorithm for the linear solver of the quasiparticle environments

  • init: initial excited state guess; defaults to a copy of the first state in ψs

  • pos: position of perturbation

source
MPSKit.excitations Function
julia
excitations(
        H, algorithm::QuasiparticleAnsatz, momentum::Union{Number, Vector{<:Number}},
        left_ψ::InfiniteMPS, [left_environment],
        [right_ψ::InfiniteMPS], [right_environment];
        kwargs...
    ) -> (energies, states)

Create and optimize infinite quasiparticle states.

Arguments

  • H::AbstractMPO: operator for which to find the excitations

  • algorithm::QuasiparticleAnsatz: optimization algorithm

  • momentum::Union{Number, Vector{<:Number}}: momentum or list of momenta

  • left_ψ::InfiniteMPS: left ground state

  • [left_environment]: left ground state environment

  • [right_ψ::InfiniteMPS]: right ground state

  • [right_environment]: right ground state environment

Keyword Arguments

  • num::Int: number of excited states to compute

  • solver: algorithm for the linear solver of the quasiparticle environments

  • sector = leftunit(left_ψ): charge of the quasiparticle state

  • parallel = true: enable multi-threading over different momenta

source
MPSKit.expectation_value Function
julia
expectation_value(ψ, O, [environments]) -> val
expectation_value(ψ, inds => O) -> val
expectation_value(ψ, (mpo, site => O), [environments]) -> val

Compute the expectation value of an operator O on a state ψ, normalized by ⟨ψ|ψ⟩. Optionally, it is possible to make the computations more efficient by also passing in previously calculated environments.

In general, the operator O may consist of an arbitrary MPO O <: AbstractMPO that acts on all sites, a local operator O = inds => operator acting on a subset of sites, or a local MPO tensor acting on a site within a network whose environment is determined by another MPO mpo. In the second case, inds is a tuple of indices that specify the sites on which the operator acts, while the operator is either a AbstractTensorMap or a FiniteMPO. In the latter case, the operator is a AbstractTensorMap that acts on the physical space of a single site.

Arguments

  • ψ::AbstractMPS: the state on which to compute the expectation value

  • O::Union{AbstractMPO, Pair, AbstractTensorMap}: the operator to compute the expectation value of. This can either be an AbstractMPO, a pair of indices and local operator, or a local MPO tensor represented as a AbstractTensorMap.

  • environments::AbstractMPSEnvironments: the environments to use for the calculation. If not given, they will be calculated. Depending on the type of O, these will be the environments of the operator O or the MPO mpo.

Returns

  • val::Number: the (normalized) expectation value ⟨ψ|O|ψ⟩ / ⟨ψ|ψ⟩.

Infinite operators

For an infinite state and an infinite operator (e.g. an InfiniteMPOHamiltonian), the return value is the total over one unit cell; divide by length(ψ) to obtain a per-site value.

Examples

julia
julia> ψ = FiniteMPS(ones(Float64, (ℂ^2)^4));

julia> S_x = TensorMap(Float64[0 1; 1 0], ℂ^2, ℂ^2);

julia> round(expectation_value(ψ, 2 => S_x))
1.0

julia> round(expectation_value(ψ, (2, 3) => S_x  S_x))
1.0
source
MPSKit.fidelity_susceptibility Method
julia
fidelity_susceptibility(
    state::Union{FiniteMPS, InfiniteMPS}, H₀::T,
    Vs::AbstractVector{T}, [henvs = environments(state, H₀, state)];
    maxiter = Defaults.maxiter,
    tol = Defaults.tol
) where {T <: MPOHamiltonian}

Computes the fidelity susceptibility of a the ground state state of a base Hamiltonian H₀ with respect to a set of perturbing Hamiltonians Vs. Each of the perturbing Hamiltonians can be interpreted as corresponding to a tuning parameter in a 'total' Hamiltonian    .

Returns a matrix containing the overlaps of the elementary excitations on top of state corresponding to each of the perturbing Hamiltonians.

source
MPSKit.find_groundstate Function
julia
find_groundstate(ψ₀, H, [environments]; kwargs...) -> (ψ, environments, ϵ)
find_groundstate(ψ₀, H, algorithm, [environments]) -> (ψ, environments, ϵ)

Compute the ground state for Hamiltonian H with initial guess ψ₀. If no algorithm is specified, one is selected automatically from the type of ψ₀ and the supplied keywords (see the automatic-selection notes below).

Arguments

  • ψ₀::AbstractMPS: initial guess

  • H::AbstractMPO: operator for which to find the ground state

  • [environments]: MPS environment manager

  • algorithm: optimization algorithm

Keyword Arguments

  • tol::Float64 = 1.0e-10: tolerance for the convergence criterion

  • maxiter::Int = 200: maximum number of iterations

  • verbosity::Int = 3: display progress information

  • trunc = nothing: if supplied, a truncation strategy that enables bond-dimension growth through a two-site algorithm (see below)

Automatic algorithm selection

When no algorithm is passed, the choice depends on the type of ψ₀:

  • InfiniteMPS: VUMPS (with its tolerance floored at 1e-4), refined by GradientGrassmann when tol < 1e-4. If trunc is given, an IDMRG2 stage is prepended to grow the bond dimension.

  • AbstractFiniteMPS: DMRG. If trunc is given, a DMRG2 stage is prepended to grow the bond dimension.

Because single-site DMRG preserves the bond dimension of ψ₀, passing a trunc (or an explicit two-site algorithm) is the usual way to converge from a low-bond-dimension initial guess such as a product state.

Returns

  • ψ::AbstractMPS: converged ground state

  • environments: environments corresponding to the converged state

  • ϵ::Float64: final convergence error upon terminating the algorithm

Examples

Ground state of a 4-site transverse-field Ising chain, H = -∑ XₖXₖ₊₁ - ∑ Zₖ, starting from a product state and letting DMRG2 grow the bond dimension:

julia
julia> X = TensorMap(Float64[0 1; 1 0], ℂ^2, ℂ^2);

julia> Z = TensorMap(Float64[1 0; 0 -1], ℂ^2, ℂ^2);

julia> L = 4; lattice = fill(ℂ^2, L);

julia> H = FiniteMPOHamiltonian(lattice, ((i, i + 1) => -(X  X) for i in 1:(L - 1))) +
           FiniteMPOHamiltonian(lattice, ((i,) => -Z for i in 1:L));

julia> ψ₀ = FiniteMPS(ones(Float64, (ℂ^2)^L));

julia> ψ, envs, ϵ = find_groundstate(ψ₀, H; verbosity = 0, trunc = truncrank(16));

julia> round(real(expectation_value(ψ, H)); digits = 4)
-4.7588
source
MPSKit.find_groundstate! Function
julia
find_groundstate!(ψ, H, algorithm, [environments]) -> (ψ, environments, ϵ)

In-place version of find_groundstate: optimize the finite MPS ψ for the Hamiltonian H, overwriting the input state instead of working on a copy. Currently supported for the finite-system algorithms DMRG and DMRG2.

Arguments

  • ψ::AbstractFiniteMPS: initial guess, mutated in place

  • H: operator for which to find the ground state

  • algorithm: optimization algorithm

  • [environments]: MPS environment manager

Returns

  • ψ::AbstractFiniteMPS: converged ground state

  • environments: environments corresponding to the converged state

  • ϵ::Float64: final convergence error upon terminating the algorithm

source
MPSKit.fixedpoint Method
julia
fixedpoint(A, x₀, which::Symbol; kwargs...) -> val, vec, info
fixedpoint(A, x₀, which::Symbol, alg) -> val, vec, info

Compute the fixed point of a given linear operator A with initial guess x₀. The dominant eigenvector is assumed to be unique.

source
MPSKit.fuse_mul_mpo Method
julia
fuse_mul_mpo(O1, O2)

Compute the mpo tensor that arises from multiplying MPOs.

source
MPSKit.gauge! Method
julia
gauge!(ψ, pos, direction, AC, [alg]; normalize = false) -> ψ, ϵ

Direction-dispatching wrapper around left_gauge! / right_gauge!: gauge an updated center tensor AC at site pos and install it into ψ, shifting the gauge center past pos to the right for direction = Val(:right) and to the left for Val(:left). alg and normalize are forwarded unchanged, and the truncation error ϵ is returned as-is.

source
MPSKit.gauge2! Method
julia
gauge2!(ψ, pos, direction, AC2, alg; normalize = false) -> ψ, ϵ

Two-site analogue of gauge!: factor an updated two-site center tensor AC2 spanning sites pos and pos+1 with the truncated SVD alg and install the resulting canonical tensors into ψ in one step, shifting the gauge center past the bond. (To the right for direction = Val(:right), to the left for Val(:left)).

Returns the truncation error ϵ, the 2-norm of the discarded singular values. Pass normalize = true to renormalize the bond tensor, so ψ stays normalized after a local update that changed its norm.

source
MPSKit.gaugefix! Function
julia
gaugefix!::InfiniteMPS, A, C₀; kwargs...) -> ψ
gaugefix!::InfiniteMPS, A, C₀, alg::Algorithm) -> ψ

Bring an InfiniteMPS into a uniform gauge, using the specified algorithm.

source
MPSKit.infinite_temperature_density_matrix Method
julia
infinite_temperature_density_matrix(H::MPOHamiltonian) -> MPO

Return the density matrix of the infinite temperature state for a given Hamiltonian. This is the identity matrix in the physical space, and the identity in the auxiliary space.

source
MPSKit.instantiate_operator Method
julia
instantiate_operator(state, O::Pair)
instantiate_operator(lattice::AbstractArray{<:VectorSpace}, O::Pair)

Instantiate a local operator O for a state or lattice as a vector of MPO tensors, and a vector of linear site indices.

source
MPSKit.integrate Function
julia
integrate(f, y₀, t, dt, alg) -> y

Integrate the differential equation   over a time step dt starting from    , using the provided algorithm.

Arguments

  • f: driving function

  • y₀: object to integrate

  • t::Number: starting time of time-step

  • dt::Number: time-step magnitude

  • alg: integration scheme

source
MPSKit.isfullrank Method
julia
isfullrank(A::GenericMPSTensor; side = :both)

Determine whether the given tensor is full rank, i.e. whether both the map from the left virtual space and the physical space to the right virtual space, and the map from the right virtual space and the physical space to the left virtual space are injective.

source
MPSKit.l_LL Method
julia
l_LL(ψ, location)

Left dominant eigenvector of the AL-AL transfermatrix.

source
MPSKit.l_LR Function
julia
l_LR(ψ, location)

Left dominant eigenvector of the AL-AR transfermatrix.

source
MPSKit.l_RL Function
julia
l_RL(ψ, location)

Left dominant eigenvector of the AR-AL transfermatrix.

source
MPSKit.l_RR Function
julia
l_RR(ψ, location)

Left dominant eigenvector of the AR-AR transfermatrix.

source
MPSKit.leading_boundary Function
julia
leading_boundary(ψ₀, O, [environments]; kwargs...) -> (ψ, environments, ϵ)
leading_boundary(ψ₀, O, algorithm, environments) -> (ψ, environments, ϵ)

Compute the leading boundary MPS for operator O with initial guess ψ. If not specified, an optimization algorithm will be attempted based on the supplied keywords.

Arguments

  • ψ₀::AbstractMPS: initial guess

  • O::AbstractMPO: operator for which to find the leading_boundary

  • [environments]: MPS environment manager

  • algorithm: optimization algorithm

Keyword Arguments

  • tol::Float64: tolerance for convergence criterium

  • maxiter::Int: maximum amount of iterations

  • verbosity::Int: display progress information

Returns

  • ψ::AbstractMPS: converged leading boundary MPS

  • environments: environments corresponding to the converged boundary

  • ϵ::Float64: final convergence error upon terminating the algorithm

source
MPSKit.left_gauge Function
julia
left_gauge(AC, [alg]) -> AL, C, ϵ
right_gauge(AC, [alg]) -> C, AR, ϵ

Factor an updated center MPS tensor AC into left- or right-canonical form, AC ≈ AL * C (left, with AL left-isometric) or AC ≈ C * AR (right, with AR right-isometric), without modifying AC. right_gauge handles the MPS leg permutation internally, so AR is returned in standard MPS-tensor form.

alg selects the factorization and defaults to a (positive) QR/LQ center-move that preserves the virtual bond. Passing a TruncatedAlgorithm instead performs a truncated SVD may shrink the bond.

Also returns the truncation error ϵ: the 2-norm of the discarded singular values from the truncated SVD, or 0 for a norm-preserving QR/LQ gauge.

source
MPSKit.left_gauge! Function
julia
left_gauge!(ψ, pos, AC, [alg]; normalize = false) -> ψ, ϵ
right_gauge!(ψ, pos, AC, [alg]; normalize = false) -> ψ, ϵ

Gauge an updated center tensor AC at site pos and install it into ψ in one step: factor AC with left_gauge / right_gauge and write the canonical tensors back, shifting the gauge center past pos (to the right for left_gauge!, to the left for right_gauge!). alg is forwarded to left_gauge / right_gauge and hence may be a TruncatedAlgorithm to truncate the bond.

By default the factors are installed as-is. Pass normalize = true to renormalize the bond tensor, so ψ stays normalized after a local update that changed its norm.

Also returns the truncation error ϵ of the factorization: the 2-norm of the discarded singular values from a truncated SVD gauge, or 0 for a norm-preserving QR gauge.

source
MPSKit.left_virtualspace Function
julia
left_virtualspace::AbstractMPS, [pos = 1:length(ψ)])

Return the virtual space of the bond to the left of sites pos.

Warning

In rare cases, the gauge tensor on the virtual space might not be square, and as a result it cannot always be guaranteed that right_virtualspace(ψ, i - 1) == left_virtualspace(ψ, i)

source
MPSKit.leftenv Method
julia
leftenv(envs, site, state)

Return the left environment stored in envs at site for the given state: the contraction of everything to the left of site in the network the environments were built for. The result is gauge-compatible with the tensor of state at site and can be contracted onto it directly.

See also rightenv and environments.

source
MPSKit.make_time_mpo Function
julia
make_time_mpo(H::MPOHamiltonian, dt::Number, alg; kwargs...) -> O::MPO

Construct an MPO that approximates  .

Keyword Arguments

  • imaginary_evolution::Bool = false: if true, the time evolution is done with an imaginary time step instead, (i.e.   instead of  ). This can be useful to compute the ground state of a Hamiltonian, or to compute finite-temperature properties of a system.
source
MPSKit.makefullrank! Method
julia
makefullrank!(A::PeriodicVector{<:GenericMPSTensor}; alg = Defaults.alg_orth())

Make the set of MPS tensors full rank by performing a series of orthogonalizations.

source
MPSKit.marek_gap Method
julia
marek_gap(above::InfiniteMPS; sector = nothing, kwargs...)

Compute the gap ϵ for the asymptotics of the transfer matrix, as well as the Marek gap δ as a scaling measure of the bond dimension, along with the associated angle θ.

By default this returns a TensorKit.SectorDict mapping each sector of the transfer spectrum to its (ϵ, δ, θ) triplet. Passing a specific sector returns only that sector's triplet. The remaining kwargs are passed on to transfer_spectrum.

source
MPSKit.matrix_contract Function
julia
matrix_contract(
    A::AbstractTensorMap, B::AbstractTensorMap{T, S, 1, 1}, i::Int,
    α::Number = One(),
    backend::AbstractBackend = DefaultBackend(), allocator = DefaultAllocator();
    transpose::Bool = false
)

Compute the tensor contraction α * A * B, where the (1, 1) - tensor B is attached to index i of A. Whenever transpose = true, this contraction (lazily) uses transpose(B) instead.

See also matrix_contract!.

source
MPSKit.matrix_contract! Function
julia
matrix_contract!(
    C::AbstractTensorMap, A::AbstractTensorMap, B::AbstractTensorMap{T, S, 1, 1}, i::Int,
    α::Number = One(), β::Number = Zero(),
    backend::AbstractBackend = DefaultBackend(), allocator = DefaultAllocator();
    transpose::Bool = false
)

Compute the tensor contraction C ← β * C + α * A * B, where the (1, 1) - tensor B is attached to index i of A, and the result is added into C. Whenever transpose = true, this contraction (lazily) uses transpose(B) instead.

See also matrix_contract.

source
MPSKit.max_Ds Method
julia
max_Ds::FiniteMPS) -> Vector{Float64}

Compute the dimension of the maximal virtual space at a given site.

source
MPSKit.max_virtualspaces Method
julia
max_virtualspaces::FiniteMPS)
max_virtualspaces(Ps::Vector{<:Union{S, CompositeSpace{S}}}; left = unitspace(S), right = unitspace(S))

Compute the maximal virtual spaces of a given finite MPS or its physical spaces.

source
MPSKit.multiply_neighbours Function
julia
multiply_neighbours(mpo::FiniteMPO, i::Integer)
multiply_neighbours!(mpo::FiniteMPO, i::Integer)

Construct the mpo of length length(mpo) - 1 which is formed by multiplying the operators on site i and i + 1.

source
MPSKit.multiply_neighbours! Function
julia
multiply_neighbours(mpo::FiniteMPO, i::Integer)
multiply_neighbours!(mpo::FiniteMPO, i::Integer)

Construct the mpo of length length(mpo) - 1 which is formed by multiplying the operators on site i and i + 1.

source
MPSKit.open_boundary_conditions Function
julia
open_boundary_conditions(mpo::InfiniteMPOHamiltonian, L::Int) -> FiniteMPOHamiltonian

Convert an infinite MPO into a finite MPO of length L, by applying open boundary conditions.

source
MPSKit.open_boundary_conditions Method
julia
open_boundary_conditions(mpo::InfiniteMPO, L::Int) -> FiniteMPO

Convert an infinite MPO into a finite MPO of length L, by applying open boundary conditions.

source
MPSKit.periodic_boundary_conditions Method
julia
periodic_boundary_conditions(mpo::AbstractInfiniteMPO, L::Int)

Convert an infinite MPO into a finite MPO of length L, by mapping periodic boundary conditions onto an open system.

source
MPSKit.physicalspace Function
julia
physicalspace::AbstractMPS, [pos = 1:length(ψ)])

Return the physical space of the site tensor at site i.

source
MPSKit.prepare_operator!! Method
julia
prepare_operator!!(O) -> O′

Given an operator, try to construct a more efficient representation of that operator. This typically consists of precomputing some parts of the application, and is expected to only pay off for repeated applications.

The backend and allocator to use are taken from O itself, which is where the resulting operator's own contractions will read them from as well.

source
MPSKit.project_complement! Method
julia
project_complement!(Y, X) -> Y

In-place projection of Y onto the orthogonal complement of the range of the left-isometry X (X' X = I): Y ← (I - X X') Y = Y - X (X' Y). Y is overwritten and returned.

See also project_complement_right!.

source
MPSKit.project_complement_right! Method
julia
project_complement_right!(Y, X) -> Y

In-place projection of Y onto the orthogonal complement of the co-range of the right-isometry X (X X' = I): Y ← Y (I - X' X) = Y - (Y X') X. Y is overwritten and returned.

See also project_complement!.

source
MPSKit.propagator Function
julia
propagator(ψ₀::AbstractFiniteMPS, z::Number, H::MPOHamiltonian, alg::DynamicalDMRG; init = copy(ψ₀)) -> (g, ψ)

Calculate the action of the propagator   using the dynamical DMRG algorithm.

Returns

  • g: approximation of the propagator matrix element   

  • ψ: MPS approximation of  

source
MPSKit.r_LL Function
julia
r_LL(ψ, location)

Right dominant eigenvector of the AL-AL transfermatrix.

source
MPSKit.r_LR Function
julia
r_LR(ψ, location)

Right dominant eigenvector of the AL-AR transfermatrix.

source
MPSKit.r_RL Function
julia
r_RL(ψ, location)

Right dominant eigenvector of the AR-AL transfermatrix.

source
MPSKit.r_RR Method
julia
r_RR(ψ, location)

Right dominant eigenvector of the AR-AR transfermatrix.

source
MPSKit.regauge! Function
julia
regauge!(AC::GenericMPSTensor, C::MPSBondTensor; alg) -> AL
regauge!(CL::MPSBondTensor, AC::GenericMPSTensor; alg) -> AR

Bring updated AC and C tensors back into a consistent set of left or right canonical tensors. This minimizes ∥AC_i - AL_i * C_i∥ or ∥AC_i - C_{i-1} * AR_i∥.

The alg is passed on to left_orth! and right_orth!, and can be used to control the kind of factorization used. By default, this is set to a (positive) QR/LQ, even though the optimal algorithm would use a polar decompositions instead, sacrificing a bit of performance for accuracy.

Note

Computing AL is slightly faster than AR, as it avoids an intermediate transposition.

source
MPSKit.resolve_environment_solver Method
julia
resolve_environment_solver(alg, below, operator, above)

Resolve an environment algorithm alg into a concrete iterative solver for the given problem. A KrylovKit algorithm is returned as-is; the DefaultAlgorithm/DynamicTol configuration wrappers are translated via environment_alg.

source
MPSKit.right_gauge Function
julia
left_gauge(AC, [alg]) -> AL, C, ϵ
right_gauge(AC, [alg]) -> C, AR, ϵ

Factor an updated center MPS tensor AC into left- or right-canonical form, AC ≈ AL * C (left, with AL left-isometric) or AC ≈ C * AR (right, with AR right-isometric), without modifying AC. right_gauge handles the MPS leg permutation internally, so AR is returned in standard MPS-tensor form.

alg selects the factorization and defaults to a (positive) QR/LQ center-move that preserves the virtual bond. Passing a TruncatedAlgorithm instead performs a truncated SVD may shrink the bond.

Also returns the truncation error ϵ: the 2-norm of the discarded singular values from the truncated SVD, or 0 for a norm-preserving QR/LQ gauge.

source
MPSKit.right_gauge! Function
julia
left_gauge!(ψ, pos, AC, [alg]; normalize = false) -> ψ, ϵ
right_gauge!(ψ, pos, AC, [alg]; normalize = false) -> ψ, ϵ

Gauge an updated center tensor AC at site pos and install it into ψ in one step: factor AC with left_gauge / right_gauge and write the canonical tensors back, shifting the gauge center past pos (to the right for left_gauge!, to the left for right_gauge!). alg is forwarded to left_gauge / right_gauge and hence may be a TruncatedAlgorithm to truncate the bond.

By default the factors are installed as-is. Pass normalize = true to renormalize the bond tensor, so ψ stays normalized after a local update that changed its norm.

Also returns the truncation error ϵ of the factorization: the 2-norm of the discarded singular values from a truncated SVD gauge, or 0 for a norm-preserving QR gauge.

source
MPSKit.right_virtualspace Function
julia
right_virtualspace::AbstractMPS, [pos = 1:length(ψ)])

Return the virtual space of the bond to the right of site(s) pos.

Warning

In rare cases, the gauge tensor on the virtual space might not be square, and as a result it cannot always be guaranteed that right_virtualspace(ψ, i - 1) == left_virtualspace(ψ, i)

source
MPSKit.rightenv Method
julia
rightenv(envs, site, state)

Return the right environment stored in envs at site for the given state: the contraction of everything to the right of site in the network the environments were built for. The result is gauge-compatible with the tensor of state at site and can be contracted onto it directly.

See also leftenv and environments.

source
MPSKit.sample_space Method
julia
sample_space(V, strategy)

Sample basis states within a given V::VectorSpace by creating weights for each state that are distributed uniformly, and then truncating according to the given strategy.

source
MPSKit.set_AC_AR! Function
julia
set_AL_AC!(ψ, site, AL, AC) -> ψ
set_AC_AR!(ψ, site, AC, AR) -> ψ

Install a canonical tensor at site together with the neighbouring center tensor, in a single update: set_AL_AC! writes the left-isometric AL at site and the center tensor AC at site + 1, set_AC_AR! writes the right-isometric AR at site and the center tensor AC at site - 1. The gauge center therefore ends up at site + 1 and site - 1 respectively.

These are the pendants of ψ.AC[site] = (AL, C) / ψ.AC[site] = (C, AR) for algorithms that already know the next center tensor: they avoid materializing a bond tensor purely to keep ψ well-defined, and — unlike installing the canonical tensor on its own — they never leave ψ without a gauge center.

The isometric nature of AL/AR is not verified.

source
MPSKit.set_AL_AC! Function
julia
set_AL_AC!(ψ, site, AL, AC) -> ψ
set_AC_AR!(ψ, site, AC, AR) -> ψ

Install a canonical tensor at site together with the neighbouring center tensor, in a single update: set_AL_AC! writes the left-isometric AL at site and the center tensor AC at site + 1, set_AC_AR! writes the right-isometric AR at site and the center tensor AC at site - 1. The gauge center therefore ends up at site + 1 and site - 1 respectively.

These are the pendants of ψ.AC[site] = (AL, C) / ψ.AC[site] = (C, AR) for algorithms that already know the next center tensor: they avoid materializing a bond tensor purely to keep ψ well-defined, and — unlike installing the canonical tensor on its own — they never leave ψ without a gauge center.

The isometric nature of AL/AR is not verified.

source
MPSKit.set_canonical! Method
julia
set_canonical!(ψ, site, direction, A, AC) -> ψ

Direction-dispatching wrapper around set_AL_AC!/set_AC_AR!: install the canonical tensor A at site — left-isometric for direction = Val(:right), right-isometric for Val(:left) — together with the center tensor AC at the next site in that direction, site + 1 or site - 1.

This is the pendant of gauge! for a sweep that already knows its next center tensor, and lets a sweep body be written once for both directions.

source
MPSKit.similar_scalartype Method
julia
similar_scalartype(T::Type{<:AbstractTensorMap}, S::Type{<:Number})

Tensor map type with the same space type and rank as T, but with scalar type S.

source
MPSKit.site_type Method
julia
site_type::AbstractMPS)
site_type(ψtype::Type{<:AbstractMPS})

Return the type of the site tensors of an AbstractMPS.

source
MPSKit.sketch_space Method
julia
sketch_space(V, alg::SketchedExpand) -> Vℓ, Vk

The random-sketch space Vℓ drawn from the complement V, together with its oversampling-free target Vk (selected by alg.trunc). Vℓ enlarges Vk by alg.oversampling extra directions (capped by V); the selection is truncated back to Vk.

source
MPSKit.swap Function
julia
swap(mpo::FiniteMPO, i::Integer; inv::Bool = false, alg = Defaults.alg_svd(), trunc)
swap!(mpo::FiniteMPO, i::Integer; inv::Bool = false, alg = Defaults.alg_svd(), trunc)

Compose the mpo with a swap gate applied to indices i and i + 1, effectively creating an operator that acts on the Hilbert spaces with those factors swapped. The keyword arguments alg and trunc can be used to control how the resulting tensor is truncated again.

source
MPSKit.swap! Function
julia
swap(mpo::FiniteMPO, i::Integer; inv::Bool = false, alg = Defaults.alg_svd(), trunc)
swap!(mpo::FiniteMPO, i::Integer; inv::Bool = false, alg = Defaults.alg_svd(), trunc)

Compose the mpo with a swap gate applied to indices i and i + 1, effectively creating an operator that acts on the Hilbert spaces with those factors swapped. The keyword arguments alg and trunc can be used to control how the resulting tensor is truncated again.

source
MPSKit.tensorexpr Method
julia
tensorexpr(name, ind_out, [ind_in])

Generates expressions for use within @tensor environments of the form name[ind_out...; ind_in].

source
MPSKit.time_evolve Function
julia
time_evolve(ψ₀, H, t_span, alg, [envs]; kwargs...) -> (ψ, envs)
time_evolve!(ψ₀, H, t_span, alg, [envs]; kwargs...) -> (ψ₀, envs)

Time-evolve the initial state ψ₀ with Hamiltonian H over a given time span by stepping through each of the time points obtained by iterating t_span.

Arguments

  • ψ₀::AbstractMPS: initial state

  • H::AbstractMPO: operator that generates the time evolution (can be time-dependent).

  • t_span::AbstractVector{<:Number}: time points over which the time evolution is stepped

  • alg: algorithm to use for the time evolution, e.g. TDVP or TDVP2.

  • envs: MPS environment manager

Keyword Arguments

  • verbosity::Int = 0: verbosity level for logging

  • imaginary_evolution::Bool = false: if true, the time evolution is done with an imaginary time step instead, (i.e.   instead of  ). This can be useful to compute the ground state of a Hamiltonian, or to compute finite-temperature properties of a system.

  • normalize::Bool = false: if true, the state is renormalized after every step, which can be useful to retain numerical stability when the norm loss is not information that is needed.

Returns

  • ψ: the time-stepped state

  • envs: the updated environment manager

source
MPSKit.time_evolve! Function
julia
time_evolve(ψ₀, H, t_span, alg, [envs]; kwargs...) -> (ψ, envs)
time_evolve!(ψ₀, H, t_span, alg, [envs]; kwargs...) -> (ψ₀, envs)

Time-evolve the initial state ψ₀ with Hamiltonian H over a given time span by stepping through each of the time points obtained by iterating t_span.

Arguments

  • ψ₀::AbstractMPS: initial state

  • H::AbstractMPO: operator that generates the time evolution (can be time-dependent).

  • t_span::AbstractVector{<:Number}: time points over which the time evolution is stepped

  • alg: algorithm to use for the time evolution, e.g. TDVP or TDVP2.

  • envs: MPS environment manager

Keyword Arguments

  • verbosity::Int = 0: verbosity level for logging

  • imaginary_evolution::Bool = false: if true, the time evolution is done with an imaginary time step instead, (i.e.   instead of  ). This can be useful to compute the ground state of a Hamiltonian, or to compute finite-temperature properties of a system.

  • normalize::Bool = false: if true, the state is renormalized after every step, which can be useful to retain numerical stability when the norm loss is not information that is needed.

Returns

  • ψ: the time-stepped state

  • envs: the updated environment manager

source
MPSKit.timestep Function
julia
timestep(ψ₀, H, t, dt, alg, [envs]; kwargs...) -> (ψ, envs)
timestep!(ψ₀, H, t, dt, alg, [envs]; kwargs...) -> (ψ₀, envs)

Time-step the state ψ₀ with Hamiltonian H over a given time step dt at time t, solving the Schroedinger equation:  .

Arguments

  • ψ₀::AbstractMPS: initial state

  • H::AbstractMPO: operator that generates the time evolution (can be time-dependent).

  • t::Number: starting time of time-step

  • dt::Number: time-step magnitude

  • alg: algorithm to use for the time evolution, e.g. TDVP or TDVP2.

  • envs: MPS environment manager

Keyword Arguments

  • imaginary_evolution::Bool = false: if true, the time evolution is done with an imaginary time step instead, (i.e.   instead of  ). This can be useful to compute the ground state of a Hamiltonian, or to compute finite-temperature properties of a system.

  • normalize::Bool = false: if true, the state is renormalized after every step, which can be useful to retain numerical stability when the norm loss is not information that is needed.

Returns

  • ψ: the time-stepped state

  • envs: the updated environment manager

Examples

Real-time evolution of the |+···+⟩ product state under a transverse field H = ∑ Zₖ. Each spin precesses independently, so ⟨Xₖ(t)⟩ = cos(2t); after a step dt = 0.1 this is cos(0.2) ≈ 0.980067. The initial state must be complex, since real-time evolution multiplies by -i:

julia
julia> X = TensorMap(ComplexF64[0 1; 1 0], ℂ^2, ℂ^2);

julia> Z = TensorMap(ComplexF64[1 0; 0 -1], ℂ^2, ℂ^2);

julia> ψ₀ = FiniteMPS(ones(ComplexF64, (ℂ^2)^4));

julia> H = FiniteMPOHamiltonian(fill(ℂ^2, 4), ((i,) => Z for i in 1:4));

julia> ψ, envs = timestep(ψ₀, H, 0.0, 0.1, TDVP());

julia> round(real(expectation_value(ψ, 2 => X)); digits = 6)
0.980067
source
MPSKit.timestep! Function
julia
timestep(ψ₀, H, t, dt, alg, [envs]; kwargs...) -> (ψ, envs)
timestep!(ψ₀, H, t, dt, alg, [envs]; kwargs...) -> (ψ₀, envs)

Time-step the state ψ₀ with Hamiltonian H over a given time step dt at time t, solving the Schroedinger equation:  .

Arguments

  • ψ₀::AbstractMPS: initial state

  • H::AbstractMPO: operator that generates the time evolution (can be time-dependent).

  • t::Number: starting time of time-step

  • dt::Number: time-step magnitude

  • alg: algorithm to use for the time evolution, e.g. TDVP or TDVP2.

  • envs: MPS environment manager

Keyword Arguments

  • imaginary_evolution::Bool = false: if true, the time evolution is done with an imaginary time step instead, (i.e.   instead of  ). This can be useful to compute the ground state of a Hamiltonian, or to compute finite-temperature properties of a system.

  • normalize::Bool = false: if true, the state is renormalized after every step, which can be useful to retain numerical stability when the norm loss is not information that is needed.

Returns

  • ψ: the time-stepped state

  • envs: the updated environment manager

Examples

Real-time evolution of the |+···+⟩ product state under a transverse field H = ∑ Zₖ. Each spin precesses independently, so ⟨Xₖ(t)⟩ = cos(2t); after a step dt = 0.1 this is cos(0.2) ≈ 0.980067. The initial state must be complex, since real-time evolution multiplies by -i:

julia
julia> X = TensorMap(ComplexF64[0 1; 1 0], ℂ^2, ℂ^2);

julia> Z = TensorMap(ComplexF64[1 0; 0 -1], ℂ^2, ℂ^2);

julia> ψ₀ = FiniteMPS(ones(ComplexF64, (ℂ^2)^4));

julia> H = FiniteMPOHamiltonian(fill(ℂ^2, 4), ((i,) => Z for i in 1:4));

julia> ψ, envs = timestep(ψ₀, H, 0.0, 0.1, TDVP());

julia> round(real(expectation_value(ψ, 2 => X)); digits = 6)
0.980067
source
MPSKit.transfer_left Method
julia
transfer_left(v, A, Ā)

apply a transfer matrix to the left.

julia
 ┌─A─
-v │
 └─Ā─
source
MPSKit.transfer_right Method
julia
transfer_right(v, A, Ā)

apply a transfer matrix to the right.

julia
─A─┐
 │ v-
─Ā─┘
source
MPSKit.transfer_spectrum Function
julia
transfer_spectrum(above::InfiniteMPS, [below = above], [alg]; howmany = 20, kwargs...)
    -> TensorKit.SectorVector

Calculate the partial spectrum of the left transfer matrix corresponding to the overlap of a given above state and a below state. The result is returned as a TensorKit.SectorVector, whose values can be inspected per sector by indexing, i.e. transfer_spectrum(above)[sector].

Arguments

  • above::InfiniteMPS: the state for the "above" leg of the mixed transfer matrix.

  • below::InfiniteMPS = above: the state for the "below" leg; defaults to the pure transfer matrix of above.

  • alg: the eigensolver algorithm specification, resolved per sector via MatrixAlgebraKit.select_algorithm. This can be a KrylovKit algorithm instance (used verbatim for every sector), a MatrixAlgebraKit.DefaultAlgorithm or NamedTuple bundling keyword arguments, or nothing (the default) to construct the eigensolver from the keyword arguments below.

Keyword Arguments

  • howmany = 20: the number of eigenvalues to compute. This can either be a single Int, which is used for every sector of the transfer space, or an AbstractDict/iterable of sector => count pairs to restrict the computation to specific sectors and request a different number of values per sector.

  • oversampling = 10: additive margin on the Krylov dimension beyond the number of values requested in a sector (see krylovdim below).

  • oversampling_factor = 1: proportionality factor between the Krylov dimension and the number of values requested in a sector (see krylovdim below).

  • krylovdim: the Krylov dimension of the eigensolver. Unless given explicitly, this is chosen adaptively per sector as max(Defaults.krylovdim, ceil(Int, oversampling_factor * howmany) + oversampling), where howmany is the number of values requested in that sector.

  • kwargs...: further keyword arguments (e.g. tol, maxiter) are forwarded to MatrixAlgebraKit.default_algorithm to build the eigensolver. Passing eigensolver keyword arguments when alg is an algorithm instance is not allowed, and will result in an error.

source
MPSKit.transferplot Function
julia
transferplot(above, below = above; sectors = nothing, transferkwargs = (;)[, kwargs...])

Plot the partial transfer matrix spectrum of two InfiniteMPS's.

Arguments

Keyword Arguments

  • sectors = nothing: restrict the spectrum to the given sectors; by default all sectors of the transfer space are included.

  • transferkwargs: kwargs for call to transfer_spectrum.

  • kwargs: other kwargs are passed on to the plotting backend.

  • thetaorigin = 0: origin of the angle range.

  • sector_formatter = string: how to convert sectors to strings.

Note

You will need to manually import Plots.jl to be able to use this function. MPSKit.jl defines its plots based on RecipesBase.jl, but the user still has to add using Plots to be able to actually produce the plots.

source
MPSKit.variance Function
julia
variance(state, hamiltonian, [envs = environments(state, hamiltonian, state)])

Compute the variance of the energy of the state with respect to the Hamiltonian.

source
MPSKit.zip_left_right! Function
julia
zip_left_right!(ψ, O, ϕ, alg_zipup, [alg_zipdown]) -> ψ, ϵ
zip_right_left!(ψ, O, ϕ, alg_zipup, [alg_zipdown]) -> ψ, ϵ

Contract the MPO O with the MPS ϕ in a single sweep, truncating the enlarged virtual bond at every site with alg_zipup, and write the result into ψ. zip_left_right! zips up from left to right, zip_right_left! from right to left. Unless alg_zipdown is nothing, a second sweep in the opposite direction imposes a final truncation with alg_zipdown in a locally gauged basis, leaving the gauge center of ψ at the far end. The destination may alias ϕ.

Also returns the truncation error ϵ, the largest 2-norm of the discarded singular values over all bonds and both sweeps.

source
MPSKit.zip_right_left! Function
julia
zip_left_right!(ψ, O, ϕ, alg_zipup, [alg_zipdown]) -> ψ, ϵ
zip_right_left!(ψ, O, ϕ, alg_zipup, [alg_zipdown]) -> ψ, ϵ

Contract the MPO O with the MPS ϕ in a single sweep, truncating the enlarged virtual bond at every site with alg_zipup, and write the result into ψ. zip_left_right! zips up from left to right, zip_right_left! from right to left. Unless alg_zipdown is nothing, a second sweep in the opposite direction imposes a final truncation with alg_zipdown in a locally gauged basis, leaving the gauge center of ψ at the far end. The destination may alias ϕ.

Also returns the truncation error ϵ, the largest 2-norm of the discarded singular values over all bonds and both sweeps.

source