Tensor Wrappers

Wrap pure TensorMap in TensorKit.jl for multiple dispatch.

FiniteMPS.AbstractTensorWrapperType
 abstract type AbstractTensorWrapper

Wrapper type for classifying different Tensors.

Note each concrete subtype must have a field A::AbstractTensorMap to save the Tensor.

source
FiniteMPS.AbstractMPSTensorType
abstract type AbstractMPSTensor <: AbstractTensorWrapper

Elements 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

source
FiniteMPS.MPSTensorType
 struct MPSTensor{R} <: AbstractMPSTensor
      A::AbstractTensorMap
 end

Wrapper 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)
source
FiniteMPS.CompositeMPSTensorType
 struct CompositeMPSTensor{N, T <: NTuple{N, MPSTensor}} <: AbstractMPSTensor
      A::AbstractTensorMap
 end

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

source
FiniteMPS.AdjointMPSTensorType
 struct AdjointMPSTensor{R} <: AbstractMPSTensor
      A::AbstractTensorMap
 end

Lazy wrapper type for tensors of adjoint MPS.

 adjoint(::MPSTensor) -> ::AdjointMPSTensor
 adjoint(::AdjointMPSTensor) -> ::MPSTensor

Convention (' marks codomain):

                   3              4                   R
                   |              |                   |
 2-- A --1'     2--A--1'       3--A--2'       (R-1)-- A  --(R-2)'        
                                  |                 / | \
                                  1'              1' ... (R-3)'
source
FiniteMPS.LocalLeftTensorType
 struct LocalLeftTensor{R} <: AbstractEnvironmentTensor
	  A::AbstractTensorMap
	  tag::NTuple{R, String}
 end

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

source
FiniteMPS.LocalRightTensorType
 struct LocalRightTensor{R} <: AbstractEnvironmentTensor
	  A::AbstractTensorMap
	  tag::NTuple{R, String}
 end

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

source
FiniteMPS.SimpleLeftTensorType
 const SimpleLeftTensor = Union{Nothing, LocalLeftTensor}

Type of left environment tensor of simple MPO, i.e. a channel of sparse MPO.

source
FiniteMPS.SimpleRightTensorType
 const SimpleRightTensor = Union{Nothing, LocalRightTensor}

Type of right environment tensor of simple MPO, i.e. a channel of sparse MPO.

source
FiniteMPS.AbstractLocalOperatorType
 abstract type AbstractLocalOperator <: AbstractTensorWrapper

Wrapper type for classifying differnet local operators in order to accelerate contractions.

source
FiniteMPS.IdentityOperatorType
 mutable struct IdentityOperator <: AbstractLocalOperator
	  pspace::VectorSpace
	  aspace::VectorSpace
	  si::Int64
	  strength::Ref{Number}
 end

Lazy type of identity operator, used for skipping some tensor contractions.

Constructors

 IdentityOperator(pspace::VectorSpace, aspace::VectorSpace, si::Int64, strength::Ref{Number} = Ref{Number}(NaN))
source
FiniteMPS.tag2TupleType
 const tag2Tuple{R₁,R₂} = Tuple{NTuple{R₁,String}, NTuple{R₂,String}}

Type of field tag of LocalOperator.

source
FiniteMPS.LocalOperatorType
 mutable struct LocalOperator{R₁,R₂} <: AbstractLocalOperator
	  A::AbstractTensorMap
	  name::String
	  si::Int64
	  fermionic::Bool
	  strength::Ref{Number}
	  tag::tag2Tuple{R₁,R₂}  
 end

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

source
FiniteMPS.StringOperatorType
 mutable struct StringOperator
      Ops::Vector{AbstractLocalOperator}
      strength::Number
 end

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

source
FiniteMPS.AbstractStoreTypeType
 abstract type AbstractStoreType

Only has 2 concrete types StoreMemory and StoreDisk, to determine how the collections such as MPS, MPO and Environment store the local tensors.

source