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

Deprecate coefficient_ring for the p-adics #1759

Merged
merged 2 commits into from
Sep 18, 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: 4 additions & 0 deletions src/Deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ end
@deprecate is_power(x::IntegerUnion) is_perfect_power_with_data(x)
@deprecate is_power(x::QQFieldElem) is_perfect_power_with_data(x)
@deprecate is_power(x::Rational) is_perfect_power_with_data(x)

# Deprecated in 0.47
@deprecate coefficient_ring(k::PadicField) base_field(k)
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
@deprecate coefficient_ring(k::QadicField) base_field(k)
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 0 additions & 3 deletions src/flint/padic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ degree(::PadicField) = 1

base_field(k::PadicField) = k

# TODO: Remove in the next minor/breaking release
coefficient_ring(k::PadicField) = base_field(k)

# Return generators of k "over" K
function gens(k::PadicField, K::PadicField)
@assert k === K
Expand Down
22 changes: 10 additions & 12 deletions src/flint/qadic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@
return z
end

# TODO: For the next minor/breaking release, rename this to base_field and
# deprecate coefficient_ring (and remove the corresponding base_field in Hecke)
function coefficient_ring(K::QadicField)
function base_field(K::QadicField)
L = get_attribute!(K, :base_field) do
return PadicField(prime(K), precision(K), cached = false)
end::PadicField
Expand Down Expand Up @@ -226,7 +224,7 @@
end

function expressify(b::QadicFieldElem, x = var(parent(b)); context = nothing)
R = coefficient_ring(parent(b))
R = base_field(parent(b))
if iszero(b)
return 0
end
Expand Down Expand Up @@ -678,13 +676,13 @@
###############################################################################

function tr(r::QadicFieldElem)
t = coefficient_ring(parent(r))()
t = base_field(parent(r))()

Check warning on line 679 in src/flint/qadic.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/qadic.jl#L679

Added line #L679 was not covered by tests
ccall((:qadic_trace, libflint), Nothing, (Ref{PadicFieldElem}, Ref{QadicFieldElem}, Ref{QadicField}), t, r, parent(r))
return t
end

function norm(r::QadicFieldElem)
t = coefficient_ring(parent(r))()
t = base_field(parent(r))()

Check warning on line 685 in src/flint/qadic.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/qadic.jl#L685

Added line #L685 was not covered by tests
ccall((:qadic_norm, libflint), Nothing, (Ref{PadicFieldElem}, Ref{QadicFieldElem}, Ref{QadicField}), t, r, parent(r))
return t
end
Expand Down Expand Up @@ -844,7 +842,7 @@
end

function coeff(x::QadicFieldElem, i::Int)
R = coefficient_ring(parent(x))
R = base_field(parent(x))
c = R()
ccall((:padic_poly_get_coeff_padic, libflint), Nothing,
(Ref{PadicFieldElem}, Ref{QadicFieldElem}, Int, Ref{QadicField}), c, x, i, parent(x))
Expand All @@ -861,7 +859,7 @@
end

function setcoeff!(x::QadicFieldElem, i::Int, y::ZZRingElem)
R = coefficient_ring(parent(x))
R = base_field(parent(x))
Y = R(ZZRingElem(y))
ccall((:padic_poly_set_coeff_padic, libflint), Nothing,
(Ref{QadicFieldElem}, Int, Ref{PadicFieldElem}, Ref{QadicField}), x, i, Y, parent(x))
Expand Down Expand Up @@ -938,7 +936,7 @@

function setprecision!(Q::QadicField, n::Int)
Q.prec_max = n
setprecision!(coefficient_ring(Q), n)
setprecision!(base_field(Q), n)
return Q
end

Expand All @@ -962,14 +960,14 @@
function with_precision(f, K::QadicField, n::Int)
@assert n >= 0
old = precision(K)
old_base = precision(coefficient_ring(K))
old_base = precision(base_field(K))
setprecision!(K, n)
setprecision!(coefficient_ring(K), n)
setprecision!(base_field(K), n)
v = try
f()
finally
setprecision!(K, old)
setprecision!(coefficient_ring(K), old_base)
setprecision!(base_field(K), old_base)
end
return v
end
Expand Down
10 changes: 5 additions & 5 deletions test/flint/qadic-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Qp = padic_field(7, cached = false)
K, _ = unramified_extension(Qp, 2)
@test isa(K, QadicField)
@test coefficient_ring(K) === Qp
@test base_field(K) === Qp

R, _ = qadic_field(7, 1, precision = 30)

Expand Down Expand Up @@ -396,8 +396,8 @@ end

@testset "QadicFieldElem.base_field" begin
L, _ = QadicField(7, 2, 10)
@test coefficient_ring(L) isa PadicField
@test prime(coefficient_ring(L)) == 7
@test base_field(L) isa PadicField
@test prime(base_field(L)) == 7
end

@testset "QadicField.setprecision" begin
Expand All @@ -421,7 +421,7 @@ end
a = one(K)
return coeff(a, 0) + 1
end
@test parent(b) === coefficient_ring(K)
@test parent(b) === base_field(K)
@test precision(b) == 30

a = 1 + 2 + 2^2 + O(K, 2^3)
Expand All @@ -444,7 +444,7 @@ end

@testset "QadicField.as_polynomial" begin
L, _ = qadic_field(5, 4)
K = coefficient_ring(L)
K = base_field(L)
Kx, x = K["x"]

for i in 1:100
Expand Down
Loading