55
66using  GradedArrays: 
77    GradedArrays,
8-     × ,
98    AbstractGradedUnitRange,
10-     AbstractSector,
11-     SectorProduct,
9+     SectorProductRange,
10+     SectorRange,
11+     × ,
1212    arguments,
1313    flip,
1414    flip_dual,
1515    isdual,
1616    nsymbol,
1717    sector_multiplicities,
1818    sector_type,
19+     sectorproduct,
1920    sectors,
2021    to_gradedrange,
2122    trivial
@@ -125,7 +126,7 @@ function GradedArrays.:×(f1::SectorFusionTree, f2::SectorFusionTree)
125126    )
126127end 
127128
128- function  GradedArrays. arguments (f:: SectorFusionTree{<:SectorProduct } )
129+ function  GradedArrays. arguments (f:: SectorFusionTree{<:SectorProductRange } )
129130    transposed_indices =  outer_multiplicity_split .(
130131        Base. tail (leaves (f)),
131132        branch_sectors (f),
@@ -136,7 +137,7 @@ function GradedArrays.arguments(f::SectorFusionTree{<:SectorProduct})
136137    arguments_leaves =  arguments .(leaves (f))
137138    arguments_branch_sectors =  arguments .(branch_sectors (f))
138139    #  TODO  way to avoid explicit ntuple?
139-     #  works fine for Tuple and NamedTuple SectorProduct 
140+     #  works fine for Tuple and NamedTuple SectorProductRange 
140141    return  ntuple (
141142        i ->  SectorFusionTree (
142143            getindex .(arguments_leaves, i),
@@ -149,21 +150,21 @@ function GradedArrays.arguments(f::SectorFusionTree{<:SectorProduct})
149150    )
150151end 
151152
152- function  GradedArrays. arguments (f:: SectorFusionTree{<:SectorProduct , 0} )
153+ function  GradedArrays. arguments (f:: SectorFusionTree{<:SectorProductRange , 0} )
153154    return  map (arg ->  SectorFusionTree ((), (), arg, (), ()), arguments (root_sector (f)))
154155end 
155156
156- function  GradedArrays. arguments (f:: SectorFusionTree{<:SectorProduct , 1} )
157+ function  GradedArrays. arguments (f:: SectorFusionTree{<:SectorProductRange , 1} )
157158    arguments_root =  arguments (root_sector (f))
158159    arguments_leave =  arguments (only (leaves (f)))
159-     #  use map(keys) to stay agnostic with respect to SectorProduct  implementation
160+     #  use map(keys) to stay agnostic with respect to SectorProductRange  implementation
160161    return  map (keys (arguments_root)) do  k
161162        return  SectorFusionTree ((arguments_leave[k],), arrows (f), arguments_root[k], (), ())
162163    end 
163164end 
164165
165166#  TBD change type depending on AbelianStyle?
166- fusiontree_eltype (:: Type{<:AbstractSector } ) =  Float64
167+ fusiontree_eltype (:: Type{<:SectorRange } ) =  Float64
167168
168169#  constructors
169170function  build_trees (legs:: Vararg{AbstractGradedUnitRange} )
@@ -175,7 +176,7 @@ function build_trees(legs::Vararg{AbstractGradedUnitRange})
175176end 
176177
177178function  build_trees (
178-         sectors_to_fuse:: NTuple{N, <:AbstractSector } , arrows_to_fuse:: NTuple{N, Bool} 
179+         sectors_to_fuse:: NTuple{N, <:SectorRange } , arrows_to_fuse:: NTuple{N, Bool} 
179180    ) where  {N}
180181    #  construct all authorized trees with fixed outer sectors
181182    trees =  [SectorFusionTree (first (sectors_to_fuse), first (arrows_to_fuse))]
@@ -186,18 +187,18 @@ end
186187#  =====================================  Internals  ========================================
187188# 
188189
189- #  --------------- SectorProduct  helper functions  ---------------
190+ #  --------------- SectorProductRange  helper functions  ---------------
190191function  outer_multiplicity_kron (
191192        sec1, sec2, fused, outer_multiplicity1, outer_multiplicity2
192193    )
193-     n =  nsymbol (sec1, sec2, fused)
194+     n =  Int ( nsymbol (sec1, sec2, fused) )
194195    linear_inds =  LinearIndices ((n, outer_multiplicity2))
195196    return  linear_inds[outer_multiplicity1, outer_multiplicity2]
196197end 
197198
198199function  outer_multiplicity_split (
199200        sec1:: S , sec2:: S , fused:: S , outer_mult_index:: Integer 
200-     ) where  {S <:  SectorProduct }
201+     ) where  {S <:  SectorProductRange }
201202    args1 =  arguments (sec1)
202203    args2 =  arguments (sec2)
203204    args12 =  arguments (fused)
@@ -207,15 +208,15 @@ end
207208
208209#  --------------- Build trees  ---------------
209210#  zero leg: need S to get sector type information
210- function  SectorFusionTree {S} () where  {S <:  AbstractSector }
211+ function  SectorFusionTree {S} () where  {S <:  SectorRange }
211212    return  SectorFusionTree ((), (), trivial (S), (), ())
212213end 
213- function  SectorFusionTree {S} (:: Tuple{} , :: Tuple{} ) where  {S <:  AbstractSector }
214+ function  SectorFusionTree {S} (:: Tuple{} , :: Tuple{} ) where  {S <:  SectorRange }
214215    return  SectorFusionTree ((), (), trivial (S), (), ())
215216end 
216217
217218#  one leg
218- function  SectorFusionTree (sect:: AbstractSector , arrow:: Bool )
219+ function  SectorFusionTree (sect:: SectorRange , arrow:: Bool )
219220    return  SectorFusionTree ((sect,), (arrow,), sect, (), ())
220221end 
221222
227228
228229function  append_tree_leave (
229230        parent_tree:: SectorFusionTree ,
230-         branch_sector:: AbstractSector ,
231+         branch_sector:: SectorRange ,
231232        level_arrow:: Bool ,
232233        child_root_sector,
233234        outer_mult,
@@ -242,7 +243,7 @@ function append_tree_leave(
242243end 
243244
244245function  fuse_next_sector (
245-         parent_tree:: SectorFusionTree , branch_sector:: AbstractSector , level_arrow:: Bool 
246+         parent_tree:: SectorFusionTree , branch_sector:: SectorRange , level_arrow:: Bool 
246247    )
247248    new_space =  to_gradedrange (root_sector (parent_tree) ⊗  branch_sector)
248249    return  mapreduce (
@@ -282,7 +283,7 @@ function to_array(f::SectorFusionTree)
282283    return  grow_tensor_tree (tree_tensor, f)
283284end 
284285
285- function  to_array (f:: SectorFusionTree{<:SectorProduct } )
286+ function  to_array (f:: SectorFusionTree{<:SectorProductRange } )
286287    args =  convert .(Array, arguments (f))
287288    return  reduce (_tensor_kron, args)
288289end 
0 commit comments