From 77ef3077e567a17f96581f12c66ee2ba8c6ac134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Gauth=C3=A9?= Date: Wed, 2 Oct 2024 12:58:59 -0400 Subject: [PATCH] split shared and diff category --- NDTensors/src/lib/Sectors/src/category_product.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NDTensors/src/lib/Sectors/src/category_product.jl b/NDTensors/src/lib/Sectors/src/category_product.jl index 2ccc388364..55bbdebec6 100644 --- a/NDTensors/src/lib/Sectors/src/category_product.jl +++ b/NDTensors/src/lib/Sectors/src/category_product.jl @@ -74,12 +74,16 @@ categories_isless(::Tuple, ::NamedTuple) = throw(ArgumentError("Not implemented" categories_type(::Type{<:CategoryProduct{T}}) where {T} = T function categories_fusion_rule(cats1, cats2) + shared_cat = shared_categories_fusion_rule(categories_common(cats1, cats2)...) diff_cat = CategoryProduct(categories_diff(cats1, cats2)) - shared1, shared2 = categories_common(cats1, cats2) + return shared_cat × diff_cat +end + +function shared_categories_fusion_rule(shared1, shared2) fused = map(fusion_rule, values(shared1), values(shared2)) factorized = factorize_gradedaxes(fused) type_fixed = recover_category_product_type(typeof(shared1), factorized) - return type_fixed × diff_cat + return type_fixed end # abelian case: there is no gradedaxis