Skip to content

Commit a2872f7

Browse files
committed
more cleanup
1 parent 2aff524 commit a2872f7

2 files changed

Lines changed: 18 additions & 24 deletions

File tree

src/spaces/homspace.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function Base.show(io::IO, W::HomSpace)
7979
)
8080
end
8181

82-
@doc """
82+
"""
8383
blocksectors(W::HomSpace) -> Indices{I}
8484
8585
Return an `Indices` of all coupled sectors for `W`. The result is cached based on the
@@ -118,9 +118,9 @@ Query whether a coupled sector `c` appears in both the codomain and domain of `W
118118
119119
See also [`blocksectors`](@ref).
120120
"""
121-
hasblock(W::HomSpace, c::Sector) = hasblock(codomain(W), c) && hasblock(domain(W), c)
121+
hasblock(W::HomSpace, c::Sector) = c in blocksectors(W)
122122

123-
@doc """
123+
"""
124124
dim(W::HomSpace) -> Int
125125
126126
Return the total dimension of a `HomSpace`, i.e. the number of linearly independent
@@ -139,8 +139,7 @@ and `r` is the corresponding index range in the flat data vector.
139139
140140
See also [`degeneracystructure`](@ref), [`subblockstructure`](@ref).
141141
"""
142-
blockstructure(W::HomSpace) =
143-
Dictionary(sectorstructure(W).blocksectors, degeneracystructure(W).blockstructure)
142+
blockstructure(W::HomSpace) = Dictionary(blocksectors(W), degeneracystructure(W).blockstructure)
144143

145144
"""
146145
fusiontrees(W::HomSpace) -> Indices{Tuple{F₁,F₂}}
@@ -163,8 +162,7 @@ Return a `Dictionary` mapping each fusion tree pair `(f₁, f₂)` to its
163162
164163
See also [`degeneracystructure`](@ref), [`blockstructure`](@ref).
165164
"""
166-
subblockstructure(W::HomSpace) =
167-
Dictionary(sectorstructure(W).fusiontrees, degeneracystructure(W).subblockstructure)
165+
subblockstructure(W::HomSpace) = Dictionary(fusiontrees(W), degeneracystructure(W).subblockstructure)
168166

169167
"""
170168
fusionblocks(W::HomSpace)

src/spaces/structure.jl

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const StridedStructure{N} = Tuple{NTuple{N, Int}, NTuple{N, Int}, Int}
44
# SectorStructure: sector-dependent characterization of HomSpaces
55
# ---------------------------------------------------------------
66
"""
7-
SectorStructure{I, F₁, F}
7+
SectorStructure{I <: Sector, F <: FusionTreePair}
88
99
Sector-only structure of a `HomSpace`: the coupled sectors and all valid fusion tree pairs,
1010
depending only on which sectors appear (not their degeneracy dimensions). Shared across
@@ -16,19 +16,18 @@ depending only on which sectors appear (not their degeneracy dimensions). Shared
1616
1717
See also [`sectorstructure`](@ref), [`DegeneracyStructure`](@ref).
1818
"""
19-
struct SectorStructure{I, F₁, F}
19+
struct SectorStructure{I <: Sector, F <: FusionTreePair{I}}
2020
blocksectors::Indices{I}
21-
fusiontrees::Indices{Tuple{F₁, F₂}}
21+
fusiontrees::Indices{F}
2222
end
2323

2424
Base.@assume_effects :foldable function sectorstructuretype(key::Hashed{S}) where {S <: HomSpace}
2525
I = sectortype(S)
26-
F₁ = fusiontreetype(I, numout(S))
27-
F₂ = fusiontreetype(I, numin(S))
28-
return SectorStructure{I, F₁, F₂}
26+
F = fusiontreetype(I, numout(S), numin(S))
27+
return SectorStructure{I, F}
2928
end
3029

31-
@doc """
30+
"""
3231
sectorstructure(W::HomSpace) -> SectorStructure
3332
3433
Return the [`SectorStructure`](@ref) for `W`, containing the coupled sectors and fusion tree
@@ -42,13 +41,11 @@ sectorstructure(W::HomSpace) = sectorstructure(Hashed(W, sectorhash, sectorequal
4241
@cached function sectorstructure(key::Hashed{S})::sectorstructuretype(key) where {S <: HomSpace}
4342
W = parent(key)
4443
codom, dom = codomain(W), domain(W)
45-
I = sectortype(S)
46-
N₁, N₂ = numout(S), numin(S)
47-
F₁ = fusiontreetype(I, N₁)
48-
F₂ = fusiontreetype(I, N₂)
4944

45+
I = sectortype(S)
46+
F = fusiontreetype(I, numout(S), numin(S))
5047
bs = Vector{I}()
51-
trees = Vector{Tuple{F₁, F₂}}()
48+
trees = Vector{F}()
5249

5350
for c in _blocksectors(W)
5451
push!(bs, c)
@@ -71,10 +68,10 @@ sectorstructure(W::HomSpace) = sectorstructure(Hashed(W, sectorhash, sectorequal
7168
end
7269
end
7370

74-
return SectorStructure{I, F₁, F₂}(Indices(bs), Indices(trees))
71+
return SectorStructure{I, F}(Indices(bs), Indices(trees))
7572
end
7673

77-
CacheStyle(::typeof(sectorstructure), ::Hashed{S}) where {S <: HomSpace} = GlobalLRUCache()
74+
CacheStyle(::typeof(sectorstructure), ::Hashed{<:HomSpace}) = GlobalLRUCache()
7875

7976
# DegeneracyStructure: degeneracy-dependent characterization of HomSpaces
8077
# -----------------------------------------------------------------------
@@ -90,8 +87,7 @@ strides that depend on the degeneracy (multiplicity) dimensions. Specific to a g
9087
- `blockstructure`: `Vector` of `((d₁, d₂), range)` values, one per coupled sector, in the
9188
same order as [`sectorstructure`](@ref)`.blocksectors`.
9289
- `subblockstructure`: `Vector` of [`StridedStructure`](@ref) `(sizes, strides, offset)`
93-
values, one per fusion tree pair, in the same order as
94-
[`sectorstructure`](@ref)`.fusiontrees`.
90+
values, one per fusion tree pair, in the same order as [`sectorstructure`](@ref)`.fusiontrees`.
9591
9692
See also [`degeneracystructure`](@ref), [`SectorStructure`](@ref).
9793
"""
@@ -106,7 +102,7 @@ function degeneracystructuretype(W::HomSpace)
106102
return DegeneracyStructure{N}
107103
end
108104

109-
@doc """
105+
"""
110106
degeneracystructure(W::HomSpace) -> DegeneracyStructure
111107
112108
Compute the [`DegeneracyStructure`](@ref) for `W`, describing block sizes, data ranges, and

0 commit comments

Comments
 (0)