Skip to content

Commit

Permalink
Rename UniversalPolynomialRing to universal_polynomial_ring (Nemo…
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Feb 28, 2024
1 parent 4546165 commit 52fc7cb
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 44 deletions.
6 changes: 3 additions & 3 deletions docs/src/univpolynomial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```

Expand All @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,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
Expand Down Expand Up @@ -1117,7 +1118,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
Expand Down
4 changes: 4 additions & 0 deletions src/Aliases.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# to be deprecated eventually

# added during 0.40.*
@alias FreeModule free_module
@alias VectorSpace vector_space
@alias UniversalPolynomialRing universal_polynomial_ring
10 changes: 0 additions & 10 deletions src/UnivPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions src/generic/UnivPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}

Expand Down
52 changes: 26 additions & 26 deletions test/generic/UnivPoly-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"])
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")

Expand Down Expand Up @@ -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")

Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 52fc7cb

Please sign in to comment.