@@ -50,6 +50,9 @@ const TensorMapSpace{S <: ElementarySpace, N₁, N₂} = HomSpace{
5050 S, ProductSpace{S, N₁},
5151 ProductSpace{S, N₂},
5252}
53+ numout (:: Type{TensorMapSpace{S, N₁, N₂}} ) where {S, N₁, N₂} = N₁
54+ numin (:: Type{TensorMapSpace{S, N₁, N₂}} ) where {S, N₁, N₂} = N₂
55+ numind (T:: Type{TensorMapSpace{S, N₁, N₂}} ) where {S, N₁, N₂} = numout (T) + numin (T)
5356
5457function Base. getindex (W:: TensorMapSpace{<:IndexSpace, N₁, N₂} , i) where {N₁, N₂}
5558 return i <= N₁ ? codomain (W)[i] : dual (domain (W)[i - N₁])
@@ -139,18 +142,33 @@ fusiontrees(W::HomSpace) = fusionblockstructure(W).fusiontreelist
139142# Operations on HomSpaces
140143# -----------------------
141144"""
142- permute(W::HomSpace, (p₁, p₂)::Index2Tuple{N₁,N₂} )
145+ permute(W::HomSpace, (p₁, p₂)::Index2Tuple)
143146
144147Return the `HomSpace` obtained by permuting the indices of the domain and codomain of `W`
145148according to the permutation `p₁` and `p₂` respectively.
146149"""
147- function permute (W:: HomSpace{S} , (p₁, p₂):: Index2Tuple{N₁, N₂} ) where {S, N₁, N₂}
150+ function permute (W:: HomSpace , (p₁, p₂):: Index2Tuple )
148151 p = (p₁... , p₂... )
149152 TupleTools. isperm (p) && length (p) == numind (W) ||
150153 throw (ArgumentError (" $((p₁, p₂)) is not a valid permutation for $(W) " ))
151154 return select (W, (p₁, p₂))
152155end
153156
157+ _transpose_indices (W:: HomSpace ) = (reverse (domainind (W)), reverse (codomainind (W)))
158+
159+ function LinearAlgebra. transpose (W:: HomSpace , (p₁, p₂):: Index2Tuple = _transpose_indices (W))
160+ p = linearizepermutation (p₁, p₂, numout (W), numin (W))
161+ iscyclicpermutation (p) || throw (ArgumentError (lazy " $((p₁, p₂)) is not a cyclic permutation for $W" ))
162+ return select (W, (p₁, p₂))
163+ end
164+
165+ function braid (W:: HomSpace , (p₁, p₂):: Index2Tuple , lvls:: IndexTuple )
166+ p = (p₁... , p₂... )
167+ TupleTools. isperm (p) && length (p) == numind (W) == length (lvls) ||
168+ throw (ArgumentError (" $((p₁, p₂)) , $lvls is not a valid braiding for $(W) " ))
169+ return select (W, (p₁, p₂))
170+ end
171+
154172"""
155173 select(W::HomSpace, (p₁, p₂)::Index2Tuple{N₁,N₂})
156174
0 commit comments