Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"]
16 changes: 12 additions & 4 deletions src/tensors/tensoroperations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know where this is necessary? I might be misremembering, but I thought spacetype already outputs S, and never SumSpace{S}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's needed for MPSKit :(. Without it, the cuda/operators tests all fail, I'll try to get a more detailed trace

end

function TK.braidingtensortype(V1::SumSpace{S}, V2::SumSpace{S}, ::Type{TorA}) where {S, TorA}
return BraidingTensor{scalartype(TorA), S, similarstoragetype(TorA)}
end
Loading