Skip to content

Commit

Permalink
Some docs fixes (#103)
Browse files Browse the repository at this point in the history
* Some docs fixes

* Fix `TrivialTensor` docstring

* Simplify subtype restrictions in alias definitions

* Format

* Small fix in deligne product docs
  • Loading branch information
leburgel authored Feb 2, 2024
1 parent e6fe747 commit 889c518
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 17 deletions.
5 changes: 3 additions & 2 deletions docs/src/lib/sectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Rsymbol
Bsymbol
dim(::Sector)
frobeniusschur
twist
twist(::Sector)
Base.isreal(::Type{<:Sector})
TensorKit.vertex_labeltype
TensorKit.vertex_ind2label
Expand Down Expand Up @@ -69,7 +69,8 @@ foldleft
cycleclockwise
cycleanticlockwise
repartition
transpose
transpose(f₁::FusionTree{I}, f₂::FusionTree{I},
p1::IndexTuple{N₁}, p2::IndexTuple{N₂}) where {I<:Sector,N₁,N₂}
braid(f₁::FusionTree{I}, f₂::FusionTree{I}, levels1::IndexTuple, levels2::IndexTuple, p1::IndexTuple{N₁}, p2::IndexTuple{N₂}) where {I<:Sector,N₁,N₂}
permute(f₁::FusionTree{I}, f₂::FusionTree{I}, p1::IndexTuple{N₁}, p2::IndexTuple{N₂}) where {I<:Sector,N₁,N₂}
```
5 changes: 3 additions & 2 deletions docs/src/lib/spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ sectors
hassector
dim
dims
blocksectors
blocksectors(::ProductSpace)
blocksectors(::HomSpace)
blockdim
space
```
Expand All @@ -61,7 +62,7 @@ while the following also work on both `ElementarySpace` and `ProductSpace`
```@docs
fuse
:⊗
:⊠
⊠(::VectorSpace, ::VectorSpace)
one
ismonomorphic
isepimorphic
Expand Down
13 changes: 6 additions & 7 deletions docs/src/lib/tensors.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ The type hierarchy of tensors is as follows:

```@docs
AbstractTensorMap
AbstractTensor
TensorMap
AdjointTensorMap
BraidingTensor
Expand Down Expand Up @@ -48,7 +47,7 @@ The following methods exist to obtain type information:

```@docs
spacetype
sectortype
sectortype(::Type{<:AbstractTensorMap{S}}) where {S<:IndexSpace}
storagetype
tensormaptype
```
Expand All @@ -57,7 +56,7 @@ To obtain information about the indices, you can use:
```@docs
domain
codomain
space
space(::AbstractTensorMap)
numin
numout
numind
Expand All @@ -68,8 +67,8 @@ allind

To obtain information about the data, the following methods exist:
```@docs
blocksectors
blockdim
blocksectors(::AbstractTensorMap)
blockdim(::AbstractTensorMap, ::Sector)
block
blocks
fusiontrees
Expand All @@ -92,8 +91,8 @@ scaling, as well as the selection of a custom backend.
```@docs
permute(t::AbstractTensorMap{S}, (p₁, p₂)::Index2Tuple{N₁,N₂}; copy::Bool=false) where {S,N₁,N₂}
braid(t::AbstractTensorMap{S}, (p₁, p₂)::Index2Tuple, levels::IndexTuple; copy::Bool=false) where {S}
transpose
twist
transpose(::AbstractTensorMap, ::Index2Tuple)
twist(::AbstractTensorMap, ::Int)
```
```@docs
permute!(tdst::AbstractTensorMap{S,N₁,N₂}, tsrc::AbstractTensorMap{S}, p::Index2Tuple{N₁,N₂}) where {S,N₁,N₂}
Expand Down
2 changes: 1 addition & 1 deletion src/sectors/product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const deligneproduct = ⊠
deligneproduct(s₁::Sector, s₂::Sector)
Given two sectors `s₁` and `s₂`, which label an isomorphism class of simple objects in a
fusion category ``C₁`` and ``C₂``, `s1 ⊠ s2` (obtained as `\boxtimes+TAB`) labels the
fusion category ``C₁`` and ``C₂``, `s1 ⊠ s2` (obtained as `\\boxtimes+TAB`) labels the
isomorphism class of simple objects in the Deligne tensor product category ``C₁ ⊠ C₂``.
The Deligne tensor product also works in the type domain and for spaces and tensors. For
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/abstracttensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ hasblock
blocksectors(t::AbstractTensorMap)
Return an iterator over all coupled sectors of a tensor.
""" blocksectors
""" blocksectors(::AbstractTensorMap)

@doc """
blockdim(t::AbstractTensorMap, c::Sector) -> Base.Dims
Return the dimensions of the block of a tensor corresponding to a coupled sector `c`.
""" blockdim
""" blockdim(::AbstractTensorMap, ::Sector)

@doc """
fusiontrees(t::AbstractTensorMap)
Expand Down
34 changes: 31 additions & 3 deletions src/tensors/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,32 @@ struct TensorMap{S<:IndexSpace, N₁, N₂, I<:Sector, A<:Union{<:DenseMatrix,Se
end
#! format: on

const Tensor{S<:IndexSpace,N,I<:Sector,A,F₁,F₂} = TensorMap{S,N,0,I,A,F₁,F₂}
const TrivialTensorMap{S<:IndexSpace,N₁,N₂,A<:DenseMatrix} = TensorMap{S,N₁,N₂,Trivial,A,
Nothing,Nothing}
"""
Tensor{S, N, I, A, F₁, F₂} = TensorMap{S, N, 0, I, A, F₁, F₂}
Specific subtype of [`AbstractTensor`](@ref) for representing tensors whose data is stored
in blocks of some subtype of `DenseMatrix`.
A `Tensor{S, N, I, A, F₁, F₂}` is actually a special case `TensorMap{S, N, 0, I, A, F₁, F₂}`,
i.e. a tensor map with only a non-trivial output space.
"""
const Tensor{S,N,I,A,F₁,F₂} = TensorMap{S,N,0,I,A,F₁,F₂}
"""
TrivialTensorMap{S<:IndexSpace, N₁, N₂, A<:DenseMatrix} = TensorMap{S, N₁, N₂, Trivial,
A, Nothing, Nothing}
A special case of [`TensorMap`](@ref) for representing tensor maps with trivial symmetry,
i.e., whose `sectortype` is `Trivial`.
"""
const TrivialTensorMap{S,N₁,N₂,A<:DenseMatrix} = TensorMap{S,N₁,N₂,Trivial,A,
Nothing,Nothing}
"""
TrivialTensor{S, N, A} = TrivialTensorMap{S, N, 0, A}
A special case of [`Tensor`](@ref) for representing tensors with trivial symmetry, i.e.,
whose `sectortype` is `Trivial`.
"""
const TrivialTensor{S,N,A} = TrivialTensorMap{S,N,0,A}
"""
tensormaptype(::Type{S}, N₁::Int, N₂::Int, [::Type{T}]) where {S<:IndexSpace,T} -> ::Type{<:TensorMap}
Expand Down Expand Up @@ -72,6 +95,11 @@ domain(t::TensorMap) = t.dom
blocksectors(t::TrivialTensorMap) = OneOrNoneIterator(dim(t) != 0, Trivial())
blocksectors(t::TensorMap) = keys(t.data)

"""
storagetype(::Union{T,Type{T}}) where {T<:TensorMap} -> Type{A<:DenseMatrix}
Return the type of the storage `A` of the tensor map.
"""
function storagetype(::Type{<:TensorMap{<:IndexSpace,N₁,N₂,Trivial,A}}) where
{N₁,N₂,A<:DenseMatrix}
return A
Expand Down

0 comments on commit 889c518

Please sign in to comment.