Vector spaces
Type hierarchy
TensorKit.Field
— Typeabstract type Field end
Abstract type at the top of the type hierarchy for denoting fields over which vector spaces can be defined. Two common fields are ℝ
and ℂ
, representing the field of real or complex numbers respectively.
TensorKit.VectorSpace
— Typeabstract type VectorSpace end
Abstract type at the top of the type hierarchy for denoting vector spaces, or, more accurately, 𝕜-linear categories.
TensorKit.ElementarySpace
— Typeabstract type ElementarySpace{𝕜} <: VectorSpace end
Elementary finite-dimensional vector space over a field 𝕜
that can be used as the index space corresponding to the indices of a tensor.
Every elementary vector space should respond to the methods conj
and dual
, returning the complex conjugate space and the dual space respectively. The complex conjugate of the dual space is obtained as dual(conj(V)) === conj(dual(V))
. These different spaces should be of the same type, so that a tensor can be defined as an element of a homogeneous tensor product of these spaces.
TensorKit.GeneralSpace
— Typestruct GeneralSpace{𝕜} <: ElementarySpace{𝕜}
A finite-dimensional space over an arbitrary field 𝕜
without additional structure. It is thus characterized by its dimension, and whether or not it is the dual and/or conjugate space. For a real field 𝕜
, the space and its conjugate are the same.
TensorKit.InnerProductSpace
— Typeabstract type InnerProductSpace{𝕜} <: ElementarySpace{𝕜} end
Abstract type for denoting vector with an inner product and a corresponding metric, which can be used to raise or lower indices of tensors.
TensorKit.EuclideanSpace
— Typeabstract type EuclideanSpace{𝕜} <: InnerProductSpace{𝕜} end
Abstract type for denoting real or complex spaces with a standard (Euclidean) inner product (i.e. orthonormal basis), such that the dual space is naturally isomorphic to the conjugate space (in the complex case) or even to the space itself (in the real case), also known as the category of finite-dimensional Hilbert spaces $FdHilb$.
TensorKit.CartesianSpace
— Typestruct CartesianSpace <: EuclideanSpace{ℝ}
A real euclidean space ℝ^d
, which is therefore self-dual. CartesianSpace
has no additonal structure and is completely characterised by its dimension d
. This is the vector space that is implicitly assumed in most of matrix algebra.
TensorKit.ComplexSpace
— Typestruct ComplexSpace <: EuclideanSpace{ℂ}
A standard complex vector space ℂ^d with Euclidean inner product and no additional structure. It is completely characterised by its dimension and whether its the normal space or its dual (which is canonically isomorphic to the conjugate space).
TensorKit.RepresentationSpace
— Typeabstract type RepresentationSpace{G<:Sector} <: EuclideanSpace{ℂ} end
Complex Euclidean space with a direct sum structure corresponding to different superselection sectors of type G<:Sector
, e.g. the elements or irreps of a compact or finite group, or the labels of a unitary fusion category.
TensorKit.GenericRepresentationSpace
— Typestruct GenericRepresentationSpace{G<:Sector} <: RepresentationSpace{G}
Generic implementation of a representation space, i.e. a complex Euclidean space with a direct sum structure corresponding to different superselection sectors of type G<:Sector
, e.g. the irreps of a compact or finite group, or the labels of a unitary fusion category.
This fallback is used when IteratorSize(values(G)) == IsInfinite()
.
TensorKit.FiniteRepresentationSpace
— Typestruct FiniteRepresentationSpace{G<:Sector,N} <: AbstractRepresentationSpace{G}
Optimized implementation for a representation space (fusion category) with a finite number of labels (simple objects), i.e. a complex Euclidean space with a direct sum structure corresponding to different superselection sectors of type G<:Sector
, e.g. the irreps of a finite group, or the labels of a unitary fusion category.
This fallback is used when IteratorSize(values(G))
is of type HasLength
or HasShape
.
TensorKit.CompositeSpace
— Typeabstract type CompositeSpace{S<:ElementarySpace} <: VectorSpace end
Abstract type for composite spaces that are defined in terms of a number of elementary vector spaces of a homogeneous type S<:ElementarySpace{𝕜}
.
TensorKit.ProductSpace
— Typestruct ProductSpace{S<:ElementarySpace, N} <: CompositeSpace{S}
A ProductSpace
is a tensor product space of N
vector spaces of type S<:ElementarySpace
. Only tensor products between ElementarySpace
objects of the same type are allowed.
Methods
Methods often apply similar to e.g. spaces and corresponding tensors or tensor maps, e.g.:
TensorKit.field
— Functionfield(V::VectorSpace) -> Field
Return the field type over which a vector space is defined.
TensorKit.sectortype
— Functionsectortype(a) -> Type{<:Sector}
Return the type of sector over which object a
(e.g. a representation space or a tensor) is defined. Also works in type domain.
TensorKit.sectors
— Functionsectors(V::ElementarySpace)
Return an iterator over the different sectors of V
.
sectors(P::ProductSpace{S,N}) where {S<:ElementarySpace}
Return an iterator over all possible combinations of sectors (represented as an NTuple{N,sectortype(S)}
) that can appear within the tensor product space P
.
TensorKit.hassector
— Functionhassector(V::VectorSpace, a::Sector) -> Bool
Return whether a vector space V
has a subspace corresponding to sector a
with non-zero dimension, i.e. dim(V, a) > 0
.
hassector(P::ProductSpace{S,N}, s::NTuple{N,sectortype(S)}) where {S<:ElementarySpace}
-> Bool
Query whether P
has a non-zero degeneracy of sector s
, representing a combination of sectors on the individual tensor indices.
TensorKit.dim
— Functiondim(V::VectorSpace) -> Int
Return the total dimension of the vector space V
as an Int.
TensorKit.dims
— Functiondims(::ProductSpace{S,N}) -> Dims{N} = NTuple{N,Int}
Return the dimensions of the spaces in the tensor product space as a tuple of integers.
dims(P::ProductSpace{S,N}, s::NTuple{N,sectortype(S)}) where {S<:ElementarySpace}
-> Dims{N} = NTuple{N,Int}
Return the degeneracy dimensions corresponding to a tuple of sectors s
for each of the spaces in the tensor product P
.
TensorKit.blocksectors
— Functionblocksectors(P::ProductSpace)
Return an iterator over the different unique coupled sector labels, i.e. the different fusion outputs that can be obtained by fusing the sectors present in the different spaces that make up the ProductSpace
instance.
TensorKit.blockdim
— Functionblockdim(P::ProductSpace, c::Sector)
Return the total dimension of a coupled sector c
in the product space, by summing over all dim(P, s)
for all tuples of sectors s::NTuple{N,<:Sector}
that can fuse to c
, counted with the correct multiplicity (i.e. number of ways in which s
can fuse to c
).
TensorKit.space
— Functionspace(a) -> VectorSpace
Return the vector space associated to object a
.
The following methods act specifically on ElementarySpace
spaces:
TensorKit.isdual
— Functionisdual(V::ElementarySpace) -> Bool
Return wether an ElementarySpace V
is normal or rather a dual space. Always returns false
for spaces where V == dual(V)
.
TensorKit.dual
— Functiondual(V::VectorSpace) -> VectorSpace
Return the dual space of V
; also obtained via V'
. It is assumed that typeof(V) == typeof(V')
.
Base.conj
— Functionconj(V::S) where {S<:ElementarySpace} -> S
Return the conjugate space of V
.
For field(V)==ℝ
, conj(V) == V
. It is assumed that typeof(V) == typeof(conj(V))
.
TensorKit.flip
— Functionflip(V::S) where {S<:ElementarySpace} -> S
Return a single vector space of type S
that has the same value of isdual
as dual(V)
, but yet is isomorphic to V
rather than to dual(V)
. The spaces flip(V)
and dual(V)
only differ in the case of RepresentationSpace{G}
.
TensorKit.:⊕
— Function⊕(V1::S, V2::S, V3::S...) where {S<:ElementarySpace} -> S
Return the corresponding vector space of type S
that represents the direct sum sum of the spaces V1
, V2
, ... Note that all the individual spaces should have the same value for isdual
, as otherwise the direct sum is not defined.
Base.oneunit
— Functiononeunit(V::S) where {S<:ElementarySpace} -> S
Return the corresponding vector space of type S
that represents the trivial one-dimensional space, i.e. the space that is isomorphic to the corresponding field. Note that this is different from one(V::S)
, which returns the empty product space ProductSpace{S,0}(())
.
while the following also work on ProductSpace
TensorKit.fuse
— Functionfuse(V1::S, V2::S, V3::S...) where {S<:ElementarySpace} -> S
fuse(P::ProductSpace{S}) where {S<:ElementarySpace} -> S
Return a single vector space of type S
that is isomorphic to the fusion product of the individual spaces V1
, V2
, ..., or the spaces contained in P
.
TensorKit.:⊗
— Function⊗(V1::S, V2::S, V3::S...) where {S<:ElementarySpace} -> S
Create a ProductSpace{S}(V1, V2, V3...)
representing the tensor product of several elementary vector spaces. For convience, Julia's regular multiplication operator *
applied to vector spaces has the same effect.
The tensor product structure is preserved, see fuse
for returning a single elementary space of type S
that is isomorphic to this tensor product.
Base.one
— Functionone(::Sector) -> Sector
one(::Type{<:Sector}) -> Sector
Return the unit element within this type of sector.
one(::S) where {S<:ElementarySpace} -> ProductSpace{S,0}
one(::ProductSpace{S}) where {S<:ElementarySpace} -> ProductSpace{S,0}
Return a tensor product of zero spaces of type S
, i.e. this is the unit object under the tensor product operation, such that V ⊗ one(V) == V
.