Vector spaces

Type hierarchy

TensorKit.FieldType
abstract 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.

source
TensorKit.VectorSpaceType
abstract type VectorSpace end

Abstract type at the top of the type hierarchy for denoting vector spaces, or, more accurately, 𝕜-linear categories.

source
TensorKit.ElementarySpaceType
abstract 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.

source
TensorKit.GeneralSpaceType
struct 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.

source
TensorKit.InnerProductSpaceType
abstract 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.

source
TensorKit.EuclideanSpaceType
abstract 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$.

source
TensorKit.CartesianSpaceType
struct 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.

source
TensorKit.ComplexSpaceType
struct 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).

source
TensorKit.RepresentationSpaceType
abstract 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.

source
TensorKit.GenericRepresentationSpaceType
struct 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().

source
TensorKit.FiniteRepresentationSpaceType
struct 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.

source
TensorKit.CompositeSpaceType
abstract 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{𝕜}.

source
TensorKit.ProductSpaceType
struct 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.

source

Methods

Methods often apply similar to e.g. spaces and corresponding tensors or tensor maps, e.g.:

TensorKit.fieldFunction
field(V::VectorSpace) -> Field

Return the field type over which a vector space is defined.

source
TensorKit.sectortypeFunction
sectortype(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.

source
TensorKit.sectorsFunction
sectors(V::ElementarySpace)

Return an iterator over the different sectors of V.

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

source
TensorKit.hassectorFunction
hassector(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.

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

source
TensorKit.dimFunction
dim(V::VectorSpace) -> Int

Return the total dimension of the vector space V as an Int.

source
TensorKit.dimsFunction
dims(::ProductSpace{S,N}) -> Dims{N} = NTuple{N,Int}

Return the dimensions of the spaces in the tensor product space as a tuple of integers.

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

source
TensorKit.blocksectorsFunction
blocksectors(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.

source
TensorKit.blockdimFunction
blockdim(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).

source

The following methods act specifically on ElementarySpace spaces:

TensorKit.isdualFunction
isdual(V::ElementarySpace) -> Bool

Return wether an ElementarySpace V is normal or rather a dual space. Always returns false for spaces where V == dual(V).

source
TensorKit.dualFunction
dual(V::VectorSpace) -> VectorSpace

Return the dual space of V; also obtained via V'. It is assumed that typeof(V) == typeof(V').

source
Base.conjFunction
conj(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)).

source
TensorKit.flipFunction
flip(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}.

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

source
Base.oneunitFunction
oneunit(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}(()).

source

while the following also work on ProductSpace

TensorKit.fuseFunction
fuse(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.

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

source
Base.oneFunction
one(::Sector) -> Sector
one(::Type{<:Sector}) -> Sector

Return the unit element within this type of sector.

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

source