Révision 240 pobysoPythonSage/src/pobyso.py

pobyso.py (revision 240)
413 413
    """
414 414
    return sollya_lib_evaluate(funcSo, argumentSo)
415 415
# End pobyso_evaluate_so_so.
416
#
417
def pobyso_diff_so_so(funcSo):
418
    """
419
    Very thin wrapper around sollya_lib_diff.
420
    """
421
    ## TODO: add a check to make sure funcSo is a functional expression.
422
    return sollya_lib_diff(funcSo)
416 423

  
417 424
def pobyso_dirty_find_zeros_so_so(funcSo, rangeSo):
418 425
    """
......
432 439

  
433 440
def pobyso_float_list_so_sa(listSo):
434 441
    """
435
    Return a Sollya list of floating-point as a Sage list of 
442
    Return a Sollya list of floating-point numbers as a Sage list of 
436 443
    floating-point numbers.
444
    TODO: add a test to make sure that each element of the list is a constant.
437 445
    """
438 446
    listSa   = []
439 447
    ## The function returns none if the list is empty or an error has happened.
440 448
    retVal = pobyso_get_list_elements_so_so(listSo)
441 449
    if retVal is None:
442 450
        return listSa
443
    ## Just in case the interface is changed and an empty list is returned.
451
    ## Just in case the interface is changed and an empty list is returned 
452
    #  instead of None.
444 453
    elif len(retVal) == 0:
445 454
        return listSa
446 455
    else:
447 456
        ## Remember pobyso_get_list_elements_so_so returns more information
448
        #  than just the elements of the list (# elements, is_ellipti)
457
        #  than just the elements of the list (# elements, is_elliptic)
449 458
        listSaSo, numElements, isEndElliptic = retVal
459
    ## Return an empty list.
450 460
    if numElements == 0:
451 461
        return listSa
452 462
    ## Search first for the maximum precision of the elements
453 463
    maxPrecSa = 0
454 464
    for floatSo in listSaSo:
455
        pobyso_autoprint(floatSo)
465
        #pobyso_autoprint(floatSo)
456 466
        curPrecSa =  pobyso_get_prec_of_constant_so_sa(floatSo)
457 467
        if curPrecSa > maxPrecSa:
458 468
            maxPrecSa = curPrecSa
......
1484 1494
        pobyso_get_interval_from_range_so_sa(rangeSo, realIntervalFieldSa) 
1485 1495
    return intervalSa
1486 1496
# End pobyso_range_to_interval_so_sa
1487

  
1497
#
1498
def pobyso_relative_so_so():
1499
    """
1500
    Very thin wrapper around the sollya_lib_relative function.
1501
    """
1502
    return sollya_lib_relative()
1503
# End pobyso_relative_so_so
1504
#
1488 1505
def pobyso_rat_poly_sa_so(polySa, precSa = None):
1489 1506
    """
1490 1507
    Create a Sollya polynomial from a Sage rational polynomial.
......
1710 1727
        sollya_lib_clear_obj(qualitySo)
1711 1728
    return(remezPolySo)
1712 1729
# End pobyso_remez_exponentsList_sa_so
1730
#
1731
def pobyso_round_coefficients_so_so(polySo, truncFormatListSo):
1732
    """
1733
    A wrapper around the "classical" sollya_lib_roundcoefficients: a Sollya
1734
    polynomial and a Sollya list are given as arguments.
1735
    """
1736
    return sollya_lib_roundcoefficients(polySo, truncFormatListSo)
1713 1737

  
1714

  
1715 1738
def pobyso_round_coefficients_progressive_so_so(polySo, 
1716 1739
                                                funcSo,
1717 1740
                                                precSo,
......
1825 1848
    # End while True
1826 1849
# End pobyso_round_coefficients_progressive_so_so
1827 1850
    
1828
def pobyso_round_coefficients_single_so_so(polySo, precSo):
1851
def pobyso_round_coefficients_single_so_so(polySo, commonPrecSo):
1829 1852
    """
1830 1853
    Create a rounded coefficients polynomial from polynomial argument to
1831 1854
    the number of bits in size argument.
1832 1855
    All coefficients are set to the same precision.
1833 1856
    """
1834 1857
    ## TODO: check arguments.
1835
    endEllipListSo = pobyso_build_end_elliptic_list_so_so(precSo)
1858
    endEllipListSo = pobyso_build_end_elliptic_list_so_so(commonPrecSo)
1836 1859
    polySo = sollya_lib_roundcoefficients(polySo, endEllipListSo, None)
1837 1860
    sollya_lib_clear_obj(endEllipListSo)
1838 1861
    #sollya_lib_clear_obj(endEllipListSo)

Formats disponibles : Unified diff