@@ -162,15 +162,15 @@ function Base.one(a::BimoduleSector)
162162end
163163
164164function TensorKitSectors. leftone (a:: BimoduleSector )
165- return A4Object (a. i, a. i, _get_dual_cache (typeof (a))[1 ][a. i])
165+ return typeof (a) (a. i, a. i, _get_dual_cache (typeof (a))[1 ][a. i])
166166end
167167
168168function TensorKitSectors. rightone (a:: BimoduleSector )
169- return A4Object (a. j, a. j, _get_dual_cache (typeof (a))[1 ][a. j])
169+ return typeof (a) (a. j, a. j, _get_dual_cache (typeof (a))[1 ][a. j])
170170end
171171
172172function Base. conj (a:: BimoduleSector )
173- return A4Object (a. j, a. i, _get_dual_cache (typeof (a))[2 ][a. i, a. j][a. label])
173+ return typeof (a) (a. j, a. i, _get_dual_cache (typeof (a))[2 ][a. i, a. j][a. label])
174174end
175175
176176function extract_Fsymbol (:: Type{A4Object} )
@@ -282,22 +282,18 @@ function Base.oneunit(S::GradedSpace{<:BimoduleSector})
282282 first (sectors (S)). i == first (sectors (S)). j ||
283283 throw (ArgumentError (" sectors of $S are non-diagonal" ))
284284 sector = one (first (sectors (S)))
285- return ℂ[A4Object] (sector => 1 )
285+ return spacetype (S) (sector => 1 )
286286end
287287
288288function Base. oneunit (S:: SumSpace{<:GradedSpace{<:BimoduleSector}} )
289- allequal (a. i for a in sectors (S)) && allequal (a. j for a in sectors (S)) ||
290- throw (ArgumentError (" sectors of $S are not all equal" ))
291- first (sectors (S)). i == first (sectors (S)). j ||
292- throw (ArgumentError (" sectors of $S are non-diagonal" ))
293- sector = one (first (sectors (S)))
294- return SumSpace (ℂ[A4Object](sector => 1 ))
289+ @assert ! isempty (S) " Cannot determine type of empty space"
290+ return SumSpace (oneunit (first (S. spaces)))
295291end
296292
297293# maybe from the homspace
298294function TensorKit. insertrightunit (P:: ProductSpace{V,N} , :: Val{i} = Val (length (P));
299295 conj:: Bool = false ,
300- dual:: Bool = false ) where {i,V<: GradedSpace{<: I} ,N} where {I<: BimoduleSector }
296+ dual:: Bool = false ) where {i,V<: GradedSpace{I} ,N} where {I<: BimoduleSector }
301297 # possible change to rightone of correct space for N = 0
302298 u = N > 0 ? oneunit (P[1 ]) : error (" no unit object in $P " )
303299 if dual
311307
312308function TensorKit. insertleftunit (P:: ProductSpace{V,N} , :: Val{i} = Val (length (P) + 1 );
313309 conj:: Bool = false ,
314- dual:: Bool = false ) where {i,V<: GradedSpace{<: I} ,N} where {I<: BimoduleSector }
310+ dual:: Bool = false ) where {i,V<: GradedSpace{I} ,N} where {I<: BimoduleSector }
315311 u = N > 0 ? oneunit (P[1 ]) : error (" no unit object in $P " )
316312 if dual
317313 u = TensorKit. dual (u)
0 commit comments