Environment

Deal with the left and right environment tensors of multi-layer MPS/MPO structure.

FiniteMPS.CenterMethod
 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.

source
FiniteMPS.SimpleEnvironmentType
 struct SimpleEnvironment{L, N, T<:NTuple{N, AbstractMPS{L}}, C<:AbstractStoreType} <: AbstractEnvironment{L}
      layer::T
      El::AbstractVector{SimpleLeftTensor}
      Er::AbstractVector{SimpleRightTensor}
      Center::Vector{Int64} 
 end

Type 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.

source
FiniteMPS.SparseEnvironmentType
 struct SparseEnvironment{L, N, T<:NTuple{N, AbstractMPS{L}}, C<:AbstractStoreType} <: AbstractEnvironment{L}
      layer::T
      El::AbstractVector{SparseLeftTensor}
      Er::AbstractVector{SparseRightTensor}
      Center::Vector{Int64} 
 end

Type 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.

source
FiniteMPS.EnvironmentFunction
 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 = false

Store 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.

source
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 = false

If true, call free!(obj) to free the local environment tensors which are no longer required. Details see free!.

source
FiniteMPS.pushleft!Function
 pushleft!(::AbstractEnvironment)

Push left the given environment object, i.e. Center == [i, j] to [i, j - 1].

source
FiniteMPS.pushright!Function
 pushright!(::AbstractEnvironment)

Push right the given environment object, i.e. Center == [i, j] to [i + 1, j].

source
FiniteMPS.canonicalize!Method
 canonicalize!(obj::DenseMPS, 
      siL::Int64
      [, siR::Int64 = siL]; kwargs...) -> obj::DenseMPS

Canonicalize 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.

source
 canonicalize!(obj::AbstractEnvironment, 
      siL::Int64
      [, siR::Int64 = siL]; kwargs...) -> obj::AbstractEnvironment

Canonicalize the environment s.t. at least El[i ≤ siL] and Er[i ≥ siR] are valid.

Kwargs

 free::Bool = true

If true, call free!(obj) to free the local environment tensors which are no longer required. Details see free!.

source
FiniteMPS.free!Method
 free!(obj::AbstractEnvironment; 
      siL::AbstractVector{Int64} = obj.Center[1] + 1 : L,
      siR::AbstractVector{Int64} = 1 : obj.Center[2] - 1     
 ) -> nothing

Free the local tensors in El[siL] and Er[siR].

source
FiniteMPS.scalar!Function
 scalar!(obj::AbstractEnvironment; kwargs...) -> ::Number

Fully contract the total tensor network to get a scalar.

Note this may change the Center of the environment obj.

Kwargs

 normalize::Bool = false

If true, calculate ⟨Ψ₁|H|Ψ₂⟩/(|Ψ₁||Ψ₂|) instead of ⟨Ψ₁|H|Ψ₂⟩.

 split::Bool = false

Split 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 = false

tmp == true means the environment is temporary, and thus we will free the local environment tensors which are no longer required.

source
FiniteMPS.connection!Function
 connection!(Env1::SparseEnvironment, Env2::SparseEnvironment, ...; 
	  kwargs...) -> ::Matrix

Return 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 = false

Move the canonical center back to the left boundary if true.

source
FiniteMPS.absorb!Function
absorb!(El::SparseLeftTensor, x::MPSTensor{2}) -> nothing
 absorb!(Er::SparseRightTensor, x::MPSTensor{2}) -> nothing

Absorb a rank-2 bond tensor to a environment tensor.

source