Skip to content

Commit

Permalink
Local trivia (#1220)
Browse files Browse the repository at this point in the history
* add attributes so some fields

* "fix" precision settings

solves Tommy's log problem
Underlying problem:
  map_coefficients is clever: a zero coefficient is mapped
  to zero(target), thus when applying it with
    x->setprecision(x, new)
  the target precision is ignored and the ring precision is used
  instead
  • Loading branch information
fieker authored Sep 21, 2023
1 parent 9de3b38 commit 0403770
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/LocalField/Elem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,9 @@ function Base.:(^)(a::LocalFieldElem, n::Int)
e = absolute_ramification_index(parent(a))
v = valuation(n, prime(parent(a)))
if v > 0
b = setprecision(a.data, precision(a.data)+v)
b = setprecision(base_ring(a.data), precision(a.data)+v) do
setprecision(a.data, precision(a.data)+v)
end
else
b = a.data
end
Expand Down
2 changes: 1 addition & 1 deletion src/LocalField/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ abstract type EisensteinLocalField <: LocalFieldParameter end
abstract type UnramifiedLocalField <: LocalFieldParameter end
abstract type GenericLocalField <: LocalFieldParameter end

mutable struct LocalField{S, T} <: NonArchLocalField
@attributes mutable struct LocalField{S, T} <: NonArchLocalField
def_poly::Function #Int -> Poly at prec n
def_poly_cache::Dict{Int, Generic.Poly{S}}
S::Symbol
Expand Down
11 changes: 11 additions & 0 deletions test/LocalField/LocalField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,15 @@
n, x = Hecke.image_of_logarithm_one_units(Qp)
@test n == 1 && length(x) == 1
end

@testset "log problems" begin
Qx, x = QQ["x"]
f = x^4 - 52*x^2 + 26
K, a = number_field(f; cached = false)
u = 1//5*a^2 - 51//5
OK = maximal_order(K)
P = prime_decomposition(OK, 2)[1][1]
C, mC = completion(K, P)
@test valuation(log(mC(u))) == 1//2
end
end

0 comments on commit 0403770

Please sign in to comment.