Environment
Deal with the left and right environment tensors of multi-layer MPS/MPO structure.
FiniteMPS.AbstractEnvironment — Type abstract type AbstractEnvironment{L}Abstract type of all multi-layer environments.
FiniteMPS.Center — Method Center(obj::AbstractEnvironment) -> Vector (length 2)Interface of environment, return the info of canonical center. Center = [a, b] means El[1:a] and Er[b:end] are valid.
FiniteMPS.SimpleEnvironment — Type struct SimpleEnvironment{L, N, T<:NTuple{N, AbstractMPS{L}}, C<:AbstractStoreType} <: AbstractEnvironment{L}
layer::T
El::AbstractVector{SimpleLeftTensor}
Er::AbstractVector{SimpleRightTensor}
Center::Vector{Int64}
endType of all environments whose local left/right tensors are simple, i.e. a single tensor instead of a vector storing several tensors.
Center = [a, b] means El[1:a] and Er[b:end] are valid.
FiniteMPS.SparseEnvironment — Type struct SparseEnvironment{L, N, T<:NTuple{N, AbstractMPS{L}}, C<:AbstractStoreType} <: AbstractEnvironment{L}
layer::T
El::AbstractVector{SparseLeftTensor}
Er::AbstractVector{SparseRightTensor}
Center::Vector{Int64}
endType of all environments whose local left/right tensors are vectors storing several tensors, usually due to a SparseMPO in a layer.
Center = [a, b] means El[1:a] and Er[b:end] are valid.
FiniteMPS.Environment — Function Environment(M::AbstractMPS{L}...; kwargs...)Generic constructor of environments.
Generate an environment object according to the input MPS/MPO objects. The boundary environment tensor, i.e. El[1] and Er[L] will be initialized.
Kwargs
disk::Bool = falseStore the local environment tensor in disk(true) or in memory(false).
El::Union{SimpleLeftTensor, SparseLeftTensor}
Er::Union{SimpleLeftTensor, SparseLeftTensor}Initialize boundary El or Er manually. Default value is generated by function _defaultEl or _defaultEr, respectively.
FiniteMPS.initialize! — Function initialize!(obj::AbstractEnvironment; kwargs...)Initialize the boundary environment tensors, i.e. El[1] and Er[L].
Kwargs
El::Union{SimpleLeftTensor, SparseLeftTensor}
Er::Union{SimpleRightTensor, SparseRightTensor}Directly give El or Er, otherwise, use _defaultEl or _defaultEr to generate one.
free::Bool = falseIf true, call free!(obj) to free the local environment tensors which are no longer required. Details see free!.
FiniteMPS.pushleft! — Function pushleft!(::AbstractEnvironment)Push left the given environment object, i.e. Center == [i, j] to [i, j - 1].
FiniteMPS.pushright! — Function pushright!(::AbstractEnvironment)Push right the given environment object, i.e. Center == [i, j] to [i + 1, j].
FiniteMPS.canonicalize! — Method canonicalize!(obj::DenseMPS,
siL::Int64
[, siR::Int64 = siL]; kwargs...) -> obj::DenseMPSCanonicalize the MPS s.t. all sites ≤ siL are left-canonical, all sites ≥ siR are right-canonical.
kwargs will be propagated to leftorth and rightorth to determine how to truncate the SVD spectra.
canonicalize!(obj::AbstractEnvironment,
siL::Int64
[, siR::Int64 = siL]; kwargs...) -> obj::AbstractEnvironmentCanonicalize the environment s.t. at least El[i ≤ siL] and Er[i ≥ siR] are valid.
Kwargs
free::Bool = trueIf true, call free!(obj) to free the local environment tensors which are no longer required. Details see free!.
FiniteMPS.free! — Method free!(obj::AbstractEnvironment;
siL::AbstractVector{Int64} = obj.Center[1] + 1 : L,
siR::AbstractVector{Int64} = 1 : obj.Center[2] - 1
) -> nothingFree the local tensors in El[siL] and Er[siR].
FiniteMPS.scalar! — Function scalar!(obj::AbstractEnvironment; kwargs...) -> ::NumberFully contract the total tensor network to get a scalar.
Note this may change the Center of the environment obj.
Kwargs
normalize::Bool = falseIf true, calculate ⟨Ψ₁|H|Ψ₂⟩/(|Ψ₁||Ψ₂|) instead of ⟨Ψ₁|H|Ψ₂⟩.
split::Bool = falseSplit the value into each contribution of each left boundary environment if true. Thus, return a vector instead of a scalar in this case.
tmp::Bool = falsetmp == true means the environment is temporary, and thus we will free the local environment tensors which are no longer required.
FiniteMPS.connection! — Function connection!(Env1::SparseEnvironment, Env2::SparseEnvironment, ...;
kwargs...) -> ::MatrixReturn the connection ⟨∇⟨Hᵢ⟩, ∇⟨Hⱼ⟩⟩ where H₀, H₁, ⋯, Hₙ are the Hamiltonian corresponding to the given environments.
Note this function will move all the canonical centers to the right boundary.
kwargs
moveback::Bool = falseMove the canonical center back to the left boundary if true.
FiniteMPS.absorb! — Functionabsorb!(El::SparseLeftTensor, x::MPSTensor{2}) -> nothing
absorb!(Er::SparseRightTensor, x::MPSTensor{2}) -> nothingAbsorb a rank-2 bond tensor to a environment tensor.