Skip to content

Commit de9bd92

Browse files
committed
adjoint indexing
1 parent 4da1880 commit de9bd92

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/tensors/adjoint.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,12 @@ 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₂}
45+
Base.@propagate_inbounds function subblock(
46+
t::AdjointTensorMap{T, S, N₁, N₂}, (f₁, f₂)::Tuple{FusionTree{I, N₁}, FusionTree{I, N₂}}
4747
) where {T, S, N₁, N₂, I}
4848
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)
49+
data = subblock(tp, (f₁, f₂))
50+
return permutedims(conj(data), (domainind(tp)..., codomainind(tp)...))
5651
end
5752

5853
# Show

0 commit comments

Comments
 (0)