Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ordering -> internal_ordering #1678

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Nemo"
uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a"
version = "0.42.1"
version = "0.43.0"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand All @@ -16,7 +16,7 @@ RandomExtensions = "fb686558-2515-59ef-acaa-46db3789a887"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[compat]
AbstractAlgebra = "0.39.0"
AbstractAlgebra = "0.40.0"
Antic_jll = "~0.201.500"
Arb_jll = "~200.2300.000"
Calcium_jll = "~0.401.100"
Expand Down
10 changes: 5 additions & 5 deletions src/flint/FlintTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6877,24 +6877,24 @@ const _fq_default_mpoly_union = Union{AbstractAlgebra.Generic.MPoly{FqPolyRepFie
base_ring::FqField
typ::Int # keep these in sync with @fq_default_mpoly_do_op

function FqMPolyRing(R::FqField, s::Vector{Symbol}, ordering::Symbol = :lex, cached::Bool = true)
return get_cached!(FqDefaultMPolyID, (R, s, ordering), cached) do
function FqMPolyRing(R::FqField, s::Vector{Symbol}, internal_ordering::Symbol = :lex, cached::Bool = true)
return get_cached!(FqDefaultMPolyID, (R, s, internal_ordering), cached) do
# in the following all constructors should use chached = false
m = modulus(R)
p = characteristic(R)
if fits(UInt, p)
Fq = Native.GF(UInt(p))
if isone(degree(m))
Fqx = polynomial_ring(Fq, s, cached = cached, ordering = ordering)[1]
Fqx = polynomial_ring(Fq, s, cached = cached, internal_ordering = internal_ordering)[1]
return new(Fqx, R, 3)
end
mm = polynomial_ring(Fq, "x")[1](lift(polynomial_ring(ZZ, "x")[1], m))
Fq = Native.FiniteField(mm, R.var, cached = cached, check = false)[1]
Fqx = polynomial_ring(Fq, s, cached = cached, ordering = ordering)[1]
Fqx = polynomial_ring(Fq, s, cached = cached, internal_ordering = internal_ordering)[1]
return new(Fqx, R, 2)
end
Fq = FqPolyRepField(m, Symbol(R.var), cached, check = false)
Fqx = AbstractAlgebra.Generic.polynomial_ring(Fq, s, cached = cached, ordering = ordering)[1]
Fqx = AbstractAlgebra.Generic.polynomial_ring(Fq, s, cached = cached, internal_ordering = internal_ordering)[1]
return new(Fqx, R, 1)
end::FqMPolyRing
end
Expand Down
2 changes: 1 addition & 1 deletion src/flint/fmpq_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ number_of_variables(a::QQMPolyRing) = ccall((:fmpq_mpoly_ctx_nvars, libflint), I

base_ring(a::QQMPolyRing) = FlintQQ

function ordering(a::QQMPolyRing)
function internal_ordering(a::QQMPolyRing)
b = ccall((:fmpq_mpoly_ctx_ord, libflint), Cint, (Ref{QQMPolyRing}, ), a)
return flint_orderings[b + 1]
end
Expand Down
2 changes: 1 addition & 1 deletion src/flint/fmpz_mod_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ modulus(R::($rtype)) = modulus(base_ring(R))
modulus(f::($etype)) = modulus(base_ring(parent(f)))


function ordering(a::($rtype))
function internal_ordering(a::($rtype))
b = a.ord
# b = ccall((:fmpz_mod_mpoly_ctx_ord, libflint), Cint, (Ref{zzModMPolyRing}, ), a)
return flint_orderings[b + 1]
Expand Down
2 changes: 1 addition & 1 deletion src/flint/fmpz_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ number_of_variables(a::ZZMPolyRing) = ccall((:fmpz_mpoly_ctx_nvars, libflint), I

base_ring(a::ZZMPolyRing) = FlintZZ

function ordering(a::ZZMPolyRing)
function internal_ordering(a::ZZMPolyRing)
b = ccall((:fmpz_mpoly_ctx_ord, libflint), Cint, (Ref{ZZMPolyRing}, ), a)
return flint_orderings[b + 1]
end
Expand Down
4 changes: 2 additions & 2 deletions src/flint/fq_default_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ modulus(R::FqMPolyRing) = modulus(base_ring(R))

modulus(f::FqMPolyRingElem) = modulus(base_ring(parent(f)))

function ordering(a::FqMPolyRing)
return ordering(a.data)
function internal_ordering(a::FqMPolyRing)
return internal_ordering(a.data)
end

function gens(R::FqMPolyRing)
Expand Down
2 changes: 1 addition & 1 deletion src/flint/fq_nmod_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ number_of_variables(a::fqPolyRepMPolyRing) = a.nvars

base_ring(a::fqPolyRepMPolyRing) = a.base_ring

function ordering(a::fqPolyRepMPolyRing)
function internal_ordering(a::fqPolyRepMPolyRing)
b = a.ord
# b = ccall((:fq_nmod_mpoly_ctx_ord, libflint), Cint, (Ref{fqPolyRepMPolyRing}, ), a)
return flint_orderings[b + 1]
Expand Down
2 changes: 1 addition & 1 deletion src/flint/nmod_mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ modulus(R::($rtype)) = modulus(base_ring(R))
modulus(f::($etype)) = modulus(base_ring(parent(f)))


function ordering(a::($rtype))
function internal_ordering(a::($rtype))
b = a.ord
# b = ccall((:nmod_mpoly_ctx_ord, libflint), Cint, (Ref{zzModMPolyRing}, ), a)
return flint_orderings[b + 1]
Expand Down
48 changes: 24 additions & 24 deletions test/flint/fmpq_mpoly-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

SS, varlist = polynomial_ring(R, var_names, ordering = ord)
SS, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

@test S === SS

SSS, varlist = polynomial_ring(R, var_names, ordering = ord, cached = false)
SSSS, varlist = polynomial_ring(R, var_names, ordering = ord, cached = false)
SSS, varlist = polynomial_ring(R, var_names, internal_ordering = ord, cached = false)
SSSS, varlist = polynomial_ring(R, var_names, internal_ordering = ord, cached = false)

@test !(SSS === SSSS)

Expand Down Expand Up @@ -112,7 +112,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)
g = gens(S)

@test characteristic(S) == 0
Expand Down Expand Up @@ -171,10 +171,10 @@ end
@test (i1 == i2) == (monomial(f, i1) == monomial(f, i2))
end

deg = is_degree(ordering(S))
rev = is_reverse(ordering(S))
deg = is_degree(internal_ordering(S))
rev = is_reverse(internal_ordering(S))

@test ord == ordering(S)
@test ord == internal_ordering(S)

@test isone(one(S))

Expand Down Expand Up @@ -238,7 +238,7 @@ end
R = FlintQQ

for ord in Nemo.flint_orderings
S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; ordering=ord)
S, (x, y, z) = polynomial_ring(R, ["x", "y", "z"]; internal_ordering=ord)

f = -8*x^5*y^3*z^5+9*x^5*y^2*z^3-8*x^4*y^5*z^4-10*x^4*y^3*z^2+8*x^3*y^2*z-10*x*y^3*
z^4-4*x*y-10*x*z^2+8*y^2*z^5-9*y^2*z^3
Expand All @@ -260,7 +260,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:10
f = rand(S, 0:5, 0:100, -100:100)
Expand All @@ -277,7 +277,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:10
f = rand(S, 0:5, 0:100, -100:100)
Expand All @@ -300,7 +300,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:100
f = rand(S, 0:5, 0:100, -100:100)
Expand Down Expand Up @@ -340,7 +340,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:100
d = rand(-100:100)
Expand All @@ -366,7 +366,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:10
f = rand(S, 0:5, 0:100, -100:100)
Expand All @@ -393,7 +393,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:10
f = rand(S, 0:5, 0:100, -100:100)
Expand Down Expand Up @@ -422,7 +422,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:10
f = S(0)
Expand Down Expand Up @@ -458,7 +458,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:10
f = S(0)
Expand Down Expand Up @@ -505,7 +505,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(FlintQQ, var_names, ordering = ord)
S, varlist = polynomial_ring(FlintQQ, var_names, internal_ordering = ord)

for iter = 1:10
f = rand(S, 0:4, 0:5, -10:10)
Expand Down Expand Up @@ -550,7 +550,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(FlintQQ, var_names, ordering = ord)
S, varlist = polynomial_ring(FlintQQ, var_names, internal_ordering = ord)

for iter = 1:10
f = rand(S, 0:4, 0:5, -10:10)
Expand All @@ -576,7 +576,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:100
f = rand(S, 0:5, 0:100, -100:100)
Expand Down Expand Up @@ -659,7 +659,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for iter = 1:100
f = S()
Expand Down Expand Up @@ -697,7 +697,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

S, varlist = polynomial_ring(R, var_names, ordering = ord)
S, varlist = polynomial_ring(R, var_names, internal_ordering = ord)

for j in 1:100
f = rand(S, 0:5, 0:100, -100:100)
Expand All @@ -715,7 +715,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

R, vars_R = polynomial_ring(FlintQQ, var_names; ordering=ord)
R, vars_R = polynomial_ring(FlintQQ, var_names; internal_ordering=ord)

for iter in 1:10
f = R()
Expand Down Expand Up @@ -749,7 +749,7 @@ end
var_names = ["x$j" for j in 1:num_vars]
ord = rand_ordering()

R, vars_R = polynomial_ring(FlintQQ, var_names; ordering=ord)
R, vars_R = polynomial_ring(FlintQQ, var_names; internal_ordering=ord)

for iter in 1:10
f = R()
Expand Down
Loading
Loading