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

Switch from FiniteField to finite_field #1231

Merged
merged 1 commit into from
Oct 8, 2023
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PolymakeExt = "Polymake"
[compat]
AbstractAlgebra = "^0.32.1"
GAP = "0.9.6"
Nemo = "^0.36.0"
Nemo = "^0.36.1"
Polymake = "0.10, 0.11"
RandomExtensions = "0.4.3"
julia = "1.6"
Expand Down
8 changes: 4 additions & 4 deletions examples/Plesken.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function plesken_kummer(p::ZZRingElem, r::Int, s::Int)


if (p-1) % r == 0
R = FiniteField(p)
R = finite_field(p)
descent = false
else
f = cyclotomic(r, polynomial_ring(FlintZZ)[2])
Expand Down Expand Up @@ -283,7 +283,7 @@ end

function plesken_as(p::ZZRingElem, r::Int, s::Int)
@assert p==r
R = FiniteField(p)
R = finite_field(p)
g = R(-1)
t = 1
while s>1
Expand All @@ -300,12 +300,12 @@ function plesken_2(p::ZZRingElem, r::Int, s::Int)
@assert r==2
#Plesken, 1.27
if valuation(p-1, 2) >1
R = FiniteField(p)
R = finite_field(p)
g = primitive_root_r_div_qm1(p, r)
t = 1
else
@assert valuation(p+1, 2)>1
R = FiniteField(p)
R = finite_field(p)
Rx,x = polynomial_ring(R, "t_1")
R = residue_ring(Rx, x^2+1)
g = primitive_root_r_div_qm1(R, 2)
Expand Down
2 changes: 1 addition & 1 deletion src/EllCrv/Finite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@
if degree(p) <= 1
return L(_to_z(j))
end
F, a = FiniteField(p)
F, a = finite_field(p)

Check warning on line 993 in src/EllCrv/Finite.jl

View check run for this annotation

Codecov / codecov/patch

src/EllCrv/Finite.jl#L993

Added line #L993 was not covered by tests
e = embed(F, L)
return e(gen(F))
end
Expand Down
2 changes: 1 addition & 1 deletion src/GenOrd/Ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ end
################################################################################

function Hecke.residue_field(R::fpPolyRing, p::fpPolyRingElem)
K, _ = FiniteField(p,"o")
K, _ = finite_field(p,"o")
return K, MapFromFunc(R, K, x->K(x), y->R(y))
end

Expand Down
2 changes: 1 addition & 1 deletion src/LocalField/LocalField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function residue_field(K::LocalField{S, UnramifiedLocalField}) where {S <: Field
Fpt = polynomial_ring(ks, cached = false)[1]
g = defining_polynomial(K)
f = Fpt([ks(mks(coeff(g, i))) for i=0:degree(K)])
kk = Native.FiniteField(f)[1]
kk = Native.finite_field(f)[1]
bas = basis(K)
u = gen(kk)
function proj(a::Hecke.LocalFieldElem)
Expand Down
2 changes: 1 addition & 1 deletion src/LocalField/qAdic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function residue_field(Q::FlintQadicField)
Fpt = polynomial_ring(Fp, cached = false)[1]
g = defining_polynomial(Q) #no Conway if parameters are too large!
f = Fpt([Fp(lift(coeff(g, i))) for i=0:degree(Q)])
k = Native.FiniteField(f, "o", cached = false)[1]
k = Native.finite_field(f, "o", cached = false)[1]
pro = function(x::qadic)
v = valuation(x)
v < 0 && error("elt non integral")
Expand Down
12 changes: 6 additions & 6 deletions src/Misc/Plesken.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@
function _presentation_artin_schreier(F, n)
p = characteristic(F)
Fx, x = polynomial_ring(F, "x", cached = false)
F1, a = FiniteField(x^p-x-1, "a", cached = false, check = false)
F1, a = finite_field(x^p-x-1, "a", cached = false, check = false)

Check warning on line 81 in src/Misc/Plesken.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/Plesken.jl#L81

Added line #L81 was not covered by tests
F1y, y = polynomial_ring(F1, "y1", cached = false)
el = a
for i = 2:n
pol = y^p-y-el^(p-1)
Frel = FiniteField(pol, "a$i", cached = false, check = false)[1]
Frel = finite_field(pol, "a$i", cached = false, check = false)[1]

Check warning on line 86 in src/Misc/Plesken.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/Plesken.jl#L86

Added line #L86 was not covered by tests
abs_def_pol = norm(pol)
F1, gF1 = FiniteField(abs_def_pol, "a", check = false, cached = false)
F1, gF1 = finite_field(abs_def_pol, "a", check = false, cached = false)

Check warning on line 88 in src/Misc/Plesken.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/Plesken.jl#L88

Added line #L88 was not covered by tests
mp = hom(F1, Frel, gen(Frel))
el = mp\(gen(Frel)*el)
F1y, y = polynomial_ring(F1, "y1", cached = false)
Expand Down Expand Up @@ -132,7 +132,7 @@
def_pol1 = Fx()
setcoeff!(def_pol1, 0, -pr_root)
setcoeff!(def_pol1, r^n, one(F))
F1, gF1 = FiniteField(def_pol1, "a1", cached = false, check = false)
F1, gF1 = finite_field(def_pol1, "a1", cached = false, check = false)

Check warning on line 135 in src/Misc/Plesken.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/Plesken.jl#L135

Added line #L135 was not covered by tests
return F1
end

Expand All @@ -151,7 +151,7 @@
ind = i
end
end
F0, gF0 = FiniteField(lF[ind], "a0", cached = false)
F0, gF0 = finite_field(lF[ind], "a0", cached = false)

Check warning on line 154 in src/Misc/Plesken.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/Plesken.jl#L154

Added line #L154 was not covered by tests
f = degree(F0)
Fn = _presentation_kummer(F0, r, n)
#Now, I need to take the trace.
Expand All @@ -163,7 +163,7 @@
g = g^e
t = add!(t, t, g)
end
return FiniteField(_minpoly(t, r^n), "a", cached = false, check = false)[1]
return finite_field(_minpoly(t, r^n), "a", cached = false, check = false)[1]

Check warning on line 166 in src/Misc/Plesken.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/Plesken.jl#L166

Added line #L166 was not covered by tests
end

function _find_exponent(f::Int, p::ZZRingElem, r::ZZRingElem, n::Int)
Expand Down
2 changes: 1 addition & 1 deletion src/Misc/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ specified, return the `n`-th cyclotomic polynomial over the integers.
# Examples

```jldoctest
julia> F, _ = FiniteField(5)
julia> F, _ = finite_field(5)
(Finite field of characteristic 5, 1)

julia> Ft, _ = F["t"]
Expand Down
6 changes: 3 additions & 3 deletions src/Misc/RelFiniteField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ end
#
################################################################################

function Native.FiniteField(f::T, s::String = "a" ; cached::Bool = true, check::Bool = true) where T <: Union{fqPolyRepPolyRingElem, FqPolyRepPolyRingElem}
function Native.finite_field(f::T, s::String = "a" ; cached::Bool = true, check::Bool = true) where T <: Union{fqPolyRepPolyRingElem, FqPolyRepPolyRingElem}
if check
@assert is_irreducible(f)
end
Expand All @@ -556,7 +556,7 @@ function Native.FiniteField(f::T, s::String = "a" ; cached::Bool = true, check::
return F, gen(F)
end

function Native.FiniteField(f::PolyElem{T}, s::String = "a" ; cached::Bool = true, check::Bool = true) where T <: RelFinFieldElem
function Native.finite_field(f::PolyElem{T}, s::String = "a" ; cached::Bool = true, check::Bool = true) where T <: RelFinFieldElem
if check
@assert is_irreducible(f)
end
Expand Down Expand Up @@ -666,7 +666,7 @@ function absolute_field(F::RelFinField{T}; cached::Bool = true) where T <: FinFi
end
p = _char(F)
d = absolute_degree(F)
K, gK = Native.FiniteField(p, d, "a", cached = cached)
K, gK = Native.finite_field(p, d, "a", cached = cached)
k, mk = absolute_field(base_field(F))
def_pol_new = map_coefficients(pseudo_inv(mk), defining_polynomial(F))
img_gen_k = roots(K, defining_polynomial(k))[1]
Expand Down
2 changes: 1 addition & 1 deletion src/NumField/NfAbs/Simplify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function _sieve_primitive_elements(B::Vector{NfAbsNSElem})
Zx = polynomial_ring(FlintZZ, "x", cached = false)[1]
pols = [Zx(to_univariate(Globals.Qx, x)) for x in K.pol]
p, d = _find_prime(pols)
F = Native.FiniteField(p, d, "w", cached = false)[1]
F = Native.finite_field(p, d, "w", cached = false)[1]
Fp = Native.GF(p, cached = false)
Fpt = polynomial_ring(Fp, ngens(K))[1]
Ft = polynomial_ring(F, "t", cached = false)[1]
Expand Down
4 changes: 2 additions & 2 deletions src/NumFieldOrd/NfOrd/Hensel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function _roots_hensel(f::Generic.Poly{nf_elem};
lp = factor(gp).fac

#set up the mod p data:
#need FiniteField as I need to factor (roots)
#need finite_field as I need to factor (roots)
# I want to find a residue field with less roots
for gp_factor in keys(lp)
deg_p = degree(gp_factor)
Expand Down Expand Up @@ -425,7 +425,7 @@ function _hensel(f::Generic.Poly{nf_elem},
#later we'll get the HNF matrix for selected powers as well

#set up the mod p data:
#need FiniteField as I need to factor (roots)
#need finite_field as I need to factor (roots)

rt = roots(fp)

Expand Down
2 changes: 1 addition & 1 deletion src/NumFieldOrd/NfOrd/Ideal/Prime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ function prime_dec_nonindex(O::NfAbsOrd{NfAbsNS,NfAbsNSElem}, p::IntegerUnion, d
=#
for x = Base.Iterators.product(fac...)
k = lcm([degree(t[1]) for t = x])
Fq = Native.FiniteField(p, k, "y", cached = false)[1]
Fq = Native.finite_field(p, k, "y", cached = false)[1]
Fq2 = residue_ring(Rx, lift(Zx, minpoly(gen(Fq))))
rt = Vector{Vector{elem_type(Fq)}}()
RT = []
Expand Down
6 changes: 3 additions & 3 deletions src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Computes the residual polynomial of the side $L$ of the Newton Polygon $N$.
function residual_polynomial(N::NewtonPolygon{ZZPolyRingElem}, L::Line)
F = GF(N.p, cached = false)
Ft = polynomial_ring(F, "t", cached = false)[1]
FF = FiniteField(Ft(N.phi), "a", cached = false)[1]
FF = finite_field(Ft(N.phi), "a", cached = false)[1]
return residual_polynomial(FF, L, N.development, N.p)
end

Expand Down Expand Up @@ -407,7 +407,7 @@ function gens_overorder_polygons(O::NfOrd, p::ZZRingElem)
isone(m) && continue
fac = factor(gg)
for (g, m1) in fac
F, a = Native.FiniteField(g, "a", cached = false)
F, a = Native.finite_field(g, "a", cached = false)
phi = lift(Zx, g)
dev, quos = phi_development_with_quos(Zx(f), phi)
N = _newton_polygon(dev, p)
Expand Down Expand Up @@ -929,7 +929,7 @@ function decomposition_type_polygon(O::NfOrd, p::Union{ZZRingElem, Int})
continue
end
Nl = filter(x -> slope(x)<0, N.lines)
F, a = Native.FiniteField(g, "a", cached = false)
F, a = Native.finite_field(g, "a", cached = false)
pols = dense_poly_type(elem_type(F))[]
for ll in Nl
rp = residual_polynomial(F, ll, dev, p)
Expand Down
2 changes: 1 addition & 1 deletion src/QuadForm/Quad/NormalForm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function _ispadic_normal_form_odd(G, p)

o = identity_matrix(QQ, 1)

F, = FiniteField(p, 1, cached = false)
F, = finite_field(p, 1, cached = false)

for i in 1:length(blocks)
if all(==(o), blocks[i])
Expand Down
4 changes: 2 additions & 2 deletions test/AlgAss/AlgAss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ end

# Restrict from F_q to F_p
Fp = GF(7)
Fq, a = FiniteField(7, 3, "a")
Fq, a = finite_field(7, 3, "a")

A = AlgAss(MatrixAlgebra(Fq, 2))
B, BtoA = Hecke.restrict_scalars(A, Fp)
Expand Down Expand Up @@ -168,7 +168,7 @@ end

@testset "Matrix Algebra" begin
Fp = GF(7)
Fq, a = FiniteField(7, 2, "a")
Fq, a = finite_field(7, 2, "a")

A = AlgAss(MatrixAlgebra(Fq, 3))
B, AtoB = Hecke._as_matrix_algebra(A)
Expand Down
4 changes: 2 additions & 2 deletions test/EllCrv/Finite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
F = GF(3)
Fx, x = F["x"]
f = x^6 + 2*x^4 + x^2 + 2*x + 2
F, a = FiniteField(f)
F, a = finite_field(f)
E = EllipticCurve([a^4 + a^3 + 2*a^2 + 2*a, 2*a^5 + 2*a^3 + 2*a^2 + 1])
A, = abelian_group(E)
@test elementary_divisors(A) == [26, 26]
Expand All @@ -192,7 +192,7 @@
F = GF(101)
Fx, x = F["x"]
f = x^3 + 3*x + 99
F, a = FiniteField(f)
F, a = finite_field(f)
E = EllipticCurve([2*a^2 + 48*a + 27, 89*a^2 + 76*a + 24])
A, = abelian_group(E)
@test elementary_divisors(A) == [1031352]
Expand Down
2 changes: 1 addition & 1 deletion test/EllCrv/Isogeny.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
E = EllipticCurve(F, [0, 1, 1, 1, 1])
@test is_kernel_polynomial(E, x + 1)

F, o = FiniteField(47, 2, "o")
F, o = finite_field(47, 2, "o")
E = EllipticCurve(F, [0, o])
Fx, x = F["x"]
f = x^3 + (7*o + 11)*x^2 + (25*o + 33)*x + 25*o
Expand Down
2 changes: 1 addition & 1 deletion test/GenOrd/MaximalOrder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ end
end

@testset "FldFin" begin
for q = [GF(17), GF(next_prime(ZZRingElem(10)^30)), FiniteField(5, 2)[1], FiniteField(next_prime(ZZRingElem(10)^25), 2, "a", cached = false)[1]]
for q = [GF(17), GF(next_prime(ZZRingElem(10)^30)), finite_field(5, 2)[1], finite_field(next_prime(ZZRingElem(10)^25), 2, "a", cached = false)[1]]
qt, t = RationalFunctionField(q, "t", cached = false)
qtx, x = polynomial_ring(qt, cached = false)
f = x^3+(t+1)^5*(x+1)+(t^2+t+1)^7
Expand Down
8 changes: 4 additions & 4 deletions test/Misc/FiniteField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ end
@testset "fqPolyRepField" begin

for p in [31, 11, 101]
F = FiniteField(p, 2)[1]
F = finite_field(p, 2)[1]
G, mG = unit_group(F)
#Test generator
g = mG(G[1])
Expand Down Expand Up @@ -127,9 +127,9 @@ end
@testset "FqPolyRepField" begin

for p in [31, 11, 101]
_ = FiniteField(ZZRingElem(p), 2, "a")[1]
_ = FiniteField(ZZRingElem(p), 2, 'a')[1]
F = FiniteField(ZZRingElem(p), 2, :a)[1]
_ = finite_field(ZZRingElem(p), 2, "a")[1]
_ = finite_field(ZZRingElem(p), 2, 'a')[1]
F = finite_field(ZZRingElem(p), 2, :a)[1]
G, mG = unit_group(F)
#Test generator
g = mG(G[1])
Expand Down
2 changes: 1 addition & 1 deletion test/Misc/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ end
@testset "Cyclotomic polynomials" begin
listp = Hecke.primes_up_to(50)
for i in 1:20
Fp, _ = FiniteField(rand(listp), cached=false)
Fp, _ = finite_field(rand(listp), cached=false)
Fpt, _ = polynomial_ring(Fp, "t", cached=false)
chi = @inferred cyclotomic_polynomial(rand(1:100), Fpt)
@test is_cyclotomic_polynomial(chi)
Expand Down
Loading
Loading