From 7da15e0d640ff717deca0e1b45130bbfaa17e17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 27 Feb 2024 16:06:21 +0100 Subject: [PATCH] Rename `UniversalPolynomialRing` to `universal_polynomial_ring` --- docs/src/univpolynomial.md | 6 ++-- src/AbstractAlgebra.jl | 3 +- src/Deprecations.jl | 3 ++ src/UnivPoly.jl | 10 ------- src/generic/UnivPoly.jl | 8 +++--- test/generic/UnivPoly-test.jl | 52 +++++++++++++++++------------------ 6 files changed, 38 insertions(+), 44 deletions(-) diff --git a/docs/src/univpolynomial.md b/docs/src/univpolynomial.md index 518f271cd8..34180b95b2 100644 --- a/docs/src/univpolynomial.md +++ b/docs/src/univpolynomial.md @@ -42,7 +42,7 @@ The universal polynomial ring over a given base ring `R` is constructed with one of the following constructor functions. ```julia -UniversalPolynomialRing(R::Ring; cached::Bool = true, internal_ordering::Symbol=:lex) +universal_polynomial_ring(R::Ring; cached::Bool = true, internal_ordering::Symbol=:lex) ``` Given a base ring `R` and an array `S` of strings, return an object representing @@ -51,7 +51,7 @@ the universal polynomial ring $S = R[\ldots]$ with no variables in it initially. **Examples** ```jldoctest -julia> S = UniversalPolynomialRing(ZZ) +julia> S = universal_polynomial_ring(ZZ) Universal Polynomial Ring over Integers ``` @@ -67,7 +67,7 @@ gens(S::UniversalPolyRing, vars::Vector{VarName}) **Examples** ```jldoctest -julia> S = UniversalPolynomialRing(ZZ) +julia> S = universal_polynomial_ring(ZZ) Universal Polynomial Ring over Integers julia> x = gen(S, "x") diff --git a/src/AbstractAlgebra.jl b/src/AbstractAlgebra.jl index da5d59d619..2da86c1d3d 100644 --- a/src/AbstractAlgebra.jl +++ b/src/AbstractAlgebra.jl @@ -675,6 +675,7 @@ import .Generic: total_degree import .Generic: trailing_coefficient import .Generic: truncate import .Generic: unit +import .Generic: universal_polynomial_ring import .Generic: upscale import .Generic: weights import .Generic: zero @@ -1121,7 +1122,7 @@ export truncate export typed_hcat export typed_hvcat export unit -export UniversalPolynomialRing +export universal_polynomial_ring export upper_triangular_matrix export upscale export use_karamul diff --git a/src/Deprecations.jl b/src/Deprecations.jl index e69de29bb2..d9f705b582 100644 --- a/src/Deprecations.jl +++ b/src/Deprecations.jl @@ -0,0 +1,3 @@ +# deprecated during 0.40.* + +@deprecate UniversalPolynomialRing universal_polynomial_ring diff --git a/src/UnivPoly.jl b/src/UnivPoly.jl index a9dbdc3042..9b95ccacad 100644 --- a/src/UnivPoly.jl +++ b/src/UnivPoly.jl @@ -25,13 +25,3 @@ end function terms(a::UniversalPolyRingElem) return Generic.UnivPolyTerms(a) end - -############################################################################### -# -# UniversalPolynomialRing constructor -# -############################################################################### - -function UniversalPolynomialRing(R::Ring; internal_ordering=:lex, cached::Bool=true) - return Generic.UniversalPolynomialRing(R; internal_ordering=internal_ordering, cached=cached) -end diff --git a/src/generic/UnivPoly.jl b/src/generic/UnivPoly.jl index 927a279723..566337508a 100644 --- a/src/generic/UnivPoly.jl +++ b/src/generic/UnivPoly.jl @@ -904,8 +904,8 @@ end ################################################################################ function _change_univ_poly_ring(R, Rx, cached::Bool) - P, _ = AbstractAlgebra.polynomial_ring(R, map(string, symbols(Rx)), internal_ordering = internal_ordering(Rx), cached = cached) - S = AbstractAlgebra.UniversalPolynomialRing(R; internal_ordering=internal_ordering(Rx), cached=cached) + P, _ = polynomial_ring(R, map(string, symbols(Rx)), internal_ordering=internal_ordering(Rx), cached=cached) + S = universal_polynomial_ring(R; internal_ordering=internal_ordering(Rx), cached=cached) S.S = deepcopy(symbols(Rx)) S.mpoly_ring = P return S @@ -1116,11 +1116,11 @@ end ############################################################################### # -# UniversalPolynomialRing constructor +# UniversalPolyRing constructor # ############################################################################### -function UniversalPolynomialRing(R::Ring; internal_ordering=:lex, cached::Bool=true) +function universal_polynomial_ring(R::Ring; internal_ordering=:lex, cached::Bool=true) T = elem_type(R) U = Generic.MPoly{T} diff --git a/test/generic/UnivPoly-test.jl b/test/generic/UnivPoly-test.jl index ba5bb23868..7b0065f260 100644 --- a/test/generic/UnivPoly-test.jl +++ b/test/generic/UnivPoly-test.jl @@ -3,10 +3,10 @@ for iters = 1:5 ord = rand_ordering() - @test UniversalPolynomialRing(R; internal_ordering=ord, cached = true) === UniversalPolynomialRing(R; internal_ordering=ord, cached = true) - @test UniversalPolynomialRing(R; internal_ordering=ord, cached = false) !== UniversalPolynomialRing(R; internal_ordering=ord, cached = false) + @test universal_polynomial_ring(R; internal_ordering=ord, cached = true) === universal_polynomial_ring(R; internal_ordering=ord, cached = true) + @test universal_polynomial_ring(R; internal_ordering=ord, cached = false) !== universal_polynomial_ring(R; internal_ordering=ord, cached = false) - S = UniversalPolynomialRing(R; internal_ordering=ord) + S = universal_polynomial_ring(R; internal_ordering=ord) x = gen(S, "x") @test x == S[1] @@ -85,7 +85,7 @@ end for iters = 1:100 ord = rand_ordering() - S = UniversalPolynomialRing(R; internal_ordering=ord, cached=false) + S = universal_polynomial_ring(R; internal_ordering=ord, cached=false) @test symbols(S) == Symbol[] @test nvars(S) == 0 @@ -132,7 +132,7 @@ function test_elem(R::AbstractAlgebra.Generic.UniversalPolyRing{EuclideanRingRes end @testset "Generic.UnivPoly.conformance" begin - S = UniversalPolynomialRing(residue_ring(ZZ, ZZ(6))[1]) + S = universal_polynomial_ring(residue_ring(ZZ, ZZ(6))[1]) gen(S, "x") test_Ring_interface(S) end @@ -142,7 +142,7 @@ end for iters = 1:100 ord = rand_ordering() - S = UniversalPolynomialRing(R; internal_ordering=ord, cached=false) + S = universal_polynomial_ring(R; internal_ordering=ord, cached=false) x = gen(S, "x") y, z = gens(S, ["y", "z"]) @@ -202,7 +202,7 @@ end @testset "Generic.UnivPoly.basic_manipulation" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) @test iszero(zero(S)) @test isone(one(S)) @@ -317,7 +317,7 @@ end @testset "Generic.UnivPoly.multivariate_coefficients" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) x = gen(S, "x") y, z = gens(S, ["y", "z"]) @@ -346,7 +346,7 @@ end @testset "Generic.UnivPoly.unary_operations" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -371,7 +371,7 @@ end @testset "Generic.UnivPoly.binary_operations" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -397,7 +397,7 @@ end @testset "Generic.UnivPoly.iterators" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) x = gen(S, "x") @@ -426,7 +426,7 @@ end @testset "Generic.UnivPoly.square_root" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) x = gen(S, "x") @@ -448,7 +448,7 @@ end @testset "Generic.UnivPoly.adhoc_binary_operations" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -504,7 +504,7 @@ end @testset "Generic.UnivPoly.comparison" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -544,7 +544,7 @@ end @testset "Generic.UnivPoly.adhoc_comparison" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -595,7 +595,7 @@ end @testset "Generic.UnivPoly.powering" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -623,7 +623,7 @@ end @testset "Generic.UnivPoly.inflation_deflation" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -668,7 +668,7 @@ end @testset "Generic.UnivPoly.exact_division" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -727,7 +727,7 @@ end @testset "Generic.UnivPoly.euclidean_division" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -780,7 +780,7 @@ end @testset "Generic.UnivPoly.derivative" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) x = gen(S, "x") y, z = gens(S, ["y", "z"]) @@ -809,7 +809,7 @@ end @testset "Generic.UnivPoly.remove_valuation" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -913,7 +913,7 @@ end @testset "Generic.UnivPoly.evaluation" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -973,7 +973,7 @@ end @testset "Generic.UnivPoly.gcd" begin for R in [ZZ, QQ] for iters = 1:100 - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) f = rand(S, 0:5, 0:10, -10:10) x = gen(S, "x") @@ -1008,7 +1008,7 @@ end @testset "Generic.UnivPoly.univariate_polynomials" begin for R in [ZZ, QQ] - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) U, y = polynomial_ring(R, "y") @@ -1041,7 +1041,7 @@ end @testset "Generic.UnivPoly.map" begin for R in [ZZ, QQ] - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) U, y = polynomial_ring(R, "y") @@ -1076,7 +1076,7 @@ end @testset "Generic.UnivPoly.unsafe_operators" begin for R in [ZZ, QQ] - S = UniversalPolynomialRing(R; cached=false) + S = universal_polynomial_ring(R; cached=false) U, y = polynomial_ring(R, "y")