Tensor Wrappers
Wrap pure TensorMap in TensorKit.jl for multiple dispatch.
FiniteMPS.AbstractTensorWrapper — Type abstract type AbstractTensorWrapperWrapper type for classifying different Tensors.
Note each concrete subtype must have a field A::AbstractTensorMap to save the Tensor.
FiniteMPS.AbstractMPSTensor — Typeabstract type AbstractMPSTensor <: AbstractTensorWrapperElements of MPS, note a MPO is nothing but a MPS with rank-4 tensors, hence we using this type to deal with both MPS and MPO
FiniteMPS.MPSTensor — Type struct MPSTensor{R} <: AbstractMPSTensor
A::AbstractTensorMap
endWrapper type for rank-R MPS local tensors.
Convention (' marks codomain):
3 ... (R-1)
\ | /
1'-- A ---R 1'-- A -- 2
|
2'In particular, R == 2 for bond tensor.
Constructors
MPSTensor(::AbstractTensorMap)
MPSTensor{R}(::AbstractTensorMap)FiniteMPS.CompositeMPSTensor — Type struct CompositeMPSTensor{N, T <: NTuple{N, MPSTensor}} <: AbstractMPSTensor
A::AbstractTensorMap
endWrapper type for multi-site local tensors.
The 2nd parameter indicates the types of the N original on-site tensors.
Constructors
CompositeMPSTensor{N, T}(::AbstractTensorMap) where T <: NTuple{N, MPSTensor}Directly construct.
CompositeMPSTensor(::NTuple{N, MPSTensor})
CompositeMPSTensor(::MPSTensor, ::MPSTensor, ...)Contract N on-site tensors to get the N-site tensor.
FiniteMPS.AdjointMPSTensor — Type struct AdjointMPSTensor{R} <: AbstractMPSTensor
A::AbstractTensorMap
endLazy wrapper type for tensors of adjoint MPS.
adjoint(::MPSTensor) -> ::AdjointMPSTensor
adjoint(::AdjointMPSTensor) -> ::MPSTensorConvention (' marks codomain):
3 4 R
| | |
2-- A --1' 2--A--1' 3--A--2' (R-1)-- A --(R-2)'
| / | \
1' 1' ... (R-3)'FiniteMPS.AbstractEnvironmentTensor — Type abstract type AbstractEnvironmentTensor <: AbstractTensorWrapperWrapper type for left and right environment tensors.
FiniteMPS.LocalLeftTensor — Type struct LocalLeftTensor{R} <: AbstractEnvironmentTensor
A::AbstractTensorMap
tag::NTuple{R, String}
endWrapper type for rank-R left environment tensor, with an additional field tag to distinguish legs of different channels.
Convention (' marks codomain):
--R
|
| --R-1(')
El ⋮
| --2(')
|
--1'Constructors
LocalLeftTensor(A::AbstractTensorMap [, tag::NTuple{R, String}])Default tag = ("", "", ..., "").
LocalLeftTensor{R}(A::AbstractTensorMap)Used for automatic converting, only support default tag.
FiniteMPS.LocalRightTensor — Type struct LocalRightTensor{R} <: AbstractEnvironmentTensor
A::AbstractTensorMap
tag::NTuple{R, String}
endWrapper type for rank-R right environment tensor, with an additional field tag to distinguish legs of different channels.
Convention (' marks codomain):
1'--
|
2(')--|
⋮ Er
R-1(')--|
|
R--Constructors
LocalRigthTensor(A::AbstractTensorMap [, tag::NTuple{R, String}])Default tag = ("", "", ..., "").
LocalRightTensor{R}(A::AbstractTensorMap)Used for automatic converting, only support default tag.
FiniteMPS.SimpleLeftTensor — Type const SimpleLeftTensor = Union{Nothing, LocalLeftTensor}Type of left environment tensor of simple MPO, i.e. a channel of sparse MPO.
FiniteMPS.SimpleRightTensor — Type const SimpleRightTensor = Union{Nothing, LocalRightTensor}Type of right environment tensor of simple MPO, i.e. a channel of sparse MPO.
FiniteMPS.SparseLeftTensor — Type const SparseLeftTensor = Vector{SimpleLeftTensor}Type of left environment tensor of sparse MPO.
FiniteMPS.SparseRightTensor — Type const SparseRightTensor = Vector{SimpleRightTensor}Type of right environment tensor of sparse MPO.
FiniteMPS.AbstractLocalOperator — Type abstract type AbstractLocalOperator <: AbstractTensorWrapperWrapper type for classifying differnet local operators in order to accelerate contractions.
FiniteMPS.IdentityOperator — Type mutable struct IdentityOperator <: AbstractLocalOperator
pspace::VectorSpace
aspace::VectorSpace
si::Int64
strength::Ref{Number}
endLazy type of identity operator, used for skipping some tensor contractions.
Constructors
IdentityOperator(pspace::VectorSpace, aspace::VectorSpace, si::Int64, strength::Ref{Number} = Ref{Number}(NaN))FiniteMPS.tag2Tuple — Type const tag2Tuple{R₁,R₂} = Tuple{NTuple{R₁,String}, NTuple{R₂,String}}Type of field tag of LocalOperator.
FiniteMPS.LocalOperator — Type mutable struct LocalOperator{R₁,R₂} <: AbstractLocalOperator
A::AbstractTensorMap
name::String
si::Int64
fermionic::Bool
strength::Ref{Number}
tag::tag2Tuple{R₁,R₂}
endWarpper type for local operators, the building blocks of sparse MPO.
R₁ and R₂ indicate the rank corresponding to codomain and domain, respectively.
Warning: this warpper type does not support automatic converting.
Convention (' marks codomain):
2 2 3 3
| | | |
A A--3 1'--A 1'--A--4
| | | |
1' 1' 2' 2'Constructors
LocalOperator(O::AbstractTensorMap,
name::Union{String,Symbol},
si::Int64,
fermionic::Bool,
[,strength::Ref{Number} = Ref{Number}(NaN)]
[, tag::tag2Tuple{R₁,R₂}];
swap::Bool=false,
aspace::Tuple{VectorSpace, VectorSpace} = Tuple(fill(trivial(codomain(O)[1]), 2)))Default tag: "phys" for physical indices and name for virtual indices.
If swap == ture, it will swap the left and right virtual indices.
FiniteMPS.StringOperator — Type mutable struct StringOperator
Ops::Vector{AbstractLocalOperator}
strength::Number
endConcrete type for an arbitrary string operator. The Ops field stores the local operators and strength is the overall strength.
Constructor
StringOperator(Ops::AbstractVector{<:AbstractLocalOperator}, strength::Number = 1.0)
StringOperator(Ops::AbstractLocalOperator..., strength::Number = 1.0)key methods
sort!(Ops::StringOperator)Sort the operators by their site index in ascending order. Note the fermionic sign will be considered if necessary and will be absorbed into the strength.
reduce!(Ops::StringOperator)Reduce the string operator to a shorter one by numerically performing the composition of operators at the same site. Note this function can only be applied to a sorted string operator.
FiniteMPS.SparseMPOTensor — Type const SparseMPOTensor = Matrix{Union{Nothing, AbstractLocalOperator}}FiniteMPS.AbstractStoreType — Type abstract type AbstractStoreTypeOnly has 2 concrete types StoreMemory and StoreDisk, to determine how the collections such as MPS, MPO and Environment store the local tensors.
FiniteMPS.StoreMemory — Type struct StoreMemory <: AbstractStoreTypeTell the collection to store local tensors in memory.
FiniteMPS.StoreDisk — Type struct StoreDisk <: AbstractStoreTypeTell the collection to store local tensors in disk.