MPS & MPO
Wrap MPS and MPO as a vector of tensors together with some information.
FiniteMPS.AbstractMPS — Type
abstract type AbstractMPS{L}Abstract type of all MPS/MPO with length L.
FiniteMPS.DenseMPS — Type
abstract type DenseMPS{L, T <:Union{Float64, ComplexF64}} <: AbstractMPS{L}Abstract type of dense MPS/MPO with length L.
LinearAlgebra.normalize! — Method
normalize!(obj::DenseMPS) -> objNormalize a given MPS according to inner-induced norm.
Note we assume the MPS satisfies a canonical form and the center tensor is normalized, hence we only normalize c.
LinearAlgebra.norm — Method
norm(obj::DenseMPS) -> ::Float64Return the inner-induced norm. Note we assume the MPS satisfies a canonical form and the center tensor is normalized, hence the norm is just abs(c).
FiniteMPS.coef — Method
coef(obj::DenseMPS) -> ::FInterface of DenseMPS, return the global coefficient, where F is the number type of given MPS.
FiniteMPS.Center — Method
Center(obj::DenseMPS) -> Vector (length 2)Interface of DenseMPS, return the info of canonical center. [a, b] means left-canonical from 1 to a-1 and right-canonical from b+1 to L.
Base.complex — Method
complex(obj::DenseMPS{L}) -> ::DenseMPS{L, ComplexF64}Return a copy of given MPS but with ComplexF64 as basic field.
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.AdjointMPS — Type
struct AdjointMPS{L} <: AbstractMPS{L}
parent::DenseMPS{L}
endLazy wrapper type for adjoint of MPS.
adjoint(::DenseMPS) -> ::AdjointMPS
adjoint(::AdjointMPS) -> ::DenseMPSFunctions to be directly propagated to the parent:
lastindex, length, keys, norm, normalize!, Center, iterate, canonicalize!Functions to be propagated to the parent with some adaptations:
getindex, setindex!, coefFiniteMPS.MPS — Type
mutable struct MPS{L, T <:Union{Float64, ComplexF64}, C} <: DenseMPS{L, T}
const A::AbstractVector{AbstractMPSTensor}
const Center::Vector{Int64}
c::T
endConcrete type of MPS, where L is the length, T == Float64 or ComplexF64 is the number type of local tensors.
C <: AbstractStoreType is the type to determine the storage of local tensors, usually C == StoreMemory. We can use package SerializedElementArrays to store local tensors in disk, in which case C == StoreDisk.
Fields
const A::AbstractVector{AbstractMPSTensor}Length L vector to store the local tensors. Note the vector A is immutable while the local tensors in it are mutable.
const Center::Vector{Int64}Length 2 vector to label the canonical form. [a, b] means left-canonical from 1 to a-1 and right-canonical from b+1 to L.
c::TThe global coefficient, i.e. we represented a MPS with L local tensors and an additional scalar c, in order to avoid too large/small local tensors.
Constructors
MPS{L, T}(A::AbstractVector{<:AbstractMPSTensor}, Center::Vector{Int64} = [1, L], c::T = one(T))Standard constructor. Note we will promote all local tensors if T == ComplexF64 while the input local tensors in A are of Float64.
MPS(A::AbstractVector{<:AbstractMPSTensor}, args...)Deduce type parameters via L = length(A) and T = typeof(c). For default c cases, assume T = Float64 if all local tensors are real, otherwise T = ComplexF64.
MPS(A::AbstractVector{<:AbstractTensorMap}, args...)Automatically convert local tensors to warpper type MPSTensor.
MPS{L, T}()
MPS(L, T = Float64)Initialize an MPS{L, T} with the local tensors A to be filled. Note we initialize Center = [1, L] and c = one(T).
Newest update, kwargs disk::Bool = false can be added to each constructor to control how to store the local tensors.
FiniteMPS.randMPS — Function
randMPS([::Type{T},]
pspace::Vector{VectorSpace},
aspace::Vector{VectorSpace};
kwargs...) -> MPS{L}Generate a length L random MPS with given length L vector pspace and aspace. T = Float64(default) or ComplexF64 is the number type. Note the canonical center is initialized to the first site.
randMPS([::Type{T},] L::Int64, pspace::VectorSpace, apsace::VectorSpace; kwargs...) -> MPS{L}Assume the same pspace and aspace, except for the boundary bond, which is assumed to be trivial.
FiniteMPS.MPO — Type
mutable struct MPO{L, T <:Union{Float64, ComplexF64}, C} <: DenseMPS{L, T}
const A::AbstractVector{AbstractMPSTensor}
const Center::Vector{Int64}
c::T
endAll the fields and constructors are exactly the same to those of MPS, we redefine the type MPO just for using multiple dispacth when implementing the algebra between MPS and MPO.
Details of constructors please see MPS.
FiniteMPS.identityMPO — Function
identityMPO(::Type{T} = Float64, L::Int64, pspace::AbstractVector; kwargs...)Construct an identity MPO where the physical spaces are informed by a length L vertor of VectorSpace.
identityMPO(::Type{T} = Float64, L::Int64, pspace::VectorSpace; kwargs...)Assume the all the physical spaces are the same.
identityMPO(obj::DenseMPS{L, T}; kwargs...)Deduce the scalar type T and physical spaces from a MPS/MPO.
Kwargs
disk::Bool = false
bspace::VectorSpaceSpace of left boundary bond, default = trivial space.
FiniteMPS.SparseMPO — Type
struct SparseMPO{L} <: AbstractMPS{L}
A::Vector{SparseMPOTensor}
endConcrete type of sparse MPO.
Note an instance of this type is usually a Hamiltonian, which will not cost too much memory, therefore we always store the local tensors in memory.
Constructors
SparseMPO(A::AbstractVector{SparseMPOTensor})