Skip to content

Commit e291962

Browse files
leburgelclaude
andcommitted
Support spaces without indices and the reverse iteration of FusionTreePairs
The units of a product sector, the block sectors of a space without indices, come with a shape, and showing a FusionTreePairs iterates it in reverse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8d9ada9 commit e291962

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/spaces/structure.jl‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Base.length(t::FusionTreePairs) = last(t.offsets)
5454
Dictionaries.istokenizable(::FusionTreePairs) = true
5555
Dictionaries.tokentype(::FusionTreePairs) = Int
5656
Dictionaries.iteratetoken(t::FusionTreePairs, i::Int = 0) = i < length(t) ? (i + 1, i + 1) : nothing
57+
Dictionaries.iteratetoken_reverse(t::FusionTreePairs, i::Int = length(t) + 1) = i > 1 ? (i - 1, i - 1) : nothing
5758
# tokens as returned by `gettoken` look like those of `Indices`, with the position second
5859
function Dictionaries.gettoken(t::FusionTreePairs, (f₁, f₂))
5960
found₁, (_, i₁) = gettoken(t.trees₁, f₁)
@@ -116,7 +117,7 @@ sectorstructure(W::HomSpace) = sectorstructure(Hashed(W, sectorhash, sectorequal
116117
@cached function sectorstructure(key::Hashed{S})::sectorstructuretype(key) where {S <: HomSpace}
117118
W = parent(key)
118119
# the trees of both sides of every coupled sector; the pairs are not stored
119-
bs = collect(_blocksectors(W))
120+
bs = vec(collect(_blocksectors(W))) # `vec`: the units of a product sector have a shape
120121
F₁, F₂ = fusiontreetype(sectortype(S), numout(S)), fusiontreetype(sectortype(S), numin(S))
121122
sides₁ = map(c -> collect(fusiontrees(codomain(W), c)), bs)
122123
sides₂ = map(c -> collect(fusiontrees(domain(W), c)), bs)

0 commit comments

Comments
 (0)