From d9cd48621cb54a212ec74bd8fdc955ed89be9662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Gauth=C3=A9?= Date: Tue, 17 Sep 2024 15:38:15 -0400 Subject: [PATCH] avoid mixing fusion_rule and fuse_blocklengths interfaces --- .../src/lib/Sectors/src/abstractcategory.jl | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/NDTensors/src/lib/Sectors/src/abstractcategory.jl b/NDTensors/src/lib/Sectors/src/abstractcategory.jl index 51311ab201..e05a97d056 100644 --- a/NDTensors/src/lib/Sectors/src/abstractcategory.jl +++ b/NDTensors/src/lib/Sectors/src/abstractcategory.jl @@ -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 ) @@ -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