From 1c1764efc31e4ad62b0abc2fc97c1b0c477717f2 Mon Sep 17 00:00:00 2001 From: Claus Fieker Date: Wed, 9 Oct 2024 10:03:22 +0200 Subject: [PATCH] fix Oscar #4170 - too low precision in factoring --- src/NumField/NfAbs/Poly.jl | 2 +- src/NumField/NfAbs/PolyFact.jl | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/NumField/NfAbs/Poly.jl b/src/NumField/NfAbs/Poly.jl index e29207fd3b..ed8b8e745b 100644 --- a/src/NumField/NfAbs/Poly.jl +++ b/src/NumField/NfAbs/Poly.jl @@ -522,7 +522,7 @@ function cld_bound(f::PolyRingElem{AbsSimpleNumFieldElem}, k::Vector{Int}) g = Zx() n = degree(base_ring(f)) for i=0:degree(f) - setcoeff!(g, i, Hecke.upper_bound(ZZRingElem, sqrt(t2(coeff(f, i))//n))) + setcoeff!(g, i, Hecke.upper_bound(ZZRingElem, sqrt(t2(coeff(f, i))))) end if is_monic(f) setcoeff!(g, degree(f), ZZRingElem(1)) diff --git a/src/NumField/NfAbs/PolyFact.jl b/src/NumField/NfAbs/PolyFact.jl index 2a38a9c8df..cac4249e70 100644 --- a/src/NumField/NfAbs/PolyFact.jl +++ b/src/NumField/NfAbs/PolyFact.jl @@ -558,6 +558,7 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId _, mK = residue_field(order(P), P) mK = extend(mK, K) r = length(factor(map_coefficients(mK, f, cached = false))) + prec_scale = max(r, prec_scale) N = degree(f) @vprintln :PolyFactor 1 "Having $r local factors for degree $N" @@ -589,7 +590,7 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId - the bounds are monotonous in the abs value of the coeffs (I think they are using abs value of coeff) - the math works for real coeffs as well - thus create an ZZPolyRingElem with pos. coeffs. containing upper bounds of the conjugates of the - coeffs. DOne via T_2: sqrt(n*T_2(alpha) is an upper bounds for all conjugates + coeffs. Done via T_2: sqrt(T_2(alpha) is an upper bounds for all conjugates - Fieker/ Friedrichs compares T_2 vs 2-norm (squared) of coeffs - leading coeff as well as den are algebraic CHECK: den*lead*cld in Z[alpha] (or in the order used) @@ -603,7 +604,7 @@ function van_hoeij(f::PolyRingElem{AbsSimpleNumFieldElem}, P::AbsNumFieldOrderId # 2nd block is for additional bits for rounding? bb = landau_mignotte_bound(f)*upper_bound(ZZRingElem, sqrt(t2(den*leading_coefficient(f)))) #CHECK: landau... is a bound on the (abs value) of the coeffs of the factors, - # need everywhere sqrt(n*T_2)? to get conjugate bounds + # need everywhere sqrt(T_2)? to get conjugate bounds kk = ceil(Int, degree(K)/2/log(norm(P))*(log2(c1*c2) + 2*nbits(bb))) @vprintln :PolyFactor 2 "using CLD precision bounds $b"