diff --git a/Project.toml b/Project.toml index c0c0443..6f65a8e 100644 --- a/Project.toml +++ b/Project.toml @@ -36,7 +36,7 @@ MatrixAlgebraKit = "0.6" Random = "1" SafeTestsets = "0.1" Strided = "2.3.3" -TensorKit = "0.16.4" +TensorKit = "0.17" TensorOperations = "5" Test = "1" TestExtras = "0.2, 0.3" @@ -55,5 +55,8 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a" +[sources] +TensorKit = {url = "https://github.com/QuantumKitHub/TensorKit.jl", rev = "main"} + [targets] test = ["Test", "TestExtras", "Random", "Combinatorics", "SafeTestsets", "Aqua", "Adapt", "JLArrays"] diff --git a/src/tensors/tensoroperations.jl b/src/tensors/tensoroperations.jl index 80bb85a..723b333 100644 --- a/src/tensors/tensoroperations.jl +++ b/src/tensors/tensoroperations.jl @@ -115,17 +115,25 @@ function TK.BraidingTensor( return TK.BraidingTensor{T, S}(V1, V2, adjoint) end -function TK.BraidingTensor{T, S}( +function TK.BraidingTensor{T, S, A}( V1::SumSpace{S}, V2::SumSpace{S}, adjoint::Bool = false - ) where {T, S} - τtype = BraidingTensor{T, S} + ) where {T, S, A} + τtype = BraidingTensor{T, S, A} tdst = SparseBlockTensorMap{τtype}(undef, V2 ⊗ V1, V1 ⊗ V2) Vs = eachspace(tdst) @inbounds for I in CartesianIndices(tdst) if I[1] == I[4] && I[2] == I[3] V = Vs[I] - tdst[I] = TK.BraidingTensor{T, S}(V[2], V[1], adjoint) + tdst[I] = TK.BraidingTensor{T, S, A}(V[2], V[1], adjoint) end end return tdst end + +function TK.braidingtensortype(::Type{SumSpace{S}}, ::Type{TorA}) where {S, TorA} + return BraidingTensor{scalartype(TorA), S, similarstoragetype(TorA)} +end + +function TK.braidingtensortype(V1::SumSpace{S}, V2::SumSpace{S}, ::Type{TorA}) where {S, TorA} + return BraidingTensor{scalartype(TorA), S, similarstoragetype(TorA)} +end