14 |
14 |
degree, targetHardnessToRound, alpha):
|
15 |
15 |
"""
|
16 |
16 |
Check an Hard-to-round value.
|
|
17 |
TODO::
|
|
18 |
Full rewriting: this is hardly a draft.
|
17 |
19 |
"""
|
18 |
20 |
polyApproxPrec = targetHardnessToRound + 1
|
19 |
21 |
polyTargetHardnessToRound = targetHardnessToRound + 1
|
... | ... | |
100 |
102 |
"""
|
101 |
103 |
# Check the parameters.
|
102 |
104 |
# RealNumbers only.
|
103 |
|
classTree = [number.__class__] + number.mro()
|
104 |
|
if not sage.rings.real_mpfr.RealNumber in classTree:
|
|
105 |
try:
|
|
106 |
classTree = [number.__class__] + number.mro()
|
|
107 |
if not sage.rings.real_mpfr.RealNumber in classTree:
|
|
108 |
return None
|
|
109 |
except AttributeError:
|
105 |
110 |
return None
|
106 |
111 |
# Non zero negative integers only for emin.
|
107 |
112 |
if emin >= 0 or int(emin) != emin:
|
... | ... | |
178 |
183 |
For a given set of arguments (see below), compute a list
|
179 |
184 |
of "reduced polynomials" that could be used to compute roots
|
180 |
185 |
of the inputPolynomial.
|
|
186 |
INPUT:
|
|
187 |
|
|
188 |
- "inputPolynomial" -- (no default) a bivariate integer polynomial;
|
|
189 |
- "alpha" -- the alpha parameter of the Coppersmith algorithm;
|
|
190 |
- "N" -- the modulus;
|
|
191 |
- "iBound" -- the bound on the first variable;
|
|
192 |
- "tBound" -- the bound on the second variable.
|
|
193 |
|
|
194 |
OUTPUT:
|
|
195 |
|
|
196 |
A list of bivariate integer polynomial obtained using the Coppersmith
|
|
197 |
algorithm. The polynomials correspond to the rows of the LLL-reduce
|
|
198 |
reduced base that comply with the Coppersmith condition.
|
|
199 |
|
|
200 |
TODO::
|
|
201 |
Full rewrite, this is barely a draft.
|
181 |
202 |
"""
|
182 |
203 |
# Arguments check.
|
183 |
204 |
if iBound == 0 or tBound == 0:
|
... | ... | |
253 |
274 |
"""
|
254 |
275 |
For a given set of arguments (see below), compute the polynomial modular
|
255 |
276 |
roots, if any.
|
|
277 |
|
256 |
278 |
"""
|
257 |
279 |
# Arguments check.
|
258 |
280 |
if iBound == 0 or tBound == 0:
|
... | ... | |
380 |
402 |
precision is reached.
|
381 |
403 |
The polynomial, the bounds, the center of the interval and the error
|
382 |
404 |
are returned.
|
|
405 |
OUTPU:
|
|
406 |
A tuple made of 4 Sollya objects:
|
|
407 |
- a polynomial;
|
|
408 |
- an range (an interval, not in the sense of number given as an interval);
|
|
409 |
- the center of the interval;
|
|
410 |
- the maximum error in the approximation of the input functionSo by the
|
|
411 |
output polynomial ; this error <= approxPrecSaS.
|
|
412 |
|
383 |
413 |
"""
|
384 |
414 |
RRR = lowerBoundSa.parent()
|
385 |
415 |
intervalShrinkConstFactorSa = RRR('0.5')
|