Skip to content
Snippets Groups Projects
Commit 70c926b7 authored by Krueger Jasmin's avatar Krueger Jasmin
Browse files

added a function that truncates in both variables

parent 6fcbf37e
No related merge requests found
......@@ -386,15 +386,13 @@ function hensel_validate(l::Int, f::PolyElem, g::PolyElem, h::PolyElem; ϵ=1e-10
e = g*h -f
(q,r) = fastdivrem(s*e,h,l,validation = true)
δ_g = t*e +q*g
BivPolMod!(δ_g,l)
δ_g = truncate(δ_g,dg+1)
δ_g = trunc(δ_g,dg+1,l)
abs_coefficientwise!(δ_g)
δ_g = mag_coefficientwise(δ_g)
@show δ_g
δ_h = r
BivPolMod!(δ_h,l)
δ_h = truncate(δ_h,dh+1)
δ_h = trunc(δ_h,dh+1,l)
abs_coefficientwise!(δ_h)
δ_h = mag_coefficientwise(δ_h)
@show δ_h
......@@ -415,11 +413,9 @@ function hensel_validate(l::Int, f::PolyElem, g::PolyElem, h::PolyElem; ϵ=1e-10
BivPolMod!(e,l)
(q,r) = fastdivrem(s*e,h,l,validation = true)
gg = g + t*e + q*g
BivPolMod!(gg,l)
gg = truncate(gg,dg+1)
gg = trunc(gg,dg+1,l)
hh = h + r
BivPolMod!(hh,l)
hh = truncate(hh,dh+1)
hh = trunc(hh,dh+1,l)
#@show isless_coefficientwise(extract_radius(hh)-extract_radius(h),η_h)
#@show extract_radius(hh)-extract_radius(h)
#@show η_h
......@@ -436,11 +432,9 @@ function hensel_validate(l::Int, f::PolyElem, g::PolyElem, h::PolyElem; ϵ=1e-10
BivPolMod!(b,l)
(c,d) = fastdivrem(s*b,h,l,validation = true)
s = s-d
s = truncate(s,ds+1)
BivPolMod!(s,l)
s = trunc(s,ds+1,l)
t = t-t*b-c*g
t = truncate(t,dt+1)
BivPolMod!(t,l)
t = trunc(t,dt+1,l)
end
print("no convergence\n")
(g,h)
......
......@@ -440,3 +440,14 @@ function replace_zeros!(p::PolyElem{T}, d, dp = -1, k = -1) where T
end
p
end
"""
trunc(p::PolyElem, k::Int, l::Int)
Truncate p in mod y^k mod x^l
"""
function trunc(p::PolyElem, k::Int, l::Int)
q = truncate(p,k)
BivPolMod!(q,l)
q
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment