Skip to content

Commit e24f01d

Browse files
committed
changes to (left/right)unitspace and zerospace
1 parent bd97efd commit e24f01d

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/spaces/gradedspace.jl

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function leftunitspace(S::GradedSpace{I}) where {I<:Sector}
142142
return unitspace(typeof(S))
143143
else
144144
!isempty(sectors(S)) || throw(ArgumentError("Cannot determine type of empty space"))
145-
allequal(a.row for a in sectors(S)) ||
145+
allequal(leftunit, sectors(S)) ||
146146
throw(ArgumentError("sectors of $S do not have the same left unit"))
147147

148148
sector = leftunit(first(sectors(S)))
@@ -161,7 +161,7 @@ function rightunitspace(S::GradedSpace{I}) where {I<:Sector}
161161
return unitspace(typeof(S))
162162
else
163163
!isempty(sectors(S)) || throw(ArgumentError("Cannot determine type of empty space"))
164-
allequal(a.row for a in sectors(S)) ||
164+
allequal(rightunit, sectors(S)) ||
165165
throw(ArgumentError("sectors of $S do not have the same right unit"))
166166

167167
sector = rightunit(first(sectors(S)))
@@ -170,19 +170,9 @@ function rightunitspace(S::GradedSpace{I}) where {I<:Sector}
170170
end
171171

172172
function unitspace(S::Type{<:GradedSpace{I}}) where {I<:Sector}
173-
if UnitStyle(I) isa SimpleUnit
174-
return S(unit(I) => 1)
175-
else
176-
return S(unit => 1 for unit in allunits(I))
177-
end
178-
end
179-
function zerospace(S::Type{<:GradedSpace{I}}) where {I<:Sector}
180-
if UnitStyle(I) isa SimpleUnit
181-
return S(unit(I) => 0)
182-
else
183-
return S(unit => 0 for unit in allunits(I))
184-
end
173+
return S(unit => 1 for unit in allunits(I))
185174
end
175+
zerospace(S::Type{<:GradedSpace}) = S()
186176

187177
# TODO: the following methods can probably be implemented more efficiently for
188178
# `FiniteGradedSpace`, but we don't expect them to be used often in hot loops, so

0 commit comments

Comments
 (0)