Skip to content

Commit

Permalink
avoid mixing fusion_rule and fuse_blocklengths interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ogauthe committed Sep 17, 2024
1 parent fbf0734 commit d9cd486
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions NDTensors/src/lib/Sectors/src/abstractcategory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,6 @@ function fusion_rule(::AbelianGroup, c1::C, c2::C) where {C<:AbstractCategory}
return C(label_fusion_rule(C, category_label(c1), category_label(c2)))
end

function fusion_rule(
::SymmetryStyle, l1::LabelledNumbers.LabelledInteger, l2::LabelledNumbers.LabelledInteger
)
fused = LabelledNumbers.label(l1) LabelledNumbers.label(l2)
v =
LabelledNumbers.labelled.(
l1 * l2 .* BlockArrays.blocklengths(fused), GradedAxes.blocklabels(fused)
)
return GradedAxes.gradedrange(v)
end

function fusion_rule(
::AbelianGroup, l1::LabelledNumbers.LabelledInteger, l2::LabelledNumbers.LabelledInteger
)
fused = LabelledNumbers.label(l1) LabelledNumbers.label(l2)
return LabelledNumbers.labelled(l1 * l2, fused)
end

function fusion_rule(
::EmptyCategory, l1::LabelledNumbers.LabelledInteger, l2::LabelledNumbers.LabelledInteger
)
Expand All @@ -95,7 +77,31 @@ function GradedAxes.fuse_blocklengths(
l1::LabelledNumbers.LabelledInteger{<:Integer,<:Sectors.AbstractCategory},
l2::LabelledNumbers.LabelledInteger{<:Integer,<:Sectors.AbstractCategory},
)
return fusion_rule(l1, l2)
return GradedAxes.fuse_blocklengths(
combine_styles(SymmetryStyle(l1), SymmetryStyle(l2)), l1, l2
)
end

function GradedAxes.fuse_blocklengths(
::SymmetryStyle,
l1::LabelledNumbers.LabelledInteger{<:Integer,<:Sectors.AbstractCategory},
l2::LabelledNumbers.LabelledInteger{<:Integer,<:Sectors.AbstractCategory},
)
fused = LabelledNumbers.label(l1) LabelledNumbers.label(l2)
v =
LabelledNumbers.labelled.(
l1 * l2 .* BlockArrays.blocklengths(fused), GradedAxes.blocklabels(fused)
)
return GradedAxes.gradedrange(v)
end

function GradedAxes.fuse_blocklengths(
::AbelianGroup,
l1::LabelledNumbers.LabelledInteger{<:Integer,<:Sectors.AbstractCategory},
l2::LabelledNumbers.LabelledInteger{<:Integer,<:Sectors.AbstractCategory},
)
fused = LabelledNumbers.label(l1) LabelledNumbers.label(l2)
return LabelledNumbers.labelled(l1 * l2, fused)
end

# cast to range
Expand Down

0 comments on commit d9cd486

Please sign in to comment.