Skip to content

Commit

Permalink
Use snake case constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
joschmitt committed May 21, 2024
1 parent 66c77db commit f2ab7d9
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions 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 =[QadicRingElem{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 Expand Up @@ -1443,7 +1443,7 @@ mutable struct NFDBGeneric{T, S}
return z
end
end

function NFDBGeneric(L::Vector{RelSimpleNumField{AbsSimpleNumFieldElem}})
res = NFDBGeneric{1, eltype(L)}()
for K in L
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
4 changes: 2 additions & 2 deletions src/HeckeTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2239,11 +2239,11 @@ mutable struct qAdicRootCtx
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 2242 in src/HeckeTypes.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeTypes.jl#L2242

Added line #L2242 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
10 changes: 5 additions & 5 deletions src/LocalField/Completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function completion(K::AbsSimpleNumField, P::AbsNumFieldOrderIdeal{AbsSimpleNumF
e = ramification_index(P)
prec_padics = div(precision+e-1, e)
if isnothing(Qp)
Qp = PadicField(minimum(P), prec_padics, cached = false)
Qp = padic_field(minimum(P), precision = prec_padics, cached = false)
end
Zp = maximal_order(Qp)
Qq, gQq = unramified_extension(Qp, f, precision = prec_padics, cached = false)
Expand Down Expand Up @@ -383,7 +383,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 @@ -442,7 +442,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 @@ -494,8 +494,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
2 changes: 1 addition & 1 deletion src/LocalField/LocalField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,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 @@ -748,7 +748,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 = change_base_ring(f, L, Lt)
gL = change_base_ring(g, L, Lt)
Expand Down
2 changes: 1 addition & 1 deletion src/LocalField/qAdic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ end

# TODO: this should be in Nemo
@attr PadicField function base_field(K::QadicField)
return PadicField(prime(K), precision(K), cached = false)
return padic_field(prime(K), precision = precision(K), cached = false)

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

View check run for this annotation

Codecov / codecov/patch

src/LocalField/qAdic.jl#L104

Added line #L104 was not covered by tests
end
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 @@ function disc_log_mod(a::ZZRingElem, b::ZZRingElem, M::ZZRingElem)
@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
20 changes: 10 additions & 10 deletions test/LocalField/LocalField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@test absolute_degree(L) == 4
@test prime(L) == 2

Q2 = PadicField(2, 10)
Q2 = padic_field(2, precision = 10)
Q2s, s = polynomial_ring(Q2, "s")
f = s^2+s+1
Ku, c = local_field(f, "s", Hecke.UnramifiedLocalField, check = false)
Expand All @@ -39,7 +39,7 @@
end

@testset "Norm" begin
K = QadicField(3, 4, 10)[1]
K = qadic_field(3, 4, precision = 10)[1]
Kx, x = polynomial_ring(K, "x")
L = eisenstein_extension(x^20+3)[1]
b = @inferred basis(L)
Expand Down Expand Up @@ -125,7 +125,7 @@


@testset "Exp and Log" begin
K = PadicField(2, 100)
K = padic_field(2, precision = 100)
Kx, x = polynomial_ring(K, "x", cached = false)
L, b = eisenstein_extension(x^7+2, :a)
pi = uniformizer(L)
Expand All @@ -140,7 +140,7 @@
@test iszero(logexp - el) || valuation(logexp - el) > 80 #need improving
end

KK, a = QadicField(2, 2, 16)
KK, a = qadic_field(2, 2, precision = 16)
KKx, x = KK["x"]
f = x + 2^1 + 2^2 + 2^3 + 2^4 + 2^5 + 2^6 + 2^7 + 2^8 + 2^9 + 2^10 + 2^11 + 2^12 + 2^13 + 2^14 + 2^15
L, b = eisenstein_extension(f, "b");
Expand All @@ -150,7 +150,7 @@

@testset "Maps" begin
# QadicField -> QadicField
Qq, a = QadicField(2, 3, 100)
Qq, a = qadic_field(2, 3, precision = 100)
rt = roots(map_coefficients(Qq, defining_polynomial(Qq)))

i = findfirst(x -> x == a, rt)
Expand Down Expand Up @@ -200,7 +200,7 @@
@test f(z) == L(-2)

# LocalField -> QadicField
Qp = PadicField(2, 100)
Qp = padic_field(2, precision = 100)
Qpx, x = polynomial_ring(Qp)
K, a = unramified_extension(x^2+x+1)
Qq, gQq = unramified_extension(Qp, 2, precision = 100)
Expand All @@ -216,11 +216,11 @@
end

@testset "Automorphisms" begin
K = PadicField(2, 200)
K = padic_field(2, precision = 200)
Kt, t = polynomial_ring(K)
L, b = eisenstein_extension(t^2+2, "a")
@test length(automorphism_list(L)) == 2
Qq, a = QadicField(2, 2, 100)
Qq, a = qadic_field(2, 2, precision = 100)
@test length(automorphism_list(Qq)) == 2
Qqx, x = polynomial_ring(Qq)
L, b = eisenstein_extension(x^3+2, "a")
Expand Down Expand Up @@ -260,7 +260,7 @@
end

@testset "extend extend extend" begin
K, = QadicField(5, 2, 10)
K, = qadic_field(5, 2, precision = 10)
L, = unramified_extension(K, 3)
M, = unramified_extension(L, 3)
end
Expand All @@ -274,7 +274,7 @@
@test length(automorphism_list(k3)) == 3

@testset "image of one units under log" begin
Qp = PadicField(3, 10)
Qp = padic_field(3, precision = 10)
Qpt, t = Qp["t"]
E, a = eisenstein_extension(t^2 - 3)
n, x = Hecke.image_of_logarithm_one_units(E)
Expand Down
6 changes: 3 additions & 3 deletions test/LocalField/Poly.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@testset "Poly" begin

K = PadicField(2, 100)
K = padic_field(2, precision = 100)
Kx, x = polynomial_ring(K, "x")
L, gL = eisenstein_extension(x^2+2, "a")

Expand Down Expand Up @@ -80,7 +80,7 @@
end

@testset "Roots" begin
_, t = PadicField(3, 10)["t"]
_, t = padic_field(3, precision = 10)["t"]
f = ((t-1+81)*(t-1+2*81))
rt = roots(f)
@test length(rt) == 2
Expand All @@ -89,7 +89,7 @@
end

@testset "Resultant" begin
R, x = polynomial_ring(PadicField(853, 2), "x")
R, x = polynomial_ring(padic_field(853, precision = 2), "x")
a = 4*x^5 + x^4 + 256*x^3 + 192*x^2 + 48*x + 4
b = derivative(a)
rab = @inferred resultant(a, b)
Expand Down

0 comments on commit f2ab7d9

Please sign in to comment.