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

Use padic_field/qadic_field and prepare deprecations #1604

Closed
wants to merge 4 commits into from
Closed
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 examples/NFDB.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ function _p_adic_regulator_coates(K::AbsSimpleNumField, p::IntegerUnion)
while true
(prec > 2^12 || working_prec > 2^12) && error("Something wrong")
imK =[LocalFieldValuationRingElem{PadicField, PadicFieldElem}[] for i in 1:degK]
Qp = PadicField(p, prec, cached = false)
Qp = padic_field(p, precision = prec, cached = false)
Zp = ring_of_integers(Qp)
dK = discriminant(OK)
r = maximum([ramification_index(P) for P in dp])
Expand Down
2 changes: 1 addition & 1 deletion examples/Plesken.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function primitive_root_r_div_qm1(R, r::Int)
end

function get_f(r::Int, p::ZZRingElem, s::Int)
R = PadicField(r, s)
R = padic_field(r, precision = s)
return lift(teichmuller(R(p)))
end
# plan
Expand Down
2 changes: 1 addition & 1 deletion examples/Tropics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ lp[1].gen_two*lp[2].gen_two^2
ma = representation_matrix(a)
mb = representation_matrix(k(ans))
@assert iszero(ma*mb - mb*ma)
Qp = PadicField(7, 10)
Qp = padic_field(7, precision = 10)
Main.TropicalModule.simultaneous_diagonalization([map_entries(Qp, ma), map_entries(Qp, mb)])

=#
Expand Down
7 changes: 7 additions & 0 deletions src/Deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,10 @@
# Deprecated in 0.33.0

@deprecate rres reduced_resultant

# To be deprecated in 0.34.0

#@deprecate lift(a::LocalFieldValuationRingElem) lift(ZZ, a)
lift(a::LocalFieldValuationRingElem) = lift(ZZ, a)

Check warning on line 280 in src/Deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/Deprecations.jl#L280

Added line #L280 was not covered by tests
#@deprecate prime_field(L::Union{QadicField, LocalField}) absolute_base_field(L)
prime_field(L::Union{QadicField, LocalField}) = absolute_base_field(L)

Check warning on line 282 in src/Deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/Deprecations.jl#L282

Added line #L282 was not covered by tests
4 changes: 2 additions & 2 deletions src/HeckeTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2240,11 +2240,11 @@
lf = Hecke.factor_mod_pk(Array, H, 1)
if splitting_field
d = lcm([degree(y[1]) for y = lf])
R = QadicField(p, d, 1)[1]
R = qadic_field(p, d, precision = 1)[1]

Check warning on line 2243 in src/HeckeTypes.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeTypes.jl#L2243

Added line #L2243 was not covered by tests
Q = [R]
r.is_splitting = true
else
Q = [QadicField(p, x, 1)[1] for x = Set(degree(y[1]) for y = lf)]
Q = [qadic_field(p, x, precision = 1)[1] for x = Set(degree(y[1]) for y = lf)]
r.is_splitting = false
end
@assert all(x->isone(x[2]), lf)
Expand Down
14 changes: 7 additions & 7 deletions src/LocalField/Completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ function completion(K::AbsSimpleNumField, P::AbsNumFieldOrderIdeal{AbsSimpleNumF
f = degree(P)
e = ramification_index(P)
prec_padics = div(precision+e-1, e)
Qp = PadicField(minimum(P), prec_padics, cached = false)
Qp = padic_field(minimum(P), precision = prec_padics, cached = false)
Zp = maximal_order(Qp)
Qq, gQq = QadicField(minimum(P), f, prec_padics, cached = false)
Qq, gQq = qadic_field(minimum(P), f, precision = prec_padics, cached = false)
Qqx, gQqx = polynomial_ring(Qq, "x")
q, mq = residue_field(Qq)
#F, mF = ResidueFieldSmall(OK, P)
Expand Down Expand Up @@ -336,7 +336,7 @@ function setprecision!(f::CompletionMap{LocalField{QadicFieldElem, EisensteinLoc
gq = _increase_precision(gq, pol_gq, div(f.precision+e-1, e), ex, P)
f.inv_img = (gq, f.inv_img[2])

Zp = maximal_order(prime_field(Kp))
Zp = maximal_order(absolute_base_field(Kp))
Qq = base_field(Kp)

setprecision!(Qq, ex)
Expand Down Expand Up @@ -384,7 +384,7 @@ function totally_ramified_completion(K::AbsSimpleNumField, P::AbsNumFieldOrderId
@assert nf(OK) == K
@assert isone(degree(P))
e = ramification_index(P)
Qp = PadicField(minimum(P), precision)
Qp = padic_field(minimum(P), precision = precision)
Zp = maximal_order(Qp)
Zx = FlintZZ["x"][1]
Qpx = polynomial_ring(Qp, "x")[1]
Expand Down Expand Up @@ -443,7 +443,7 @@ function setprecision!(f::CompletionMap{LocalField{PadicFieldElem, EisensteinLoc
if r > 0
ex += 1
end
Qp = PadicField(prime(Kp), div(new_prec, e)+1)
Qp = padic_field(prime(Kp), precision = div(new_prec, e) + 1)
Zp = maximal_order(Qp)
Qpx, _ = polynomial_ring(Qp, "x")
pows_u = powers(u, e-1)
Expand Down Expand Up @@ -495,8 +495,8 @@ function unramified_completion(K::AbsSimpleNumField, P::AbsNumFieldOrderIdeal{Ab
@assert isone(ramification_index(P))
f = degree(P)
p = minimum(P)
Qq, gQq = QadicField(p, f, precision)
Qp = PadicField(p, precision)
Qq, gQq = qadic_field(p, f, precision = precision)
Qp = padic_field(p, precision = precision)
Zp = maximal_order(Qp)
q, mq = residue_field(Qq)
F, mF = residue_field(OK, P)
Expand Down
10 changes: 5 additions & 5 deletions src/LocalField/Conjugates.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#XXX: valuation(Q(0)) == 0 !!!!!
function newton_lift(f::ZZPolyRingElem, r::QadicFieldElem, prec::Int = parent(r).prec_max, starting_prec::Int = 2)
function newton_lift(f::ZZPolyRingElem, r::QadicFieldElem, prec::Int = precision(parent(r)), starting_prec::Int = 2)
Q = parent(r)
n = prec
i = n
Expand All @@ -19,22 +19,22 @@
for p = reverse(chain)
setprecision!(r, p)
setprecision!(o, p)
Q.prec_max = r.N
setprecision!(Q, r.N)
if r.N > precision(Q)
setprecision!(qf, r.N)
setprecision!(qfs, r.N)
end
r = r - qf(r)*o
if r.N >= n
Q.prec_max = n
setprecision!(Q, n)
return r
end
o = o*(2-qfs(r)*o)
end
return r
end

function newton_lift(f::ZZPolyRingElem, r::LocalFieldElem, precision::Int = parent(r).prec_max, starting_prec::Int = 2)
function newton_lift(f::ZZPolyRingElem, r::LocalFieldElem, precision::Int = precision(parent(r)), starting_prec::Int = 2)

Check warning on line 37 in src/LocalField/Conjugates.jl

View check run for this annotation

Codecov / codecov/patch

src/LocalField/Conjugates.jl#L37

Added line #L37 was not covered by tests
Q = parent(r)
n = precision
i = n
Expand Down Expand Up @@ -93,7 +93,7 @@
lf = factor_mod_pk(Array, C.H, n)
rt = QadicFieldElem[]
for Q = C.Q
Q.prec_max = n
setprecision!(Q, n)
for x = lf
if is_splitting(C) || degree(x[1]) == degree(Q)
append!(rt, roots(Q, x[1], max_roots = 1))
Expand Down
2 changes: 1 addition & 1 deletion src/LocalField/Elem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ function divexact(a::LocalFieldElem, b::Union{Integer, ZZRingElem}; check::Bool=
e = absolute_ramification_index(K)
v = valuation(b, p)
iszero(a) && return setprecision(a, precision(a) - v*e)
Qp = prime_field(K)
Qp = absolute_base_field(K)
old = precision(Qp)
setprecision!(Qp, e*precision(a)+ Int(_valuation_integral(a)) + v)
bb = inv(Qp(b))
Expand Down
11 changes: 1 addition & 10 deletions src/LocalField/LocalField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,6 @@ end
#
################################################################################

function prime_field(L::Union{QadicField, LocalField})
L = base_ring(defining_polynomial(L))
while typeof(L) != PadicField
L = base_ring(defining_polynomial(L))
end
return L
end


function base_field(L::LocalField)
return base_ring(defining_polynomial(L))
end
Expand Down Expand Up @@ -366,7 +357,7 @@ end

function local_field(f::QQPolyRingElem, p::Int, precision::Int, s::VarName, ::Type{T} = GenericLocalField; check::Bool = true, cached::Bool = true) where T <: LocalFieldParameter
@assert is_prime(p)
K = PadicField(p, precision)
K = padic_field(p, precision = precision)
fK = map_coefficients(K, f, cached = false)
return local_field(fK, s, T, cached = cached, check = check)
end
Expand Down
4 changes: 2 additions & 2 deletions src/LocalField/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function setcoeff!(c::Generic.Poly{T}, n::Int, a::T) where {T <: Union{PadicFiel
end

#TODO: find better crossover points
# qp = PadicField(3, 10);
# qp = padic_field(3, precision = 10);
# qpt, t = qp["t"]
# E = eisenstein_extension(cyclotomic(3, gen(Hecke.Globals.Zx))(t+1))[1]
# Es, s = E["s"]
Expand Down Expand Up @@ -749,7 +749,7 @@ function characteristic_polynomial(f::Generic.Poly{T}, g::Generic.Poly{T}) where
error("Not yet implemented")
end
d1 = clog(ZZRingElem(degree(f)+1), p)
L = QadicField(p, d1, min(precision(f), precision(g)))
L = qadic_field(p, d1, precision = min(precision(f), precision(g)))
Lt = polynomial_ring(L, "t")[1]
fL = map_coefficients(L, f, parent = Lt)
gL = map_coefficients(L, g, parent = Lt)
Expand Down
14 changes: 7 additions & 7 deletions src/LocalField/neq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
return c
end
coordinates(a::PadicFieldElem, ::PadicField) = [a]
lift(a::Hecke.LocalFieldValuationRingElem{PadicField, PadicFieldElem}) = lift(a.x)
lift(R::Ring, a::Hecke.LocalFieldValuationRingElem{PadicField, PadicFieldElem}) = lift(R, a.x)

Check warning on line 217 in src/LocalField/neq.jl

View check run for this annotation

Codecov / codecov/patch

src/LocalField/neq.jl#L217

Added line #L217 was not covered by tests

function setprecision!(A::Generic.MatSpaceElem{Hecke.LocalFieldValuationRingElem{PadicField, PadicFieldElem}}, n::Int)
for i=1:nrows(A)
Expand Down Expand Up @@ -255,7 +255,7 @@
cur_a = copy(a)
cur_b = b
# @assert degree(K) == e
Qp = prime_field(K)
Qp = absolute_base_field(K)
Zp = ring_of_integers(Qp)
expo_mult = identity_matrix(ZZ, length(cur_a))
#transformation of cur_a to a
Expand Down Expand Up @@ -565,7 +565,7 @@
map::Generic.MatSpaceElem{PadicFieldElem}

function MapEvalCtx(M::LocalFieldMor)
mat = matrix(prime_field(domain(M)),
mat = matrix(absolute_base_field(domain(M)),
absolute_degree(domain(M)),
absolute_degree(codomain(M)),
reduce(vcat, [absolute_coordinates(M(x))
Expand Down Expand Up @@ -778,7 +778,7 @@
#thus Gal(E/base_field(L)) = Gal(L/base_field(L)) x unram of base_field
bL = base_field(L)
E2, _ = unramified_extension(map_coefficients(x->bL(coeff(x, 0)), defining_polynomial(E), cached = false))
G2 = automorphism_list(E2, prime_field(E2))
G2 = automorphism_list(E2, absolute_base_field(E2))
GG = morphism_type(E)[]
for e = G2
ime = e(gen(E2))
Expand All @@ -794,7 +794,7 @@
@assert length(GG) == divexact(absolute_degree(E), absolute_degree(K))
# @assert all(x->x in GG, automorphism_list(E, K))
else
GG = automorphism_list(E, prime_field(E))
GG = automorphism_list(E, absolute_base_field(E))

Check warning on line 797 in src/LocalField/neq.jl

View check run for this annotation

Codecov / codecov/patch

src/LocalField/neq.jl#L797

Added line #L797 was not covered by tests
gK = map(E, gK)
GG = [g for g = GG if map(g, gK) == gK]
end
Expand Down Expand Up @@ -828,7 +828,7 @@
beta = []
sigma_hat = []
#need to map and compare all generators
gL = gens(L, prime_field(L))
gL = gens(L, absolute_base_field(L))
imGG = map(x->map(x, map(E, gL)), GG)
imG = map(x->map(x, gL), G)

Expand Down Expand Up @@ -1367,7 +1367,7 @@
end
continue
end
Qp = PadicField(p, prec)
Qp = padic_field(p, precision = prec)
#for each P we need
# - a gen (pi) for the valuation
# - a gen for the residue field
Expand Down
6 changes: 3 additions & 3 deletions src/LocalField/pAdic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
pp = prime(parent(x), 2)
X = 1-x
while true
y = lift(1-X) % pp
y = lift(ZZ, 1-X) % pp

Check warning on line 44 in src/LocalField/pAdic.jl

View check run for this annotation

Codecov / codecov/patch

src/LocalField/pAdic.jl#L44

Added line #L44 was not covered by tests
lg += parent(x)(my_log_one_minus_inner(y, precision(x), le, prime(parent(x))))
X = X*inv(parent(x)(1-y))
pp *= pp
Expand Down Expand Up @@ -76,10 +76,10 @@
pp = prime(parent(x))^2
X = 1-x
R, _ = polynomial_ring(QQ, cached = false)
S, _ = residue_ring(R, map_coefficients(x->QQ(lift(x)), defining_polynomial(parent(x)), parent = R))
S, _ = residue_ring(R, map_coefficients(x->QQ(lift(ZZ, x)), defining_polynomial(parent(x)), parent = R))

Check warning on line 79 in src/LocalField/pAdic.jl

View check run for this annotation

Codecov / codecov/patch

src/LocalField/pAdic.jl#L79

Added line #L79 was not covered by tests
while true
Y = 1-X
y = S(R([lift(coeff(Y, i)) % pp for i=0:length(Y)]))
y = S(R([lift(ZZ, coeff(Y, i)) % pp for i=0:length(Y)]))

Check warning on line 82 in src/LocalField/pAdic.jl

View check run for this annotation

Codecov / codecov/patch

src/LocalField/pAdic.jl#L82

Added line #L82 was not covered by tests
lg += parent(x)(my_log_one_minus_inner(y, precision(x), le, prime(parent(x))).data)
X = X*inv(parent(x)(1-y.data))
pp *= pp
Expand Down
2 changes: 1 addition & 1 deletion src/LocalField/qAdic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
return x*prime(R, v)
end
else
return lift(FlintQQ, a)
return lift(QQ, a)

Check warning on line 82 in src/LocalField/qAdic.jl

View check run for this annotation

Codecov / codecov/patch

src/LocalField/qAdic.jl#L82

Added line #L82 was not covered by tests
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/Misc/UnitsModM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
@assert (b-1) % 8 == 0
@assert (a^2-1) % 8 == 0
if fM[p] > 3
F = PadicField(p, fM[p], cached = false)
F = padic_field(p, precision = fM[p], cached = false)

Check warning on line 283 in src/Misc/UnitsModM.jl

View check run for this annotation

Codecov / codecov/patch

src/Misc/UnitsModM.jl#L283

Added line #L283 was not covered by tests
g += 2*lift(divexact(log(F(b)), log(F(a^2))))
end
return g
Expand Down
2 changes: 1 addition & 1 deletion src/NumField/NfAbs/MPolyAbsFact.jl
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ function field(RC::RootCtx, m::MatElem)

@vprintln :AbsFact 1 "target field has (local) degree $k"

Qq = QadicField(characteristic(F), k, 1, cached = false)[1]
Qq = qadic_field(characteristic(F), k, precision = 1, cached = false)[1]
Qqt = polynomial_ring(Qq, cached = false)[1]
k, mk = residue_field(Qq)

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 @@ -208,7 +208,7 @@ function _padic_normal_form(G::QQMatrix, p::ZZRingElem; prec::Int = -1, partial:

n = ncols(Gmod)

Qp = PadicField(p, prec, cached = false)
Qp = padic_field(p, precision = prec, cached = false)

if n == 0
return (zero_matrix(FlintQQ, n, n), zero_matrix(FlintQQ, n, n))::Tuple{QQMatrix, QQMatrix}
Expand Down
Loading
Loading