Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f880019
`MultiFusionStyle` and its properties with itself and `FusionStyle`
borisdevos Sep 10, 2025
51740bc
`allones` for `Type{Sector}`
borisdevos Sep 10, 2025
6b13d0c
changes to `IsingBimodule`
borisdevos Sep 10, 2025
9d2821f
export them all
borisdevos Sep 10, 2025
2f7e183
`allones` tests
borisdevos Sep 10, 2025
ef985d7
fix `&` and make commutative for mixed case
borisdevos Sep 10, 2025
20f98b6
`MultiFusionStyle` tests
borisdevos Sep 10, 2025
7a3fb13
format
borisdevos Sep 10, 2025
7eca2d2
update `MultiFusionStyle` to only reflect the semisimplicity of the unit
borisdevos Sep 11, 2025
ce0d87b
update for `IsingBimodule`
borisdevos Sep 11, 2025
1b0aa9a
fix exports
borisdevos Sep 11, 2025
46a6ce5
fix tests
borisdevos Sep 11, 2025
1cd98d7
fix docstrings
borisdevos Sep 11, 2025
97fb36b
add `MultiFusionStyle` for product sectors + test
borisdevos Sep 16, 2025
d03cc5d
remove interplay `MultiFusionStyle`-`FusionStyle` + related tests
borisdevos Sep 16, 2025
ed31fd2
fix domain error of one of IsingBimodule
borisdevos Sep 16, 2025
0a215fd
introduce `allones` for all sectors
borisdevos Sep 16, 2025
08648f0
introduce generic `one` for type sector + remove for specific sectors
borisdevos Sep 16, 2025
b28941c
`allones` for productsector with tests
borisdevos Sep 16, 2025
5a313ef
have multifusionstyle fully depend on `allones`
borisdevos Sep 16, 2025
ccb4313
format
borisdevos Sep 16, 2025
5c5647f
change `one` to `unit` and have `Base.one` fall back to `unit` + rena…
borisdevos Sep 16, 2025
684d810
rename `MultiFusionStyle` to `UnitStyle`
borisdevos Sep 16, 2025
d6188d6
replace `Base.conj` with `dual` and have `dual` fall back to `Base.c…
borisdevos Sep 16, 2025
700cb1c
replacing more `conj` with `dual` + docstring changes
borisdevos Sep 16, 2025
182cb70
minor docstring fix
borisdevos Sep 16, 2025
4ac1073
more one to unit changes
borisdevos Sep 16, 2025
0658c5f
fix `allunits` of product sector to be type stable and return set
borisdevos Sep 16, 2025
77b6a5f
`allunits` for `NewSU2Irrep`
borisdevos Sep 16, 2025
23dc373
add imports for `NewSU2Irrep`
borisdevos Sep 16, 2025
78a888c
`allunits` for `TimeReversed`
borisdevos Sep 16, 2025
c6bcf98
remove some specific `unit`s I missed
borisdevos Sep 16, 2025
2401c7f
apply code suggestions
borisdevos Sep 22, 2025
a69806f
reverse roles of `unit` and `allunits` to make `unit` the entry point…
borisdevos Sep 22, 2025
f00d2c8
more `mapreduce`s
borisdevos Sep 22, 2025
35ae0d4
another `mapreduce` + format
borisdevos Sep 22, 2025
2ced6ff
use `SectorSet` for time reversed `allunits`
borisdevos Sep 22, 2025
7dd58d8
remove `_isreal` code
borisdevos Sep 22, 2025
3fd2d0c
derive `unit` from `one` for `GroupElement`
borisdevos Sep 23, 2025
c5fa94a
avoid string interpolations in error messages
borisdevos Sep 23, 2025
6eb8d8a
reduce specification
borisdevos Sep 23, 2025
6fb637a
make otimes output of time reversed a `SectorSet`
borisdevos Sep 23, 2025
2326b67
introduce `isunit` and change `isone` to `isunit` where relevant
borisdevos Sep 23, 2025
83e4313
bump version to 0.3.0
borisdevos Sep 23, 2025
4662db2
one last `isunit`
borisdevos Sep 23, 2025
02a8cab
change fib field name to `isunit`
borisdevos Sep 23, 2025
955f42f
`unit(::Type{<:AbstractGroupElement})`
lkdvos Sep 24, 2025
88e5025
noinline domainerror
lkdvos Sep 24, 2025
881cbe7
also update precompile
lkdvos Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/TensorKitSectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export dim, sqrtdim, invsqrtdim, frobeniusschur, twist, fusiontensor, dual
export otimes, deligneproduct, times
export FusionStyle, UniqueFusion, MultipleFusion, SimpleFusion, GenericFusion,
MultiplicityFreeFusion
export MultiFusionStyle, UniqueMultiFusion, SimpleMultiFusion, GenericMultiFusion,
MultiplicityFreeMultiFusion
export BraidingStyle, NoBraiding, HasBraiding, SymmetricBraiding, Bosonic, Fermionic, Anyonic
export SectorSet, SectorValues, findindex
export rightone, leftone
export rightone, leftone, allones

export triangle_equation, pentagon_equation, hexagon_equation

Expand Down
4 changes: 3 additions & 1 deletion src/multifusion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function Base.convert(::Type{IsingAnyon}, a::IsingBimodule) # identify RepZ2 ⊕
return IsingAnyon(a.label == 0 ? :I : :ψ)
end

FusionStyle(::Type{IsingBimodule}) = SimpleFusion() # no multiplicities
MultiFusionStyle(::Type{IsingBimodule}) = SimpleMultiFusion() # no multiplicities
BraidingStyle(::Type{IsingBimodule}) = NoBraiding() # because of module categories

function Nsymbol(a::IsingBimodule, b::IsingBimodule, c::IsingBimodule)
Expand Down Expand Up @@ -91,6 +91,8 @@ function Base.one(::Type{IsingBimodule})
throw(ArgumentError("one of Type IsingBimodule doesn't exist"))
end

allones(::Type{IsingBimodule}) = (IsingBimodule(1, 1, 0), IsingBimodule(2, 2, 0))

function Base.isless(a::IsingBimodule, b::IsingBimodule)
return isless((a.col, a.row, a.label), (b.col, b.row, b.label))
end
Expand Down
57 changes: 57 additions & 0 deletions src/sectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ See also [`leftone`](@ref) and [`Base.one`](@ref).
"""
rightone(a::Sector) = one(a)

"""
allones(I::Type{<:Sector}) -> Tuple{I}

Return a tuple with all unit elements of the sector type `I`.
For fusion categories, this will contain only one element.
"""
allones(I::Type{<:Sector}) = (one(I),)
Comment thread
borisdevos marked this conversation as resolved.
Outdated

"""
dual(a::Sector) -> Sector

Expand Down Expand Up @@ -220,6 +228,55 @@ Base.:&(::SimpleFusion, ::UniqueFusion) = SimpleFusion()
Base.:&(::GenericFusion, ::UniqueFusion) = GenericFusion()
Base.:&(::GenericFusion, ::SimpleFusion) = GenericFusion()

# similar, but for multifusion categories
"""
MultiFusionStyle(::Sector)
MultiFusionStyle(I::Type{<:Sector})

Trait to describe the fusion behavior of multifusion sectors of type `I`,
which is based on the most general fusion behavior of the subcategories in
the multifusion category. For all allowed fusions, the following types are possible:
* `UniqueMultiFusion()`: single fusion output;
* `SimpleMultiFusion()`: multiple outputs, but every output occurs at most once;
* `GenericMultiFusion()`: multiple outputs that can occur more than once.

There is a type alias `MultiplicityFreeMultiFusion`
for those fusion types which do not require muliplicity labels, i.e.
`MultiplicityFreeMultiFusion = Union{UniqueMultiFusion,SimpleMultiFusion}`.
"""
abstract type MultiFusionStyle end
MultiFusionStyle(a::Sector) = MultiFusionStyle(typeof(a))

struct UniqueMultiFusion <: MultiFusionStyle end
struct SimpleMultiFusion <: MultiFusionStyle end
struct GenericMultiFusion <: MultiFusionStyle end
const MultiplicityFreeMultiFusion = Union{UniqueMultiFusion, SimpleMultiFusion}

# combine fusion properties of tensor products of multifusion sectors
Comment thread
borisdevos marked this conversation as resolved.
Base.:&(f::F, ::F) where {F <: MultiFusionStyle} = f
Base.:&(f₁::MultiFusionStyle, f₂::MultiFusionStyle) = f₂ & f₁

Base.:&(::SimpleMultiFusion, ::UniqueMultiFusion) = SimpleMultiFusion()
Base.:&(::GenericMultiFusion, ::UniqueMultiFusion) = GenericMultiFusion()
Base.:&(::GenericMultiFusion, ::SimpleMultiFusion) = GenericMultiFusion()

# combine fusion properties of tensor products between fusion and multifusion sectors
# lift FusionStyle to MultiFusionStyle

Base.:&(g::G, f::F) where {F <: MultiFusionStyle, G <: FusionStyle} = f & g

function Base.:&(f::F, g::G) where {F <: MultiFusionStyle, G <: FusionStyle}
if f isa GenericMultiFusion || g isa GenericFusion
return GenericMultiFusion()
elseif f isa SimpleMultiFusion # g isa MultiplicityFreeFusion
return SimpleMultiFusion()
elseif g isa SimpleFusion # f isa UniqueMultiFusion
return SimpleMultiFusion()
else
return UniqueMultiFusion()
end
end

"""
Fsymbol(a::I, b::I, c::I, d::I, e::I, f::I) where {I<:Sector}

Expand Down
7 changes: 7 additions & 0 deletions test/multifusion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Istr = TensorKitSectors.type_repr(I)
@testset "Basic type properties" begin
@test eval(Meta.parse(sprint(show, I))) == I
@test eval(Meta.parse(TensorKitSectors.type_repr(I))) == I

@test MultiFusionStyle(I) isa MultiplicityFreeMultiFusion
@test MultiFusionStyle(I) & GenericFusion() isa GenericMultiFusion
@test MultiFusionStyle(I) & SimpleFusion() == SimpleFusion() & MultiFusionStyle(I)
end

M = IsingBimodule(1, 2, 0)
Expand All @@ -27,6 +31,9 @@ Istr = TensorKitSectors.type_repr(I)
@test isone(D0)
@test !isone(C1) && !isone(D1) && !isone(M) && !isone(Mop)

@test length(allones(I)) == 2
@test allones(I) == (C0, D0)

@test eval(Meta.parse(sprint(show, s))) == s
@test @constinferred(hash(s)) == hash(deepcopy(s))
@constinferred dual(s)
Expand Down
1 change: 1 addition & 0 deletions test/sectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ end
i >= 10 && break
end
@test one(I) == first(values(I))
@test length(allones(I)) == 1
@test (@constinferred findindex(values(I), one(I))) == 1
for s in smallset(I)
@test (@constinferred values(I)[findindex(values(I), s)]) == s
Expand Down
Loading