@@ -60,6 +60,10 @@ function _numlabels(::Type{T}, i, j) where {T<:BimoduleSector}
6060 return length (_get_dual_cache (T)[2 ][i, j])
6161end
6262
63+ # User-friendly functions
64+ # -------------------
65+ # TODO : add functions to identify categories
66+
6367# Data from files
6468# ---------------
6569const artifact_path = joinpath (artifact " fusiondata" , " MultiTensorKit.jl-data-v0.1.3" )
@@ -240,12 +244,13 @@ function TensorKitSectors.Fsymbol(a::I, b::I, c::I, d::I, e::I,
240244 Nbcf = Nsymbol (b, c, f)
241245 Nafd = Nsymbol (a, f, d)
242246
247+ zero_array = zeros (sectorscalartype (I), Nabe, Necd, Nbcf, Nafd)
243248 Nabe > 0 && Necd > 0 && Nbcf > 0 && Nafd > 0 ||
244- return zeros ( sectorscalartype (I), Nabe, Necd, Nbcf, Nafd)
249+ return zero_array
245250
246251 i, j, k, l = a. i, a. j, b. j, c. j
247252 colordict = _get_Fcache (I)[i, j, k, l]
248- return colordict[ (a. label, b. label, c. label, d. label, e. label, f. label)]
253+ return get! ( colordict, (a. label, b. label, c. label, d. label, e. label, f. label), zero_array)
249254end
250255
251256# interface with TensorKit where necessary
@@ -273,6 +278,17 @@ function TensorKit.blocksectors(W::TensorMapSpace{S,N₁,N₂}) where
273278 end
274279end
275280
281+ # TODO : is this needed?
282+ # function TensorKit.scalar(t::AbstractTensorMap{T,S,0,0}) where {T,
283+ # S<:GradedSpace{<:BimoduleSector}}
284+ # _vector = findall(!iszero, t.data) # should have 0 or 1 elements, since only one of the blocks could be non-zero
285+ # if isempty(_vector)
286+ # return zero(scalartype(t))
287+ # end
288+ # unit = one(A4Object(only(_vector), only(_vector), 1))
289+ # return only(block(t, unit))
290+ # end
291+
276292# TODO : definition for zero of GradedSpace?
277293
278294function dim (V:: GradedSpace{<:BimoduleSector} )
0 commit comments