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
Improvement_of_dup_zz_mignotte_bound(f, K) #19254
Changes from 4 commits
8adfdbe
68f7405
cfffcd1
c9aeae8
2a4c9dd
1daa06f
5332a98
9509193
9bb4c81
eaf5403
f5c9620
6f60e90
49a41e3
ad5638b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ | |
|
||
from sympy.ntheory import nextprime, isprime, factorint | ||
from sympy.utilities import subsets | ||
from sympy import binomial | ||
|
||
from math import ceil as _ceil, log as _log | ||
|
||
|
@@ -124,13 +125,33 @@ def dmp_trial_division(f, factors, u, K): | |
|
||
|
||
def dup_zz_mignotte_bound(f, K): | ||
"""Mignotte bound for univariate polynomials in `K[x]`. """ | ||
a = dup_max_norm(f, K) | ||
b = abs(dup_LC(f, K)) | ||
n = dup_degree(f) | ||
""" | ||
The Knuth-Cohen variant of Mignotte bound for | ||
univariate polynomials in `K[x]`. | ||
|
||
return K.sqrt(K(n + 1))*2**n*a*b | ||
References | ||
========== | ||
|
||
..[1] [Abbott2013]_ | ||
|
||
""" | ||
d = dup_degree(f) | ||
delta = _ceil( d / 2 ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In SymPy, no space is added after |
||
|
||
# euclidean-norm | ||
eucl_norm = K.sqrt( sum( [cf**2 for cf in f] ) ) | ||
|
||
# biggest values of binomial coefficients (p. 538 of reference) | ||
t1 = binomial( delta - 1, _ceil( delta / 2 ) ) | ||
lagamura marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would consider defining something like |
||
t2 = binomial( delta - 1, _ceil( delta / 2 ) - 1 ) | ||
|
||
lc = abs( dup_LC(f, K) ) # leading coefficient | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In principle, this could probably have |
||
|
||
bound = t1 * eucl_norm + t2 * lc # (p. 538 of reference) | ||
|
||
bound = _ceil( bound / 2 ) * 2 # round up to even integer | ||
|
||
return bound + dup_max_norm(f, K) # add max_coeff for irreducible polys | ||
|
||
def dmp_zz_mignotte_bound(f, u, K): | ||
"""Mignotte bound for multivariate polynomials in `K[X]`. """ | ||
|
@@ -1147,7 +1168,7 @@ def dmp_ext_factor(f, u, K): | |
return lc, [] | ||
|
||
f, F = dmp_sqf_part(f, u, K), f | ||
s, g, r = dmp_sqf_norm(F, u, K) | ||
s, g, r = dmp_sqf_norm(f, u, K) | ||
|
||
factors = dmp_factor_list_include(r, u, K.dom) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ def test_dmp_trial_division(): | |
|
||
def test_dup_zz_mignotte_bound(): | ||
R, x = ring("x", ZZ) | ||
assert R.dup_zz_mignotte_bound(2*x**2 + 3*x + 4) == 32 | ||
assert R.dup_zz_mignotte_bound(2*x**2 + 3*x + 4) == 6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps there could be a couple of more examples, preferable with comments on actual bounds for comparison. |
||
|
||
|
||
def test_dmp_zz_mignotte_bound(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears to be a public function. So,
Parameters
andExamples
sections can be added in the doc strings.