Révision 90 pobysoPythonSage/src/sageSLZ/sageSLZ.sage

sageSLZ.sage (revision 90)
1
"""
2
module: sageSLZ.sage
3

  
4
Sage core function needed for the implementation of SLZ.
5

  
6
Created on 2013-08
7

  
8
moduleauthor:: S.T.
9
"""
1 10
print "sageSLZ loading..."
2 11
def slz_compute_polynomial_and_interval(functionSo, degreeSo, lowerBoundSa, 
3 12
                                        upperBoundSa, approxPrecSa, 
......
331 340
                                                variable1,
332 341
                                                variable2):
333 342
    """
334
    Creates a new polynomial with integer coefficients for use with the
335
    Coppersmith method.
343
    Creates a new multivariate polynomial with integer coefficients for use
344
     with the Coppersmith method.
336 345
    A the same time it computes :
337 346
    - 2^K (N);
338
    - 2^k
347
    - 2^k (bound on the second variable)
339 348
    - lcm
349

  
350
    :param ratPolyOfInt: a polynomial with rational coefficients and integer
351
                         variables.
352
    :param precision: the precision of the floating-point coefficients.
353
    :param targetHardnessToRound: the hardness to round we want to check.
354
    :param variable1: the first variable of the polynomial (an expression).
355
    :param variable2: the second variable of the polynomial (an expression).
356
    
357
    :returns: a 4 elements tuple:
358
                - the polynomial;
359
                - the module (N);
360
                - the lcm used to compute the integral coefficients and the 
361
                  module.
340 362
    """
341 363
    # Create a new integer polynomial ring.
342 364
    IP = PolynomialRing(ZZ, name=str(variable1) + "," + str(variable2))
......
346 368
    coefficientDenominators = sro_denominators(ratPolyCoefficients)
347 369
    coefficientDenominators.append(2^precision)
348 370
    coefficientDenominators.append(2^(targetHardnessToRound + 1))
349
    # Compute the lcm
350 371
    leastCommonMultiple = lcm(coefficientDenominators)
351 372
    # Compute the expression corresponding to the new polynomial
352 373
    coefficientNumerators =  sro_numerators(ratPolyCoefficients)

Formats disponibles : Unified diff