Skip to content

Commit ff6af7b

Browse files
committed
add allunits, fix dual, revert insertleft/rightunitspace
1 parent 9e718a2 commit ff6af7b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/bimodulesector.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ end
191191

192192
# Base.isone(a::BimoduleSector) = leftone(a) == a == rightone(a)
193193

194+
function TensorKitSectors.allunits(::Type{I}) where {I <: BimoduleSector}
195+
s = size(I)
196+
return I[I(i, i, _get_dual_cache(I)[1][i]) for i in 1:s]
197+
end
198+
194199
function TensorKitSectors.unit(::Type{<:BimoduleSector})
195200
throw(ArgumentError("one of Type BimoduleSector doesn't exist"))
196201
end
@@ -203,7 +208,7 @@ function TensorKitSectors.rightunit(a::BimoduleSector)
203208
return typeof(a)(a.j, a.j, _get_dual_cache(typeof(a))[1][a.j])
204209
end
205210

206-
function Base.conj(a::BimoduleSector)
211+
function TensorKitSectors.dual(a::BimoduleSector)
207212
return typeof(a)(a.j, a.i, _get_dual_cache(typeof(a))[2][a.i, a.j][a.label])
208213
end
209214

@@ -345,6 +350,8 @@ function TensorKit.fuse(V₁::GradedSpace{I}, V₂::GradedSpace{I}) where {I<:Bi
345350
return typeof(V₁)(dims)
346351
end
347352

353+
#TODO: these might not be necessary anymore after TensorKit#291
354+
348355
# limited unitspace
349356
function TensorKit.unitspace(S::GradedSpace{<:BimoduleSector})
350357
allequal(a.i for a in sectors(S)) && allequal(a.j for a in sectors(S)) ||
@@ -387,7 +394,8 @@ function leftunitspace(S::SumSpace{<:GradedSpace{<:BimoduleSector}})
387394
return SumSpace(leftunitspace(first(S.spaces)))
388395
end
389396

390-
function TensorKit.insertrightunitspace(P::ProductSpace{V,N}, ::Val{i};
397+
398+
function TensorKit.insertrightunit(P::ProductSpace{V,N}, ::Val{i};
391399
conj::Bool=false,
392400
dual::Bool=false) where {i,V<:GradedSpace{I},N} where {I<:BimoduleSector}
393401
i > N && error("cannot insert a sensible right unit onto $P at index $(i+1)")
@@ -403,7 +411,7 @@ function TensorKit.insertrightunitspace(P::ProductSpace{V,N}, ::Val{i};
403411
end
404412

405413
# possible TODO: overwrite defaults at level of HomSpace and TensorMap?
406-
function TensorKit.insertleftunitspace(P::ProductSpace{V,N}, ::Val{i}; # want no defaults?
414+
function TensorKit.insertleftunit(P::ProductSpace{V,N}, ::Val{i}; # want no defaults?
407415
conj::Bool=false,
408416
dual::Bool=false) where {i,V<:GradedSpace{I},N} where {I<:BimoduleSector}
409417
i > N && error("cannot insert a sensible left unit onto $P at index $i") # do we want this to error in the diagonal case?

0 commit comments

Comments
 (0)