Skip to content

Commit cf62381

Browse files
committed
add specializations
1 parent 681440d commit cf62381

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/spaces/gradedspace.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,21 @@ function Base.:(==)(V₁::GradedSpace, V₂::GradedSpace)
191191
return sectortype(V₁) == sectortype(V₂) && (V₁.dims == V₂.dims) && V₁.dual == V₂.dual
192192
end
193193

194+
function sectorhash(V::GradedSpace{I, NTuple{N, Int}}, h::UInt) where {I, N}
195+
return hash(iszero.(V.dims), hash(isdual(V), h))
196+
end
197+
function sectorequal(V₁::GradedSpace{I, D}, V₂::GradedSpace{I, D}) where {I, N, D <: NTuple{N, Int}}
198+
return isdual(V₁) == isdual(V₂) && all(zip(V₁.dims, V₂.dims)) do (d₁, d₂)
199+
return iszero(d₁) == iszero(d₂)
200+
end
201+
end
202+
function sectorhash(V::GradedSpace{I, <:SectorDict}, h::UInt) where {I}
203+
return hash(keys(V.dims), hash(isdual(V), h))
204+
end
205+
function sectorequal(V₁::GradedSpace{I, D}, V₂::GradedSpace{I, D}) where {I, D <: SectorDict}
206+
return isdual(V₁) == isdual(V₂) && keys(V₁.dims) == keys(V₂.dims)
207+
end
208+
194209
Base.summary(io::IO, V::GradedSpace) = print(io, type_repr(typeof(V)))
195210

196211
function Base.show(io::IO, V::GradedSpace)

0 commit comments

Comments
 (0)