Named Sectors: NamedSector
NamedSector represents the same Deligne tensor product as ProductSector, but stores its component sectors in a named tuple so that they can be accessed by name rather than by position. This is convenient when a product mixes several symmetries (e.g. a charge and a spin) and positional indexing would be error-prone.
Sector type
TensorKitSectors.NamedSector — Type
struct NamedSector{NT <: NamedSectorTuple}
NamedSector((; name₁=s₁, name₂=s₂, ...))Represents the Deligne tensor product of sectors stored with named components. Similar to ProductSector, but components are accessible by name via s.name.
Examples
julia> s = NamedSector(; charge=U1Irrep(1), spin=SU2Irrep(1//2))
NamedSector(; charge=Irrep[U₁](1), spin=Irrep[SU₂](1/2))
julia> s.charge
Irrep[U₁](1)
julia> s.spin
Irrep[SU₂](1/2)TensorKitSectors.@NamedSector — Macro
@NamedSector{name₁::T₁, name₂::T₂, ...}Convenience macro for constructing a NamedSector type with named components, analogous to @NamedTuple.
Examples
julia> @NamedSector{charge::U1Irrep, spin::SU2Irrep}
NamedSector{@NamedTuple{charge::U1Irrep, spin::SU2Irrep}}
julia> (@NamedSector{charge::U1Irrep, spin::SU2Irrep})(U1Irrep(1), SU2Irrep(1//2))
NamedSector(; charge=Irrep[U₁](1), spin=Irrep[SU₂](1/2))A named sector is constructed with keyword arguments to ⊠/NamedSector, or from a type built with the @NamedSector macro:
julia> s = ⊠(; charge = U1Irrep(1), spin = SU2Irrep(1//2))
NamedSector(; charge=Irrep[U₁](1), spin=Irrep[SU₂](1/2))
julia> s.charge
Irrep[U₁](1)
julia> s.spin
Irrep[SU₂](1/2)
julia> I = @NamedSector{charge::U1Irrep, spin::SU2Irrep}
NamedSector{@NamedTuple{charge::U1Irrep, spin::SU2Irrep}}
julia> I(U1Irrep(1), SU2Irrep(1//2))
NamedSector(; charge=Irrep[U₁](1), spin=Irrep[SU₂](1/2))Fusion Rules
NamedSector behaves identically to the underlying ProductSector: fusion, duality, and units act componentwise, and every piece of topological data is forwarded to the corresponding ProductSector of the same components. Concretely, NamedSector converts to ProductSector (via ProductSector(s)) and delegates ⊗, Nsymbol, dual, unit, and allunits. See the ProductSector page for the componentwise fusion rules.
Topological Data
Fsymbol, Rsymbol, Asymbol, Bsymbol, fusiontensor, and dim are all computed by forwarding to the underlying ProductSector. Likewise, FusionStyle, BraidingStyle, UnitStyle, and the scalar-type traits are inherited from the product of the components.
Iteration
values(I) for a NamedSector type I iterates the same Cartesian product as the corresponding ProductSector, wrapping each result back into the named type. Indexing and findindex use the same ordering.