From 44a38d19d0da410f5202f35c4720991556abda09 Mon Sep 17 00:00:00 2001 From: Martin Wagner Date: Tue, 17 Sep 2024 22:29:20 +0200 Subject: [PATCH] add `number_of_generators` for `UniversalPolyRing` --- docs/src/univpolynomial.md | 6 ++++++ src/generic/UnivPoly.jl | 2 ++ 2 files changed, 8 insertions(+) diff --git a/docs/src/univpolynomial.md b/docs/src/univpolynomial.md index 34180b95b2..4b26d4d8bf 100644 --- a/docs/src/univpolynomial.md +++ b/docs/src/univpolynomial.md @@ -73,8 +73,14 @@ Universal Polynomial Ring over Integers julia> x = gen(S, "x") x +julia> number_of_generators(S) +1 + julia> y, z = gens(S, ["y", "z"]) (y, z) + +julia> number_of_generators(S) +3 ``` ## Universal polynomial functionality diff --git a/src/generic/UnivPoly.jl b/src/generic/UnivPoly.jl index 7aa884d6ec..9689034423 100644 --- a/src/generic/UnivPoly.jl +++ b/src/generic/UnivPoly.jl @@ -36,6 +36,8 @@ end number_of_variables(S::UniversalPolyRing) = length(S.S) +number_of_generators(S::UniversalPolyRing) = length(S.S) + symbols(S::UniversalPolyRing) = S.S function vars(p::UnivPoly{T}) where {T}