From b7ea8697cb516a90126ceab7c56b0737b3ed5691 Mon Sep 17 00:00:00 2001 From: Claus Fieker Date: Fri, 22 Mar 2024 10:56:36 +0100 Subject: [PATCH 1/2] add xxgcd, make_exact and fix canonical unit canonical unit for QadicRing was retuning the inv of what it should. The spec is return u s.th. x/u is canonical, so for fields u = x is legal. xxgcd and make_exact are using AA in shf/hnf --- src/Hecke.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Hecke.jl b/src/Hecke.jl index a4da653ada..c50a3aa21b 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -74,6 +74,7 @@ using Pkg import AbstractAlgebra import AbstractAlgebra: get_cached!, @alias +import AbstractAlgebra: xxgcd, make_exact import AbstractAlgebra: pretty, Lowercase, LowercaseOff, Indent, Dedent, terse, is_terse From a331534e589f7aaee9c3901d554c06e02462c892 Mon Sep 17 00:00:00 2001 From: Claus Fieker Date: Wed, 9 Oct 2024 10:03:22 +0200 Subject: [PATCH 2/2] 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"