Skip to content

Commit 4831ed1

Browse files
committed
adjoint indexing
1 parent 4da1880 commit 4831ed1

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

src/tensors/adjoint.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,10 @@ function Base.getindex(iter::BlockIterator{<:AdjointTensorMap}, c::Sector)
4242
return adjoint(Base.getindex(iter.structure, c))
4343
end
4444

45-
function Base.getindex(
46-
t::AdjointTensorMap{T, S, N₁, N₂}, f₁::FusionTree{I, N₁}, f₂::FusionTree{I, N₂}
47-
) where {T, S, N₁, N₂, I}
45+
Base.@propagate_inbounds function subblock(t::AdjointTensorMap, (f₁, f₂)::Tuple{FusionTree, FusionTree})
4846
tp = parent(t)
49-
subblock = getindex(tp, f₂, f₁)
50-
return permutedims(conj(subblock), (domainind(tp)..., codomainind(tp)...))
51-
end
52-
function Base.setindex!(
53-
t::AdjointTensorMap{T, S, N₁, N₂}, v, f₁::FusionTree{I, N₁}, f₂::FusionTree{I, N₂}
54-
) where {T, S, N₁, N₂, I}
55-
return copy!(getindex(t, f₁, f₂), v)
47+
data = subblock(tp, (f₂, f₁))
48+
return permutedims(conj(data), (domainind(tp)..., codomainind(tp)...))
5649
end
5750

5851
# Show

0 commit comments

Comments
 (0)