From 5b69bca39695c3b61de2395c4d59d2ea5c4fd06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 16 Feb 2024 15:14:14 +0100 Subject: [PATCH] the same for similar functions --- experimental/LieAlgebras/docs/src/modules.md | 11 --- .../LieAlgebras/src/LieAlgebraModule.jl | 88 +++++++++---------- .../LieAlgebras/src/LieAlgebraModuleHom.jl | 36 ++++---- experimental/LieAlgebras/src/LieAlgebras.jl | 20 ++--- .../LieAlgebras/test/LieAlgebraModule-test.jl | 30 +++---- src/Modules/UngradedModules/Methods.jl | 6 +- 6 files changed, 87 insertions(+), 104 deletions(-) diff --git a/experimental/LieAlgebras/docs/src/modules.md b/experimental/LieAlgebras/docs/src/modules.md index 21a1f4731660..1c0dc6ecf63b 100644 --- a/experimental/LieAlgebras/docs/src/modules.md +++ b/experimental/LieAlgebras/docs/src/modules.md @@ -63,14 +63,3 @@ tensor_power(::LieAlgebraModule{C}, ::Int) where {C<:FieldElem} abstract_module(::LieAlgebra{C}, ::Int, ::Vector{<:MatElem{C}}, ::Vector{<:VarName}; ::Bool) where {C<:FieldElem} abstract_module(::LieAlgebra{C}, ::Int, ::Matrix{SRow{C}}, ::Vector{<:VarName}; ::Bool) where {C<:FieldElem} ``` - -# Type-dependent getters - -```@docs -is_standard_module(::LieAlgebraModule) -is_dual(::LieAlgebraModule) -is_direct_sum(::LieAlgebraModule) -is_tensor_product(::LieAlgebraModule) -is_symmetric_power(::LieAlgebraModule) -is_tensor_power(::LieAlgebraModule) -``` diff --git a/experimental/LieAlgebras/src/LieAlgebraModule.jl b/experimental/LieAlgebras/src/LieAlgebraModule.jl index 3569e873e82b..9d03f57ad385 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModule.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModule.jl @@ -155,12 +155,12 @@ function Base.show(io::IO, ::MIME"text/plain", V::LieAlgebraModule) io = pretty(io) println(io, _module_type_to_string(V)) println(io, Indent(), "of dimension $(dim(V))") - if is_dual(V)[1] || - is_direct_sum(V)[1] || - is_tensor_product(V)[1] || + if _is_dual(V)[1] || + _is_direct_sum(V)[1] || + _is_tensor_product(V)[1] || _is_exterior_power(V)[1] || - is_symmetric_power(V)[1] || - is_tensor_power(V)[1] + _is_symmetric_power(V)[1] || + _is_tensor_power(V)[1] _show_inner(io, V) end print(io, Dedent()) @@ -169,21 +169,21 @@ function Base.show(io::IO, ::MIME"text/plain", V::LieAlgebraModule) end function _show_inner(io::IO, V::LieAlgebraModule) - if is_standard_module(V) + if _is_standard_module(V) println(io, "standard module") - elseif ((fl, W) = is_dual(V); fl) + elseif ((fl, W) = _is_dual(V); fl) println(io, "dual of ", Lowercase()) print(io, Indent()) _show_inner(io, W) print(io, Dedent()) - elseif ((fl, Ws) = is_direct_sum(V); fl) + elseif ((fl, Ws) = _is_direct_sum(V); fl) println(io, "direct sum with direct summands") print(io, Indent()) for W in Ws _show_inner(io, W) end print(io, Dedent()) - elseif ((fl, Ws) = is_tensor_product(V); fl) + elseif ((fl, Ws) = _is_tensor_product(V); fl) println(io, "tensor product with tensor factors") print(io, Indent()) for W in Ws @@ -195,12 +195,12 @@ function _show_inner(io::IO, V::LieAlgebraModule) print(io, Indent()) _show_inner(io, W) print(io, Dedent()) - elseif ((fl, W, k) = is_symmetric_power(V); fl) + elseif ((fl, W, k) = _is_symmetric_power(V); fl) println(io, "$(ordinal_number_string(k)) symmetric power of") print(io, Indent()) _show_inner(io, W) print(io, Dedent()) - elseif ((fl, W, k) = is_tensor_power(V); fl) + elseif ((fl, W, k) = _is_tensor_power(V); fl) println(io, "$(ordinal_number_string(k)) tensor power of") print(io, Indent()) _show_inner(io, W) @@ -221,19 +221,19 @@ function Base.show(io::IO, V::LieAlgebraModule) end function _module_type_to_string(V::LieAlgebraModule) - if is_standard_module(V) + if _is_standard_module(V) return "Standard module" - elseif is_dual(V)[1] + elseif _is_dual(V)[1] return "Dual module" - elseif is_direct_sum(V)[1] + elseif _is_direct_sum(V)[1] return "Direct sum module" - elseif is_tensor_product(V)[1] + elseif _is_tensor_product(V)[1] return "Tensor product module" elseif _is_exterior_power(V)[1] return "Exterior power module" - elseif is_symmetric_power(V)[1] + elseif _is_symmetric_power(V)[1] return "Symmetric power module" - elseif is_tensor_power(V)[1] + elseif _is_tensor_power(V)[1] return "Tensor power module" else return "Abstract Lie algebra module" @@ -354,24 +354,24 @@ function (V::LieAlgebraModule{C})( ) where {C<:FieldElem} if length(a) == 1 && V === parent(a[1]) return a[1] - elseif ((fl, W) = is_dual(V); fl) + elseif ((fl, W) = _is_dual(V); fl) @req length(a) == 1 "Invalid input length." @req W === parent(v) "Incompatible modules." return V(coefficients(v)) - elseif ((fl, Vs) = is_direct_sum(V); fl) + elseif ((fl, Vs) = _is_direct_sum(V); fl) @req length(a) == length(Vs) "Invalid input length." @req all(i -> parent(a[i]) === Vs[i], 1:length(a)) "Incompatible modules." return sum(inji(ai) for (ai, inji) in zip(a, canonical_injections(V)); init=zero(V)) - elseif is_tensor_product(V)[1] + elseif _is_tensor_product(V)[1] pure = get_attribute(V, :tensor_pure_function) return pure(a)::elem_type(V) elseif _is_exterior_power(V)[1] pure = get_attribute(V, :wedge_pure_function) return pure(a)::elem_type(V) - elseif is_symmetric_power(V)[1] + elseif _is_symmetric_power(V)[1] pure = get_attribute(V, :mult_pure_function) return pure(a)::elem_type(V) - elseif is_tensor_power(V)[1] + elseif _is_tensor_power(V)[1] pure = get_attribute(V, :tensor_pure_function) return pure(a)::elem_type(V) else @@ -384,15 +384,15 @@ function (V::LieAlgebraModule{C})(a::LieAlgebraModuleElem{C}...) where {C<:Field end function _is_allowed_input_length(V::LieAlgebraModule, a::Int) - if ((fl, Vs) = is_direct_sum(V); fl) + if ((fl, Vs) = _is_direct_sum(V); fl) return a == length(Vs) - elseif ((fl, Vs) = is_tensor_product(V); fl) + elseif ((fl, Vs) = _is_tensor_product(V); fl) return a == length(Vs) elseif ((fl, W, k) = _is_exterior_power(V); fl) return a == k - elseif ((fl, W, k) = is_symmetric_power(V); fl) + elseif ((fl, W, k) = _is_symmetric_power(V); fl) return a == k - elseif ((fl, W, k) = is_tensor_power(V); fl) + elseif ((fl, W, k) = _is_tensor_power(V); fl) return a == k else throw(ArgumentError("Invalid input.")) @@ -518,11 +518,11 @@ end ############################################################################### @doc raw""" - is_standard_module(V::LieAlgebraModule{C}) -> Bool + _is_standard_module(V::LieAlgebraModule{C}) -> Bool Check whether `V` has been constructed as a standard module. """ -function is_standard_module(V::LieAlgebraModule) +function _is_standard_module(V::LieAlgebraModule) if has_attribute(V, :is_standard_module) @assert get_attribute(V, :is_standard_module)::Bool === true return true @@ -531,13 +531,13 @@ function is_standard_module(V::LieAlgebraModule) end @doc raw""" - is_dual(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C} + _is_dual(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C} Check whether `V` has been constructed as a dual module. If it has, return `true` and the base module. If not, return `false` as the first return value, and an arbitrary value for the second. """ -function is_dual(V::LieAlgebraModule) +function _is_dual(V::LieAlgebraModule) if has_attribute(V, :is_dual) W = get_attribute(V, :is_dual)::typeof(V) return (true, W) @@ -546,13 +546,13 @@ function is_dual(V::LieAlgebraModule) end @doc raw""" - is_direct_sum(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} + _is_direct_sum(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} Check whether `V` has been constructed as a direct sum of modules. If it has, return `true` and the summands. If not, return `false` as the first return value, and an empty vector for the second. """ -function is_direct_sum(V::LieAlgebraModule) +function _is_direct_sum(V::LieAlgebraModule) if has_attribute(V, :is_direct_sum) summands = get_attribute(V, :is_direct_sum)::Vector{typeof(V)} return (true, summands) @@ -561,13 +561,13 @@ function is_direct_sum(V::LieAlgebraModule) end @doc raw""" - is_tensor_product(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} + _is_tensor_product(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} Check whether `V` has been constructed as a tensor product of modules. If it has, return `true` and the tensor factors. If not, return `false` as the first return value, and an empty vector for the second. """ -function is_tensor_product(V::LieAlgebraModule) +function _is_tensor_product(V::LieAlgebraModule) if has_attribute(V, :is_tensor_product) factors = get_attribute(V, :is_tensor_product)::Vector{typeof(V)} return (true, factors) @@ -591,13 +591,13 @@ function _is_exterior_power(V::LieAlgebraModule) end @doc raw""" - is_symmetric_power(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int + _is_symmetric_power(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int Check whether `V` has been constructed as an symmetric power of a module. If it has, return `true`, the base module, and the power. If not, return `false` as the first return value, and arbitrary values for the other two. """ -function is_symmetric_power(V::LieAlgebraModule) +function _is_symmetric_power(V::LieAlgebraModule) if has_attribute(V, :is_symmetric_power) W, k = get_attribute(V, :is_symmetric_power)::Tuple{typeof(V),Int} return (true, W, k) @@ -606,13 +606,13 @@ function is_symmetric_power(V::LieAlgebraModule) end @doc raw""" - is_tensor_power(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int + _is_tensor_power(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int Check whether `V` has been constructed as a tensor power of a module. If it has, return `true`, the base module, and the power. If not, return `false` as the first return value, and arbitrary values for the other two. """ -function is_tensor_power(V::LieAlgebraModule) +function _is_tensor_power(V::LieAlgebraModule) if has_attribute(V, :is_tensor_power) W, k = get_attribute(V, :is_tensor_power)::Tuple{typeof(V),Int} return (true, W, k) @@ -797,7 +797,7 @@ function dual(V::LieAlgebraModule{C}; cached::Bool=true) where {C<:FieldElem} -transpose(transformation_matrix(V, i)) end - s = if is_standard_module(V) + s = if _is_standard_module(V) [Symbol("$(s)*") for s in symbols(V)] else [Symbol("($(s))*") for s in symbols(V)] @@ -855,7 +855,7 @@ function direct_sum(V::LieAlgebraModule{C}, Vs::LieAlgebraModule{C}...) where {C else [ Symbol("$s^($j)") for (j, Vj) in enumerate(Vs) for - s in (is_standard_module(Vj) ? symbols(Vj) : (x -> "($x)").(symbols(Vj))) + s in (_is_standard_module(Vj) ? symbols(Vj) : (x -> "($x)").(symbols(Vj))) ] end @@ -926,7 +926,7 @@ function tensor_product( Symbol(join(s, (is_unicode_allowed() ? "⊗" : "(x)"))) for s in reverse.( ProductIterator([ - is_standard_module(Vi) ? symbols(Vi) : (x -> "($x)").(symbols(Vi)) for + _is_standard_module(Vi) ? symbols(Vi) : (x -> "($x)").(symbols(Vi)) for Vi in reverse(Vs) ]) ) @@ -1049,7 +1049,7 @@ function exterior_power( [Symbol("1")] elseif k == 1 symbols(V) - elseif is_standard_module(V) + elseif _is_standard_module(V) [Symbol(join(s, (is_unicode_allowed() ? "∧" : "^"))) for s in combinations(symbols(V), k)] else [ @@ -1185,7 +1185,7 @@ function symmetric_power( [Symbol("1")] elseif k == 1 symbols(V) - elseif is_standard_module(V) + elseif _is_standard_module(V) [ Symbol( join( @@ -1336,7 +1336,7 @@ function tensor_power( [Symbol("1")] elseif k == 1 symbols(V) - elseif is_standard_module(V) + elseif _is_standard_module(V) [ Symbol(join(s, (is_unicode_allowed() ? "⊗" : "(x)"))) for s in reverse.(ProductIterator(symbols(V), k)) diff --git a/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl b/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl index fb6db01dbb91..f544f7a07fd2 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl @@ -360,7 +360,7 @@ Return the canonical injections from all components into $V$ where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_injections(V::LieAlgebraModule) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" return [canonical_injection(V, i) for i in 1:length(Vs)] end @@ -372,7 +372,7 @@ Return the canonical injection $V_i \to V$ where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_injection(V::LieAlgebraModule, i::Int) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" @req 1 <= i <= length(Vs) "Index out of bound" j = sum(dim(Vs[l]) for l in 1:(i - 1); init=0) @@ -387,7 +387,7 @@ Return the canonical projections from $V$ to all components where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_projections(V::LieAlgebraModule) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" return [canonical_projection(V, i) for i in 1:length(Vs)] end @@ -399,7 +399,7 @@ Return the canonical projection $V \to V_i$ where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_projection(V::LieAlgebraModule, i::Int) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" @req 1 <= i <= length(Vs) "Index out of bound" j = sum(dim(Vs[l]) for l in 1:(i - 1); init=0) @@ -430,9 +430,9 @@ If `hs` is a vector, then it is interpreted as a diagonal matrix. function hom_direct_sum( V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Matrix{<:LieAlgebraModuleHom} ) where {C<:FieldElem} - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "First module must be a direct sum" - fl, Ws = is_direct_sum(W) + fl, Ws = Oscar._is_direct_sum(W) @req fl "Second module must be a direct sum" @req length(Vs) == size(hs, 1) "Length mismatch" @req length(Ws) == size(hs, 2) "Length mismatch" @@ -456,9 +456,9 @@ end function hom_direct_sum( V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Vector{<:LieAlgebraModuleHom} ) where {C<:FieldElem} - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "First module must be a direct sum" - fl, Ws = is_direct_sum(W) + fl, Ws = Oscar._is_direct_sum(W) @req fl "Second module must be a direct sum" @req length(Vs) == length(Ws) == length(hs) "Length mismatch" @req all(i -> domain(hs[i]) === Vs[i] && codomain(hs[i]) === Ws[i], 1:length(hs)) "Domain/codomain mismatch" @@ -479,16 +479,16 @@ This works for $r$th tensor powers as well. function hom_tensor( V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Vector{<:LieAlgebraModuleHom} ) where {C<:FieldElem} # TODO: cleanup after refactoring tensor_product - if ((fl, Vs) = is_tensor_product(V); fl) + if ((fl, Vs) = _is_tensor_product(V); fl) # nothing to do - elseif ((fl, Vb, k) = is_tensor_power(V); fl) + elseif ((fl, Vb, k) = _is_tensor_power(V); fl) Vs = [Vb for _ in 1:k] else throw(ArgumentError("First module must be a tensor product or power")) end - if ((fl, Ws) = is_tensor_product(W); fl) + if ((fl, Ws) = _is_tensor_product(W); fl) # nothing to do - elseif ((fl, Wb, k) = is_tensor_power(W); fl) + elseif ((fl, Wb, k) = _is_tensor_power(W); fl) Ws = [Wb for _ in 1:k] else throw(ArgumentError("Second module must be a tensor product or power")) @@ -517,9 +517,9 @@ function hom( ) where {C<:FieldElem} if _is_exterior_power(V)[1] return induced_map_on_exterior_power(h; domain=V, codomain=W) - elseif is_symmetric_power(V)[1] + elseif _is_symmetric_power(V)[1] return induced_map_on_symmetric_power(h; domain=V, codomain=W) - elseif is_tensor_power(V)[1] + elseif _is_tensor_power(V)[1] return induced_map_on_tensor_power(h; domain=V, codomain=W) else throw(ArgumentError("First module must be a power module")) @@ -569,8 +569,8 @@ function induced_map_on_symmetric_power( domain::LieAlgebraModule{C}=symmetric_power(Oscar.domain(phi), p)[1], codomain::LieAlgebraModule{C}=symmetric_power(Oscar.codomain(phi), p)[1], ) where {C<:FieldElem} - (domain_fl, domain_base, domain_k) = is_symmetric_power(domain) - (codomain_fl, codomain_base, codomain_k) = is_symmetric_power(codomain) + (domain_fl, domain_base, domain_k) = _is_symmetric_power(domain) + (codomain_fl, codomain_base, codomain_k) = _is_symmetric_power(codomain) @req domain_fl "Domain must be an symmetric power" @req codomain_fl "Codomain must be an symmetric power" @req domain_k == codomain_k "Exponent mismatch" @@ -585,8 +585,8 @@ function induced_map_on_tensor_power( domain::LieAlgebraModule{C}=tensor_power(Oscar.domain(phi), p)[1], codomain::LieAlgebraModule{C}=tensor_power(Oscar.codomain(phi), p)[1], ) where {C<:FieldElem} - (domain_fl, domain_base, domain_k) = is_tensor_power(domain) - (codomain_fl, codomain_base, codomain_k) = is_tensor_power(codomain) + (domain_fl, domain_base, domain_k) = _is_tensor_power(domain) + (codomain_fl, codomain_base, codomain_k) = _is_tensor_power(codomain) @req domain_fl "Domain must be an tensor power" @req codomain_fl "Codomain must be an tensor power" @req domain_k == codomain_k "Exponent mismatch" diff --git a/experimental/LieAlgebras/src/LieAlgebras.jl b/experimental/LieAlgebras/src/LieAlgebras.jl index 790e693a9f63..f352993bc948 100644 --- a/experimental/LieAlgebras/src/LieAlgebras.jl +++ b/experimental/LieAlgebras/src/LieAlgebras.jl @@ -16,6 +16,7 @@ using AbstractAlgebra.PrettyPrinting # functions with new methods import ..Oscar: _is_exterior_power, + _is_tensor_product, _iso_oscar_gap, action, basis_matrix, @@ -57,7 +58,6 @@ import ..Oscar: is_perfect, is_simple, is_solvable, - is_tensor_product, is_welldefined, kernel, lower_central_series, @@ -99,7 +99,13 @@ export WeightLatticeElem export WeylGroup, WeylGroupElem export WeylOrbitIterator +export _is_direct_sum +export _is_dual export _is_exterior_power +export _is_standard_module +export _is_symmetric_power +export _is_tensor_power +export _is_tensor_product export abelian_lie_algebra export abstract_module export base_lie_algebra @@ -132,9 +138,7 @@ export induced_map_on_tensor_power export is_cartan_matrix export is_cartan_type export is_coroot_with_index -export is_direct_sum export is_dominant -export is_dual export is_negative_coroot_with_index export is_negative_root_with_index export is_positive_coroot_with_index @@ -143,10 +147,6 @@ export is_root_with_index export is_self_normalizing export is_simple_coroot_with_index export is_simple_root_with_index -export is_standard_module -export is_symmetric_power -export is_tensor_power -export is_tensor_product export lie_algebra export lmul, lmul! export longest_element @@ -257,9 +257,7 @@ export induced_map_on_tensor_power export is_cartan_matrix export is_cartan_type export is_coroot_with_index -export is_direct_sum export is_dominant -export is_dual export is_negative_coroot_with_index export is_negative_root_with_index export is_positive_coroot_with_index @@ -268,10 +266,6 @@ export is_root_with_index export is_self_normalizing export is_simple_coroot_with_index export is_simple_root_with_index -export is_standard_module -export is_symmetric_power -export is_tensor_power -export is_tensor_product export lie_algebra export lmul, lmul! export longest_element diff --git a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl index 32afd3370105..f981f7e40a50 100644 --- a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl +++ b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl @@ -181,13 +181,13 @@ end module_type_bools(V) = ( - is_standard_module(V), - is_dual(V)[1], - is_direct_sum(V)[1], - is_tensor_product(V)[1], + Oscar._is_standard_module(V), + Oscar._is_dual(V)[1], + Oscar._is_direct_sum(V)[1], + Oscar._is_tensor_product(V)[1], Oscar._is_exterior_power(V)[1], - is_symmetric_power(V)[1], - is_tensor_power(V)[1], + Oscar._is_symmetric_power(V)[1], + Oscar._is_tensor_power(V)[1], ) @testset "module constructions" begin @@ -215,7 +215,7 @@ @test dual_V === dual(V) @test dual_V !== dual(V; cached=false) @test type_V == module_type_bools(V) # construction of dual_V should not change type of V - @test is_dual(dual_V) === (true, V) + @test Oscar._is_dual(dual_V) === (true, V) @test dim(dual_V) == dim(V) @test length(repr(dual_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -241,8 +241,8 @@ @test_broken ds_V === direct_sum([V for _ in 1:k]...) @test_broken ds_V !== direct_sum([V for _ in 1:k]...; cached=false) @test type_V == module_type_bools(V) # construction of ds_V should not change type of V - @test is_direct_sum(ds_V) == (true, [V for _ in 1:k]) - @test all(x -> x[1] === x[2], zip(is_direct_sum(ds_V)[2], [V for _ in 1:k])) + @test Oscar._is_direct_sum(ds_V) == (true, [V for _ in 1:k]) + @test all(x -> x[1] === x[2], zip(Oscar._is_direct_sum(ds_V)[2], [V for _ in 1:k])) @test dim(ds_V) == k * dim(V) @test length(repr(ds_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -262,7 +262,7 @@ ds_V = direct_sum(V1, V2) @test type_V1 == module_type_bools(V1) # construction of ds_V should not change type of V1 @test type_V2 == module_type_bools(V2) # construction of ds_V should not change type of V2 - @test is_direct_sum(ds_V) == (true, [V1, V2]) + @test Oscar._is_direct_sum(ds_V) == (true, [V1, V2]) @test dim(ds_V) == dim(V1) + dim(V2) @test length(repr(ds_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -282,8 +282,8 @@ @test_broken tp_V === tensor_product([V for _ in 1:k]...) @test_broken tp_V !== tensor_product([V for _ in 1:k]...; cached=false) @test type_V == module_type_bools(V) # construction of tp_V should not change type of V - @test is_tensor_product(tp_V) == (true, [V for _ in 1:k]) - @test all(x -> x[1] === x[2], zip(is_tensor_product(tp_V)[2], [V for _ in 1:k])) + @test Oscar._is_tensor_product(tp_V) == (true, [V for _ in 1:k]) + @test all(x -> x[1] === x[2], zip(Oscar._is_tensor_product(tp_V)[2], [V for _ in 1:k])) @test dim(tp_V) == dim(V)^k @test length(repr(tp_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -305,7 +305,7 @@ tp_V = tensor_product(V1, V2) @test type_V1 == module_type_bools(V1) # construction of tp_V should not change type of V1 @test type_V2 == module_type_bools(V2) # construction of tp_V should not change type of V2 - @test is_tensor_product(tp_V) == (true, [V1, V2]) + @test Oscar._is_tensor_product(tp_V) == (true, [V1, V2]) @test dim(tp_V) == dim(V1) * dim(V2) @test length(repr(tp_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -386,7 +386,7 @@ @test S === symmetric_power(V, k)[1] @test S !== symmetric_power(V, k; cached=false)[1] @test type_V == module_type_bools(V) # construction of S should not change type of V - @test is_symmetric_power(S) === (true, V, k) + @test Oscar._is_symmetric_power(S) === (true, V, k) @test dim(S) == binomial(dim(V) + k - 1, k) @test length(repr(S)) < 10^4 # outputs tend to be excessively long due to recursion @@ -441,7 +441,7 @@ @test T === tensor_power(V, k)[1] @test T !== tensor_power(V, k; cached=false)[1] @test type_V == module_type_bools(V) # construction of T should not change type of V - @test is_tensor_power(T) === (true, V, k) + @test Oscar._is_tensor_power(T) === (true, V, k) @test dim(T) == dim(V)^k @test length(repr(T)) < 10^4 # outputs tend to be excessively long due to recursion diff --git a/src/Modules/UngradedModules/Methods.jl b/src/Modules/UngradedModules/Methods.jl index 48bbdd6ee98a..d0250dc6e6eb 100644 --- a/src/Modules/UngradedModules/Methods.jl +++ b/src/Modules/UngradedModules/Methods.jl @@ -791,19 +791,19 @@ function Base.:*(k::Int, f::ModuleFPHom) return base_ring(codomain(f))(k)*f end -function is_tensor_product(M::ModuleFP) +function _is_tensor_product(M::ModuleFP) !has_attribute(M, :tensor_product) && return false, [M] return true, get_attribute(M, :tensor_product)::Tuple end function tensor_pure_function(M::ModuleFP) - success, facs = is_tensor_product(M) + success, facs = _is_tensor_product(M) success || error("not a tensor product") return get_attribute(M, :tensor_pure_function) end function tensor_generator_decompose_function(M::ModuleFP) - success, facs = is_tensor_product(M) + success, facs = _is_tensor_product(M) success || error("not a tensor product") return get_attribute(M, :tensor_generator_decompose_function) end