Révision 91

pobysoPythonSage/src/sageMpfr.spyx (revision 91)
9 9
# from the Sage real_mpfr.pyx file.
10 10
# Notes:
11 11
# - notice how #define constants are imported.
12
# - mpfr_min_prec is declared with an unsigned int return value, not
12
# - mpfr_min_prec() is declared with an unsigned int return value, not
13 13
#   a mpfr_prec_t since it is not recognized as type in Cython.
14 14
cdef extern from "mpfr.h":
15 15
    cdef int MPFR_PREC_MIN "MPFR_PREC_MIN"
pobysoPythonSage/src/sollya_lib.sage (revision 91)
143 143
#retc = cast(retc, POINTER(c_int)).contents
144 144
#arg = sollya_lib_constant_from_int(int(retc))
145 145
#retc = sollya_lib_autoprint(arg, None)
146
#sollya_lib_set_prec(c_int(100))
146
#sollya_lib_set_prec(c_int(100))
pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage (revision 91)
165 165
    pTdegree = p.degree(pVariables[1])
166 166
    currentIdegree = currentPolynomial.degree(iVariable)
167 167
    nAtPower = N^alpha
168
    nAtAlpha = nAtPower
168 169
    # We work from p^0 * N^alpha to p^alpha * N^0
169 170
    for pPower in xrange(0, alpha + 1):
170 171
        # pPower == 0 is a special case. We introduce all the monomials but one
......
185 186
                                                             pPower, 
186 187
                                                             alpha)
187 188
                    currentExpression = iVariable^iPower * \
188
                                        tVariable^tPower * nAtPower
189
                                        tVariable^tPower * nAtAlpha
189 190
                    # polynomialAtPower == 1 here. Next line should be commented
190 191
                    # out but it does not work! Some conversion problem?
191
                    currentPolynomial = pRing(currentExpression) * \
192
                                        polynomialAtPower 
192
                    currentPolynomial = pRing(currentExpression)
193 193
                    pMonomials = currentPolynomial.monomials()
194 194
                    pCoefficients = currentPolynomial.coefficients()
195 195
                    spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
......
250 250
                                                         tPower, 
251 251
                                                         0,  
252 252
                                                         alpha)
253
                currentExpression = i^(iPower * pIdegree) * t^tPower * nAtPower
253
                currentExpression = i^(iPower * pIdegree) * t^tPower * nAtAlpha
254 254
                currentPolynomial = pRing(currentExpression)
255 255
                pMonomials = currentPolynomial.monomials()
256 256
                pCoefficients = currentPolynomial.coefficients()
......
282 282
                                                             outerTpower,
283 283
                                                             0,
284 284
                                                             alpha)
285
                    currentExpression = i^iPower * t^outerTpower * nAtPower
285
                    currentExpression = i^iPower * t^outerTpower * nAtAlpha
286 286
                    currentPolynomial = pRing(currentExpression)
287 287
                    pMonomials = currentPolynomial.monomials()
288 288
                    pCoefficients = currentPolynomial.coefficients()
......
313 313
                                                                     0,
314 314
                                                                     alpha) 
315 315
                            currentExpression = \
316
                                    i^(iPower) * t^(innerTpower) * nAtPower
316
                                    i^(iPower) * t^(innerTpower) * nAtAlpha
317 317
                            currentPolynomial = pRing(currentExpression)
318 318
                            pMonomials = currentPolynomial.monomials()
319 319
                            pCoefficients = currentPolynomial.coefficients()
......
393 393
    """
394 394
    Create a row (each column holds the evaluation one monomial at boundVar1 and
395 395
    boundVar2 values) matrix.
396
    protoMatrixRows.
397 396
    
398 397
    Parameters
399 398
    ----------
......
402 401
    numRows = len(protoMatrixRows)
403 402
    if numRows == 0:
404 403
        return None
404
    # The last row is the longest one.
405 405
    numColumns = len(protoMatrixRows[numRows-1])
406 406
    if numColumns == 0:
407 407
        return None
pobysoPythonSage/src/sageSLZ/sageSLZ.sage (revision 91)
356 356
    
357 357
    :returns: a 4 elements tuple:
358 358
                - the polynomial;
359
                - the module (N);
359
                - the modulus (N);
360
                - the t bound;
360 361
                - the lcm used to compute the integral coefficients and the 
361 362
                  module.
362 363
    """
......
364 365
    IP = PolynomialRing(ZZ, name=str(variable1) + "," + str(variable2))
365 366
    # Coefficients are issued in the increasing power order.
366 367
    ratPolyCoefficients = ratPolyOfInt.coefficients()
368
    # Print the reversed list for debugging.
369
    print ratPolyCoefficients[::-1]
367 370
    # Build the list of number we compute the lcmm of.
368 371
    coefficientDenominators = sro_denominators(ratPolyCoefficients)
369 372
    coefficientDenominators.append(2^precision)
......
371 374
    leastCommonMultiple = lcm(coefficientDenominators)
372 375
    # Compute the expression corresponding to the new polynomial
373 376
    coefficientNumerators =  sro_numerators(ratPolyCoefficients)
374
    print coefficientNumerators
377
    #print coefficientNumerators
375 378
    polynomialExpression = 0
376 379
    power = 0
377 380
    # Iterate over two lists at the same time, stop when the shorter is
......
385 388
    polynomialExpression += - variable2
386 389
    return (IP(polynomialExpression),
387 390
            leastCommonMultiple / 2^precision, # 2^K or N.
388
            leastCommonMultiple / 2 ^(targetHardnessToRound + 1), # tBound
389
            leastCommonMultiple)
391
            leastCommonMultiple / 2^(targetHardnessToRound + 1), # tBound
392
            leastCommonMultiple) # If we want to make test computations.
390 393
        
391 394
# End slz_ratPoly_of_int_to_poly_for_coppersmith
392 395

  
......
401 404
    respectively, the "right" power.
402 405
    """
403 406
    polynomialField = ratPolyOfRat.parent()
404
    polynomialVariable = rationalPolynomial.variables()[0]
405
    print "The polynomial field is:", polynomialField
407
    polynomialVariable = ratPolyOfRat.variables()[0]
408
    #print "The polynomial field is:", polynomialField
406 409
    return \
407
        polynomialField(rationalPolynomial.subs({polynomialVariable : \
410
        polynomialField(ratPolyOfRat.subs({polynomialVariable : \
408 411
                                   polynomialVariable/2^(precision-1)}))
409 412
    
410 413
    # Return a tuple:

Formats disponibles : Unified diff