Skip to content

Commit f548497

Browse files
committed
code suggestions
1 parent f125a4a commit f548497

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/spaces/productspace.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function blocksectors(P::ProductSpace{S, N}) where {S, N}
151151
end
152152
bs = Vector{I}()
153153
if N == 0
154-
return collect(allunits(I))
154+
append!(bs, allunits(I))
155155
elseif N == 1
156156
for s in sectors(P)
157157
push!(bs, first(s))

src/spaces/vectorspaces.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ Always returns `false` for spaces where `V == conj(V)`, i.e. vector spaces over
134134
135135
Return the corresponding vector space of type `S` that represents the trivial
136136
one-dimensional space, i.e. the space that is isomorphic to the corresponding field.
137-
For vector spaces of type `GradedSpace{I}` where `Sector` `I` has a semi-simple unit
138-
structure, this returns a multi-dimensional space corresponding to all unit sectors in `I`.
137+
For vector spaces where `I = sectortype(S)` has a semi-simple unit structure
138+
(`UnitStyle(I) == GenericUnit()`), this returns a multi-dimensional space corresponding to all unit sectors:
139+
`dim(unitspace(V), s) == 1` for all `s in allunits(I)`.
139140
140141
!!! note
141142
`unitspace(V)`is different from `one(V)`. The latter returns the empty product space
@@ -169,7 +170,7 @@ function leftunitspace(V::ElementarySpace)
169170
if UnitStyle(I) isa SimpleUnit
170171
return unitspace(typeof(V))
171172
else
172-
!isempty(sectors(V)) || throw(ArgumentError("Cannot determine type of empty space"))
173+
!isempty(sectors(V)) || throw(ArgumentError("Cannot determine the left unit of an empty space"))
173174
_allequal(leftunit, sectors(V)) ||
174175
throw(ArgumentError("sectors of $V do not have the same left unit"))
175176

@@ -191,7 +192,7 @@ function rightunitspace(V::ElementarySpace)
191192
if UnitStyle(I) isa SimpleUnit
192193
return unitspace(typeof(V))
193194
else
194-
!isempty(sectors(V)) || throw(ArgumentError("Cannot determine type of empty space"))
195+
!isempty(sectors(V)) || throw(ArgumentError("Cannot determine the right unit of an empty space"))
195196
_allequal(rightunit, sectors(V)) ||
196197
throw(ArgumentError("sectors of $V do not have the same right unit"))
197198

0 commit comments

Comments
 (0)