Révision 225

pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage (revision 225)
2610 2610
                                                        lb,
2611 2611
                                                        ub,
2612 2612
                                                        polyApproxAccur)
2613
        if prceSo is None:
2614
            raise Exception("Could not compute an approximation polynomial.")
2613 2615
        ### Convert back the data into Sage space.                         
2614 2616
        (floatP, floatPcv, intvl, ic, terr) = \
2615 2617
            slz_interval_and_polynomial_to_sage((prceSo[0], prceSo[0],
pobysoPythonSage/src/sageSLZ/sageSLZ.sage (revision 225)
10 10
"""
11 11
print "sageSLZ loading..."
12 12
#
13
import inspect
14
#
13 15
def slz_compute_binade(number):
14 16
    """"
15 17
    For a given number, compute the "binade" that is integer m such that
......
704 706
    #print"In slz_compute_polynomial_and_interval..."
705 707
    ## Superficial argument check.
706 708
    if lowerBoundSa > upperBoundSa:
709
        print inspect.stack()[0][3], ": lower bound is larger than upper bound. "
707 710
        return None
708 711
    ## Change Sollya precision, if requested.
709
    if not sollyaPrecSa is None:
710
        sollyaPrecSo = pobyso_get_prec_so()
711
        pobyso_set_prec_sa_so(sollyaPrecSa)
712
    sollyaPrecChangedSa = False
713
    if sollyaPrecSa is None:
714
        sollyaPrecSa = pobyso_get_prec_so_sa()
712 715
    else:
713
        sollyaPrecSa = pobyso_get_prec_so_sa()
714
        sollyaPrecSo = None
716
        initialSollyaPrecSa = pobyso_get_prec_so_sa()
717
        if sollyaPrecSa != initialSollyaPrecSa:
718
            initialSollyaPrecSo = pobyso_get_prec_so()
719
            pobyso_set_prec_sa_so(sollyaPrecSa)
720
            sollyaPrecChangedSa = True
721
    ## Other initializations and data recovery.
715 722
    RRR = lowerBoundSa.parent()
716 723
    intervalShrinkConstFactorSa = RRR('0.9')
717 724
    absoluteErrorTypeSo = pobyso_absolute_so_so()
......
761 768
            print "Use either or both a higher polynomial degree or a higher",
762 769
            print "internal precision."
763 770
            print "Aborting!"
764
            if not sollyaPrecSo is None:
765
                pobyso_set_prec_so_so(sollyaPrecSo)
766
                sollya_lib_clear_obj(sollyaPrecSo)
771
            if sollyaPrecChangedSa:
772
                pobyso_set_prec_so_so(initialSollyaPrecSo)
773
                sollya_lib_clear_obj(initialSollyaPrecSo)
767 774
            return None
768 775
        currentRangeSo = pobyso_bounds_to_range_sa_so(currentLowerBoundSa, 
769 776
                                                      currentUpperBoundSa)
......
827 834
    sollya_lib_clear_obj(itpSo)
828 835
    sollya_lib_clear_obj(ftpSo)
829 836
    sollya_lib_clear_obj(approxAccurSo)
830
    if not sollyaPrecSo is None:
831
        pobyso_set_prec_so_so(sollyaPrecSo)
832
        sollya_lib_clear_obj(sollyaPrecSo)
837
    if sollyaPrecChangedSa:
838
        pobyso_set_prec_so_so(initialSollyaPrecSa)
839
        sollya_lib_clear_obj(initialSollyaPrecSa)
833 840
    if debug:
834 841
        print "1: ", ; pobyso_autoprint(roundedPolySo)
835 842
        print "2: ", ; pobyso_autoprint(currentRangeSo)
836 843

  

Formats disponibles : Unified diff