Révision 237
pobysoPythonSage/src/sollya_lib.sage (revision 237) | ||
---|---|---|
28 | 28 |
sollya_lib_build_function_mul = sollya.sollya_lib_build_function_mul |
29 | 29 |
sollya_lib_build_function_pow = sollya.sollya_lib_build_function_pow |
30 | 30 |
sollya_lib_build_function_sub = sollya.sollya_lib_build_function_sub |
31 |
sollya_lib_build_list = sollya.sollya_lib_build_list |
|
31 | 32 |
sollya_lib_chebyshevform = sollya.sollya_lib_chebyshevform |
32 | 33 |
sollya_lib_clear_obj = sollya.sollya_lib_clear_obj |
33 | 34 |
sollya_lib_clear_object_list = sollya.sollya_lib_clear_object_list |
pobysoPythonSage/src/sageSLZ/runSLZ-06.sage.py (revision 237) | ||
---|---|---|
1 |
# This file was *autogenerated* from the file ./runSLZ-06.sage |
|
2 |
from sage.all_cmdline import * # import sage library |
|
3 |
_sage_const_3 = Integer(3); _sage_const_2 = Integer(2); _sage_const_35 = Integer(35); _sage_const_8 = Integer(8); _sage_const_1023 = Integer(1023); _sage_const_1022 = Integer(1022); _sage_const_10 = Integer(10); _sage_const_53 = Integer(53)#! /opt/sage/sage |
|
4 |
# @file runSLZ-05.sage |
|
5 |
#from scipy.constants.codata import precision |
|
6 |
def initialize_env(): |
|
7 |
""" |
|
8 |
Load all necessary modules. |
|
9 |
""" |
|
10 |
compiledSpyxDir = "/home/storres/recherche/arithmetique/pobysoPythonSage/compiledSpyx" |
|
11 |
if compiledSpyxDir not in sys.path: |
|
12 |
sys.path.append(compiledSpyxDir) |
|
13 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
14 |
sage.misc.cython.standard_libs.append('mpfi') |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
16 |
#load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
19 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
20 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
21 |
# Matrix operations are loaded by polynomial operations. |
|
22 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
23 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
24 |
|
|
25 |
|
|
26 |
print "Running SLZ..." |
|
27 |
initialize_env() |
|
28 |
from sageMpfr import * |
|
29 |
from sageGMP import * |
|
30 |
# |
|
31 |
x = var('x') |
|
32 |
__tmp__=var("x"); func = symbolic_expression(exp(x)).function(x) |
|
33 |
precision = _sage_const_53 |
|
34 |
RRR = RealField(precision) |
|
35 |
intervalCenter = RRR(_sage_const_3 /_sage_const_2 ) |
|
36 |
icUlp = intervalCenter.ulp() |
|
37 |
intervalRadiusInUlp = _sage_const_2 **_sage_const_8 |
|
38 |
intervalRadius = RRR(_sage_const_2 **(-_sage_const_35 )) |
|
39 |
srs_run_SLZ_v06(inputFunction = func, |
|
40 |
inputLowerBound = intervalCenter - intervalRadiusInUlp * icUlp, |
|
41 |
inputUpperBound = intervalCenter + intervalRadiusInUlp * icUlp, |
|
42 |
alpha = _sage_const_2 , |
|
43 |
degree = _sage_const_2 , |
|
44 |
precision = precision, |
|
45 |
emin = -_sage_const_1022 , |
|
46 |
emax = _sage_const_1023 , |
|
47 |
targetHardnessToRound = precision + _sage_const_10 , |
|
48 |
debug = True) |
|
49 |
# |
pobysoPythonSage/src/sageSLZ/runSLZ-01.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
#from scipy.constants.codata import precision |
|
3 |
def initialize_env(): |
|
4 |
""" |
|
5 |
Load all necessary modules. |
|
6 |
""" |
|
7 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
8 |
sage.misc.cython.standard_libs.append('mpfi') |
|
9 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
15 |
# Matrix operations are loaded by polynomial operations. |
|
16 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
18 |
|
|
19 |
|
|
20 |
print "Running SLZ..." |
|
21 |
initialize_env() |
|
22 |
x = var('x') |
|
23 |
func(x) = exp(x) |
|
24 |
precision = 53 |
|
25 |
RRR = RealField(precision) |
|
26 |
intervalCenter = RRR("1.9E9CBBFD6080B",16) * 2^-31 |
|
27 |
icUlp = intervalCenter.ulp() |
|
28 |
intervalRadiusInUlp = 2^49 + 2^45 |
|
29 |
srs_run_SLZ_v01(inputFunction=func, |
|
30 |
inputLowerBound = RRR(1) * 2^-31, |
|
31 |
inputUpperBound = RRR(1) * 2^-30 - icUlp, |
|
32 |
alpha = 2, |
|
33 |
degree = 2, |
|
34 |
precision = 53, |
|
35 |
emin = -1022, |
|
36 |
emax = 1023, |
|
37 |
targetHardnessToRound = precision+50, |
|
38 |
debug = True) |
|
39 |
# |
|
40 |
""" |
|
41 |
srs_run_SLZ_v01(inputFunction=func, |
|
42 |
inputLowerBound = intervalCenter - icUlp * intervalRadiusInUlp, |
|
43 |
inputUpperBound = intervalCenter + icUlp * intervalRadiusInUlp, |
|
44 |
alpha = 2, |
|
45 |
degree = 2, |
|
46 |
precision = 53, |
|
47 |
emin = -1022, |
|
48 |
emax = 1023, |
|
49 |
targetHardnessToRound = precision+50, |
|
50 |
debug = True) |
|
51 |
""" |
|
52 |
""" |
|
53 |
srs_run_SLZ_v01(inputFunction=func, |
|
54 |
inputLowerBound = 402653184/1073741824, |
|
55 |
inputUpperBound = 402653185/1073741824, |
|
56 |
alpha = 2, |
|
57 |
degree = 10, |
|
58 |
precision = 53, |
|
59 |
emin = -1022, |
|
60 |
emax = 1023, |
|
61 |
targetHardnessToRound = precision+50, |
|
62 |
debug = True) |
|
63 |
|
|
64 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
65 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
66 |
""" |
pobysoPythonSage/src/sageSLZ/runSLZ-02.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
#from scipy.constants.codata import precision |
|
3 |
def initialize_env(): |
|
4 |
""" |
|
5 |
Load all necessary modules. |
|
6 |
""" |
|
7 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
8 |
sage.misc.cython.standard_libs.append('mpfi') |
|
9 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
15 |
# Matrix operations are loaded by polynomial operations. |
|
16 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
18 |
|
|
19 |
|
|
20 |
print "Running SLZ..." |
|
21 |
initialize_env() |
|
22 |
x = var('x') |
|
23 |
func(x) = exp(x) |
|
24 |
precision = 53 |
|
25 |
RRR = RealField(precision) |
|
26 |
intervalCenter = RRR("1.9E9CBBFD6080B",16) * 2^-31 |
|
27 |
icUlp = intervalCenter.ulp() |
|
28 |
intervalRadiusInUlp = 2^49 + 2^45 |
|
29 |
srs_run_SLZ_v02(inputFunction=func, |
|
30 |
inputLowerBound = RRR(1) * 2^-31, |
|
31 |
inputUpperBound = RRR(1) * 2^-30 - icUlp, |
|
32 |
alpha = 2, |
|
33 |
degree = 2, |
|
34 |
precision = 53, |
|
35 |
emin = -1022, |
|
36 |
emax = 1023, |
|
37 |
targetHardnessToRound = precision+50, |
|
38 |
debug = True) |
|
39 |
# |
|
40 |
""" |
|
41 |
srs_run_SLZ_v02(inputFunction=func, |
|
42 |
inputLowerBound = intervalCenter - icUlp * intervalRadiusInUlp, |
|
43 |
inputUpperBound = intervalCenter + icUlp * intervalRadiusInUlp, |
|
44 |
alpha = 2, |
|
45 |
degree = 2, |
|
46 |
precision = 53, |
|
47 |
emin = -1022, |
|
48 |
emax = 1023, |
|
49 |
targetHardnessToRound = precision+50, |
|
50 |
debug = True) |
|
51 |
""" |
|
52 |
""" |
|
53 |
srs_run_SLZ_v01(inputFunction=func, |
|
54 |
inputLowerBound = 402653184/1073741824, |
|
55 |
inputUpperBound = 402653185/1073741824, |
|
56 |
alpha = 2, |
|
57 |
degree = 10, |
|
58 |
precision = 53, |
|
59 |
emin = -1022, |
|
60 |
emax = 1023, |
|
61 |
targetHardnessToRound = precision+50, |
|
62 |
debug = True) |
|
63 |
|
|
64 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
65 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
66 |
""" |
pobysoPythonSage/src/sageSLZ/runSLZ-03.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
# @file runSLZ-03.sage |
|
3 |
# |
|
4 |
def initialize_env(): |
|
5 |
""" |
|
6 |
Load all necessary modules. |
|
7 |
""" |
|
8 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
9 |
sage.misc.cython.standard_libs.append('mpfi') |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
16 |
# Matrix operations are loaded by polynomial operations. |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
19 |
|
|
20 |
|
|
21 |
print "Running SLZ..." |
|
22 |
initialize_env() |
|
23 |
x = var('x') |
|
24 |
func(x) = exp(x) |
|
25 |
precision = 53 |
|
26 |
RRR = RealField(precision) |
|
27 |
intervalCenter = RRR("1.9E9CBBFD6080B",16) * 2^-31 |
|
28 |
icUlp = intervalCenter.ulp() |
|
29 |
intervalRadiusInUlp = 2^49 + 2^45 |
|
30 |
srs_run_SLZ_v03(inputFunction=func, |
|
31 |
inputLowerBound = RRR(1) * 2^-31, |
|
32 |
inputUpperBound = RRR(1) * 2^-30 - icUlp, |
|
33 |
alpha = 2, |
|
34 |
degree = 2, |
|
35 |
precision = 53, |
|
36 |
emin = -1022, |
|
37 |
emax = 1023, |
|
38 |
targetHardnessToRound = precision+50, |
|
39 |
debug = True) |
|
40 |
# |
|
41 |
""" |
|
42 |
srs_run_SLZ_v02(inputFunction=func, |
|
43 |
inputLowerBound = RRR(1) * 2^-31, |
|
44 |
inputUpperBound = RRR(1) * 2^-30 - icUlp, |
|
45 |
alpha = 2, |
|
46 |
degree = 2, |
|
47 |
precision = 53, |
|
48 |
emin = -1022, |
|
49 |
emax = 1023, |
|
50 |
targetHardnessToRound = precision+50, |
|
51 |
debug = True) |
|
52 |
""" |
|
53 |
""" |
|
54 |
srs_run_SLZ_v01(inputFunction=func, |
|
55 |
inputLowerBound = 402653184/1073741824, |
|
56 |
inputUpperBound = 402653185/1073741824, |
|
57 |
alpha = 2, |
|
58 |
degree = 10, |
|
59 |
precision = 53, |
|
60 |
emin = -1022, |
|
61 |
emax = 1023, |
|
62 |
targetHardnessToRound = precision+50, |
|
63 |
debug = True) |
|
64 |
|
|
65 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
66 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
67 |
""" |
pobysoPythonSage/src/sageSLZ/runHtrn-01.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
#from scipy.constants.codata import precision |
|
3 |
def initialize_env(): |
|
4 |
""" |
|
5 |
Load all necessary modules. |
|
6 |
""" |
|
7 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
8 |
sage.misc.cython.standard_libs.append('mpfi') |
|
9 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageGMP.spyx") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
16 |
# Matrix operations are loaded by polynomial operations. |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
19 |
|
|
20 |
|
|
21 |
print "Running HTRN..." |
|
22 |
initialize_env() |
|
23 |
# |
|
24 |
f(x) = exp(x) |
|
25 |
precision = 53 |
|
26 |
htrAccuracyShift = 50#58 |
|
27 |
precisionRF = RealField(precision) |
|
28 |
precPlusOneRF = RealField(precisionRF.prec()+1) |
|
29 |
quasiExactRF = RealField(1024) |
|
30 |
targetAccuracy = 2^-(precision + htrAccuracyShift) |
|
31 |
binade = 2^-31 |
|
32 |
binadeAbsLowerBound = precisionRF(binade) |
|
33 |
binadeUlp = binadeAbsLowerBound.ulp() |
|
34 |
|
|
35 |
binadeLowerBound = binadeAbsLowerBound |
|
36 |
htrnc = precisionRF("1.9E9CBBFD6080B",16) * 2^-31 |
|
37 |
|
|
38 |
print binade.n() |
|
39 |
print binadeAbsLowerBound.n() |
|
40 |
|
|
41 |
htrncOffset = htrnc - binadeLowerBound |
|
42 |
iterStep = binadeUlp * 2^22 |
|
43 |
iterVar = binadeLowerBound + floor(htrncOffset/iterStep) * iterStep |
|
44 |
iterLimit = iterVar + iterStep |
|
45 |
|
|
46 |
print iterVar.n() |
|
47 |
print htrnc.n() |
|
48 |
print iterLimit.n() |
|
49 |
|
|
50 |
iterCount = 0 |
|
51 |
iterationsStartTime = cputime() |
|
52 |
kiloIterStartTime = cputime() |
|
53 |
kiloIterCount = 0 |
|
54 |
kiloIterCountStep = 2^20 |
|
55 |
print "Starting iterations..." |
|
56 |
while iterVar < iterLimit: |
|
57 |
if iterVar == htrnc: |
|
58 |
print "Found at iter count:", iterCount |
|
59 |
print "After:", cputime(iterationsStartTime) |
|
60 |
if slz_is_htrn(argument=iterVar, |
|
61 |
function=f, |
|
62 |
targetAccuracy=targetAccuracy, |
|
63 |
targetRF=precisionRF, |
|
64 |
targetPlusOnePrecRF=precPlusOneRF, |
|
65 |
quasiExactRF=quasiExactRF): |
|
66 |
print "HTRN candidate:", iterVar.n().str(base=2) |
|
67 |
print "HTRN candidate:", iterVar.n().str(base=10) |
|
68 |
print "HTRN candidate:", iterVar.n().str(base=16) |
|
69 |
|
|
70 |
if kiloIterCount == kiloIterCountStep: |
|
71 |
print "1024 iterations computed in:", |
|
72 |
print cputime(kiloIterStartTime), "s" |
|
73 |
kiloIterCount = 0 |
|
74 |
kiloIterStartTime = cputime() |
|
75 |
|
|
76 |
# End if |
|
77 |
iterVar += binadeUlp |
|
78 |
iterCount += 1 |
|
79 |
kiloIterCount += 1 |
|
80 |
iterationsFullTime = cputime(iterationsStartTime) |
|
81 |
print "Iterations terminates in", iterationsStartTime, "s." |
|
82 |
|
pobysoPythonSage/src/sageSLZ/runSLZ-04.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
# @file runSLZ-04.sage |
|
3 |
#from scipy.constants.codata import precision |
|
4 |
def initialize_env(): |
|
5 |
""" |
|
6 |
Load all necessary modules. |
|
7 |
""" |
|
8 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
9 |
sage.misc.cython.standard_libs.append('mpfi') |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
16 |
# Matrix operations are loaded by polynomial operations. |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
19 |
|
|
20 |
|
|
21 |
print "Running SLZ..." |
|
22 |
initialize_env() |
|
23 |
x = var('x') |
|
24 |
func(x) = exp(x) |
|
25 |
precision = 113 |
|
26 |
RRR = RealField(precision) |
|
27 |
intervalCenter = RRR(3/8) |
|
28 |
icUlp = intervalCenter.ulp() |
|
29 |
intervalRadiusInUlp = 2^49 + 2^45 |
|
30 |
intervalRadius = RRR(2^(-35)) |
|
31 |
srs_run_SLZ_v04(inputFunction=func, |
|
32 |
inputLowerBound = intervalCenter - intervalRadius, |
|
33 |
inputUpperBound = intervalCenter + intervalRadius, |
|
34 |
alpha = 6, |
|
35 |
degree = 18, |
|
36 |
precision = precision, |
|
37 |
emin = -16382, |
|
38 |
emax = 16383, |
|
39 |
targetHardnessToRound = precision * 6, |
|
40 |
debug = True) |
|
41 |
# |
|
42 |
""" |
|
43 |
srs_run_SLZ_v01(inputFunction=func, |
|
44 |
inputLowerBound = intervalCenter - icUlp * intervalRadiusInUlp, |
|
45 |
inputUpperBound = intervalCenter + icUlp * intervalRadiusInUlp, |
|
46 |
alpha = 2, |
|
47 |
degree = 2, |
|
48 |
precision = 53, |
|
49 |
emin = -1022, |
|
50 |
emax = 1023, |
|
51 |
targetHardnessToRound = precision+50, |
|
52 |
debug = True) |
|
53 |
""" |
|
54 |
""" |
|
55 |
srs_run_SLZ_v01(inputFunction=func, |
|
56 |
inputLowerBound = 402653184/1073741824, |
|
57 |
inputUpperBound = 402653185/1073741824, |
|
58 |
alpha = 2, |
|
59 |
degree = 10, |
|
60 |
precision = 53, |
|
61 |
emin = -1022, |
|
62 |
emax = 1023, |
|
63 |
targetHardnessToRound = precision+50, |
|
64 |
debug = True) |
|
65 |
|
|
66 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
67 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
68 |
""" |
pobysoPythonSage/src/sageSLZ/runSLZ-05.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
# @file runSLZ-05.sage |
|
3 |
#from scipy.constants.codata import precision |
|
4 |
def initialize_env(): |
|
5 |
""" |
|
6 |
Load all necessary modules. |
|
7 |
""" |
|
8 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
9 |
sage.misc.cython.standard_libs.append('mpfi') |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
16 |
# Matrix operations are loaded by polynomial operations. |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
19 |
|
|
20 |
|
|
21 |
print "Running SLZ..." |
|
22 |
initialize_env() |
|
23 |
x = var('x') |
|
24 |
func(x) = exp(x) |
|
25 |
precision = 113 |
|
26 |
RRR = RealField(precision) |
|
27 |
intervalCenter = RRR(3/8) |
|
28 |
icUlp = intervalCenter.ulp() |
|
29 |
intervalRadiusInUlp = 2^49 + 2^45 |
|
30 |
intervalRadius = RRR(2^(-35)) |
|
31 |
srs_run_SLZ_v05(inputFunction=func, |
|
32 |
inputLowerBound = intervalCenter - intervalRadius, |
|
33 |
inputUpperBound = intervalCenter + intervalRadius, |
|
34 |
alpha = 6, |
|
35 |
degree = 17, |
|
36 |
precision = precision, |
|
37 |
emin = -16382, |
|
38 |
emax = 16383, |
|
39 |
targetHardnessToRound = precision * 6, |
|
40 |
debug = False) |
|
41 |
# |
|
42 |
""" |
|
43 |
srs_run_SLZ_v01(inputFunction=func, |
|
44 |
inputLowerBound = intervalCenter - icUlp * intervalRadiusInUlp, |
|
45 |
inputUpperBound = intervalCenter + icUlp * intervalRadiusInUlp, |
|
46 |
alpha = 2, |
|
47 |
degree = 2, |
|
48 |
precision = 53, |
|
49 |
emin = -1022, |
|
50 |
emax = 1023, |
|
51 |
targetHardnessToRound = precision+50, |
|
52 |
debug = True) |
|
53 |
""" |
|
54 |
""" |
|
55 |
srs_run_SLZ_v01(inputFunction=func, |
|
56 |
inputLowerBound = 402653184/1073741824, |
|
57 |
inputUpperBound = 402653185/1073741824, |
|
58 |
alpha = 2, |
|
59 |
degree = 10, |
|
60 |
precision = 53, |
|
61 |
emin = -1022, |
|
62 |
emax = 1023, |
|
63 |
targetHardnessToRound = precision+50, |
|
64 |
debug = True) |
|
65 |
|
|
66 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
67 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
68 |
""" |
pobysoPythonSage/src/sageSLZ/runSLZ-06.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
# @file runSLZ-05.sage |
|
3 |
#from scipy.constants.codata import precision |
|
4 |
def initialize_env(): |
|
5 |
""" |
|
6 |
Load all necessary modules. |
|
7 |
""" |
|
8 |
compiledSpyxDir = "/home/storres/recherche/arithmetique/pobysoPythonSage/compiledSpyx" |
|
9 |
if compiledSpyxDir not in sys.path: |
|
10 |
sys.path.append(compiledSpyxDir) |
|
11 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
12 |
sage.misc.cython.standard_libs.append('mpfi') |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
14 |
#load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
16 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
19 |
# Matrix operations are loaded by polynomial operations. |
|
20 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
21 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
22 |
|
|
23 |
|
|
24 |
print "Running SLZ..." |
|
25 |
initialize_env() |
|
26 |
from sageMpfr import * |
|
27 |
from sageGMP import * |
|
28 |
# |
|
29 |
x = var('x') |
|
30 |
func(x) = exp(x) |
|
31 |
precision = 53 |
|
32 |
RRR = RealField(precision) |
|
33 |
intervalCenter = RRR(3/2) |
|
34 |
icUlp = intervalCenter.ulp() |
|
35 |
intervalRadiusInUlp = 2^8 |
|
36 |
intervalRadius = RRR(2^(-35)) |
|
37 |
srs_run_SLZ_v06(inputFunction = func, |
|
38 |
inputLowerBound = intervalCenter - intervalRadiusInUlp * icUlp, |
|
39 |
inputUpperBound = intervalCenter + intervalRadiusInUlp * icUlp, |
|
40 |
alpha = 2, |
|
41 |
degree = 2, |
|
42 |
precision = precision, |
|
43 |
emin = -1022, |
|
44 |
emax = 1023, |
|
45 |
targetHardnessToRound = precision + 10, |
|
46 |
debug = True) |
|
47 |
# |
pobysoPythonSage/src/sageSLZ/runSLZ-05-06-02.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
# @file runSLZ-05-11-02.sage |
|
3 |
#from scipy.constants.codata import precision |
|
4 |
def initialize_env(): |
|
5 |
""" |
|
6 |
Load all necessary modules. |
|
7 |
""" |
|
8 |
compiledSpyxDir = "/home/storres/recherche/arithmetique/pobysoPythonSage/compiledSpyx" |
|
9 |
if compiledSpyxDir not in sys.path: |
|
10 |
sys.path.append(compiledSpyxDir) |
|
11 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
12 |
sage.misc.cython.standard_libs.append('mpfi') |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
14 |
#load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
16 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
19 |
# Matrix operations are loaded by polynomial operations. |
|
20 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
21 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
22 |
|
|
23 |
|
|
24 |
print "Running SLZ..." |
|
25 |
initialize_env() |
|
26 |
from sageMpfr import * |
|
27 |
from sageGMP import * |
|
28 |
# |
|
29 |
x = var('x') |
|
30 |
func(x) = exp(x) |
|
31 |
precision = 113 |
|
32 |
RRR = RealField(precision) |
|
33 |
intervalCenter = RRR(3/8) |
|
34 |
icUlp = intervalCenter.ulp() |
|
35 |
intervalRadius = RRR(2^(-35)) |
|
36 |
srs_run_SLZ_v05(inputFunction=func, |
|
37 |
inputLowerBound = intervalCenter - intervalRadius, |
|
38 |
inputUpperBound = intervalCenter + intervalRadius, |
|
39 |
alpha = 2, |
|
40 |
degree = 6, |
|
41 |
precision = precision, |
|
42 |
emin = -16382, |
|
43 |
emax = 16383, |
|
44 |
targetHardnessToRound = precision * 2, |
|
45 |
debug = True) |
|
46 |
# |
|
47 |
""" |
|
48 |
srs_run_SLZ_v01(inputFunction=func, |
|
49 |
inputLowerBound = intervalCenter - icUlp * intervalRadiusInUlp, |
|
50 |
inputUpperBound = intervalCenter + icUlp * intervalRadiusInUlp, |
|
51 |
alpha = 2, |
|
52 |
degree = 2, |
|
53 |
precision = 53, |
|
54 |
emin = -1022, |
|
55 |
emax = 1023, |
|
56 |
targetHardnessToRound = precision+50, |
|
57 |
debug = True) |
|
58 |
""" |
|
59 |
""" |
|
60 |
srs_run_SLZ_v01(inputFunction=func, |
|
61 |
inputLowerBound = 402653184/1073741824, |
|
62 |
inputUpperBound = 402653185/1073741824, |
|
63 |
alpha = 2, |
|
64 |
degree = 10, |
|
65 |
precision = 53, |
|
66 |
emin = -1022, |
|
67 |
emax = 1023, |
|
68 |
targetHardnessToRound = precision+50, |
|
69 |
debug = True) |
|
70 |
|
|
71 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
72 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
73 |
""" |
pobysoPythonSage/src/sageSLZ/runSLZ-05-17-06.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
# @file runSLZ-05.sage |
|
3 |
#from scipy.constants.codata import precision |
|
4 |
def initialize_env(): |
|
5 |
""" |
|
6 |
Load all necessary modules. |
|
7 |
""" |
|
8 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
9 |
sage.misc.cython.standard_libs.append('mpfi') |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
16 |
# Matrix operations are loaded by polynomial operations. |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
19 |
|
|
20 |
|
|
21 |
print "Running SLZ..." |
|
22 |
initialize_env() |
|
23 |
x = var('x') |
|
24 |
func(x) = exp(x) |
|
25 |
precision = 113 |
|
26 |
RRR = RealField(precision) |
|
27 |
intervalCenter = RRR(3/8) |
|
28 |
icUlp = intervalCenter.ulp() |
|
29 |
intervalRadius = RRR(2^(-35)) |
|
30 |
srs_run_SLZ_v05(inputFunction=func, |
|
31 |
inputLowerBound = intervalCenter - intervalRadius, |
|
32 |
inputUpperBound = intervalCenter + intervalRadius, |
|
33 |
alpha = 6, |
|
34 |
degree = 17, |
|
35 |
precision = precision, |
|
36 |
emin = -16382, |
|
37 |
emax = 16383, |
|
38 |
targetHardnessToRound = precision * 6, |
|
39 |
debug = False) |
|
40 |
# |
|
41 |
""" |
|
42 |
srs_run_SLZ_v01(inputFunction=func, |
|
43 |
inputLowerBound = intervalCenter - icUlp * intervalRadiusInUlp, |
|
44 |
inputUpperBound = intervalCenter + icUlp * intervalRadiusInUlp, |
|
45 |
alpha = 2, |
|
46 |
degree = 2, |
|
47 |
precision = 53, |
|
48 |
emin = -1022, |
|
49 |
emax = 1023, |
|
50 |
targetHardnessToRound = precision+50, |
|
51 |
debug = True) |
|
52 |
""" |
|
53 |
""" |
|
54 |
srs_run_SLZ_v01(inputFunction=func, |
|
55 |
inputLowerBound = 402653184/1073741824, |
|
56 |
inputUpperBound = 402653185/1073741824, |
|
57 |
alpha = 2, |
|
58 |
degree = 10, |
|
59 |
precision = 53, |
|
60 |
emin = -1022, |
|
61 |
emax = 1023, |
|
62 |
targetHardnessToRound = precision+50, |
|
63 |
debug = True) |
|
64 |
|
|
65 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
66 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
67 |
""" |
pobysoPythonSage/src/sageSLZ/runSLZ-05-29-08.sage (revision 237) | ||
---|---|---|
1 |
#! /opt/sage/sage |
|
2 |
# @file runSLZ-05.sage |
|
3 |
#from scipy.constants.codata import precision |
|
4 |
def initialize_env(): |
|
5 |
""" |
|
6 |
Load all necessary modules. |
|
7 |
""" |
|
8 |
if not 'mpfi' in sage.misc.cython.standard_libs: |
|
9 |
sage.misc.cython.standard_libs.append('mpfi') |
|
10 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sollya_lib.sage") |
|
11 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageMpfr.spyx") |
|
12 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/pobyso.py") |
|
13 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageSLZ.sage") |
|
14 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageNumericalOperations.sage") |
|
15 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRationalOperations.sage") |
|
16 |
# Matrix operations are loaded by polynomial operations. |
|
17 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage") |
|
18 |
load("/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageRunSLZ.sage") |
|
19 |
|
|
20 |
|
|
21 |
print "Running SLZ..." |
|
22 |
initialize_env() |
|
23 |
x = var('x') |
|
24 |
func(x) = exp(x) |
|
25 |
precision = 113 |
|
26 |
RRR = RealField(precision) |
|
27 |
intervalCenter = RRR(3/8) |
|
28 |
icUlp = intervalCenter.ulp() |
|
29 |
#intervalRadiusInUlp = 2^49 + 2^45 |
|
30 |
intervalRadius = RRR(2^(-27)) |
|
31 |
srs_run_SLZ_v05(inputFunction = func, |
|
32 |
inputLowerBound = intervalCenter - intervalRadius, |
|
33 |
inputUpperBound = intervalCenter + intervalRadius, |
|
34 |
alpha = 8, |
|
35 |
degree = 29, |
|
36 |
precision = precision, |
|
37 |
emin = -16382, |
|
38 |
emax = 16383, |
|
39 |
targetHardnessToRound = precision * 8, |
|
40 |
debug = False) |
|
41 |
# |
|
42 |
""" |
|
43 |
srs_run_SLZ_v01(inputFunction=func, |
|
44 |
inputLowerBound = intervalCenter - icUlp * intervalRadiusInUlp, |
|
45 |
inputUpperBound = intervalCenter + icUlp * intervalRadiusInUlp, |
|
46 |
alpha = 2, |
|
47 |
degree = 2, |
|
48 |
precision = 53, |
|
49 |
emin = -1022, |
|
50 |
emax = 1023, |
|
51 |
targetHardnessToRound = precision+50, |
|
52 |
debug = True) |
|
53 |
""" |
|
54 |
""" |
|
55 |
srs_run_SLZ_v01(inputFunction=func, |
|
56 |
inputLowerBound = 402653184/1073741824, |
|
57 |
inputUpperBound = 402653185/1073741824, |
|
58 |
alpha = 2, |
|
59 |
degree = 10, |
|
60 |
precision = 53, |
|
61 |
emin = -1022, |
|
62 |
emax = 1023, |
|
63 |
targetHardnessToRound = precision+50, |
|
64 |
debug = True) |
|
65 |
|
|
66 |
#inputUpperBound = RRR(1/2) - RRR(1/4).ulp(), |
|
67 |
RR("1.9E9CBBFD6080B",16) * 2^-31] |
|
68 |
""" |
pobysoPythonSage/src/pobyso.py (revision 237) | ||
---|---|---|
132 | 132 |
|
133 | 133 |
def pobyso_build_end_elliptic_list_so_so(*args): |
134 | 134 |
""" |
135 |
From argumrny Sollya objects, create a Sollya end elliptic list.
|
|
136 |
Elements of the list are "eaten" (should not be cleared individualy, |
|
135 |
From Sollya argument objects, create a Sollya end elliptic list.
|
|
136 |
Elements of the list are "eaten" (should not be cleared individually,
|
|
137 | 137 |
are cleared when the list is cleared). |
138 | 138 |
""" |
139 | 139 |
if len(args) == 0: |
... | ... | |
153 | 153 |
# End pobyso_build_end_elliptic_list_so_so |
154 | 154 |
|
155 | 155 |
def pobyso_build_function_sub_so_so(exp1So, exp2So): |
156 |
return(sollya_lib_build_function_sub(exp1So, exp2So))
|
|
156 |
return sollya_lib_build_function_sub(exp1So, exp2So)
|
|
157 | 157 |
|
158 |
def pobyso_build_list_of_ints_sa_so(*args): |
|
159 |
""" |
|
160 |
Build a Sollya list from Sage integral arguments. |
|
161 |
""" |
|
162 |
if len(args) == 0: |
|
163 |
return pobyso_build_list_so_so() |
|
164 |
## Make a Sage list of integral constants. |
|
165 |
intsList = [] |
|
166 |
for intElem in args: |
|
167 |
intsList.append(pobyso_constant_from_int_sa_so(intElem)) |
|
168 |
return pobyso_build_list_so_so(*intsList) |
|
169 |
|
|
170 |
def pobyso_build_list_so_so(*args): |
|
171 |
""" |
|
172 |
Make a Sollya list out of Sollya objects passed as arguments. |
|
173 |
If one wants to call it with a list argument, should prepend a "*" |
|
174 |
before the list variable name. |
|
175 |
Elements of the list are "eaten" (should not be cleared individually, |
|
176 |
are cleared when the list is cleared). |
|
177 |
""" |
|
178 |
if len(args) == 0: |
|
179 |
## Called with an empty list produced "error". |
|
180 |
return sollya_lib_build_list(None) |
|
181 |
index = 0 |
|
182 |
## Append the Sollya elements one by one. |
|
183 |
for elementSo in args: |
|
184 |
if index == 0: |
|
185 |
listSo = sollya_lib_build_list(elementSo, None) |
|
186 |
else: |
|
187 |
listSo = sollya_lib_append(listSo, elementSo) |
|
188 |
index += 1 |
|
189 |
return listSo |
|
190 |
# End pobyso_build list_so_so |
|
191 |
|
|
192 |
|
|
158 | 193 |
def pobyso_change_var_in_function_so_so(funcSo, chvarExpSo): |
159 | 194 |
""" |
160 | 195 |
Variable change in a function. |
... | ... | |
167 | 202 |
return(resultSo) |
168 | 203 |
# End pobyso_chebyshevform_so_so. |
169 | 204 |
|
205 |
def pobyso_clear_obj(objSo): |
|
206 |
""" |
|
207 |
Free a Sollya object's memory. |
|
208 |
Very thin wrapper around sollya_lib_clear_obj(). |
|
209 |
""" |
|
210 |
sollya_lib_clear_obj(objSo) |
|
211 |
# End pobyso_clear_obj. |
|
212 |
|
|
170 | 213 |
def pobyso_clear_taylorform_sa_so(taylorFormSaSo): |
171 | 214 |
""" |
172 | 215 |
This method is necessary to correctly clean up the memory from Taylor forms. |
... | ... | |
174 | 217 |
For no clearly understood reason, sollya_lib_clear_object_list crashed |
175 | 218 |
when applied to the object list. |
176 | 219 |
Here, we decompose it into Sage list of Sollya objects references and we |
177 |
clear them one by one.
|
|
220 |
clear them one at a time.
|
|
178 | 221 |
""" |
179 | 222 |
sollya_lib_clear_obj(taylorFormSaSo[0]) |
180 | 223 |
(coefficientsErrorsListSaSo, numElementsSa, isEndEllipticSa) = \ |
... | ... | |
187 | 230 |
|
188 | 231 |
def pobyso_cmp(rnArgSa, cteSo): |
189 | 232 |
""" |
233 |
Deprecated, use pobyso_cmp_sa_so_sa instead. |
|
234 |
""" |
|
235 |
print "Deprecated, use pobyso_cmp_sa_so_sa instead." |
|
236 |
return pobyso_cmp_sa_so_sa(rnArgSa, cteSo) |
|
237 |
# End pobyso_cmp |
|
238 |
|
|
239 |
def pobyso_cmp_sa_so_sa(rnArgSa, cteSo): |
|
240 |
""" |
|
190 | 241 |
Compare the MPFR value a RealNumber with that of a Sollya constant. |
191 | 242 |
|
192 | 243 |
Get the value of the Sollya constant into a RealNumber and compare |
... | ... | |
203 | 254 |
rnLocalSa = RRRR(0) |
204 | 255 |
sollya_lib_get_constant(get_rn_value(rnLocalSa), cteSo) |
205 | 256 |
# |
206 |
## Compare the Sage RealNumber version of the Sollya constant with rnArg. |
|
207 |
return(cmp_rn_value(rnArgSa, rnLocal)) |
|
208 |
# End pobyso_smp |
|
257 |
## Compare the Sage RealNumber version of the Sollya constant with rnArg |
|
258 |
# through a direct comparison of underlying MPFR numbers. |
|
259 |
return cmp_rn_value(rnArgSa, rnLocal) |
|
260 |
# End pobyso_smp_sa_so_sa |
|
209 | 261 |
|
210 | 262 |
def pobyso_compute_pos_function_abs_val_bounds_sa_sa(funcSa, lowerBoundSa, \ |
211 | 263 |
upperBoundSa): |
... | ... | |
361 | 413 |
""" |
362 | 414 |
return sollya_lib_evaluate(funcSo, argumentSo) |
363 | 415 |
# End pobyso_evaluate_so_so. |
416 |
|
|
364 | 417 |
def pobyso_dirty_find_zeros_so_so(funcSo, rangeSo): |
365 | 418 |
""" |
366 | 419 |
Thin wrapper over sollya_lib_dirtyfindzeros() |
... | ... | |
368 | 421 |
return sollya_lib_dirtyfindzeros(funcSo, rangeSo) |
369 | 422 |
# End pobys_dirty_find_zeros |
370 | 423 |
|
424 |
def pobyso_dirty_inf_norm_so_so(funcSo, rangeSo, preSo=None): |
|
425 |
""" |
|
426 |
Thin wrapper around sollya_dirtyinfnorm(). |
|
427 |
""" |
|
428 |
# TODO: manage the precision change. |
|
429 |
|
|
430 |
return sollya_lib_dirtyinfnorm(funcSo, rangeSo) |
|
431 |
# End pobyso_dirty_inf_norm_so_so |
|
432 |
|
|
371 | 433 |
def pobyso_float_list_so_sa(listSo): |
372 | 434 |
""" |
373 | 435 |
Return a Sollya list of floating-point as a Sage list of |
... | ... | |
1134 | 1196 |
|
1135 | 1197 |
def pobyso_lib_close(): |
1136 | 1198 |
sollya_lib_close(None) |
1137 |
|
|
1199 |
|
|
1138 | 1200 |
def pobyso_name_free_variable(freeVariableNameSa): |
1139 | 1201 |
""" Legacy function. See pobyso_name_free_variable_sa_so. """ |
1140 | 1202 |
pobyso_name_free_variable_sa_so(freeVariableNameSa) |
... | ... | |
1570 | 1632 |
return(sollya_lib_remez(funcSo, degreeSo, rangeSo, weightSo, qualitySo, None)) |
1571 | 1633 |
# End pobyso_remez_canonical_so_so. |
1572 | 1634 |
|
1635 |
def pobyso_remez_exponents_list_sa_so(func, \ |
|
1636 |
exponentsList, \ |
|
1637 |
lowerBound, \ |
|
1638 |
upperBound, \ |
|
1639 |
weight = None, \ |
|
1640 |
quality = None): |
|
1641 |
""" |
|
1642 |
All arguments are Sage/Python. |
|
1643 |
The functions (func and weight) must be passed as expressions or strings. |
|
1644 |
Otherwise the function fails. |
|
1645 |
The return value is a pointer to a Sollya function. |
|
1646 |
lowerBound and upperBound mus be reals. |
|
1647 |
""" |
|
1648 |
var('zorglub') # Dummy variable name for type check only. Type of |
|
1649 |
# zorglub is "symbolic expression". |
|
1650 |
currentVariableNameSa = None |
|
1651 |
# The func argument can be of different types (string, |
|
1652 |
# symbolic expression...) |
|
1653 |
if parent(func) == parent("string"): |
|
1654 |
localFuncSa = sage_eval(func,globals()) |
|
1655 |
if len(localFuncSa.variables()) > 0: |
|
1656 |
currentVariableNameSa = localFuncSa.variables()[0] |
|
1657 |
sollya_lib_name_free_variable(str(currentVariableNameSa)) |
|
1658 |
functionSo = \ |
|
1659 |
sollya_lib_parse_string(localFuncSa._assume_str().replace('_SAGE_VAR_', '')) |
|
1660 |
# Expression test. |
|
1661 |
elif type(func) == type(zorglub): |
|
1662 |
# Until we are able to translate Sage expressions into Sollya |
|
1663 |
# expressions : parse the string version. |
|
1664 |
if len(func.variables()) > 0: |
|
1665 |
currentVariableNameSa = func.variables()[0] |
|
1666 |
sollya_lib_name_free_variable(str(currentVariableNameSa)) |
|
1667 |
functionSo = \ |
|
1668 |
sollya_lib_parse_string(func._assume_str().replace('_SAGE_VAR_', '')) |
|
1669 |
else: |
|
1670 |
return(None) |
|
1671 |
## Deal with the weight, much in the same way as with the function. |
|
1672 |
if weight is None: # No weight given -> 1. |
|
1673 |
weightSo = pobyso_constant_1_sa_so() |
|
1674 |
elif parent(weight) == parent("string"): # Weight given as string: parse it. |
|
1675 |
weightSo = sollya_lib_parse_string(func) |
|
1676 |
elif type(weight) == type(zorglub): # Weight given as symbolice expression. |
|
1677 |
functionSo = \ |
|
1678 |
sollya_lib_parse_string(weight._assume_str().replace('_SAGE_VAR_', '',100)) |
|
1679 |
else: |
|
1680 |
return(None) |
|
1681 |
rangeSo = pobyso_bounds_to_range_sa_so(lowerBound, upperBound) |
|
1682 |
if not quality is None: |
|
1683 |
qualitySo= pobyso_constant_sa_so(quality) |
|
1684 |
else: |
|
1685 |
qualitySo = None |
|
1686 |
# |
|
1687 |
## Tranform the Sage list of exponents into a Sollya list. |
|
1688 |
exponentsListSo = pobyso_build_list_of_ints_sa_so(*exponentsList) |
|
1689 |
remezPolySo = sollya_lib_remez(functionSo, \ |
|
1690 |
exponentsListSo, \ |
|
1691 |
rangeSo, \ |
|
1692 |
weightSo, \ |
|
1693 |
qualitySo, \ |
|
1694 |
None) |
|
1695 |
sollya_lib_clear_obj(functionSo) |
|
1696 |
sollya_lib_clear_obj(exponentsListSo) |
|
1697 |
sollya_lib_clear_obj(rangeSo) |
|
1698 |
sollya_lib_clear_obj(weightSo) |
|
1699 |
if not qualitySo is None: |
|
1700 |
sollya_lib_clear_obj(qualitySo) |
|
1701 |
return(remezPolySo) |
|
1702 |
# End pobyso_remez_exponentsList_sa_so |
|
1703 |
|
|
1704 |
|
|
1573 | 1705 |
def pobyso_round_coefficients_progressive_so_so(polySo, |
1574 | 1706 |
funcSo, |
1575 | 1707 |
precSo, |
... | ... | |
1743 | 1875 |
errorTypeIsNone = False |
1744 | 1876 |
# |
1745 | 1877 |
if accuracySo is None: |
1746 |
# Notice the **: we are in Pythonland! |
|
1878 |
# Notice the **: we are in Pythonland here!
|
|
1747 | 1879 |
accuracySo = pobyso_constant_sa_so(RR(2**(-40))) |
1748 | 1880 |
accuracyIsNone = True |
1749 | 1881 |
else: |
Formats disponibles : Unified diff