From 494b22e8d1439efdf3d5131d5d4b6dc279bbcc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Wed, 2 Oct 2024 18:01:07 +0200 Subject: [PATCH] Hotpatch `free_associative_algebra_type` --- src/OscarPatches.jl | 8 ++++++++ src/SmashProductLie.jl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/OscarPatches.jl b/src/OscarPatches.jl index 94c1d01..a5f0a60 100644 --- a/src/OscarPatches.jl +++ b/src/OscarPatches.jl @@ -19,3 +19,11 @@ end function tensor_power_obj(V::LieAlgebraModule, k::Int) return tensor_power(V, k)[1] end + +if !isdefined(Oscar, :free_associative_algebra_type) + free_associative_algebra_type(::Type{T}) where T<:RingElement = Generic.FreeAssociativeAlgebra{T} + + free_associative_algebra_type(::Type{S}) where S<:Ring = free_associative_algebra_type(elem_type(S)) + free_associative_algebra_type(x) = free_associative_algebra_type(typeof(x)) # to stop this method from eternally recursing on itself, we better add ... + free_associative_algebra_type(::Type{T}) where T = throw(ArgumentError("Type `$T` must be subtype of `RingElement`.")) +end diff --git a/src/SmashProductLie.jl b/src/SmashProductLie.jl index a3a32ee..35d94db 100644 --- a/src/SmashProductLie.jl +++ b/src/SmashProductLie.jl @@ -29,7 +29,7 @@ base_module(Sp::SmashProductLie{C, LieC, LieT}) where {C <: RingElem, LieC <: Fi underlying_algebra( Sp::SmashProductLie{C, LieC, LieT}, -) where {C <: RingElem, LieC <: FieldElem, LieT <: LieAlgebraElem{LieC}} = Sp.alg::Generic.FreeAssAlgebra{C} # TODO: add free_ass_algebra_type or something like that +) where {C <: RingElem, LieC <: FieldElem, LieT <: LieAlgebraElem{LieC}} = Sp.alg::free_associative_algebra_type(C) ngens(Sp::SmashProductLie) = ngens(underlying_algebra(Sp)) function ngens(Sp::SmashProductLie, part::Symbol)