fusionscalartype, braidingscalartype and dimscalartype#62
Merged
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Jutho
reviewed
Jan 31, 2026
|
|
||
| function fusiontensor(a::I, b::I, c::I) where {I <: AbelianIrrep} | ||
| return fill(Int(Nsymbol(a, b, c)), (1, 1, 1, 1)) | ||
| T = sectorscalartype(I) |
Member
There was a problem hiding this comment.
Not that it matters, but from the perspective that the Fsymbols can be determined by contracting fusiontensors, I think it makes sense that fusiontensors have fusionscalartype as scalar type.
Member
There was a problem hiding this comment.
But in the cases where fusiontensor exists, it also determines the Rsybmol, so I can also see the sectorscalartype motivation.
Jutho
reviewed
Jan 31, 2026
| In particular, this is the scalar type of [`dim`](@ref). | ||
| """ | ||
| @assume_effects :foldable dimscalartype(::Type{I}) where {I <: Sector} = | ||
| FusionStyle(I) isa UniqueFusion ? Int : typeof(dim(first(allunits(I)))) |
Member
There was a problem hiding this comment.
I think we could add:
Suggested change
| FusionStyle(I) isa UniqueFusion ? Int : typeof(dim(first(allunits(I)))) | |
| (FusionStyle(I) isa UniqueFusion || I isa Irrep) ? Int : typeof(dim(first(allunits(I)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds various utility functions to obtain the scalar types of some of the interface functions.
In particular:
fusionscalartype<->scalartype(Fsymbol)braidingscalartype<->scalartype(Rsymbol)dimscalartype<->scalartype(dim)This is useful for keeping tensors with
Realscalartypes in planar contexts, and for determining the correct output type of things likerankandcondof anyonic tensors.I additionally rewrote the implementations to no longer depend on type inference for automatically determining these scalartypes, and rather use
:foldableannotations and running actual code.Overall I think this is slightly cleaner, and while I don't really know what the overall impact is of this, I would argue it is nicer to no longer have to depend on
Core.CompilerorBase.promote_op, since that seems to be heavily discouraged anyways.If this ever shows up as a performance issue, we can always add specializations or re-evaluate.
I also removed some
@pureannotations, since we require at least Julia 1.10 anyways.