@@ -28,8 +28,7 @@ struct BraidingTensor{T, S, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2
2828 end
2929end
3030function BraidingTensor {T} (V1:: S , V2:: S , adjoint:: Bool = false ) where {T, S <: IndexSpace }
31- TA = similarstoragetype (T)
32- return BraidingTensor {T, S, TA} (V1, V2, adjoint)
31+ return braidingtensortype (S, T)(V1, V2, adjoint)
3332end
3433function BraidingTensor (V1:: S , V2:: S , adjoint:: Bool = false ) where {S <: IndexSpace }
3534 T = BraidingStyle (sectortype (S)) isa SymmetricBraiding ? Float64 : ComplexF64
6059
6160# these are here to make the preprocessing for `@planar` expressions less painful
6261function braidingtensortype (:: Type{S} , :: Type{TorA} ) where {S <: IndexSpace , TorA}
63- T = eltype (TorA)
64- TA = similarstoragetype (TorA)
65- return BraidingTensor{T, S, TA}
62+ A = similarstoragetype (TorA)
63+ return BraidingTensor{scalartype (A), S, A}
6664end
6765braidingtensortype (V:: S , :: Type{TorA} ) where {S <: IndexSpace , TorA} = braidingtensortype (S, TorA)
6866braidingtensortype (V1:: S , V2:: S , :: Type{TorA} ) where {S <: IndexSpace , TorA} = braidingtensortype (S, TorA)
7371function braidingtensortype (V:: HomSpace , :: Type{TorA} ) where {TorA}
7472 domain (V) == reverse (codomain (V)) ||
7573 throw (SpaceMismatch (" Cannot define a braiding on $V " ))
76- T = eltype (TorA)
77- S = spacetype (V[2 ])
78- TA = similarstoragetype (TorA)
79- return braidingtensortype (S, TA)
74+ return braidingtensortype (spacetype (V), TorA)
8075end
8176
8277storagetype (:: Type{BraidingTensor{T, S, A}} ) where {T, S, A} = A
0 commit comments