282282# -----------------------------------------
283283
284284# TODO : generalise
285+ # is this blocksectors necessary with the productspace one?
285286function TensorKit. blocksectors (W:: TensorMapSpace{S,N₁,N₂} ) where
286287 {S<: Union {Vect[A4Object],
287288 SumSpace{Vect[A4Object]}},N₁,N₂}
@@ -304,6 +305,28 @@ function TensorKit.blocksectors(W::TensorMapSpace{S,N₁,N₂}) where
304305 end
305306end
306307
308+ # TODO : generalise
309+ # function TensorKit.blocksectors(P::ProductSpace{S,N}) where {S<:Union{Vect[A4Object],SumSpace{Vect[A4Object]}},N}
310+ # I = sectortype(S) # currently just A4Object
311+ # bs = Vector{I}()
312+ # if N == 0
313+ # return I[one(I(i, i, 1)) for i in 1:size(I)]
314+ # elseif N == 1
315+ # for s in sectors(P)
316+ # push!(bs, first(s))
317+ # end
318+ # else
319+ # for s in sectors(P)
320+ # for c in ⊗(s...)
321+ # if !(c in bs)
322+ # push!(bs, c)
323+ # end
324+ # end
325+ # end
326+ # end
327+ # return sort!(bs)
328+ # end
329+
307330function TensorKit. dim (V:: GradedSpace{<:BimoduleSector} )
308331 T = Base. promote_op (* , Int, real (sectorscalartype (sectortype (V))))
309332 return reduce (+ , dim (V, c) * dim (c) for c in sectors (V); init= zero (T))
@@ -334,32 +357,32 @@ end
334357
335358function Base. oneunit (S:: SumSpace{<:GradedSpace{<:BimoduleSector}} )
336359 @assert ! isempty (S) " Cannot determine type of empty space"
337- return SumSpace (oneunit (first (S. spaces)))
360+ return SumSpace (oneunit (first (S. spaces))) # assuming diagonal SumSpace (like in MPSKit)
338361end
339362
340363# oneunit for spaces whose elements all belong to the same sector
341- function TensorKit . rightoneunit (S:: GradedSpace{<:BimoduleSector} )
364+ function rightoneunit (S:: GradedSpace{<:BimoduleSector} )
342365 allequal (a. j for a in sectors (S)) ||
343366 throw (ArgumentError (" sectors of $S do not have the same rightone" ))
344367
345368 sector = rightone (first (sectors (S)))
346369 return spacetype (S)(sector => 1 )
347370end
348371
349- function TensorKit . rightoneunit (S:: SumSpace{<:GradedSpace{<:BimoduleSector}} )
372+ function rightoneunit (S:: SumSpace{<:GradedSpace{<:BimoduleSector}} )
350373 @assert ! isempty (S) " Cannot determine type of empty space"
351374 return SumSpace (rightoneunit (first (S. spaces)))
352375end
353376
354- function TensorKit . leftoneunit (S:: GradedSpace{<:BimoduleSector} )
377+ function leftoneunit (S:: GradedSpace{<:BimoduleSector} )
355378 allequal (a. i for a in sectors (S)) ||
356379 throw (ArgumentError (" sectors of $S do not have the same leftone" ))
357380
358381 sector = leftone (first (sectors (S)))
359382 return spacetype (S)(sector => 1 )
360383end
361384
362- function TensorKit . leftoneunit (S:: SumSpace{<:GradedSpace{<:BimoduleSector}} )
385+ function leftoneunit (S:: SumSpace{<:GradedSpace{<:BimoduleSector}} )
363386 @assert ! isempty (S) " Cannot determine type of empty space"
364387 return SumSpace (leftoneunit (first (S. spaces)))
365388end
0 commit comments