Révision 278 pobysoPythonSage/src/pobyso.py
pobyso.py (revision 278) | ||
---|---|---|
1791 | 1791 |
# |
1792 | 1792 |
## Tranform the Sage list of exponents into a Sollya list. |
1793 | 1793 |
exponentsListSo = pobyso_build_list_of_ints_sa_so(*exponentsList) |
1794 |
remezPolySo = sollya_lib_remez(functionSo, \ |
|
1794 |
remezPolySo = sollya_lib_remez(functionSo, \
|
|
1795 | 1795 |
exponentsListSo, \ |
1796 |
rangeSo, \ |
|
1797 |
weightSo, \ |
|
1798 |
qualitySo, \ |
|
1796 |
rangeSo, \
|
|
1797 |
weightSo, \
|
|
1798 |
qualitySo, \
|
|
1799 | 1799 |
None) |
1800 | 1800 |
sollya_lib_clear_obj(functionSo) |
1801 | 1801 |
sollya_lib_clear_obj(exponentsListSo) |
... | ... | |
1843 | 1843 |
# the former as inutile after call. |
1844 | 1844 |
return (sollya_lib_copy_obj(polySo), |
1845 | 1845 |
sollya_lib_copy_obj(currentApproxErrorSo)) |
1846 |
# |
|
1847 |
## Try to round the coefficients. |
|
1846 | 1848 |
degreeSa = pobyso_polynomial_degree_so_sa(polySo) |
1847 | 1849 |
intervalSa = pobyso_range_to_interval_so_sa(intervalSo) |
1848 | 1850 |
|
... | ... | |
1913 | 1915 |
# never happen since the rounding algorithm is proved. But some |
1914 | 1916 |
# circumstances may break it (e.g. internal precision of tools). |
1915 | 1917 |
if cerrSa > approxAccurSa: |
1916 |
if iterIndex > 0: # Round 1 and beyond.
|
|
1918 |
if iterIndex == 0: # Round 0 is agressive rounding, got round 1 (proved rounding)
|
|
1917 | 1919 |
sollya_lib_clear_obj(resPolySo) |
1918 | 1920 |
sollya_lib_clear_obj(infNormSo) |
1921 |
iterIndex += 1 |
|
1922 |
continue |
|
1923 |
else: # Round 1 and beyond : just return the oroginal polynomial. |
|
1924 |
sollya_lib_clear_obj(resPolySo) |
|
1925 |
sollya_lib_clear_obj(infNormSo) |
|
1919 | 1926 |
#### Do not return the arguments but copies: the caller may free |
1920 | 1927 |
# free the former as inutile after call. |
1921 | 1928 |
return (sollya_lib_copy_obj(polySo), |
1922 | 1929 |
sollya_lib_copy_obj(currentApproxErrorSo)) |
1923 |
else: # Round 0 (agressive rounding), got round 1 (proved rounding) |
|
1924 |
sollya_lib_clear_obj(resPolySo) |
|
1925 |
sollya_lib_clear_obj(infNormSo) |
|
1926 |
iterIndex += 1 |
|
1927 |
continue |
|
1928 | 1930 |
### If get here it is because cerrSa <= approxAccurSa |
1929 | 1931 |
### Approximation error of the new polynomial is acceptable. |
1930 | 1932 |
return (resPolySo, infNormSo) |
Formats disponibles : Unified diff