passagemath-singular 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-singular might be problematic. Click here for more details.
- PySingular.cpython-314-x86_64-linux-musl.so +0 -0
- passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
- passagemath_singular-10.6.31rc3.dist-info/RECORD +493 -0
- passagemath_singular-10.6.31rc3.dist-info/WHEEL +5 -0
- passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
- passagemath_singular.libs/libSingular-4-67059f19.4.1.so +0 -0
- passagemath_singular.libs/libcddgmp-30166d29.so.0.1.3 +0 -0
- passagemath_singular.libs/libfactory-4-9d37bcf4.4.1.so +0 -0
- passagemath_singular.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
- passagemath_singular.libs/libgcc_s-0cd532bd.so.1 +0 -0
- passagemath_singular.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
- passagemath_singular.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
- passagemath_singular.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
- passagemath_singular.libs/libgsl-42cda06f.so.28.0.0 +0 -0
- passagemath_singular.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
- passagemath_singular.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
- passagemath_singular.libs/libntl-26885ca2.so.44.0.1 +0 -0
- passagemath_singular.libs/libomalloc-0-e9ff96db.9.6.so +0 -0
- passagemath_singular.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
- passagemath_singular.libs/libpolys-4-8bcf8e7d.4.1.so +0 -0
- passagemath_singular.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
- passagemath_singular.libs/libreadline-06542304.so.8.2 +0 -0
- passagemath_singular.libs/libsingular_resources-4-73bf7623.4.1.so +0 -0
- passagemath_singular.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
- sage/algebras/all__sagemath_singular.py +3 -0
- sage/algebras/fusion_rings/all.py +19 -0
- sage/algebras/fusion_rings/f_matrix.py +2448 -0
- sage/algebras/fusion_rings/fast_parallel_fmats_methods.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +5 -0
- sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +538 -0
- sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +3 -0
- sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +331 -0
- sage/algebras/fusion_rings/fusion_double.py +899 -0
- sage/algebras/fusion_rings/fusion_ring.py +1580 -0
- sage/algebras/fusion_rings/poly_tup_engine.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/fusion_rings/poly_tup_engine.pxd +24 -0
- sage/algebras/fusion_rings/poly_tup_engine.pyx +579 -0
- sage/algebras/fusion_rings/shm_managers.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/fusion_rings/shm_managers.pxd +24 -0
- sage/algebras/fusion_rings/shm_managers.pyx +780 -0
- sage/algebras/letterplace/all.py +1 -0
- sage/algebras/letterplace/free_algebra_element_letterplace.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/letterplace/free_algebra_element_letterplace.pxd +18 -0
- sage/algebras/letterplace/free_algebra_element_letterplace.pyx +755 -0
- sage/algebras/letterplace/free_algebra_letterplace.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/letterplace/free_algebra_letterplace.pxd +35 -0
- sage/algebras/letterplace/free_algebra_letterplace.pyx +914 -0
- sage/algebras/letterplace/letterplace_ideal.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/letterplace/letterplace_ideal.pyx +408 -0
- sage/algebras/quatalg/all.py +2 -0
- sage/algebras/quatalg/quaternion_algebra.py +4778 -0
- sage/algebras/quatalg/quaternion_algebra_cython.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
- sage/algebras/quatalg/quaternion_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/algebras/quatalg/quaternion_algebra_element.pxd +29 -0
- sage/algebras/quatalg/quaternion_algebra_element.pyx +2176 -0
- sage/all__sagemath_singular.py +11 -0
- sage/ext_data/all__sagemath_singular.py +1 -0
- sage/ext_data/singular/function_field/core.lib +98 -0
- sage/interfaces/all__sagemath_singular.py +1 -0
- sage/interfaces/singular.py +2835 -0
- sage/libs/all__sagemath_singular.py +1 -0
- sage/libs/singular/__init__.py +1 -0
- sage/libs/singular/decl.pxd +1168 -0
- sage/libs/singular/function.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/singular/function.pxd +87 -0
- sage/libs/singular/function.pyx +1901 -0
- sage/libs/singular/function_factory.py +61 -0
- sage/libs/singular/groebner_strategy.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/singular/groebner_strategy.pxd +22 -0
- sage/libs/singular/groebner_strategy.pyx +582 -0
- sage/libs/singular/option.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/singular/option.pyx +671 -0
- sage/libs/singular/polynomial.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/singular/polynomial.pxd +39 -0
- sage/libs/singular/polynomial.pyx +661 -0
- sage/libs/singular/ring.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/singular/ring.pxd +58 -0
- sage/libs/singular/ring.pyx +893 -0
- sage/libs/singular/singular.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/singular/singular.pxd +72 -0
- sage/libs/singular/singular.pyx +1944 -0
- sage/libs/singular/standard_options.py +145 -0
- sage/matrix/all__sagemath_singular.py +1 -0
- sage/matrix/matrix_mpolynomial_dense.cpython-314-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_mpolynomial_dense.pxd +7 -0
- sage/matrix/matrix_mpolynomial_dense.pyx +615 -0
- sage/rings/all__sagemath_singular.py +1 -0
- sage/rings/function_field/all__sagemath_singular.py +1 -0
- sage/rings/function_field/derivations_polymod.py +911 -0
- sage/rings/function_field/element_polymod.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/function_field/element_polymod.pyx +406 -0
- sage/rings/function_field/function_field_polymod.py +2611 -0
- sage/rings/function_field/ideal_polymod.py +1775 -0
- sage/rings/function_field/order_polymod.py +1475 -0
- sage/rings/function_field/place_polymod.py +681 -0
- sage/rings/polynomial/all__sagemath_singular.py +1 -0
- sage/rings/polynomial/multi_polynomial_ideal_libsingular.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +5 -0
- sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +339 -0
- sage/rings/polynomial/multi_polynomial_libsingular.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial_libsingular.pxd +30 -0
- sage/rings/polynomial/multi_polynomial_libsingular.pyx +6277 -0
- sage/rings/polynomial/plural.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/polynomial/plural.pxd +48 -0
- sage/rings/polynomial/plural.pyx +3171 -0
- sage/symbolic/all__sagemath_singular.py +1 -0
- sage/symbolic/comparison_impl.pxi +428 -0
- sage/symbolic/constants_c_impl.pxi +178 -0
- sage/symbolic/expression.cpython-314-x86_64-linux-musl.so +0 -0
- sage/symbolic/expression.pxd +7 -0
- sage/symbolic/expression.pyx +14200 -0
- sage/symbolic/getitem_impl.pxi +202 -0
- sage/symbolic/pynac.pxi +572 -0
- sage/symbolic/pynac_constant_impl.pxi +133 -0
- sage/symbolic/pynac_function_impl.pxi +206 -0
- sage/symbolic/pynac_impl.pxi +2576 -0
- sage/symbolic/pynac_wrap.h +124 -0
- sage/symbolic/series_impl.pxi +272 -0
- sage/symbolic/substitution_map_impl.pxi +94 -0
- sage_wheels/bin/ESingular +0 -0
- sage_wheels/bin/Singular +0 -0
- sage_wheels/bin/TSingular +0 -0
- sage_wheels/lib/singular/MOD/cohomo.la +41 -0
- sage_wheels/lib/singular/MOD/cohomo.so +0 -0
- sage_wheels/lib/singular/MOD/customstd.la +41 -0
- sage_wheels/lib/singular/MOD/customstd.so +0 -0
- sage_wheels/lib/singular/MOD/freealgebra.la +41 -0
- sage_wheels/lib/singular/MOD/freealgebra.so +0 -0
- sage_wheels/lib/singular/MOD/gfanlib.la +41 -0
- sage_wheels/lib/singular/MOD/gfanlib.so +0 -0
- sage_wheels/lib/singular/MOD/gitfan.la +41 -0
- sage_wheels/lib/singular/MOD/gitfan.so +0 -0
- sage_wheels/lib/singular/MOD/interval.la +41 -0
- sage_wheels/lib/singular/MOD/interval.so +0 -0
- sage_wheels/lib/singular/MOD/loctriv.la +41 -0
- sage_wheels/lib/singular/MOD/loctriv.so +0 -0
- sage_wheels/lib/singular/MOD/machinelearning.la +41 -0
- sage_wheels/lib/singular/MOD/machinelearning.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldQ.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldQ.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldZp.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldZp.so +0 -0
- sage_wheels/lib/singular/MOD/partialgb.la +41 -0
- sage_wheels/lib/singular/MOD/partialgb.so +0 -0
- sage_wheels/lib/singular/MOD/pyobject.la +41 -0
- sage_wheels/lib/singular/MOD/pyobject.so +0 -0
- sage_wheels/lib/singular/MOD/singmathic.la +41 -0
- sage_wheels/lib/singular/MOD/singmathic.so +0 -0
- sage_wheels/lib/singular/MOD/sispasm.la +41 -0
- sage_wheels/lib/singular/MOD/sispasm.so +0 -0
- sage_wheels/lib/singular/MOD/subsets.la +41 -0
- sage_wheels/lib/singular/MOD/subsets.so +0 -0
- sage_wheels/lib/singular/MOD/systhreads.la +41 -0
- sage_wheels/lib/singular/MOD/systhreads.so +0 -0
- sage_wheels/lib/singular/MOD/syzextra.la +41 -0
- sage_wheels/lib/singular/MOD/syzextra.so +0 -0
- sage_wheels/libexec/singular/MOD/change_cost +0 -0
- sage_wheels/libexec/singular/MOD/singularsurf +11 -0
- sage_wheels/libexec/singular/MOD/singularsurf_jupyter +9 -0
- sage_wheels/libexec/singular/MOD/singularsurf_win +10 -0
- sage_wheels/libexec/singular/MOD/solve_IP +0 -0
- sage_wheels/libexec/singular/MOD/surfex +16 -0
- sage_wheels/libexec/singular/MOD/toric_ideal +0 -0
- sage_wheels/share/factory/gftables/10201 +342 -0
- sage_wheels/share/factory/gftables/1024 +37 -0
- sage_wheels/share/factory/gftables/10609 +356 -0
- sage_wheels/share/factory/gftables/11449 +384 -0
- sage_wheels/share/factory/gftables/11881 +398 -0
- sage_wheels/share/factory/gftables/121 +6 -0
- sage_wheels/share/factory/gftables/12167 +408 -0
- sage_wheels/share/factory/gftables/125 +7 -0
- sage_wheels/share/factory/gftables/12769 +428 -0
- sage_wheels/share/factory/gftables/128 +7 -0
- sage_wheels/share/factory/gftables/1331 +47 -0
- sage_wheels/share/factory/gftables/1369 +48 -0
- sage_wheels/share/factory/gftables/14641 +490 -0
- sage_wheels/share/factory/gftables/15625 +523 -0
- sage_wheels/share/factory/gftables/16 +3 -0
- sage_wheels/share/factory/gftables/16129 +540 -0
- sage_wheels/share/factory/gftables/16384 +549 -0
- sage_wheels/share/factory/gftables/16807 +563 -0
- sage_wheels/share/factory/gftables/1681 +58 -0
- sage_wheels/share/factory/gftables/169 +8 -0
- sage_wheels/share/factory/gftables/17161 +574 -0
- sage_wheels/share/factory/gftables/1849 +64 -0
- sage_wheels/share/factory/gftables/18769 +628 -0
- sage_wheels/share/factory/gftables/19321 +646 -0
- sage_wheels/share/factory/gftables/19683 +659 -0
- sage_wheels/share/factory/gftables/2048 +71 -0
- sage_wheels/share/factory/gftables/2187 +75 -0
- sage_wheels/share/factory/gftables/2197 +76 -0
- sage_wheels/share/factory/gftables/2209 +76 -0
- sage_wheels/share/factory/gftables/22201 +742 -0
- sage_wheels/share/factory/gftables/22801 +762 -0
- sage_wheels/share/factory/gftables/2401 +82 -0
- sage_wheels/share/factory/gftables/243 +11 -0
- sage_wheels/share/factory/gftables/24389 +815 -0
- sage_wheels/share/factory/gftables/24649 +824 -0
- sage_wheels/share/factory/gftables/25 +3 -0
- sage_wheels/share/factory/gftables/256 +11 -0
- sage_wheels/share/factory/gftables/26569 +888 -0
- sage_wheels/share/factory/gftables/27 +3 -0
- sage_wheels/share/factory/gftables/27889 +932 -0
- sage_wheels/share/factory/gftables/2809 +96 -0
- sage_wheels/share/factory/gftables/28561 +954 -0
- sage_wheels/share/factory/gftables/289 +12 -0
- sage_wheels/share/factory/gftables/29791 +995 -0
- sage_wheels/share/factory/gftables/29929 +1000 -0
- sage_wheels/share/factory/gftables/3125 +107 -0
- sage_wheels/share/factory/gftables/32 +4 -0
- sage_wheels/share/factory/gftables/32041 +1070 -0
- sage_wheels/share/factory/gftables/32761 +1094 -0
- sage_wheels/share/factory/gftables/32768 +1095 -0
- sage_wheels/share/factory/gftables/343 +14 -0
- sage_wheels/share/factory/gftables/3481 +118 -0
- sage_wheels/share/factory/gftables/361 +14 -0
- sage_wheels/share/factory/gftables/36481 +1218 -0
- sage_wheels/share/factory/gftables/3721 +126 -0
- sage_wheels/share/factory/gftables/37249 +1244 -0
- sage_wheels/share/factory/gftables/38809 +1296 -0
- sage_wheels/share/factory/gftables/39601 +1322 -0
- sage_wheels/share/factory/gftables/4 +3 -0
- sage_wheels/share/factory/gftables/4096 +139 -0
- sage_wheels/share/factory/gftables/44521 +1486 -0
- sage_wheels/share/factory/gftables/4489 +152 -0
- sage_wheels/share/factory/gftables/49 +4 -0
- sage_wheels/share/factory/gftables/4913 +166 -0
- sage_wheels/share/factory/gftables/49729 +1660 -0
- sage_wheels/share/factory/gftables/5041 +170 -0
- sage_wheels/share/factory/gftables/50653 +1691 -0
- sage_wheels/share/factory/gftables/512 +20 -0
- sage_wheels/share/factory/gftables/51529 +1720 -0
- sage_wheels/share/factory/gftables/52441 +1750 -0
- sage_wheels/share/factory/gftables/529 +20 -0
- sage_wheels/share/factory/gftables/5329 +180 -0
- sage_wheels/share/factory/gftables/54289 +1812 -0
- sage_wheels/share/factory/gftables/57121 +1906 -0
- sage_wheels/share/factory/gftables/58081 +1938 -0
- sage_wheels/share/factory/gftables/59049 +1971 -0
- sage_wheels/share/factory/gftables/6241 +210 -0
- sage_wheels/share/factory/gftables/625 +23 -0
- sage_wheels/share/factory/gftables/63001 +2102 -0
- sage_wheels/share/factory/gftables/64 +5 -0
- sage_wheels/share/factory/gftables/6561 +221 -0
- sage_wheels/share/factory/gftables/6859 +231 -0
- sage_wheels/share/factory/gftables/6889 +232 -0
- sage_wheels/share/factory/gftables/729 +27 -0
- sage_wheels/share/factory/gftables/7921 +266 -0
- sage_wheels/share/factory/gftables/8 +3 -0
- sage_wheels/share/factory/gftables/81 +5 -0
- sage_wheels/share/factory/gftables/8192 +276 -0
- sage_wheels/share/factory/gftables/841 +30 -0
- sage_wheels/share/factory/gftables/9 +3 -0
- sage_wheels/share/factory/gftables/9409 +316 -0
- sage_wheels/share/factory/gftables/961 +34 -0
- sage_wheels/share/info/singular.info +191898 -0
- sage_wheels/share/singular/LIB/GND.lib +1359 -0
- sage_wheels/share/singular/LIB/JMBTest.lib +976 -0
- sage_wheels/share/singular/LIB/JMSConst.lib +1363 -0
- sage_wheels/share/singular/LIB/KVequiv.lib +699 -0
- sage_wheels/share/singular/LIB/SingularityDBM.lib +491 -0
- sage_wheels/share/singular/LIB/VecField.lib +1542 -0
- sage_wheels/share/singular/LIB/absfact.lib +959 -0
- sage_wheels/share/singular/LIB/ainvar.lib +730 -0
- sage_wheels/share/singular/LIB/aksaka.lib +419 -0
- sage_wheels/share/singular/LIB/alexpoly.lib +2542 -0
- sage_wheels/share/singular/LIB/algebra.lib +1193 -0
- sage_wheels/share/singular/LIB/all.lib +136 -0
- sage_wheels/share/singular/LIB/arcpoint.lib +514 -0
- sage_wheels/share/singular/LIB/arnold.lib +4553 -0
- sage_wheels/share/singular/LIB/arnoldclassify.lib +2058 -0
- sage_wheels/share/singular/LIB/arr.lib +3486 -0
- sage_wheels/share/singular/LIB/assprimeszerodim.lib +755 -0
- sage_wheels/share/singular/LIB/autgradalg.lib +3361 -0
- sage_wheels/share/singular/LIB/bfun.lib +1964 -0
- sage_wheels/share/singular/LIB/bimodules.lib +774 -0
- sage_wheels/share/singular/LIB/brillnoether.lib +226 -0
- sage_wheels/share/singular/LIB/brnoeth.lib +5017 -0
- sage_wheels/share/singular/LIB/central.lib +2169 -0
- sage_wheels/share/singular/LIB/chern.lib +4162 -0
- sage_wheels/share/singular/LIB/cimonom.lib +571 -0
- sage_wheels/share/singular/LIB/cisimplicial.lib +1835 -0
- sage_wheels/share/singular/LIB/classify.lib +3239 -0
- sage_wheels/share/singular/LIB/classify2.lib +1462 -0
- sage_wheels/share/singular/LIB/classifyMapGerms.lib +1515 -0
- sage_wheels/share/singular/LIB/classify_aeq.lib +3253 -0
- sage_wheels/share/singular/LIB/classifyceq.lib +2092 -0
- sage_wheels/share/singular/LIB/classifyci.lib +1133 -0
- sage_wheels/share/singular/LIB/combinat.lib +91 -0
- sage_wheels/share/singular/LIB/compregb.lib +276 -0
- sage_wheels/share/singular/LIB/control.lib +1636 -0
- sage_wheels/share/singular/LIB/crypto.lib +3795 -0
- sage_wheels/share/singular/LIB/curveInv.lib +667 -0
- sage_wheels/share/singular/LIB/curvepar.lib +1817 -0
- sage_wheels/share/singular/LIB/customstd.lib +100 -0
- sage_wheels/share/singular/LIB/deRham.lib +5979 -0
- sage_wheels/share/singular/LIB/decodegb.lib +2134 -0
- sage_wheels/share/singular/LIB/decomp.lib +1655 -0
- sage_wheels/share/singular/LIB/deflation.lib +872 -0
- sage_wheels/share/singular/LIB/deform.lib +925 -0
- sage_wheels/share/singular/LIB/difform.lib +3055 -0
- sage_wheels/share/singular/LIB/divisors.lib +750 -0
- sage_wheels/share/singular/LIB/dmod.lib +5817 -0
- sage_wheels/share/singular/LIB/dmodapp.lib +3269 -0
- sage_wheels/share/singular/LIB/dmodideal.lib +1211 -0
- sage_wheels/share/singular/LIB/dmodloc.lib +2645 -0
- sage_wheels/share/singular/LIB/dmodvar.lib +818 -0
- sage_wheels/share/singular/LIB/dummy.lib +17 -0
- sage_wheels/share/singular/LIB/elim.lib +1009 -0
- sage_wheels/share/singular/LIB/ellipticcovers.lib +548 -0
- sage_wheels/share/singular/LIB/enumpoints.lib +146 -0
- sage_wheels/share/singular/LIB/equising.lib +2127 -0
- sage_wheels/share/singular/LIB/ffmodstd.lib +2384 -0
- sage_wheels/share/singular/LIB/ffsolve.lib +1289 -0
- sage_wheels/share/singular/LIB/findifs.lib +778 -0
- sage_wheels/share/singular/LIB/finitediff.lib +1768 -0
- sage_wheels/share/singular/LIB/finvar.lib +7989 -0
- sage_wheels/share/singular/LIB/fpadim.lib +2429 -0
- sage_wheels/share/singular/LIB/fpalgebras.lib +1666 -0
- sage_wheels/share/singular/LIB/fpaprops.lib +1462 -0
- sage_wheels/share/singular/LIB/freegb.lib +3853 -0
- sage_wheels/share/singular/LIB/general.lib +1350 -0
- sage_wheels/share/singular/LIB/gfan.lib +1768 -0
- sage_wheels/share/singular/LIB/gitfan.lib +3130 -0
- sage_wheels/share/singular/LIB/gkdim.lib +99 -0
- sage_wheels/share/singular/LIB/gmspoly.lib +589 -0
- sage_wheels/share/singular/LIB/gmssing.lib +1739 -0
- sage_wheels/share/singular/LIB/goettsche.lib +909 -0
- sage_wheels/share/singular/LIB/graal.lib +1366 -0
- sage_wheels/share/singular/LIB/gradedModules.lib +2541 -0
- sage_wheels/share/singular/LIB/graphics.lib +360 -0
- sage_wheels/share/singular/LIB/grobcov.lib +7706 -0
- sage_wheels/share/singular/LIB/groups.lib +1123 -0
- sage_wheels/share/singular/LIB/grwalk.lib +507 -0
- sage_wheels/share/singular/LIB/hdepth.lib +194 -0
- sage_wheels/share/singular/LIB/help.cnf +57 -0
- sage_wheels/share/singular/LIB/hess.lib +1946 -0
- sage_wheels/share/singular/LIB/hnoether.lib +4292 -0
- sage_wheels/share/singular/LIB/hodge.lib +400 -0
- sage_wheels/share/singular/LIB/homolog.lib +1965 -0
- sage_wheels/share/singular/LIB/hyperel.lib +975 -0
- sage_wheels/share/singular/LIB/inout.lib +679 -0
- sage_wheels/share/singular/LIB/integralbasis.lib +6224 -0
- sage_wheels/share/singular/LIB/interval.lib +1418 -0
- sage_wheels/share/singular/LIB/intprog.lib +778 -0
- sage_wheels/share/singular/LIB/invar.lib +443 -0
- sage_wheels/share/singular/LIB/involut.lib +980 -0
- sage_wheels/share/singular/LIB/jacobson.lib +1215 -0
- sage_wheels/share/singular/LIB/kskernel.lib +534 -0
- sage_wheels/share/singular/LIB/latex.lib +3146 -0
- sage_wheels/share/singular/LIB/lejeune.lib +651 -0
- sage_wheels/share/singular/LIB/linalg.lib +2040 -0
- sage_wheels/share/singular/LIB/locnormal.lib +212 -0
- sage_wheels/share/singular/LIB/lrcalc.lib +526 -0
- sage_wheels/share/singular/LIB/makedbm.lib +294 -0
- sage_wheels/share/singular/LIB/mathml.lib +813 -0
- sage_wheels/share/singular/LIB/matrix.lib +1372 -0
- sage_wheels/share/singular/LIB/maxlike.lib +1132 -0
- sage_wheels/share/singular/LIB/methods.lib +212 -0
- sage_wheels/share/singular/LIB/moddiq.lib +322 -0
- sage_wheels/share/singular/LIB/modfinduni.lib +181 -0
- sage_wheels/share/singular/LIB/modnormal.lib +218 -0
- sage_wheels/share/singular/LIB/modprimdec.lib +1278 -0
- sage_wheels/share/singular/LIB/modquotient.lib +269 -0
- sage_wheels/share/singular/LIB/modstd.lib +1024 -0
- sage_wheels/share/singular/LIB/modular.lib +545 -0
- sage_wheels/share/singular/LIB/modules.lib +2561 -0
- sage_wheels/share/singular/LIB/modwalk.lib +609 -0
- sage_wheels/share/singular/LIB/mondromy.lib +1016 -0
- sage_wheels/share/singular/LIB/monomialideal.lib +3851 -0
- sage_wheels/share/singular/LIB/mprimdec.lib +2353 -0
- sage_wheels/share/singular/LIB/mregular.lib +1863 -0
- sage_wheels/share/singular/LIB/multigrading.lib +5629 -0
- sage_wheels/share/singular/LIB/ncHilb.lib +777 -0
- sage_wheels/share/singular/LIB/ncModslimgb.lib +791 -0
- sage_wheels/share/singular/LIB/ncalg.lib +16311 -0
- sage_wheels/share/singular/LIB/ncall.lib +31 -0
- sage_wheels/share/singular/LIB/ncdecomp.lib +468 -0
- sage_wheels/share/singular/LIB/ncfactor.lib +13371 -0
- sage_wheels/share/singular/LIB/ncfrac.lib +1023 -0
- sage_wheels/share/singular/LIB/nchilbert.lib +448 -0
- sage_wheels/share/singular/LIB/nchomolog.lib +759 -0
- sage_wheels/share/singular/LIB/ncloc.lib +361 -0
- sage_wheels/share/singular/LIB/ncpreim.lib +795 -0
- sage_wheels/share/singular/LIB/ncrat.lib +2849 -0
- sage_wheels/share/singular/LIB/nctools.lib +1887 -0
- sage_wheels/share/singular/LIB/nets.lib +1456 -0
- sage_wheels/share/singular/LIB/nfmodstd.lib +1000 -0
- sage_wheels/share/singular/LIB/nfmodsyz.lib +732 -0
- sage_wheels/share/singular/LIB/noether.lib +1106 -0
- sage_wheels/share/singular/LIB/normal.lib +8700 -0
- sage_wheels/share/singular/LIB/normaliz.lib +2226 -0
- sage_wheels/share/singular/LIB/ntsolve.lib +362 -0
- sage_wheels/share/singular/LIB/numerAlg.lib +560 -0
- sage_wheels/share/singular/LIB/numerDecom.lib +2261 -0
- sage_wheels/share/singular/LIB/olga.lib +1933 -0
- sage_wheels/share/singular/LIB/orbitparam.lib +351 -0
- sage_wheels/share/singular/LIB/parallel.lib +319 -0
- sage_wheels/share/singular/LIB/paraplanecurves.lib +3110 -0
- sage_wheels/share/singular/LIB/perron.lib +202 -0
- sage_wheels/share/singular/LIB/pfd.lib +2223 -0
- sage_wheels/share/singular/LIB/phindex.lib +642 -0
- sage_wheels/share/singular/LIB/pointid.lib +673 -0
- sage_wheels/share/singular/LIB/polybori.lib +1430 -0
- sage_wheels/share/singular/LIB/polyclass.lib +525 -0
- sage_wheels/share/singular/LIB/polylib.lib +1174 -0
- sage_wheels/share/singular/LIB/polymake.lib +1902 -0
- sage_wheels/share/singular/LIB/presolve.lib +1533 -0
- sage_wheels/share/singular/LIB/primdec.lib +9576 -0
- sage_wheels/share/singular/LIB/primdecint.lib +1782 -0
- sage_wheels/share/singular/LIB/primitiv.lib +401 -0
- sage_wheels/share/singular/LIB/puiseuxexpansions.lib +1631 -0
- sage_wheels/share/singular/LIB/purityfiltration.lib +960 -0
- sage_wheels/share/singular/LIB/qhmoduli.lib +1561 -0
- sage_wheels/share/singular/LIB/qmatrix.lib +293 -0
- sage_wheels/share/singular/LIB/random.lib +455 -0
- sage_wheels/share/singular/LIB/ratgb.lib +489 -0
- sage_wheels/share/singular/LIB/realclassify.lib +5759 -0
- sage_wheels/share/singular/LIB/realizationMatroids.lib +772 -0
- sage_wheels/share/singular/LIB/realrad.lib +1197 -0
- sage_wheels/share/singular/LIB/recover.lib +2628 -0
- sage_wheels/share/singular/LIB/redcgs.lib +3984 -0
- sage_wheels/share/singular/LIB/reesclos.lib +465 -0
- sage_wheels/share/singular/LIB/resbinomial.lib +2802 -0
- sage_wheels/share/singular/LIB/resgraph.lib +789 -0
- sage_wheels/share/singular/LIB/resjung.lib +820 -0
- sage_wheels/share/singular/LIB/resolve.lib +5110 -0
- sage_wheels/share/singular/LIB/resources.lib +170 -0
- sage_wheels/share/singular/LIB/reszeta.lib +5473 -0
- sage_wheels/share/singular/LIB/ring.lib +1328 -0
- sage_wheels/share/singular/LIB/ringgb.lib +343 -0
- sage_wheels/share/singular/LIB/rinvar.lib +1153 -0
- sage_wheels/share/singular/LIB/rootisolation.lib +1481 -0
- sage_wheels/share/singular/LIB/rootsmr.lib +709 -0
- sage_wheels/share/singular/LIB/rootsur.lib +886 -0
- sage_wheels/share/singular/LIB/rstandard.lib +607 -0
- sage_wheels/share/singular/LIB/rwalk.lib +336 -0
- sage_wheels/share/singular/LIB/sagbi.lib +1353 -0
- sage_wheels/share/singular/LIB/sagbiNormaliz.lib +1622 -0
- sage_wheels/share/singular/LIB/sagbiNormaliz0.lib +1498 -0
- sage_wheels/share/singular/LIB/sagbigrob.lib +449 -0
- sage_wheels/share/singular/LIB/schreyer.lib +321 -0
- sage_wheels/share/singular/LIB/schubert.lib +2551 -0
- sage_wheels/share/singular/LIB/sets.lib +524 -0
- sage_wheels/share/singular/LIB/sheafcoh.lib +1663 -0
- sage_wheels/share/singular/LIB/signcond.lib +437 -0
- sage_wheels/share/singular/LIB/sing.lib +1094 -0
- sage_wheels/share/singular/LIB/sing4ti2.lib +419 -0
- sage_wheels/share/singular/LIB/solve.lib +2243 -0
- sage_wheels/share/singular/LIB/spcurve.lib +1077 -0
- sage_wheels/share/singular/LIB/spectrum.lib +62 -0
- sage_wheels/share/singular/LIB/sresext.lib +757 -0
- sage_wheels/share/singular/LIB/ssi.lib +143 -0
- sage_wheels/share/singular/LIB/standard.lib +2769 -0
- sage_wheels/share/singular/LIB/stanleyreisner.lib +473 -0
- sage_wheels/share/singular/LIB/stdmodule.lib +547 -0
- sage_wheels/share/singular/LIB/stratify.lib +1070 -0
- sage_wheels/share/singular/LIB/surf.lib +506 -0
- sage_wheels/share/singular/LIB/surf_jupyter.lib +223 -0
- sage_wheels/share/singular/LIB/surfacesignature.lib +522 -0
- sage_wheels/share/singular/LIB/surfex.lib +1462 -0
- sage_wheels/share/singular/LIB/swalk.lib +877 -0
- sage_wheels/share/singular/LIB/symodstd.lib +1570 -0
- sage_wheels/share/singular/LIB/systhreads.lib +74 -0
- sage_wheels/share/singular/LIB/tasks.lib +1324 -0
- sage_wheels/share/singular/LIB/tateProdCplxNegGrad.lib +2412 -0
- sage_wheels/share/singular/LIB/teachstd.lib +858 -0
- sage_wheels/share/singular/LIB/template.lib +116 -0
- sage_wheels/share/singular/LIB/toric.lib +1119 -0
- sage_wheels/share/singular/LIB/transformation.lib +116 -0
- sage_wheels/share/singular/LIB/triang.lib +1197 -0
- sage_wheels/share/singular/LIB/tropical.lib +8741 -0
- sage_wheels/share/singular/LIB/tropicalEllipticCovers.lib +2922 -0
- sage_wheels/share/singular/LIB/tropicalNewton.lib +1128 -0
- sage_wheels/share/singular/LIB/tst.lib +1108 -0
- sage_wheels/share/singular/LIB/weierstr.lib +241 -0
- sage_wheels/share/singular/LIB/zeroset.lib +1478 -0
- sage_wheels/share/singular/emacs/.emacs-general +184 -0
- sage_wheels/share/singular/emacs/.emacs-singular +234 -0
- sage_wheels/share/singular/emacs/COPYING +44 -0
- sage_wheels/share/singular/emacs/cmd-cmpl.el +241 -0
- sage_wheels/share/singular/emacs/ex-cmpl.el +1681 -0
- sage_wheels/share/singular/emacs/hlp-cmpl.el +4318 -0
- sage_wheels/share/singular/emacs/lib-cmpl.el +179 -0
- sage_wheels/share/singular/emacs/singular.el +4273 -0
- sage_wheels/share/singular/emacs/singular.xpm +39 -0
- sage_wheels/share/singular/singular.idx +5002 -0
|
@@ -0,0 +1,2384 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
version="version ffmodstd.lib 4.4.0.6 Oct_2024 "; // $Id: 3a6d0d9dde45510ff3c430a809956a528f8e345f $
|
|
3
|
+
category="Commutative Algebra";
|
|
4
|
+
info="
|
|
5
|
+
LIBRARY: ffmodstd.lib Groebner bases of ideals in polynomial rings
|
|
6
|
+
over rational function fields
|
|
7
|
+
AUTHORS: D.K. Boku boku@mathematik.uni-kl.de
|
|
8
|
+
W. Decker decker@mathematik.uni-kl.dei
|
|
9
|
+
C. Fieker fieker@mathematik.uni-kl.de
|
|
10
|
+
A. Steenpass steenpass@mathematik.uni-kl.de
|
|
11
|
+
|
|
12
|
+
OVERVIEW:
|
|
13
|
+
A library for computing a Groebner basis of an ideal in a polynomial
|
|
14
|
+
ring over an algebraic function field Q(T):=Q(t_1,...,t_m) using modular
|
|
15
|
+
methods and sparse multivariate rational interpolation, where the
|
|
16
|
+
t_i are transcendental over Q. The idea is as follows:
|
|
17
|
+
Given an ideal I in Q(T)[X], we map I to J via the map sending T to
|
|
18
|
+
Tz:=(t_1z+s_1,..., t_mz+s_m) for a suitable point s in Q^m\\{(0,...,0)} and for some
|
|
19
|
+
extra variable z so that J is an ideal in Q(Tz)[X]. For a suitable point b in
|
|
20
|
+
Z^m\\{(0,...,0)}, we map J to K via the map sending (T,z) to (b,z), where
|
|
21
|
+
b:=(b_1,...,b_m) (usually the b_i's are distinct primes), so that K is an ideal in
|
|
22
|
+
Q(z)[X]. For such a rational point b, we compute a Groebner basis G_b of K using
|
|
23
|
+
modular algorithms [1], where prime numbers are replaced by maximal ideals of the form
|
|
24
|
+
<z-z_i>, and univariate rational interpolation [2,7]. Note that since Q[z]/<z-z_i> = Q
|
|
25
|
+
we also use (if required) modular algorithms [1] over Q. The procedure is repeated for
|
|
26
|
+
many rational points b until their number is sufficiently large to recover the correct
|
|
27
|
+
coefficients in Q(T). Once we have these points, we obtain a set of polynomials G by
|
|
28
|
+
applying the sparse multivariate rational interpolation algorithm from [4] coefficient-
|
|
29
|
+
wise to the list of Groebner bases G_b in Q(z)[X], where this algorithm makes use of
|
|
30
|
+
the following algorithms: univariate polynomial interpolation [2], univariate rational
|
|
31
|
+
function reconstruction [7], and multivariate polynomial interpolation [3]. The last
|
|
32
|
+
algorithm uses the well-known Berlekamp/Massey algorithm [5] and its early termination
|
|
33
|
+
version [6]. The set G is then a Groebner basis of I with high probability.
|
|
34
|
+
|
|
35
|
+
REFERENCES:
|
|
36
|
+
[1] E. A. Arnold: Modular algorithms for computing Groebner bases.
|
|
37
|
+
J. Symb. Comput. 35, 403-419 (2003).
|
|
38
|
+
[2] R. L. Burden and J. D. Faires: Numerical analysis. 9th ed. (1993).
|
|
39
|
+
[3] M. Ben-Or and P. Tiwari: A deterministic algorithm for sparse multivariate
|
|
40
|
+
polynomial interpolation. Proc. of the 20th Annual ACM Symposium on
|
|
41
|
+
Theory of Computing, 301-309 (1988).
|
|
42
|
+
[4] A. Cuyt and W.-s. Lee: Sparse interpolation of multivariate rational functions.
|
|
43
|
+
Theor. Comput. Sci. 412, 1445-1456 (2011).
|
|
44
|
+
[5] E. Kaltofen and W.-s. Lee: Early termination in sparse interpolation algorithms.
|
|
45
|
+
J. Symb. Comput. 36, 365-400 (2003).
|
|
46
|
+
[6] E. Kaltofen, W.-s. Lee and A. A. Lobo: Early termination in Ben-Or/Tiwari
|
|
47
|
+
sparse interpolation and a hybrid of Zippel's algorithm. Proc. ISSAC
|
|
48
|
+
(ISSAC '00), 192-201 (2000).
|
|
49
|
+
[7] K. Sara and M. Monagan: Fast Rational Function Reconstruction. Proc. ISSAC
|
|
50
|
+
(ISSAC '06), 184-190 (2006).
|
|
51
|
+
|
|
52
|
+
PROCEDURES:
|
|
53
|
+
fareypoly(g,f); univariate rational function reconstruction
|
|
54
|
+
polyInterpolation(l,m); univariate polynomial interpolation
|
|
55
|
+
modrationalInterpolation(l,m); modular univariate rational interpolation
|
|
56
|
+
BerlekampMassey(L,i); Berlekamp/Massey algorithm
|
|
57
|
+
modberlekampMassey(L,i) modular Berlekamp/Massey algorithm
|
|
58
|
+
sparseInterpolation(f,L,n); sparse multivariate polynomial interpolation
|
|
59
|
+
ffmodStd(I); Groebner bases over algebraic function fields
|
|
60
|
+
using modular methods and sparse multivariate rational
|
|
61
|
+
interpolation
|
|
62
|
+
";
|
|
63
|
+
LIB "modstd.lib";
|
|
64
|
+
LIB "linalg.lib";
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
68
|
+
|
|
69
|
+
static proc collect_coeffs(ideal I)
|
|
70
|
+
{
|
|
71
|
+
// return the numerators of the coefficients in I
|
|
72
|
+
list J1;
|
|
73
|
+
int i,j;
|
|
74
|
+
poly g;
|
|
75
|
+
number n1,N;
|
|
76
|
+
while(i < ncols(I))
|
|
77
|
+
{
|
|
78
|
+
i++;
|
|
79
|
+
g = I[i];
|
|
80
|
+
for(j = 1;j<=size(g);j++)
|
|
81
|
+
{
|
|
82
|
+
N = leadcoef(g[j]);
|
|
83
|
+
n1 = numerator(N);
|
|
84
|
+
J1 = J1+list(n1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return(J1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
91
|
+
|
|
92
|
+
static proc Testlist_all(list L)
|
|
93
|
+
{
|
|
94
|
+
// discard all constants from the list L
|
|
95
|
+
// base ring is a polynomial ring over polynomal ring with block ordering
|
|
96
|
+
ideal I = 0;
|
|
97
|
+
for(int j = 1;j <= size(L);j++)
|
|
98
|
+
{
|
|
99
|
+
if(deg(L[j])>0)
|
|
100
|
+
{
|
|
101
|
+
I = I + L[j];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return(I);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
108
|
+
// ++++++++++++++++++++ polynomial Interpolation +++++++++++++++
|
|
109
|
+
|
|
110
|
+
proc polyInterpolation(list d, list e,list #)
|
|
111
|
+
"USAGE: polyInterpolation(d, e[, n, L]); d list, e list, n int, L list
|
|
112
|
+
RETURN: a list l_p where f:=l_p[1] is a polynomial of degree at most size(d)-1
|
|
113
|
+
which satisfies the conditions f(d[i])=e[i] for all i, l_p[2] is the product
|
|
114
|
+
of all (var(n)-d[i]) for 1 <= i <= size(d) and l_p[3]=d.
|
|
115
|
+
NOTE: The procedure applies the Newton interpolation algorithm to the pair (d,e)
|
|
116
|
+
and returns the output w.r.t. the first variable (default) of the ground
|
|
117
|
+
ring. If an optional parameter n, 1<=n<=N (N is the number of variables in the
|
|
118
|
+
current basering), is given, then the procedure returns the list l_p w.r.t. the
|
|
119
|
+
n-th variable. Moreover, if the number of points (d'[i],e'[i]) is not large enough
|
|
120
|
+
to obtain the target polynomial, L = polyInterpolation(d', e', n) can be provided
|
|
121
|
+
as an optional parameter to add more interpolation points.
|
|
122
|
+
The elements in the first list must be distinct.
|
|
123
|
+
EXAMPLE: example polyInterpolation; shows an example
|
|
124
|
+
"
|
|
125
|
+
{
|
|
126
|
+
/* compute a polynomial from given numerical data
|
|
127
|
+
* size of d and e must be equal
|
|
128
|
+
* d is list of distinct elements
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
// optional parameters
|
|
132
|
+
|
|
133
|
+
int vr,i,dt,j;
|
|
134
|
+
int sz = size(#);
|
|
135
|
+
int s_d = size(d);
|
|
136
|
+
poly f,g;
|
|
137
|
+
list l_p,ltd;
|
|
138
|
+
vr = 1;
|
|
139
|
+
if(sz)
|
|
140
|
+
{
|
|
141
|
+
vr = #[1];
|
|
142
|
+
}
|
|
143
|
+
f = e[1];
|
|
144
|
+
g = (var(vr)-d[1]);
|
|
145
|
+
l_p = f,g,d;
|
|
146
|
+
number s,t;
|
|
147
|
+
if(sz <= 1)
|
|
148
|
+
{
|
|
149
|
+
if(s_d == 1)
|
|
150
|
+
{
|
|
151
|
+
return(l_p);
|
|
152
|
+
}
|
|
153
|
+
for(j = 2;j <= s_d;j++)
|
|
154
|
+
{
|
|
155
|
+
s = (d[j]-d[1]);
|
|
156
|
+
t = e[j] - number(subst(f,var(vr),d[j]));
|
|
157
|
+
for(i = 2; i < j; i++)
|
|
158
|
+
{
|
|
159
|
+
s = s*(d[j]-d[i]);
|
|
160
|
+
}
|
|
161
|
+
t = t/s;
|
|
162
|
+
f = f + t*g;
|
|
163
|
+
g = g*(var(vr)-d[j]);
|
|
164
|
+
}
|
|
165
|
+
l_p = f,g,d;
|
|
166
|
+
return(l_p);
|
|
167
|
+
}
|
|
168
|
+
else
|
|
169
|
+
{
|
|
170
|
+
// ================ interpolate at additional points ======
|
|
171
|
+
vr = #[1];
|
|
172
|
+
# = #[2];
|
|
173
|
+
ltd = #[3]+d;
|
|
174
|
+
dt = size(#[3]);
|
|
175
|
+
f = #[1];
|
|
176
|
+
g = #[2];
|
|
177
|
+
for(j=1;j<=s_d;j++)
|
|
178
|
+
{
|
|
179
|
+
s = d[j]-ltd[1];
|
|
180
|
+
t = e[j] - number(subst(f,var(vr),d[j]));
|
|
181
|
+
for(i=2;i < dt+j;i++)
|
|
182
|
+
{
|
|
183
|
+
s= s*(ltd[dt+j]-ltd[i]);
|
|
184
|
+
}
|
|
185
|
+
t = t/s;
|
|
186
|
+
f = f + t*g;
|
|
187
|
+
g = g*(var(vr)-ltd[dt+j]);
|
|
188
|
+
}
|
|
189
|
+
l_p=f,g,ltd;
|
|
190
|
+
return(l_p);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
example
|
|
194
|
+
{ "EXAMPLE:"; echo = 2;
|
|
195
|
+
ring rr = 23,(x,y),dp;
|
|
196
|
+
list d = 1,2,3,4;
|
|
197
|
+
list e = -1,10,3,8;
|
|
198
|
+
polyInterpolation(d,e);
|
|
199
|
+
polyInterpolation(d,e,2)[1];
|
|
200
|
+
list d1 = 5,6;
|
|
201
|
+
list e1 = -7,6;
|
|
202
|
+
list L = polyInterpolation(d,e);
|
|
203
|
+
L = polyInterpolation(d1,e1,1,L); // add points
|
|
204
|
+
L;
|
|
205
|
+
ring R = (499,a),x,dp;
|
|
206
|
+
list d2 = 2,3a,5;
|
|
207
|
+
list e2 = (a-2), (9a2-8a), (a+10);
|
|
208
|
+
polyInterpolation(d2,e2);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
212
|
+
// +++++++++++++++ choose a shift +++++++++++++++
|
|
213
|
+
|
|
214
|
+
static proc test_the_shift(ideal I, int n, int pa)
|
|
215
|
+
{
|
|
216
|
+
/* generators of I are the coefficients of a given input ideal w.r.t main
|
|
217
|
+
* variables n
|
|
218
|
+
* pa is the number of parameters */
|
|
219
|
+
|
|
220
|
+
list sh = choose_a_shift(pa);
|
|
221
|
+
if(size(I) == 0)
|
|
222
|
+
{
|
|
223
|
+
return(sh);
|
|
224
|
+
}
|
|
225
|
+
ideal J = Evaluate_givenI(I,sh,1,n);
|
|
226
|
+
int i;
|
|
227
|
+
while(size(J) != ncols(I))
|
|
228
|
+
{
|
|
229
|
+
i++;
|
|
230
|
+
sh = choose_a_shift(pa);
|
|
231
|
+
J = Evaluate_givenI(I,sh,1,n);
|
|
232
|
+
}
|
|
233
|
+
return(sh);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
237
|
+
// evaluate the polynomials in J at given values
|
|
238
|
+
|
|
239
|
+
static proc Evaluate_givenI(ideal J,list pr, int i,int n)
|
|
240
|
+
{
|
|
241
|
+
// n is the number of main variables
|
|
242
|
+
int sz = ncols(J);
|
|
243
|
+
int sr = size(pr);
|
|
244
|
+
int k;
|
|
245
|
+
for(int j=1;j<=sz;j++)
|
|
246
|
+
{
|
|
247
|
+
for(k = n+1;k <= n+sr;k++)
|
|
248
|
+
{
|
|
249
|
+
J = subst(J,var(k),number(pr[k-n])**i);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return(J);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
256
|
+
|
|
257
|
+
static proc choose_a_shift(int pa)
|
|
258
|
+
{
|
|
259
|
+
// choose a shift w.r.t pa (the number of parameters)
|
|
260
|
+
list h = random(100,150);
|
|
261
|
+
for(int i = 2;i <= pa; i++)
|
|
262
|
+
{
|
|
263
|
+
h[i] = random(h[i-1]+2, h[i-1]+7);
|
|
264
|
+
}
|
|
265
|
+
return(h);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
269
|
+
// +++++++++++++++ choose a random distinct primes +++++++++++++++
|
|
270
|
+
|
|
271
|
+
static proc choose_a_prime(int p)
|
|
272
|
+
{
|
|
273
|
+
// p must be a prime number and the procedure returns the next prime
|
|
274
|
+
if(p == 2){return(3);}
|
|
275
|
+
int i = p;
|
|
276
|
+
while(1)
|
|
277
|
+
{
|
|
278
|
+
i = i+2;
|
|
279
|
+
if(prime(i) == i)
|
|
280
|
+
{
|
|
281
|
+
return(i);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
287
|
+
|
|
288
|
+
static proc list_of_primes(int pa, list #)
|
|
289
|
+
{
|
|
290
|
+
// find distinct pa prime(s) up to permutations
|
|
291
|
+
int p=3;
|
|
292
|
+
int j,k;
|
|
293
|
+
list L,l,l1;
|
|
294
|
+
if(size(#)>0)
|
|
295
|
+
{
|
|
296
|
+
p = #[1];
|
|
297
|
+
}
|
|
298
|
+
for(j = 1;j <= pa;j++)
|
|
299
|
+
{
|
|
300
|
+
L[j] = p;
|
|
301
|
+
p = choose_a_prime(p);
|
|
302
|
+
}
|
|
303
|
+
l1 = L;
|
|
304
|
+
for(j = 1;j <= size(L);j++)
|
|
305
|
+
{
|
|
306
|
+
|
|
307
|
+
k = random(1,size(l1));
|
|
308
|
+
l = l+list(l1[k]);
|
|
309
|
+
l1 = delete(l1,k);
|
|
310
|
+
}
|
|
311
|
+
return(l);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
315
|
+
// +++++++++++ BerlekampMassey Algorithm +++++++++++++++++++++++
|
|
316
|
+
|
|
317
|
+
static proc reverse_coef(poly f, int i)
|
|
318
|
+
{
|
|
319
|
+
/* keeping the monomials (in f) fixed returns a polynomial g by reversing
|
|
320
|
+
* the coefficients in f, example (1,2,3) to (3,2,1) */
|
|
321
|
+
poly g;
|
|
322
|
+
for(int j = size(f);j >= 1;j--)
|
|
323
|
+
{
|
|
324
|
+
g = g + var(i)**(j-1)*leadcoef(f[j]);
|
|
325
|
+
}
|
|
326
|
+
return(g);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
330
|
+
|
|
331
|
+
static proc rev_coef_new(poly f, int i)
|
|
332
|
+
{
|
|
333
|
+
/* return a list of numbers which are the coefficients of f
|
|
334
|
+
* starting from deg(f) */
|
|
335
|
+
matrix M = coeffs(f,var(i));
|
|
336
|
+
int t = nrows(M);
|
|
337
|
+
list L = number(M[1..t,1]);
|
|
338
|
+
L = L[t..1];
|
|
339
|
+
return(L);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
343
|
+
// compute the minimal polynomial of L using Berlekamp/Massey algorithm
|
|
344
|
+
|
|
345
|
+
proc BerlekampMassey(list L, int i,list #)
|
|
346
|
+
"USAGE: BerlekampMassey(L, i[, M]); L list, i int, M list
|
|
347
|
+
RETURN: a list Tr where f:=Tr[1] is the minimal polynomial (w.r.t. the i-th variable)
|
|
348
|
+
generated by the sequence (L[j]), 1<=j<= Tr[2], if the
|
|
349
|
+
length of the sequence is long enough. In this case, the coefficients c_i of
|
|
350
|
+
the polynomial f satisfy the relation -L[j+t] = c_0*L[j] + ... + c_{t-1}*L[j+t-1]
|
|
351
|
+
for all j >=1 where t=deg(f).
|
|
352
|
+
NOTE: The procedure applies the Berlekamp/Massey algorithm to the sequence L[j]
|
|
353
|
+
(elements from the field Q) for j>0 and returns a polynomial f. If the polynomial
|
|
354
|
+
f splits into linear factors with no multiplicity greater than one, then we say that
|
|
355
|
+
the length of the sequence L is long enough. If this polynomial does not split into
|
|
356
|
+
linear factors, an optional parameter M = BerlekampMassey(L',i) can be provided to
|
|
357
|
+
add more elements to the sequence.
|
|
358
|
+
REFERENCES:
|
|
359
|
+
@* [1] E. Kaltofen and W.-s. Lee: Early termination in sparse interpolation
|
|
360
|
+
algorithms. J. Symb. Comput. 36, 365-400 (2003).
|
|
361
|
+
@* [2] E. Kaltofen, W.-s. Lee and A. A. Lobo: Early termination in Ben-Or/Tiwari
|
|
362
|
+
sparse interpolation and a hybrid of Zippel's algorithm. Proc. ISSAC
|
|
363
|
+
(ISSAC '00), 192-201 (2000).
|
|
364
|
+
EXAMPLE: example BerlekampMassey; shows an example
|
|
365
|
+
"
|
|
366
|
+
{
|
|
367
|
+
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
368
|
+
* L is stream (sequence), unbounded, of elements from any field
|
|
369
|
+
* i is variable position
|
|
370
|
+
* Note that we may not obtain the minimal polynomial because the length of
|
|
371
|
+
* the sequence may not be long enough so we need to update it this is where
|
|
372
|
+
* we need the optional parameters +++++++++++++++ */
|
|
373
|
+
|
|
374
|
+
list la,Tr,Z;
|
|
375
|
+
int s,j,k,sp,n, l0, l1;
|
|
376
|
+
number De = 1;
|
|
377
|
+
number d, D1;
|
|
378
|
+
poly g0, g1, B0, B1;
|
|
379
|
+
g0 = 1;
|
|
380
|
+
n = size(L);
|
|
381
|
+
if(size(#) > 0)
|
|
382
|
+
{
|
|
383
|
+
/*********************************************************************
|
|
384
|
+
************ update BerlekampMassey procedure *********************/
|
|
385
|
+
list M = #[6];
|
|
386
|
+
sp = #[5];
|
|
387
|
+
int ik = n+sp;
|
|
388
|
+
M[sp+1..ik] = L[1..n];
|
|
389
|
+
L = M;
|
|
390
|
+
g0 = #[1];
|
|
391
|
+
B0 = #[2];
|
|
392
|
+
l0 = #[3];
|
|
393
|
+
De = #[4];
|
|
394
|
+
}
|
|
395
|
+
for(j = sp+1;j <= n+sp; j++)
|
|
396
|
+
{
|
|
397
|
+
s = deg(g0);
|
|
398
|
+
la = rev_coef_new(g0,i);
|
|
399
|
+
d = 0;
|
|
400
|
+
for(k = 0;k <= s; k++)
|
|
401
|
+
{
|
|
402
|
+
d = d + la[k+1]*number(L[j-s+k]);
|
|
403
|
+
}
|
|
404
|
+
D1 = d;
|
|
405
|
+
if(D1 == 0)
|
|
406
|
+
{
|
|
407
|
+
if(j>1)//(2*l0) < j &&
|
|
408
|
+
{
|
|
409
|
+
// early termination is triggered here
|
|
410
|
+
return(list(reverse_coef(g0,i), j-1));
|
|
411
|
+
}
|
|
412
|
+
g1 = g0;
|
|
413
|
+
B1 = var(i)*B0;
|
|
414
|
+
l1 = l0;
|
|
415
|
+
}
|
|
416
|
+
else
|
|
417
|
+
{
|
|
418
|
+
if(2*l0 < j)
|
|
419
|
+
{
|
|
420
|
+
B1 = g0;
|
|
421
|
+
g1 = g0 - (D1*var(i)*B0)/De;
|
|
422
|
+
l1 = j-l0;
|
|
423
|
+
De = D1;
|
|
424
|
+
}
|
|
425
|
+
else
|
|
426
|
+
{
|
|
427
|
+
g1 = g0 - (D1*var(i)*B0)/De;
|
|
428
|
+
B1 = var(i)*B0;
|
|
429
|
+
l1 = l0;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
g0 = g1;
|
|
433
|
+
B0 = B1;
|
|
434
|
+
l0 = l1;
|
|
435
|
+
}
|
|
436
|
+
Tr = g1, B1,l1, De, n+sp, L;
|
|
437
|
+
return(Tr);
|
|
438
|
+
}
|
|
439
|
+
example
|
|
440
|
+
{ "EXAMPLE:"; echo = 2;
|
|
441
|
+
ring rr=0,x,dp;
|
|
442
|
+
list L = 150,3204,79272,2245968;
|
|
443
|
+
list Tr = BerlekampMassey(L,1);
|
|
444
|
+
Tr[1];
|
|
445
|
+
factorize(Tr[1]); //not linearly factored
|
|
446
|
+
list L1 = 70411680, 2352815424, 81496927872;
|
|
447
|
+
Tr = BerlekampMassey(L1,1,Tr); // increase the length of L by size(L1)
|
|
448
|
+
Tr[1];
|
|
449
|
+
factorize(Tr[1]); //linearly factored and has distinct roots
|
|
450
|
+
Tr[2]; //the length of the sequence required to generate Tr[1]
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
454
|
+
// ++++++++++++++++++ Sparse Multivariate Interpolation +++++++++++++
|
|
455
|
+
|
|
456
|
+
static proc find_monomials(bigint B, list L,int n)
|
|
457
|
+
{
|
|
458
|
+
/* return monomial(s) represented by B w.r.t. L where L[i] -> var(i)
|
|
459
|
+
* L is list of primes */
|
|
460
|
+
int nr = size(L);
|
|
461
|
+
poly f = 1;
|
|
462
|
+
list l;
|
|
463
|
+
for(int j = n+1;j <= n+nr;j++)
|
|
464
|
+
{
|
|
465
|
+
l = p_adic_valuation(B,L[j-n]);
|
|
466
|
+
f = f*var(j)**(l[1]);
|
|
467
|
+
B = l[2];
|
|
468
|
+
}
|
|
469
|
+
return(f);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
473
|
+
|
|
474
|
+
static proc p_adic_valuation(bigint B, bigint p)
|
|
475
|
+
{
|
|
476
|
+
// return the exponent j of the greatest power of p that divides B
|
|
477
|
+
int j = -1;
|
|
478
|
+
bigint H = 1;
|
|
479
|
+
while(1)
|
|
480
|
+
{
|
|
481
|
+
j++;
|
|
482
|
+
H = H*p;
|
|
483
|
+
if((B mod H)!=0)
|
|
484
|
+
{
|
|
485
|
+
return(list(j,(B div (H div p))));
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
491
|
+
|
|
492
|
+
static proc rootsofpoly(poly f, int n)
|
|
493
|
+
{
|
|
494
|
+
// return roots of f only for linearly factorizable polynomal f
|
|
495
|
+
if(n == 0){ n = 1;}
|
|
496
|
+
ideal J = factorize(f,1);
|
|
497
|
+
list L;
|
|
498
|
+
for(int i = 1;i <= ncols(J); i++)
|
|
499
|
+
{
|
|
500
|
+
L[i] = bigint(-1*subst(J[i],var(n),0));
|
|
501
|
+
}
|
|
502
|
+
return(L);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
506
|
+
|
|
507
|
+
static proc generate_tVandermondeMatrix(list lroot, list lprime, int n, list #)
|
|
508
|
+
{
|
|
509
|
+
/*
|
|
510
|
+
* return list L of monomials w.r.t. list of primes lprime and
|
|
511
|
+
* transposed Vandermonde matrix M
|
|
512
|
+
*/
|
|
513
|
+
int nr = size(lroot);
|
|
514
|
+
int i,j, mr;
|
|
515
|
+
int k = 1;
|
|
516
|
+
mr = nr;
|
|
517
|
+
if(size(#)>0)
|
|
518
|
+
{
|
|
519
|
+
k = #[1]; // primes powers start with k
|
|
520
|
+
mr = mr+k-1;
|
|
521
|
+
}
|
|
522
|
+
list L;
|
|
523
|
+
matrix M[nr][nr];
|
|
524
|
+
for(j = 1;j <= nr;j++)
|
|
525
|
+
{
|
|
526
|
+
L[j] = find_monomials(lroot[j],lprime,n);
|
|
527
|
+
for(i = k;i <= mr;i++)
|
|
528
|
+
{
|
|
529
|
+
M[i-k+1,j] = lroot[j]**i;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return(list(L,M));
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
536
|
+
|
|
537
|
+
proc sparseInterpolation(poly Br,list La,list lpr,int n, list #)
|
|
538
|
+
"USAGE: sparseInterpolation(Br, La, lpr, n[, m]); Br poly, La list, lpr list, n int, m int
|
|
539
|
+
RETURN: a polynomial B in the polynomial ring Q[var(n+1),...,var(n+size(lpr))]
|
|
540
|
+
satisfying the relation La[i] = B(lpr[1]^i,...,lpr[size(lpr)]^i).
|
|
541
|
+
NOTE: The polynomial Br in Q[var(n)] is the minimal polynomial obtained by
|
|
542
|
+
applying the SINGULAR command @ref{BerlekampMassey} to the sequence (La[j]),
|
|
543
|
+
1<=j<=size(La). By default the exponent i starts from 1. However, if the optional
|
|
544
|
+
parameter m>=0 is provided, then it starts from m.
|
|
545
|
+
The list lpr must be a list of distinct primes.
|
|
546
|
+
SEE ALSO: BerlekampMassey
|
|
547
|
+
EXAMPLE: example sparseInterpolation; shows an example
|
|
548
|
+
"
|
|
549
|
+
{
|
|
550
|
+
/* n is the number of variables of the base ring
|
|
551
|
+
* Br the minimal polynomial of the sequence La
|
|
552
|
+
*/
|
|
553
|
+
int na = size(La);
|
|
554
|
+
|
|
555
|
+
// compute the roots of f using factorization algorithm
|
|
556
|
+
|
|
557
|
+
list Lr = rootsofpoly(Br,n);
|
|
558
|
+
|
|
559
|
+
// Monomials and transposed Vandermonde Matrix
|
|
560
|
+
|
|
561
|
+
list F = generate_tVandermondeMatrix(Lr, lpr, n, #);
|
|
562
|
+
|
|
563
|
+
// compute the coefficients of the monomials in F[1]
|
|
564
|
+
|
|
565
|
+
int nr = nrows(F[2]);
|
|
566
|
+
list la = F[1]; // list of monomials
|
|
567
|
+
matrix T[nr][1] = La[1..nr];
|
|
568
|
+
matrix V = inverse(F[2]); // compute inverse of the matrix F[2]
|
|
569
|
+
matrix Z = V*T; // the coefficient ci
|
|
570
|
+
|
|
571
|
+
// the procedure ends here
|
|
572
|
+
|
|
573
|
+
matrix C[1][nr] = la[1..nr];
|
|
574
|
+
poly g = (C*Z)[1,1];
|
|
575
|
+
return(g);
|
|
576
|
+
}
|
|
577
|
+
example
|
|
578
|
+
{ "EXAMPLE:"; echo = 2;
|
|
579
|
+
ring rr=0,(x,y),dp;
|
|
580
|
+
list lpr = 2,3; // assign 2 for x and 3 for y
|
|
581
|
+
list La = 150,3204,79272,2245968,70411680, 2352815424, 81496927872;
|
|
582
|
+
// La[i] = number(subst(f,y,lpr[1]^i,z,lpr[2]^i)); for f = x2y2+2x2y+5xy2 and i=1,...,7
|
|
583
|
+
poly Br = BerlekampMassey(La,1)[1];
|
|
584
|
+
Br;
|
|
585
|
+
sparseInterpolation(Br,La,lpr,0); // reconstruct f default
|
|
586
|
+
La = 97,275,793,2315,6817;
|
|
587
|
+
// La[i] = number(subst(g,y,lpr[1]^i,z,lpr[2]^i)); for g = x+y and i=4,...,8
|
|
588
|
+
Br = BerlekampMassey(La,1)[1];
|
|
589
|
+
Br;
|
|
590
|
+
sparseInterpolation(Br,La,lpr,0,4);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
594
|
+
// ++++++++++++++++++++++ univariate rational function reconstruction ++++
|
|
595
|
+
|
|
596
|
+
proc fareypoly(poly g, poly f,list #)
|
|
597
|
+
"USAGE: fareypoly(f, g[, m]); f poly, g poly, m int
|
|
598
|
+
RETURN: a list l where r/t (r:=l[1], t:=l[2]) is a univariate rational function
|
|
599
|
+
such that r/t = g mod f, gcd(r,t)=gcd(f,t)=1 and deg(r) + deg(t) < deg(f)
|
|
600
|
+
NOTE: An optional parameter m can be provided to define the way how t is normalized.
|
|
601
|
+
If m = 0 (default), then the leading coefficient of t is 1. Otherwise,
|
|
602
|
+
assuming the polynomial t has a non-zero constant term, the procedure
|
|
603
|
+
returns the uniquely determined rational function r/t where the constant term
|
|
604
|
+
in t is equal to 1.
|
|
605
|
+
If the ground ring has n variables and f and g are in a polynomial
|
|
606
|
+
ring k[var(i)] (k is a field) for some i<=n, then the function r/t is returned
|
|
607
|
+
as an element in k(var(i)).
|
|
608
|
+
In positive characteristic, the condition r/t = g mod f may not be satisfied.
|
|
609
|
+
The degree deg(f) of f must be higher than the degree deg(g) of g.
|
|
610
|
+
SEE ALSO: polyInterpolation, farey
|
|
611
|
+
EXAMPLE: example fareypoly; shows an example
|
|
612
|
+
"
|
|
613
|
+
{
|
|
614
|
+
int normalize_constant_term = 0; // default
|
|
615
|
+
if(size(#) > 0 && typeof(#[1]) == "int")
|
|
616
|
+
{
|
|
617
|
+
normalize_constant_term = #[1];
|
|
618
|
+
}
|
|
619
|
+
poly r1,r2,r3,t1,t2,q_m,r_m,t_m,q1;
|
|
620
|
+
q_m = 1;
|
|
621
|
+
if(g == 0)
|
|
622
|
+
{
|
|
623
|
+
return(list(poly(0), poly(1), 0));
|
|
624
|
+
}
|
|
625
|
+
if(2*deg(g) < deg(f))
|
|
626
|
+
{
|
|
627
|
+
// the degree of f is large enough
|
|
628
|
+
return(list(g,poly(1)));
|
|
629
|
+
}
|
|
630
|
+
number h = number(1)/lu(g);
|
|
631
|
+
r2 = g*h;
|
|
632
|
+
r1 = f/lu(f);
|
|
633
|
+
t1 = 0;
|
|
634
|
+
t2 = h;
|
|
635
|
+
list ls,l1,l,T;
|
|
636
|
+
int i = 0;
|
|
637
|
+
// a modified while loop in the Extended Euclidean algorithm
|
|
638
|
+
while(r2!=0)
|
|
639
|
+
{
|
|
640
|
+
i++;
|
|
641
|
+
ls = division(r1,r2);
|
|
642
|
+
r3 = r2;
|
|
643
|
+
q1 = ls[1][1,1]; // quotient
|
|
644
|
+
h = number(1)/lu(ls[2][1]);
|
|
645
|
+
r2 = ls[2][1]*h; // remainder times h
|
|
646
|
+
r1 = r3;
|
|
647
|
+
r3 = t2;
|
|
648
|
+
t2 = (t1-q1*t2)*h;
|
|
649
|
+
t1 = r3;
|
|
650
|
+
/***** find a quotient q_m whose degree is maximal and polynomials r_m & t_m
|
|
651
|
+
correspond to q_m *********************************************************/
|
|
652
|
+
if( deg(q1) > deg(q_m))
|
|
653
|
+
{
|
|
654
|
+
q_m = q1;
|
|
655
|
+
r_m = r1;
|
|
656
|
+
t_m = t1;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if(deg(q_m) == 1)
|
|
660
|
+
{
|
|
661
|
+
return(list(g, poly(1))); //trivial solution
|
|
662
|
+
}
|
|
663
|
+
else
|
|
664
|
+
{
|
|
665
|
+
poly vd = gcd(r_m,t_m);
|
|
666
|
+
if(vd != 1)
|
|
667
|
+
{
|
|
668
|
+
//gcd condition is not satisfied;
|
|
669
|
+
t_m = t_m/vd;
|
|
670
|
+
r_m = r_m/vd;
|
|
671
|
+
if(normalize_constant_term)
|
|
672
|
+
{
|
|
673
|
+
//here we normalize only for internal use
|
|
674
|
+
number ut = number(1)/lu(t_m[size(t_m)]);
|
|
675
|
+
return(list(ut*r_m,ut*t_m));
|
|
676
|
+
}
|
|
677
|
+
number ut = lu(t_m);
|
|
678
|
+
return(list(r_m/ut,t_m/ut));
|
|
679
|
+
}
|
|
680
|
+
else
|
|
681
|
+
{
|
|
682
|
+
if(normalize_constant_term)
|
|
683
|
+
{
|
|
684
|
+
// here we normalize only for internal use
|
|
685
|
+
number ut = number(1)/lu(t_m[size(t_m)]);
|
|
686
|
+
return(list(ut*r_m,ut*t_m));
|
|
687
|
+
}
|
|
688
|
+
number ut = lu(t_m);
|
|
689
|
+
return(list(r_m/ut,t_m/ut));
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
example
|
|
694
|
+
{ "EXAMPLE:"; echo = 2;
|
|
695
|
+
ring rr=23,x,dp;
|
|
696
|
+
poly g = 10x5-5x4+3x3+3x2-x-11;
|
|
697
|
+
poly f = x6+2x5-9x4+x3-9x2+7x+7;
|
|
698
|
+
fareypoly(g,f);
|
|
699
|
+
fareypoly(g,f,1);
|
|
700
|
+
|
|
701
|
+
ring R = 0, x,dp;
|
|
702
|
+
poly g = (24/1616615)*x6-(732/1616615)*x5+(9558/1616615)*x4-(14187/323323)*x3+
|
|
703
|
+
(1148101/1616615)*x2+(4089347/1616615)*x+547356/230945;
|
|
704
|
+
poly f = x7-28x6+322x5-1960x4+6769x3-13132x2+13068x-5040;
|
|
705
|
+
fareypoly(g,f);
|
|
706
|
+
fareypoly(g,f,1);
|
|
707
|
+
|
|
708
|
+
ring r = (499,a),x,dp;
|
|
709
|
+
number N = (-113a4+170a3-29a2+226a+222)/(a7-56a6+114a5+144a4+171a3-64a2+192a);
|
|
710
|
+
poly h1 = x4+(-55a5-18a4-141a3+233a2+66a-40)/(a4-28a3+40a2-2a+210)*x3;
|
|
711
|
+
poly h2 = (107a6-221a5-68a4-93a3+112a2-54a+216)/(a4-28a3+40a2-2a+210)*x2;
|
|
712
|
+
poly h3 = (-53a7+214a6+27a5+12a4+15a3+60a2-167a-83)/(a4-28a3+40a2-2a+210)*x;
|
|
713
|
+
poly h4 = (10a6-75a5+47a4+246a3-20a2-217a+196)/(a4-28a3+40a2-2a+210);
|
|
714
|
+
poly g = N*(h1+h2+h3+h4);
|
|
715
|
+
poly f = x5+(-2a-119)*x4+(a2+237a+3437)*x3+(-118a2-6756a-29401)*x2+
|
|
716
|
+
(3319a2+55483a+26082)*x+(-26082a2-26082a);
|
|
717
|
+
fareypoly(g,f);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
721
|
+
|
|
722
|
+
static proc lu(poly f)
|
|
723
|
+
{
|
|
724
|
+
// lu leading unit of f
|
|
725
|
+
if(f != 0)
|
|
726
|
+
{
|
|
727
|
+
return(leadcoef(f));
|
|
728
|
+
}
|
|
729
|
+
return(1);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
733
|
+
|
|
734
|
+
static proc list_coef_index(list L, int idx1, int idx2,int lmt)
|
|
735
|
+
{
|
|
736
|
+
// return list of leadcoef of the list L w.r.t. idx1, idx2,lmt
|
|
737
|
+
ideal K;
|
|
738
|
+
list lv;
|
|
739
|
+
for(int j = 1;j <= lmt;j++)
|
|
740
|
+
{
|
|
741
|
+
K = L[j];
|
|
742
|
+
lv[j] = leadcoef(K[idx1][idx2]);
|
|
743
|
+
}
|
|
744
|
+
return(lv);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
748
|
+
|
|
749
|
+
static proc scalIdeal(ideal I)
|
|
750
|
+
{
|
|
751
|
+
//clear the denominators in the ideal I
|
|
752
|
+
int t = ncols(I);
|
|
753
|
+
if(size(I) == 0)
|
|
754
|
+
{
|
|
755
|
+
return(I);
|
|
756
|
+
}
|
|
757
|
+
else
|
|
758
|
+
{
|
|
759
|
+
for(int i = 1;i <= ncols(I);i++)
|
|
760
|
+
{
|
|
761
|
+
I[i] = cleardenom(I[i]);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
return(I);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
768
|
+
|
|
769
|
+
static proc evaluate_f_at_given_points(poly f,list shft,int n)
|
|
770
|
+
{
|
|
771
|
+
// evaluate f at var(n+k) = bigint(shft[k])**j for each j
|
|
772
|
+
if(deg(f) == 0 or f == 0)
|
|
773
|
+
{
|
|
774
|
+
return(list(poly(0)));
|
|
775
|
+
}
|
|
776
|
+
int sr = size(shft);
|
|
777
|
+
int k;
|
|
778
|
+
poly g;
|
|
779
|
+
for(k = n+1;k <= n+sr;k++)
|
|
780
|
+
{
|
|
781
|
+
f = subst(f,var(k),var(n)*var(k)+shft[k-n]);
|
|
782
|
+
}
|
|
783
|
+
matrix M = coeffs(f,var(n));
|
|
784
|
+
list L = M[(nrows(M)-1)..1,1];
|
|
785
|
+
return(L);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
789
|
+
|
|
790
|
+
static proc evaluatef_ataprime_power(poly f, list prm, int n, int in, int st)
|
|
791
|
+
{
|
|
792
|
+
// evaluate f at var(n+k) = bigint(prm[k])**j for in <= j <= st
|
|
793
|
+
list L;
|
|
794
|
+
poly v;
|
|
795
|
+
int k;
|
|
796
|
+
for(int j = in;j <= st;j++)
|
|
797
|
+
{
|
|
798
|
+
v = subst(f,var(n+1),bigint(prm[1])**j);
|
|
799
|
+
for(k = 2;k <= size(prm);k++)
|
|
800
|
+
{
|
|
801
|
+
v = subst(v,var(k+n),bigint(prm[k])**j);
|
|
802
|
+
}
|
|
803
|
+
L = L + list(number(v));
|
|
804
|
+
}
|
|
805
|
+
return(L);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
809
|
+
|
|
810
|
+
static proc Add_poly_list(list lup)
|
|
811
|
+
{
|
|
812
|
+
// return a list of the sum of two polynomials in the list lup
|
|
813
|
+
if(size(lup[2]) == 0)
|
|
814
|
+
{
|
|
815
|
+
return(lup[1]);
|
|
816
|
+
}
|
|
817
|
+
else
|
|
818
|
+
{
|
|
819
|
+
list l1 = lup[1];
|
|
820
|
+
list l2 = lup[2];
|
|
821
|
+
for(int j = 1;j <= size(l1);j++)
|
|
822
|
+
{
|
|
823
|
+
l1[j] = l1[j]+l2[j];
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return(l1);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
830
|
+
// subtract L[1][i]-L[2][i]
|
|
831
|
+
|
|
832
|
+
static proc SubList(list L)
|
|
833
|
+
{
|
|
834
|
+
if(size(L[2]) == 0)
|
|
835
|
+
{
|
|
836
|
+
return(L[1]);
|
|
837
|
+
}
|
|
838
|
+
else
|
|
839
|
+
{
|
|
840
|
+
list l1 = L[1];
|
|
841
|
+
list l2 = L[2];
|
|
842
|
+
for(int j = 1;j <= size(l1);j++)
|
|
843
|
+
{
|
|
844
|
+
l1[j] = l1[j]-l2[j];
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return(l1);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
851
|
+
|
|
852
|
+
static proc Add_the_list_farey(list L)
|
|
853
|
+
{
|
|
854
|
+
/* the procedure returns list of the denominators and the numerators of the
|
|
855
|
+
rational functions */
|
|
856
|
+
list lst,lyt,Yt,lm;
|
|
857
|
+
int i,j;
|
|
858
|
+
for(j = 1;j <= size(L[1]);j++)
|
|
859
|
+
{
|
|
860
|
+
lst = L[1];
|
|
861
|
+
if(size(lst[j])!=0)
|
|
862
|
+
{
|
|
863
|
+
lyt = lst[j];
|
|
864
|
+
for(i = 2;i <= size(L);i++)
|
|
865
|
+
{
|
|
866
|
+
lst = L[i];
|
|
867
|
+
lyt = Add_two_lists(lyt,lst[j]);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
Yt[j] = lyt;
|
|
871
|
+
lyt = list();
|
|
872
|
+
}
|
|
873
|
+
return(Yt);
|
|
874
|
+
}
|
|
875
|
+
example
|
|
876
|
+
{ "EXAMPLE:"; echo = 2;
|
|
877
|
+
ring rr=0,y,dp;
|
|
878
|
+
list l1 = list(list(-2y-5/6,poly(1))); // (-2y-5/6)/(1) is a rational function
|
|
879
|
+
list l2 = list(list(poly(-7/6),7/2y+1));
|
|
880
|
+
list m1 = list(list(-4y-5/6,poly(1)));
|
|
881
|
+
list m2 = list(list(poly(-7/6),21/2y+1));
|
|
882
|
+
list L = list(l1,l2),list(m1,m2);
|
|
883
|
+
Add_the_list_farey(L);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
887
|
+
|
|
888
|
+
static proc Add_list_of_list(list l1,list l2, int m)
|
|
889
|
+
{
|
|
890
|
+
// the procedure returns a list containing list of polynomials w.r.t. m
|
|
891
|
+
list lst,lyt,Yt,lm;
|
|
892
|
+
if(size(l1)!=size(l2))
|
|
893
|
+
{
|
|
894
|
+
ERROR("wrong size: sizes of lists do not coincide");
|
|
895
|
+
}
|
|
896
|
+
int i,j;
|
|
897
|
+
for(j = m;j <= size(l1);j++)
|
|
898
|
+
{
|
|
899
|
+
if(size(l1[j])!=0)
|
|
900
|
+
{
|
|
901
|
+
for(i=1;i<=size(l1[j]);i++)
|
|
902
|
+
{
|
|
903
|
+
l1[j][i][1] = l1[j][i][1] + l2[j][i][1];
|
|
904
|
+
l1[j][i][2] = l1[j][i][2] + l2[j][i][2];
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return(l1);
|
|
909
|
+
}
|
|
910
|
+
example
|
|
911
|
+
{
|
|
912
|
+
"EXAMPLE:"; echo = 2;
|
|
913
|
+
ring rr=0,y,dp;
|
|
914
|
+
list l2,m2;
|
|
915
|
+
l2[1] = list(list(-2y-5/6,y+1));
|
|
916
|
+
m2[1] = list(list(-4y-5/6,y-5));
|
|
917
|
+
l2[2] = list(list(-2y-5/6,2y+3));
|
|
918
|
+
m2[2] = list(list(-4y-5/6,3y-7));
|
|
919
|
+
Add_list_of_list(l2,m2,1);
|
|
920
|
+
}
|
|
921
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
922
|
+
|
|
923
|
+
static proc Add_two_lists(list l1, list l2)
|
|
924
|
+
{
|
|
925
|
+
// the procedure returns a list containing list of polynomials
|
|
926
|
+
int im=size(l1);
|
|
927
|
+
int k,i;
|
|
928
|
+
list l,m;
|
|
929
|
+
for(k = 1;k <= im;k++)
|
|
930
|
+
{
|
|
931
|
+
for(i = 1;i <= 2;i++)
|
|
932
|
+
{
|
|
933
|
+
if(typeof(l1[k][i])=="poly")
|
|
934
|
+
{
|
|
935
|
+
l[i] = list(l1[k][i]) + list(l2[k][i]);
|
|
936
|
+
}
|
|
937
|
+
else
|
|
938
|
+
{
|
|
939
|
+
l[i] = l1[k][i] + list(l2[k][i]);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
m[k] = l;
|
|
943
|
+
l = list();
|
|
944
|
+
}
|
|
945
|
+
return(m);
|
|
946
|
+
}
|
|
947
|
+
example
|
|
948
|
+
{
|
|
949
|
+
"EXAMPLE:"; echo = 2;
|
|
950
|
+
ring rr=0,y,dp;
|
|
951
|
+
list l2,m2;
|
|
952
|
+
l2[2] = list(list(-2y-5/6,poly(1)));
|
|
953
|
+
m2[2] = list(list(-4y-5/6,poly(1)));
|
|
954
|
+
Add_two_lists(l2[2],m2[2]);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
958
|
+
|
|
959
|
+
static proc arrange_list_first(list L)
|
|
960
|
+
{
|
|
961
|
+
// arrange a given list
|
|
962
|
+
list T,TT;
|
|
963
|
+
int j,u,l1,l2;
|
|
964
|
+
l1 = size(L[1]);
|
|
965
|
+
l2 = size(L);
|
|
966
|
+
for(u = 1;u <= l1;u++)
|
|
967
|
+
{
|
|
968
|
+
for(j = 1;j <= l2;j++)
|
|
969
|
+
{
|
|
970
|
+
TT[j] = L[j][u];
|
|
971
|
+
}
|
|
972
|
+
T[u] = TT;
|
|
973
|
+
}
|
|
974
|
+
return(T);
|
|
975
|
+
}
|
|
976
|
+
example
|
|
977
|
+
{ "EXAMPLE:"; echo = 2;
|
|
978
|
+
ring rr=0,y,dp;
|
|
979
|
+
list l1 = 1,2,3;
|
|
980
|
+
list l2 = 1,4,9;
|
|
981
|
+
list l3 = 1,8,27;
|
|
982
|
+
list l4 = 1,16,81;
|
|
983
|
+
list L = l1,l2,l3,l4;
|
|
984
|
+
arrange_list_first(L);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
988
|
+
// return list of leadcoef of I w.r.t. i, I is of type list of list
|
|
989
|
+
|
|
990
|
+
static proc return_coef_indx(def I, int i)
|
|
991
|
+
{
|
|
992
|
+
list l;
|
|
993
|
+
for(int j=1;j<=size(I);j++)
|
|
994
|
+
{
|
|
995
|
+
l[j] = leadcoef(I[j][i]);
|
|
996
|
+
}
|
|
997
|
+
return(l);
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1001
|
+
// return list of leadcoef of I of size k w.r.t. i, I is of type list of list
|
|
1002
|
+
|
|
1003
|
+
static proc return_coef_indx_wrtk(def I, int i, int k)
|
|
1004
|
+
{
|
|
1005
|
+
list l;
|
|
1006
|
+
for(int j=1;j<=k;j++)
|
|
1007
|
+
{
|
|
1008
|
+
l[j] = leadcoef(I[j][i]);
|
|
1009
|
+
}
|
|
1010
|
+
return(l);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1014
|
+
|
|
1015
|
+
static proc arrangeListofIdeals(list L, list #)
|
|
1016
|
+
{
|
|
1017
|
+
/* the procedure returns list of coefficients in the given list of ideals. The
|
|
1018
|
+
* coefficients are correspond to polynomials whose leading monomials are the same.
|
|
1019
|
+
* Moreover, if optional parameter # is given, then it also returns a list
|
|
1020
|
+
* of monomials in one of these ideals
|
|
1021
|
+
*/
|
|
1022
|
+
ideal Tr = L[1];
|
|
1023
|
+
L = arrange_list_first(L);
|
|
1024
|
+
list l1,l2,ln,ld, J,ln1,ld1,Ld;
|
|
1025
|
+
int i,j, k;
|
|
1026
|
+
number N;
|
|
1027
|
+
poly f;
|
|
1028
|
+
for(i=1;i<=size(L);i++)
|
|
1029
|
+
{
|
|
1030
|
+
J = L[i];
|
|
1031
|
+
if(size(J[1])>1)
|
|
1032
|
+
{
|
|
1033
|
+
for(j=2;j<=size(J[1]);j++)
|
|
1034
|
+
{
|
|
1035
|
+
for(k=1;k<=size(J);k++)
|
|
1036
|
+
{
|
|
1037
|
+
N = number(leadcoef(J[k][j]));
|
|
1038
|
+
ln[k] = numerator(N);
|
|
1039
|
+
ld[k] = denominator(N);
|
|
1040
|
+
}
|
|
1041
|
+
l1=ln,ld;
|
|
1042
|
+
l2[j-1] = l1;
|
|
1043
|
+
ln = list();
|
|
1044
|
+
ld = list();
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
Ld[i] = l2;
|
|
1048
|
+
l2 = list();
|
|
1049
|
+
}
|
|
1050
|
+
if(size(#)>0)
|
|
1051
|
+
{
|
|
1052
|
+
list Zr = list_all_monom(Tr);
|
|
1053
|
+
return(list(Ld,Zr));
|
|
1054
|
+
}
|
|
1055
|
+
return(Ld);
|
|
1056
|
+
}
|
|
1057
|
+
example
|
|
1058
|
+
{
|
|
1059
|
+
"EXAMPLE:"; echo = 2;
|
|
1060
|
+
ring rr=(0,a),y,dp;
|
|
1061
|
+
ideal I1 = y2+(3a2+6a+5)/(a+2)*y+1, y-6a;
|
|
1062
|
+
ideal I2 = y2+(3a2+5a+7)/(a+4)*y+1, 7y-17a;
|
|
1063
|
+
list L = I1,I2;
|
|
1064
|
+
arrangeListofIdeals(L);
|
|
1065
|
+
arrangeListofIdeals(L,1);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1069
|
+
|
|
1070
|
+
static proc Add_the_shift_and_evaluate_new(ideal J,list pr, list shft, int i)
|
|
1071
|
+
{
|
|
1072
|
+
// evaluate J at a given point
|
|
1073
|
+
int k;
|
|
1074
|
+
number Nm;
|
|
1075
|
+
ideal Jc=J;
|
|
1076
|
+
int sc = size(pr);
|
|
1077
|
+
for(k=1;k<=sc;k++)
|
|
1078
|
+
{
|
|
1079
|
+
Nm = (par(sc+1)*number(pr[k])**i)+shft[k];
|
|
1080
|
+
Jc =subst(Jc,par(k),Nm);
|
|
1081
|
+
}
|
|
1082
|
+
return(Jc);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1086
|
+
|
|
1087
|
+
static proc generate_uniRationalFunctions(ideal I, list pr, list shift, int in,
|
|
1088
|
+
int fn, string Command, list JL,list #)
|
|
1089
|
+
{
|
|
1090
|
+
// generate a set of ideals whose coefficients are univariate rational functions
|
|
1091
|
+
def Gt = basering;
|
|
1092
|
+
int i,i1;
|
|
1093
|
+
int tp = 0;
|
|
1094
|
+
if(size(#)>0){tp = 1; ideal Jc = #[1];}
|
|
1095
|
+
list L;
|
|
1096
|
+
for(i=in;i<=fn;i++)
|
|
1097
|
+
{
|
|
1098
|
+
L = L + list(Add_the_shift_and_evaluate_new(I, pr, shift, i));
|
|
1099
|
+
}
|
|
1100
|
+
list rl = ringlist(Gt);
|
|
1101
|
+
rl[1][2] = list("AXVR");
|
|
1102
|
+
def St = ring(rl);
|
|
1103
|
+
setring St;
|
|
1104
|
+
list L = imap(Gt, L);
|
|
1105
|
+
list optL = imap(Gt,JL);
|
|
1106
|
+
list T, vL;
|
|
1107
|
+
int tmp;
|
|
1108
|
+
int c_z = size(L);
|
|
1109
|
+
for(i1=1;i1<=c_z;i1++)
|
|
1110
|
+
{
|
|
1111
|
+
if(Command == "slimgb")
|
|
1112
|
+
{
|
|
1113
|
+
task tk(i1) = "slimgb", list(L[i1]);
|
|
1114
|
+
}
|
|
1115
|
+
else
|
|
1116
|
+
{
|
|
1117
|
+
task tk(i1) = "Ffmodstd::ffmodStdOne",list(L[i1], optL);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
startTasks(tk(1..c_z));
|
|
1121
|
+
waitAllTasks(tk(1..c_z));
|
|
1122
|
+
for(i1 = 1;i1 <= c_z; i1++)
|
|
1123
|
+
{
|
|
1124
|
+
T[i1] = getResult(tk(i1));
|
|
1125
|
+
killTask(tk(i1));
|
|
1126
|
+
kill tk(i1);
|
|
1127
|
+
}
|
|
1128
|
+
if(Command == "slimgb"){ T = T, 0;}
|
|
1129
|
+
else{
|
|
1130
|
+
int evbd = T[1][3];
|
|
1131
|
+
vL[1] = T[1][1];
|
|
1132
|
+
for(int j = 2; j <= c_z; j++)
|
|
1133
|
+
{
|
|
1134
|
+
vL[j] = T[j][1];
|
|
1135
|
+
if(evbd < T[j][3])
|
|
1136
|
+
{
|
|
1137
|
+
evbd = T[j][3];
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
T = vL;
|
|
1141
|
+
T = T, evbd;
|
|
1142
|
+
}
|
|
1143
|
+
if(tp)
|
|
1144
|
+
{
|
|
1145
|
+
ideal Jc = imap(Gt,Jc);
|
|
1146
|
+
T[1] = list(Jc) + T[1];
|
|
1147
|
+
}
|
|
1148
|
+
setring Gt;
|
|
1149
|
+
list M = imap(St,T);
|
|
1150
|
+
M[1] = normalize_LiftofIdeal(M[1]);
|
|
1151
|
+
return(M);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1155
|
+
|
|
1156
|
+
static proc normalize_LiftofIdeal(list L)
|
|
1157
|
+
{
|
|
1158
|
+
// normalize each ideal L[j]
|
|
1159
|
+
for(int j=1;j<=size(L);j++)
|
|
1160
|
+
{
|
|
1161
|
+
L[j] = normalize(L[j]);
|
|
1162
|
+
}
|
|
1163
|
+
return(L);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1167
|
+
|
|
1168
|
+
static proc normalize_constTerm(poly g, poly f)
|
|
1169
|
+
{
|
|
1170
|
+
/* Assumption: f has a non-zero constant. Then the procedure
|
|
1171
|
+
returns a pair (g/N, f/N) where N is the constant term of f */
|
|
1172
|
+
number N = leadcoef(f[size(f)]);
|
|
1173
|
+
g = g/N;
|
|
1174
|
+
f = f/N;
|
|
1175
|
+
return(list(g,f));
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1179
|
+
|
|
1180
|
+
static proc normalize_constTermAll(list M2, int kk)
|
|
1181
|
+
{
|
|
1182
|
+
/*
|
|
1183
|
+
Assumption: each polynomial in the list has a non-zero constant term. Then
|
|
1184
|
+
the procedure normalize_constTermAll normalizes the constatnt term of
|
|
1185
|
+
each polynomial in this list starting from M2[kk] where kk is a
|
|
1186
|
+
positive integer less than or equal to the size of M2
|
|
1187
|
+
*/
|
|
1188
|
+
int i,j,k;
|
|
1189
|
+
list l,l1,l2,l3,l4;
|
|
1190
|
+
if(kk!=1)
|
|
1191
|
+
{
|
|
1192
|
+
matrix M[1][kk-1]=0;
|
|
1193
|
+
l4 = M[1,1..kk-1];
|
|
1194
|
+
}
|
|
1195
|
+
for(i=kk;i<=size(M2);i++)
|
|
1196
|
+
{
|
|
1197
|
+
for(j=1;j<=size(M2[i]);j++)
|
|
1198
|
+
{
|
|
1199
|
+
for(k=1;k<=size(M2[i][j][1]);k++)
|
|
1200
|
+
{
|
|
1201
|
+
l = normalize_constTerm(M2[i][j][1][k], M2[i][j][2][k]);
|
|
1202
|
+
l1 = l1+list(l[1]);
|
|
1203
|
+
l2 = l2+list(l[2]);
|
|
1204
|
+
}
|
|
1205
|
+
l3[j] = list(l1,l2);
|
|
1206
|
+
l1 = list();
|
|
1207
|
+
l2 = list();
|
|
1208
|
+
}
|
|
1209
|
+
l4[i] = l3;
|
|
1210
|
+
l3 = list();
|
|
1211
|
+
}
|
|
1212
|
+
return(l4);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1216
|
+
|
|
1217
|
+
static proc stdoverFF(ideal I, list pr, list shft,string Command, list JL)
|
|
1218
|
+
{
|
|
1219
|
+
// return std of I with high probability using sparse rational interpolation
|
|
1220
|
+
int fn=13;
|
|
1221
|
+
def R_1=basering;
|
|
1222
|
+
list Zr = JL[1];
|
|
1223
|
+
int n,pa, evbd;
|
|
1224
|
+
n = nvars(R_1);
|
|
1225
|
+
pa = npars(R_1);
|
|
1226
|
+
list rl=ringlist(R_1);
|
|
1227
|
+
list la=rl[1][2];
|
|
1228
|
+
list m=rl[2];
|
|
1229
|
+
m[(n+1)..(n+pa)]=la[1..pa];
|
|
1230
|
+
rl[2]=m;
|
|
1231
|
+
rl[1]=rl[1][1];
|
|
1232
|
+
rl[3][size(rl[3])+1]=rl[3][size(rl[3])];
|
|
1233
|
+
rl[3][size(rl[3])-1]=list("lp",pa);
|
|
1234
|
+
def R_2=ring(rl);
|
|
1235
|
+
setring R_2;
|
|
1236
|
+
setring R_1;
|
|
1237
|
+
int in = 2;
|
|
1238
|
+
// with respect to given bounds, generate univariate rational functions
|
|
1239
|
+
list M2 = generate_uniRationalFunctions(I, pr, shft, in,fn, Command,list(JL[1..2]),JL[3]);
|
|
1240
|
+
JL = JL[1..2];
|
|
1241
|
+
JL[2] = M2[2];
|
|
1242
|
+
evbd = M2[2];
|
|
1243
|
+
M2 = M2[1];
|
|
1244
|
+
M2 = arrangeListofIdeals(M2);
|
|
1245
|
+
poly Gn;
|
|
1246
|
+
list uM1;
|
|
1247
|
+
ideal J;
|
|
1248
|
+
setring R_2;
|
|
1249
|
+
list M2 = imap(R_1,M2);
|
|
1250
|
+
M2 = normalize_constTermAll(M2,1); // starts from 1
|
|
1251
|
+
list Zr = imap(R_1, Zr); // list of monomials in the std of I
|
|
1252
|
+
int u_w,i1,i2,i3;
|
|
1253
|
+
poly Gn,pn,pl,plm;
|
|
1254
|
+
list l1,l2,l3,bp,lup,lk1,lk2,lk3,py,l3n;
|
|
1255
|
+
ideal J;
|
|
1256
|
+
list #;
|
|
1257
|
+
while(u_w < size(Zr))
|
|
1258
|
+
{
|
|
1259
|
+
u_w++;
|
|
1260
|
+
if(size(Zr[u_w])>1)
|
|
1261
|
+
{
|
|
1262
|
+
setring R_1;
|
|
1263
|
+
Gn = Zr[u_w][1];
|
|
1264
|
+
setring R_2;
|
|
1265
|
+
/******** start lifting elements from Q to Q(var(1),.., var(pa)) *****/
|
|
1266
|
+
l1 = M2[u_w];
|
|
1267
|
+
for(i1=1;i1<=size(l1);i1++)
|
|
1268
|
+
{
|
|
1269
|
+
for(i2=1;i2<=2;i2++)
|
|
1270
|
+
{
|
|
1271
|
+
// the procedure first lifts the numerator and then the denominator
|
|
1272
|
+
for(i3=1;i3<=size(l1[i1][i2][1]);i3++)
|
|
1273
|
+
{
|
|
1274
|
+
l3 = return_coef_indx(l1[i1][i2],i3);
|
|
1275
|
+
l3 = l3,lk1;
|
|
1276
|
+
l3 = SubList(l3); // adjust the coefficients
|
|
1277
|
+
// early termination for BerlekampMassey algorithm(BMA)
|
|
1278
|
+
bp = BerlekampMassey(l3,n);
|
|
1279
|
+
if(size(bp) == 2)
|
|
1280
|
+
{
|
|
1281
|
+
// at this step BerlekampMassey algorithm terminated early
|
|
1282
|
+
if(bp[1] == 1)
|
|
1283
|
+
{
|
|
1284
|
+
lup = lk3,list(); // if l3 = 0, ..., 0
|
|
1285
|
+
}
|
|
1286
|
+
else
|
|
1287
|
+
{
|
|
1288
|
+
l3 = l3[1..bp[2]];
|
|
1289
|
+
pn = sparseInterpolation(bp[1],l3,pr,n);
|
|
1290
|
+
pl = pn+pl;
|
|
1291
|
+
lup = evaluate_f_at_given_points(pn, shft, n);
|
|
1292
|
+
lup = lup,lk3;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
else
|
|
1296
|
+
{
|
|
1297
|
+
/* elements in the sequence l3[i] are not large enough.
|
|
1298
|
+
* We thus add more elements to l3 and continue with the
|
|
1299
|
+
* early termination strategy until size(bp)=2 where bp[2]
|
|
1300
|
+
* is the length of the sequence that the early termination
|
|
1301
|
+
* of BMA requires
|
|
1302
|
+
*/
|
|
1303
|
+
l3n = bp[6];
|
|
1304
|
+
while(1)
|
|
1305
|
+
{
|
|
1306
|
+
in = fn+1;
|
|
1307
|
+
fn = 2*in;
|
|
1308
|
+
setring R_1;
|
|
1309
|
+
/* add more points to l3 by generating rational
|
|
1310
|
+
functions*/
|
|
1311
|
+
uM1 = generate_uniRationalFunctions(I, pr, shft, in,
|
|
1312
|
+
fn, Command,JL);
|
|
1313
|
+
JL[2] = uM1[2];
|
|
1314
|
+
evbd = uM1[2];
|
|
1315
|
+
uM1 = uM1[1];
|
|
1316
|
+
uM1 = arrangeListofIdeals(uM1);
|
|
1317
|
+
setring R_2;
|
|
1318
|
+
list uM2 = imap(R_1, uM1);
|
|
1319
|
+
uM2 = normalize_constTermAll(uM2,u_w); // u_w optional
|
|
1320
|
+
M2 = Add_list_of_list(M2,uM2,u_w);
|
|
1321
|
+
l3 = return_coef_indx(uM2[u_w][i1][i2],i3);
|
|
1322
|
+
kill uM2;
|
|
1323
|
+
if(i3>1)
|
|
1324
|
+
{
|
|
1325
|
+
lk1 = evaluatef_ataprime_power(plm, pr,n,in,fn);
|
|
1326
|
+
l3 = l3,lk1;
|
|
1327
|
+
l3 = SubList(l3);
|
|
1328
|
+
}
|
|
1329
|
+
# = bp;
|
|
1330
|
+
l3n = l3n+l3;
|
|
1331
|
+
bp = BerlekampMassey(l3,n,#);
|
|
1332
|
+
if(size(bp)==2)
|
|
1333
|
+
{
|
|
1334
|
+
// at this step BerlekampMassey algorithm terminated early
|
|
1335
|
+
l3n = l3n[1..bp[2]];
|
|
1336
|
+
pn = sparseInterpolation(bp[1],l3n,pr,n);
|
|
1337
|
+
pl = pn+pl;
|
|
1338
|
+
lup = evaluate_f_at_given_points(pn,shft,n);
|
|
1339
|
+
lup = lup,lk3;
|
|
1340
|
+
break;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
l1 = M2[u_w];
|
|
1344
|
+
}
|
|
1345
|
+
if(i3 < size(l1[i1][i2][1]))
|
|
1346
|
+
{
|
|
1347
|
+
// unshift the shifted parameters see also SubList
|
|
1348
|
+
lk3 = Add_poly_list(lup);
|
|
1349
|
+
plm = lk3[1];
|
|
1350
|
+
lk1 = evaluatef_ataprime_power(lk3[1], pr, n,1,fn);
|
|
1351
|
+
lk3 = delete(lk3,1);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
py[i2]=pl;
|
|
1355
|
+
pl=0;
|
|
1356
|
+
lk1 = list();
|
|
1357
|
+
lk2 = list();
|
|
1358
|
+
lk3 = list();
|
|
1359
|
+
}
|
|
1360
|
+
setring R_1;
|
|
1361
|
+
list H = imap(R_2,py);
|
|
1362
|
+
// numerator H[1] & denominator H[2] are recovered for each i1=1,2,...
|
|
1363
|
+
Gn = Gn + (H[1]/H[2])*Zr[u_w][i1+1];
|
|
1364
|
+
kill H;
|
|
1365
|
+
setring R_2;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
else
|
|
1369
|
+
{
|
|
1370
|
+
setring R_1;
|
|
1371
|
+
Gn = Zr[u_w][1];
|
|
1372
|
+
setring R_2;
|
|
1373
|
+
}
|
|
1374
|
+
setring R_1;
|
|
1375
|
+
Gn = cleardenom(Gn);
|
|
1376
|
+
J[u_w] = Gn;
|
|
1377
|
+
setring R_2;
|
|
1378
|
+
}
|
|
1379
|
+
setring R_1;
|
|
1380
|
+
return(list(J, evbd));
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1384
|
+
// +++++++++++++++++ std for one parameter begins here +++++++++++++++++++
|
|
1385
|
+
|
|
1386
|
+
static proc test_fmodI(poly f,ideal I)
|
|
1387
|
+
{
|
|
1388
|
+
// test whether f in I or not
|
|
1389
|
+
ideal If=f;
|
|
1390
|
+
attrib(If,"isSB",1);
|
|
1391
|
+
if(size(reduce(I,If))!=ncols(I))
|
|
1392
|
+
{
|
|
1393
|
+
return(0);
|
|
1394
|
+
}
|
|
1395
|
+
return(1);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1399
|
+
|
|
1400
|
+
static proc choose_evaluation_points(ideal I, ideal cI,int n1,int nt, int i_s)
|
|
1401
|
+
{
|
|
1402
|
+
/*
|
|
1403
|
+
* I is given ideal
|
|
1404
|
+
* cI is an output from Testlist_all
|
|
1405
|
+
* n1 is number of variables
|
|
1406
|
+
* nt number of prime ideals
|
|
1407
|
+
* i_s is an integer
|
|
1408
|
+
*/
|
|
1409
|
+
int j,ss;
|
|
1410
|
+
list m,n;
|
|
1411
|
+
poly f;
|
|
1412
|
+
while(1)
|
|
1413
|
+
{
|
|
1414
|
+
ss++;
|
|
1415
|
+
if(i_s == 0)
|
|
1416
|
+
{
|
|
1417
|
+
i_s = i_s-2;
|
|
1418
|
+
}
|
|
1419
|
+
f = var(n1)-i_s;
|
|
1420
|
+
if(test_fmodI(f,cI) == 1)
|
|
1421
|
+
{
|
|
1422
|
+
j = j+1;
|
|
1423
|
+
// specialize var(n1) with i_s
|
|
1424
|
+
n = n + list(subst(I,var(n1),i_s));
|
|
1425
|
+
m[j] = i_s;
|
|
1426
|
+
}
|
|
1427
|
+
i_s = i_s-1;
|
|
1428
|
+
if(j == nt)
|
|
1429
|
+
{
|
|
1430
|
+
n = n,m;
|
|
1431
|
+
return(n);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1437
|
+
|
|
1438
|
+
static proc stdone(ideal I, ideal cI, int in_value, list #)
|
|
1439
|
+
{
|
|
1440
|
+
list l_1, lus, lev, m_l, fr;
|
|
1441
|
+
int nx = nvars(basering);
|
|
1442
|
+
int k1, k2, i, r_d, ug;
|
|
1443
|
+
if(size(#) > 1)
|
|
1444
|
+
{
|
|
1445
|
+
m_l = #[1];
|
|
1446
|
+
r_d = #[2];
|
|
1447
|
+
}
|
|
1448
|
+
else
|
|
1449
|
+
{
|
|
1450
|
+
r_d = random(50, 100);
|
|
1451
|
+
l_1 = choose_evaluation_points(I,cI, nx,in_value,r_d);
|
|
1452
|
+
lus = l_1[2];
|
|
1453
|
+
l_1 = l_1[1];
|
|
1454
|
+
// compute std in parallel w.r.t. distinct r_d
|
|
1455
|
+
for(k1 = 1; k1 <= in_value; k1++)
|
|
1456
|
+
{
|
|
1457
|
+
task tk(k1) = "modStd", list(l_1[k1]);
|
|
1458
|
+
}
|
|
1459
|
+
startTasks(tk(1..in_value));
|
|
1460
|
+
waitAllTasks(tk(1..in_value));
|
|
1461
|
+
for(k1 = 1;k1 <= in_value; k1++)
|
|
1462
|
+
{
|
|
1463
|
+
m_l = m_l + list(getResult(tk(k1)));
|
|
1464
|
+
killTask(tk(k1));
|
|
1465
|
+
kill tk(k1);
|
|
1466
|
+
}
|
|
1467
|
+
r_d = lus[in_value]-1;
|
|
1468
|
+
// DeleteUnluckyEvaluationPoints
|
|
1469
|
+
list indices = Modstd::deleteUnluckyPrimes_std(m_l);
|
|
1470
|
+
for(i = size(indices); i > 0; i--)
|
|
1471
|
+
{
|
|
1472
|
+
m_l = delete(m_l, indices[i]);
|
|
1473
|
+
lus = delete(lus, indices[i]);
|
|
1474
|
+
}
|
|
1475
|
+
m_l = normalize_LiftofIdeal(m_l);
|
|
1476
|
+
}
|
|
1477
|
+
if(size(#) > 0)
|
|
1478
|
+
{
|
|
1479
|
+
for(int cZ = 1;cZ <= ncols(m_l[1]); cZ++)
|
|
1480
|
+
{
|
|
1481
|
+
if(size(m_l[1][cZ]) > 1)
|
|
1482
|
+
{
|
|
1483
|
+
ug = cZ;
|
|
1484
|
+
break;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
if(!ug)
|
|
1488
|
+
{
|
|
1489
|
+
return(list(m_l[1]));
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
number Nd = 0;
|
|
1493
|
+
number Nn = 1;
|
|
1494
|
+
list Pl, Il, L, M;
|
|
1495
|
+
L[1] = lus;
|
|
1496
|
+
ideal J = m_l[1];
|
|
1497
|
+
M = m_l;
|
|
1498
|
+
int dg, sz, mx_data, k11;
|
|
1499
|
+
for(k1 = 1; k1 <= ncols(J); k1++)
|
|
1500
|
+
{
|
|
1501
|
+
for(k2 = 2; k2 <= size(J[k1]); k2++)
|
|
1502
|
+
{
|
|
1503
|
+
lev = list_coef_index(M,k1,k2,size(L[1]));
|
|
1504
|
+
L[2] = lev;
|
|
1505
|
+
lus = L[1];
|
|
1506
|
+
sz = size(lus);
|
|
1507
|
+
// apply modular rational interpolation algorithm
|
|
1508
|
+
fr = modrationalInterpolation(list(lus[1..sz-1]),list(lev[1..sz-1]), nx);
|
|
1509
|
+
Nd = number(subst(fr[1], var(nx), lus[sz])/subst(fr[2], var(nx), lus[sz]));
|
|
1510
|
+
Nn = lev[sz];
|
|
1511
|
+
while(Nd != Nn)
|
|
1512
|
+
{
|
|
1513
|
+
in_value = 3*(in_value div 2);
|
|
1514
|
+
l_1 = choose_evaluation_points(I, cI, nx, in_value, r_d);
|
|
1515
|
+
lus = l_1[2];
|
|
1516
|
+
l_1 = l_1[1];
|
|
1517
|
+
// compute std in parallel w.r.t. lus = in_value
|
|
1518
|
+
for(k11 = 1; k11 <= in_value; k11++)
|
|
1519
|
+
{
|
|
1520
|
+
task tk(k11) = "modStd", list(l_1[k11]);
|
|
1521
|
+
}
|
|
1522
|
+
startTasks(tk(1..in_value));
|
|
1523
|
+
waitAllTasks(tk(1..in_value));
|
|
1524
|
+
for(k11 = 1;k11<=in_value;k11++)
|
|
1525
|
+
{
|
|
1526
|
+
m_l[k11] = getResult(tk(k11));
|
|
1527
|
+
killTask(tk(k11));
|
|
1528
|
+
kill tk(k11);
|
|
1529
|
+
}
|
|
1530
|
+
r_d = lus[size(lus)]-1;
|
|
1531
|
+
// SelectLuckyEvaluationPointsWithWeightedCardinality
|
|
1532
|
+
indices = Modstd::deleteUnluckyPrimes_std(list(M[1])+m_l);
|
|
1533
|
+
if(size(indices) > 0)
|
|
1534
|
+
{
|
|
1535
|
+
if(indices[1] == 1)
|
|
1536
|
+
{
|
|
1537
|
+
"BadEvaluationPointsIsDetected";
|
|
1538
|
+
return(stdone(I, cI, in_value, m_l, r_d));
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
for(i = size(indices); i > 0; i--)
|
|
1542
|
+
{
|
|
1543
|
+
m_l = delete(m_l, indices[i]);
|
|
1544
|
+
lus = delete(lus, indices[i]);
|
|
1545
|
+
}
|
|
1546
|
+
sz = size(m_l);
|
|
1547
|
+
m_l = normalize_LiftofIdeal(m_l);
|
|
1548
|
+
lev = list_coef_index(m_l,k1,k2,sz);
|
|
1549
|
+
// apply modular rational interpolation algorithm
|
|
1550
|
+
fr = modrationalInterpolation(list(lus[1..sz-1]), list(lev[1..sz-1]), nx, L);
|
|
1551
|
+
M = M + m_l;
|
|
1552
|
+
L[1] = L[1] + lus;
|
|
1553
|
+
L[2] = L[2] + lev;
|
|
1554
|
+
Nd = number(subst(fr[1], var(nx), lus[sz])/subst(fr[2], var(nx), lus[sz]));
|
|
1555
|
+
Nn = lev[sz];
|
|
1556
|
+
if(Nd == Nn)
|
|
1557
|
+
{
|
|
1558
|
+
break;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
Pl = Pl + list(fr);
|
|
1562
|
+
dg = deg(fr[1]) + deg(fr[2]) + 3;
|
|
1563
|
+
if(mx_data < dg){ mx_data = dg;}
|
|
1564
|
+
}
|
|
1565
|
+
Il[k1] = list(list(poly(1), poly(1))) + Pl;
|
|
1566
|
+
Pl = list();
|
|
1567
|
+
}
|
|
1568
|
+
if(size(#) > 0)
|
|
1569
|
+
{
|
|
1570
|
+
list Zr = list_all_monom(J);
|
|
1571
|
+
return(list(Il, mx_data, Zr));
|
|
1572
|
+
}
|
|
1573
|
+
return(list(Il, mx_data));
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1577
|
+
|
|
1578
|
+
static proc firststd(ideal I, ideal cI, int in_value, list #)
|
|
1579
|
+
{
|
|
1580
|
+
/* return std FJ of I together with a bound on the number of evaluation
|
|
1581
|
+
points to be used for the next lifting */
|
|
1582
|
+
def St=basering;
|
|
1583
|
+
// define a new ring
|
|
1584
|
+
int nx=nvars(St);
|
|
1585
|
+
int nr=nx-1;
|
|
1586
|
+
list ly=ringlist(St);
|
|
1587
|
+
list L,l1,l3,l4,l5,A1,l2;
|
|
1588
|
+
l1=ly[2];
|
|
1589
|
+
l2=l1[1..nr];
|
|
1590
|
+
L[2]=l2;
|
|
1591
|
+
l3=l1[(nr+1)..nx];
|
|
1592
|
+
l5=ly[3];
|
|
1593
|
+
l4=l5[2];
|
|
1594
|
+
A1=ly[1],l3,list(l4),ly[4];
|
|
1595
|
+
L[1]=A1;
|
|
1596
|
+
l5=delete(l5,2);
|
|
1597
|
+
L[3]=l5;
|
|
1598
|
+
L[4]=ly[4];
|
|
1599
|
+
def Gt=ring(L);
|
|
1600
|
+
kill L,l1,l3,l4,l5,A1,l2;
|
|
1601
|
+
setring Gt;
|
|
1602
|
+
setring St;
|
|
1603
|
+
int k1,k2;
|
|
1604
|
+
list T1,L2,Fr, Zr;
|
|
1605
|
+
if(size(#) > 0)
|
|
1606
|
+
{
|
|
1607
|
+
Zr = #;
|
|
1608
|
+
T1 = stdone(I, cI, in_value);
|
|
1609
|
+
T1 = T1 + list(Zr);
|
|
1610
|
+
}
|
|
1611
|
+
else
|
|
1612
|
+
{
|
|
1613
|
+
T1 = stdone(I, cI, in_value, 1);
|
|
1614
|
+
if(size(T1) == 1)
|
|
1615
|
+
{
|
|
1616
|
+
return(T1);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
setring Gt;
|
|
1620
|
+
list T = imap(St, T1);
|
|
1621
|
+
list rZ = T[3];
|
|
1622
|
+
T = T[1];
|
|
1623
|
+
poly g_t;
|
|
1624
|
+
ideal FJ;
|
|
1625
|
+
for(k1 = 1; k1 <= size(rZ); k1++)
|
|
1626
|
+
{
|
|
1627
|
+
for(k2=1;k2<=size(rZ[k1]);k2++)
|
|
1628
|
+
{
|
|
1629
|
+
Fr = T[k1][k2];
|
|
1630
|
+
g_t = g_t + (Fr[1]/Fr[2])*rZ[k1][k2];
|
|
1631
|
+
}
|
|
1632
|
+
FJ[k1]= cleardenom(g_t);
|
|
1633
|
+
g_t = 0;
|
|
1634
|
+
}
|
|
1635
|
+
setring St;
|
|
1636
|
+
ideal FJ = imap(Gt,FJ);
|
|
1637
|
+
L2 = FJ, T1[3],T1[2];
|
|
1638
|
+
return(L2);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1642
|
+
|
|
1643
|
+
static proc list_all_monom(ideal T)
|
|
1644
|
+
{
|
|
1645
|
+
// list all monomials in T
|
|
1646
|
+
list L, E, l;
|
|
1647
|
+
int i,j;
|
|
1648
|
+
poly f;
|
|
1649
|
+
for(j = 1;j <= ncols(T);j++)
|
|
1650
|
+
{
|
|
1651
|
+
f=T[j];
|
|
1652
|
+
for(i = 1;i <= size(f);i++)
|
|
1653
|
+
{
|
|
1654
|
+
l[i]=leadmonom(f[i]);
|
|
1655
|
+
}
|
|
1656
|
+
L[j]=l;
|
|
1657
|
+
l=E;
|
|
1658
|
+
}
|
|
1659
|
+
return(L);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
1663
|
+
|
|
1664
|
+
static proc select_the_command(ideal I, list #)
|
|
1665
|
+
{
|
|
1666
|
+
/* the procedure select_the_command selects a command which finishes the
|
|
1667
|
+
computation first but if this command applied in a machine with a single
|
|
1668
|
+
core it returns (by default) the command ffmodStdOne
|
|
1669
|
+
*/
|
|
1670
|
+
if(system("cpu") <= 1)
|
|
1671
|
+
{
|
|
1672
|
+
def F = ffmodStdOne(I, #);
|
|
1673
|
+
return(list("ffmodStdOne", F));
|
|
1674
|
+
}
|
|
1675
|
+
else
|
|
1676
|
+
{
|
|
1677
|
+
list commands = list("Ffmodstd::ffmodStdOne", "slimgb");
|
|
1678
|
+
list args = list(list(I, #), list(I));
|
|
1679
|
+
list L = parallelWaitFirst(commands, args);
|
|
1680
|
+
if(typeof(L[1])!="none")
|
|
1681
|
+
{
|
|
1682
|
+
return(list("ffmodStdOne", L[1]));
|
|
1683
|
+
}
|
|
1684
|
+
else
|
|
1685
|
+
{
|
|
1686
|
+
return(list("slimgb", L[2]));
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
1692
|
+
|
|
1693
|
+
static proc ffmodStdOne(ideal I, list #)
|
|
1694
|
+
{
|
|
1695
|
+
// compute std of I using dense univariate rational interpolation
|
|
1696
|
+
intvec opt=option(get);option(pure_gb);
|
|
1697
|
+
option(redSB);
|
|
1698
|
+
int tmp, tmp1, evbd;
|
|
1699
|
+
def G_t = basering;
|
|
1700
|
+
list pL;
|
|
1701
|
+
if(size(#) > 0)
|
|
1702
|
+
{
|
|
1703
|
+
if(typeof(#[1]) == "int")
|
|
1704
|
+
{
|
|
1705
|
+
tmp1 = 1;
|
|
1706
|
+
evbd = #[1];
|
|
1707
|
+
}
|
|
1708
|
+
else
|
|
1709
|
+
{
|
|
1710
|
+
tmp = 1;
|
|
1711
|
+
pL = #;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
// optional parameters
|
|
1715
|
+
int n,pa,kr;
|
|
1716
|
+
n = nvars(G_t);
|
|
1717
|
+
pa = 1;
|
|
1718
|
+
I = normalize(I); // make each element of I monic
|
|
1719
|
+
I = scalIdeal(I);
|
|
1720
|
+
list L = collect_coeffs(I);
|
|
1721
|
+
// define a new ring
|
|
1722
|
+
list rl = ringlist(G_t);
|
|
1723
|
+
list la = rl[1][2];
|
|
1724
|
+
list m = rl[2];
|
|
1725
|
+
m[(n+1)..(n+pa)] = la[1..pa];
|
|
1726
|
+
rl[2] = m;
|
|
1727
|
+
rl[1] = rl[1][1];
|
|
1728
|
+
rl[3][size(rl[3])+1] = rl[3][size(rl[3])];
|
|
1729
|
+
rl[3][size(rl[3])-1] = list("lp",pa);
|
|
1730
|
+
def S_t = ring(rl);
|
|
1731
|
+
setring S_t;
|
|
1732
|
+
if(tmp){ list opL = imap(G_t, pL);}
|
|
1733
|
+
list L = imap(G_t,L);
|
|
1734
|
+
ideal I = imap(G_t,I);
|
|
1735
|
+
ideal cI = Testlist_all(L);
|
|
1736
|
+
if(size(cI) == 0)
|
|
1737
|
+
{
|
|
1738
|
+
cI = 1;
|
|
1739
|
+
}
|
|
1740
|
+
ideal J;
|
|
1741
|
+
list newL, optionL, rL;
|
|
1742
|
+
if(tmp)
|
|
1743
|
+
{
|
|
1744
|
+
rL = firststd(I, cI, opL[2], opL[1]);
|
|
1745
|
+
}
|
|
1746
|
+
else
|
|
1747
|
+
{
|
|
1748
|
+
int in_value = 12;// initial number of prime ideals (or number of points)
|
|
1749
|
+
// initial std computation using dense rational interpolation
|
|
1750
|
+
if(tmp1)
|
|
1751
|
+
{
|
|
1752
|
+
in_value = evbd;
|
|
1753
|
+
}
|
|
1754
|
+
rL = firststd(I, cI, in_value);
|
|
1755
|
+
}
|
|
1756
|
+
setring G_t;
|
|
1757
|
+
list bL = imap(S_t, rL);
|
|
1758
|
+
option(set,opt);
|
|
1759
|
+
return(bL);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1763
|
+
|
|
1764
|
+
static proc finalTest(ideal I, ideal fareyresult)
|
|
1765
|
+
{
|
|
1766
|
+
//return 1 if I included in fareyresult otherwise 0
|
|
1767
|
+
attrib(fareyresult,"isSB",1);
|
|
1768
|
+
int i;
|
|
1769
|
+
for(i = ncols(I); i >= 1; i--)
|
|
1770
|
+
{
|
|
1771
|
+
if(reduce(I[i],fareyresult, 5) != 0)
|
|
1772
|
+
{
|
|
1773
|
+
return(0);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
//return 1 if std(fareyresult) included in fareyresult otherwise 0
|
|
1777
|
+
attrib(fareyresult,"isSB",1);
|
|
1778
|
+
ideal J = std(fareyresult);
|
|
1779
|
+
if(size(reduce(J,fareyresult, 5)) != 0)
|
|
1780
|
+
{
|
|
1781
|
+
return(0);
|
|
1782
|
+
}
|
|
1783
|
+
return(1);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
// =============== a procedure for one parameter ends here ==========
|
|
1787
|
+
|
|
1788
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1789
|
+
// =========== the main procedure for multi parameters begins here =========
|
|
1790
|
+
|
|
1791
|
+
proc ffmodStd(ideal I, list #)
|
|
1792
|
+
"USAGE: ffmodStd(I [, d]); I ideal, d int
|
|
1793
|
+
RETURN: Groebner basis of I over an algebraic function field
|
|
1794
|
+
NOTE: An optional parameter d>0, a positive integer, can be provided for the procedure.
|
|
1795
|
+
It refers to a number of evaluation points to used.
|
|
1796
|
+
SEE ALSO: nfmodStd
|
|
1797
|
+
EXAMPLE: example ffmodStd; shows an example
|
|
1798
|
+
"
|
|
1799
|
+
{
|
|
1800
|
+
def G_t = basering;
|
|
1801
|
+
int n,pa,kr;
|
|
1802
|
+
n = nvars(G_t);
|
|
1803
|
+
pa = npars(G_t);
|
|
1804
|
+
int evbd;
|
|
1805
|
+
if(size(#) > 0){evbd = #[1];}
|
|
1806
|
+
if(pa == 0)
|
|
1807
|
+
{
|
|
1808
|
+
ERROR("the coefficient field is not rational function field");
|
|
1809
|
+
}
|
|
1810
|
+
if(size(I) == 0)
|
|
1811
|
+
{
|
|
1812
|
+
return(ideal(0));
|
|
1813
|
+
}
|
|
1814
|
+
I = simplify(I,2);
|
|
1815
|
+
for(int hj = 1;hj <= ncols(I);hj++)
|
|
1816
|
+
{
|
|
1817
|
+
if(deg(I[hj]) == 0)
|
|
1818
|
+
{
|
|
1819
|
+
return(ideal(1));
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
// optional parameters
|
|
1823
|
+
if(pa == 1)
|
|
1824
|
+
{
|
|
1825
|
+
// if the current ring has one parameter
|
|
1826
|
+
def GF = ffmodStdOne(I);
|
|
1827
|
+
if(finalTest(I,GF[1]))
|
|
1828
|
+
{
|
|
1829
|
+
attrib(GF[1], "isSB", 1);
|
|
1830
|
+
return(GF[1]);
|
|
1831
|
+
}
|
|
1832
|
+
else
|
|
1833
|
+
{
|
|
1834
|
+
print("FAIL");
|
|
1835
|
+
if(GF[3] < evbd){ GF[3] = evbd;}
|
|
1836
|
+
return(ffmodStdOne(I, GF[3]+3));
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
intvec opt = option(get);
|
|
1840
|
+
option(pure_gb);
|
|
1841
|
+
option(redSB); // to obtain the reduced standard basis
|
|
1842
|
+
I = normalize(I);
|
|
1843
|
+
I = scalIdeal(I);
|
|
1844
|
+
list L = collect_coeffs(I);
|
|
1845
|
+
// define a new ring
|
|
1846
|
+
list rl = ringlist(G_t);
|
|
1847
|
+
list la = rl[1][2];
|
|
1848
|
+
list m = rl[2];
|
|
1849
|
+
m[(n+1)..(n+pa)] = la[1..pa];
|
|
1850
|
+
rl[2] = m;
|
|
1851
|
+
rl[1] = rl[1][1];
|
|
1852
|
+
rl[3][size(rl[3])+1] = rl[3][size(rl[3])];
|
|
1853
|
+
rl[3][size(rl[3])-1] = list("lp",pa);
|
|
1854
|
+
def S_t = ring(rl);
|
|
1855
|
+
setring S_t;
|
|
1856
|
+
list L = imap(G_t,L);
|
|
1857
|
+
ideal I = imap(G_t,I);
|
|
1858
|
+
ideal cI = Testlist_all(L);
|
|
1859
|
+
if( size(cI) == 0)
|
|
1860
|
+
{
|
|
1861
|
+
cI = 1;
|
|
1862
|
+
}
|
|
1863
|
+
list shft = test_the_shift(cI,n,pa);
|
|
1864
|
+
int j;
|
|
1865
|
+
// shift the parameters
|
|
1866
|
+
for(j = 1;j <= size(shft);j++)
|
|
1867
|
+
{
|
|
1868
|
+
cI = subst(cI, var(n+j), var(n+j) + shft[j]);
|
|
1869
|
+
}
|
|
1870
|
+
list pr = list_of_primes(pa); // list distinct primes
|
|
1871
|
+
// define a new ring
|
|
1872
|
+
setring G_t;
|
|
1873
|
+
rl = ringlist(G_t);
|
|
1874
|
+
rl[1][2][size(rl[1][2])+1] = "AXVR";
|
|
1875
|
+
def St = ring(rl);
|
|
1876
|
+
setring St;
|
|
1877
|
+
ideal Jc = Add_the_shift_and_evaluate_new(imap(G_t,I), pr, shft, 1);
|
|
1878
|
+
setring G_t;
|
|
1879
|
+
rl = ringlist(G_t);
|
|
1880
|
+
rl[1][2] = list("AXVR");
|
|
1881
|
+
def StA = ring(rl);
|
|
1882
|
+
setring StA;
|
|
1883
|
+
ideal Jc = imap(St,Jc);
|
|
1884
|
+
// make selection to use relitively fast command
|
|
1885
|
+
list Lcom;
|
|
1886
|
+
if(!evbd)
|
|
1887
|
+
{
|
|
1888
|
+
Lcom = select_the_command(Jc);
|
|
1889
|
+
}
|
|
1890
|
+
else
|
|
1891
|
+
{
|
|
1892
|
+
Lcom = select_the_command(Jc, evbd);
|
|
1893
|
+
}
|
|
1894
|
+
string Command = Lcom[1];
|
|
1895
|
+
def GF = Lcom[2];
|
|
1896
|
+
list Zr;
|
|
1897
|
+
int invalue, cd;
|
|
1898
|
+
if(typeof(GF) != "ideal")
|
|
1899
|
+
{
|
|
1900
|
+
Jc = GF[1];
|
|
1901
|
+
for(j = 1; j <= ncols(Jc); j++)
|
|
1902
|
+
{
|
|
1903
|
+
if(size(Jc[j])>1)
|
|
1904
|
+
{
|
|
1905
|
+
cd = 1;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
if(!cd)
|
|
1909
|
+
{
|
|
1910
|
+
setring G_t;
|
|
1911
|
+
option(set,opt);
|
|
1912
|
+
return(imap(StA, Jc));
|
|
1913
|
+
}
|
|
1914
|
+
else
|
|
1915
|
+
{
|
|
1916
|
+
Zr = GF[2];
|
|
1917
|
+
invalue = GF[3];
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
else
|
|
1921
|
+
{
|
|
1922
|
+
Jc = GF;
|
|
1923
|
+
for(j = 1; j <= ncols(Jc); j++)
|
|
1924
|
+
{
|
|
1925
|
+
if(size(Jc[j])>1)
|
|
1926
|
+
{
|
|
1927
|
+
cd = 1;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
if(!cd)
|
|
1931
|
+
{
|
|
1932
|
+
setring G_t;
|
|
1933
|
+
option(set,opt);
|
|
1934
|
+
return(imap(StA, Jc));
|
|
1935
|
+
}
|
|
1936
|
+
else
|
|
1937
|
+
{
|
|
1938
|
+
Zr = list_all_monom(Jc);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
Lcom = Zr, invalue, Jc;
|
|
1942
|
+
setring St;
|
|
1943
|
+
ideal I = imap(G_t, I);
|
|
1944
|
+
list FG = imap(StA, Lcom);
|
|
1945
|
+
// compute std using sparse multivariate rational interpolation
|
|
1946
|
+
list Jr = stdoverFF(I,pr,shft, Command, FG);
|
|
1947
|
+
setring G_t;
|
|
1948
|
+
list rJ = imap(St,Jr);
|
|
1949
|
+
ideal J = rJ[1];
|
|
1950
|
+
if(finalTest(I,J))
|
|
1951
|
+
{
|
|
1952
|
+
attrib(J, "isSB", 1);
|
|
1953
|
+
option(set, opt);
|
|
1954
|
+
return(J);
|
|
1955
|
+
}
|
|
1956
|
+
else
|
|
1957
|
+
{
|
|
1958
|
+
print("FAIL");
|
|
1959
|
+
if(rJ[2] < invalue){ rJ[2] = invalue;}
|
|
1960
|
+
option(set,opt);
|
|
1961
|
+
return(ffmodStd(I, rJ[2]+3));
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
example
|
|
1965
|
+
{ "EXAMPLE:"; echo = 2;
|
|
1966
|
+
ring Ra=(0,a),(x,y,z),dp;
|
|
1967
|
+
ideal I = (a^2+2)*x^2*y+a*y*z^2, x*z^2+(a+1)*x^2-a*y^2;
|
|
1968
|
+
ffmodStd(I);
|
|
1969
|
+
ideal J = x^2*y+y*z^2, x*z^2+x^2-y^2;
|
|
1970
|
+
ffmodStd(J);
|
|
1971
|
+
ring R1=(0,a,b),(x,y,z),dp;
|
|
1972
|
+
ideal I = x^2*y^3*z+2*a*x*y*z^2+7*y^3,
|
|
1973
|
+
x^2*y^4*z+(a-7b)*x^2*y*z^2-x*y^2*z^2+2*x^2*y*z-12*x+by,
|
|
1974
|
+
(a2+b-2)*y^5*z+(a+5b)*x^2*y^2*z-b*x*y^3*z-x*y^3+y^4+2*a2*y^2*z,
|
|
1975
|
+
a*x^2*y^2*z-x*y^3*z+3a*x*y*z^3+(-a+4)*y^3*z^2+4*z^2-bx;
|
|
1976
|
+
ffmodStd(I);
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
1980
|
+
// modular berlekamp massey algorithm
|
|
1981
|
+
|
|
1982
|
+
proc modberlekampMassey(list L, list #)
|
|
1983
|
+
"USAGE: modberlekampMassey(L [, i]); L list, i int
|
|
1984
|
+
RETURN: The minimal polynomial f (w.r.t. the i-th variable) generated by the
|
|
1985
|
+
sequence (L[j]), j = 1, 2, ... .
|
|
1986
|
+
NOTE: The procedure first construct polynomials f and g of degrees size(L) and size(L)-1,
|
|
1987
|
+
respectively from the sequence L[j] (elements from the field Q) for j>0 as described
|
|
1988
|
+
in [1]. It then returns the denominator polynomial d obtained by applying the
|
|
1989
|
+
SINGULAR command @ref{fareypoly} to the input (g,f). If the ground ring has n
|
|
1990
|
+
variables, the procedure returns d in a polynomial ring k[var(i)] (k is a field) for
|
|
1991
|
+
some i<=n. In this case, an optional parameter i (default 0) can be provided.
|
|
1992
|
+
SEE ALSO: BerlekampMassey
|
|
1993
|
+
REFERENCES:
|
|
1994
|
+
@* [1] Nadia Ben Atti, Gema M. Diaz-Toca and Henri Lombardi: The Berlekamp-Massey Algorithm
|
|
1995
|
+
Revisited, 2000.
|
|
1996
|
+
EXAMPLE: example modberlekampMassey; shows an example
|
|
1997
|
+
"
|
|
1998
|
+
{
|
|
1999
|
+
int p = 536870909;
|
|
2000
|
+
if(typeof(L[1]) != "number"){
|
|
2001
|
+
for(int ii = 1; ii <= size(L); ii++){ L[ii] = number(L[ii]);}
|
|
2002
|
+
}
|
|
2003
|
+
L = L, #;
|
|
2004
|
+
ideal I = modular("Ffmodstd::berlekamp_naive", list(L), primeTest_massey,
|
|
2005
|
+
Modstd::deleteUnluckyPrimes_std, pTest_massey, finalTest_massey, p);
|
|
2006
|
+
if(size(#) > 1)
|
|
2007
|
+
{
|
|
2008
|
+
return(list(I[1], L[1]));
|
|
2009
|
+
}
|
|
2010
|
+
return(I[1]);
|
|
2011
|
+
}
|
|
2012
|
+
example
|
|
2013
|
+
{ "EXAMPLE:"; echo = 2;
|
|
2014
|
+
ring rr=0, (x,y,z), dp;
|
|
2015
|
+
list L = 150,3204,79272,2245968, 70411680, 2352815424, 81496927872;
|
|
2016
|
+
modberlekampMassey(L);// default w.r.t x
|
|
2017
|
+
modberlekampMassey(L,3);// returns an output in the ring Q[z]
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
2021
|
+
|
|
2022
|
+
static proc berlekamp_naive(list L)
|
|
2023
|
+
{
|
|
2024
|
+
list # = L[2];
|
|
2025
|
+
L = L[1];
|
|
2026
|
+
int vr = 1;
|
|
2027
|
+
if(size(#) > 0 and typeof(#[1]) == "int")
|
|
2028
|
+
{
|
|
2029
|
+
vr = #[1];
|
|
2030
|
+
}
|
|
2031
|
+
int lg = size(L);
|
|
2032
|
+
poly g;
|
|
2033
|
+
for(int i=0;i <= lg-1;i++)
|
|
2034
|
+
{
|
|
2035
|
+
g = g + var(vr)^i*L[lg-i];
|
|
2036
|
+
}
|
|
2037
|
+
if(g==0)
|
|
2038
|
+
{
|
|
2039
|
+
return(ideal(0));
|
|
2040
|
+
}
|
|
2041
|
+
poly f = var(vr)^lg;
|
|
2042
|
+
number N = number(1)/(leadcoef(g));
|
|
2043
|
+
poly g1 = g*N;
|
|
2044
|
+
poly v0, v1, v, q, r;
|
|
2045
|
+
v1 = 1;
|
|
2046
|
+
list K;
|
|
2047
|
+
while(lg <= 2*deg(g1))
|
|
2048
|
+
{
|
|
2049
|
+
K = division(f,g1);
|
|
2050
|
+
q = K[1][1,1];
|
|
2051
|
+
r = K[2][1];
|
|
2052
|
+
if(r==0)
|
|
2053
|
+
{
|
|
2054
|
+
N = 1;
|
|
2055
|
+
}
|
|
2056
|
+
else
|
|
2057
|
+
{
|
|
2058
|
+
N = number(1)/leadcoef(r);
|
|
2059
|
+
}
|
|
2060
|
+
v = (v0-q*v1)*N;
|
|
2061
|
+
v0 = v1;
|
|
2062
|
+
v1 = v;
|
|
2063
|
+
f = g1;
|
|
2064
|
+
g1= r*N;
|
|
2065
|
+
}
|
|
2066
|
+
return(ideal(v1/leadcoef(v1)));
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2070
|
+
|
|
2071
|
+
static proc primeTest_massey(int p, list L)
|
|
2072
|
+
{
|
|
2073
|
+
/*
|
|
2074
|
+
* test whether a prime p divides the denominator(s)
|
|
2075
|
+
* of L[i] for i =1, ..., size(L)
|
|
2076
|
+
*/
|
|
2077
|
+
int i,j;
|
|
2078
|
+
L = L[1][1];
|
|
2079
|
+
number num;
|
|
2080
|
+
bigint d1,d2,d3;
|
|
2081
|
+
for(i = 1; i <= size(L); i++)
|
|
2082
|
+
{
|
|
2083
|
+
num = L[i];
|
|
2084
|
+
d1 = bigint(numerator(num));
|
|
2085
|
+
d2 = bigint(denominator(num));
|
|
2086
|
+
if( d1!= 0 and (d1 mod p) == 0)
|
|
2087
|
+
{
|
|
2088
|
+
return(0);
|
|
2089
|
+
}
|
|
2090
|
+
if((d2 mod p) == 0)
|
|
2091
|
+
{
|
|
2092
|
+
return(0);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
return(1);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2099
|
+
|
|
2100
|
+
static proc pTest_massey(string Command, list args, ideal fareyResult, int Testp)
|
|
2101
|
+
{
|
|
2102
|
+
//pTest
|
|
2103
|
+
def St = basering;
|
|
2104
|
+
list lpr = ringlist(St);
|
|
2105
|
+
lpr[1] = Testp;
|
|
2106
|
+
def Stp = ring(lpr);
|
|
2107
|
+
setring Stp;
|
|
2108
|
+
list args = imap(St, args);
|
|
2109
|
+
args = args[1];
|
|
2110
|
+
ideal Jp = berlekamp_naive(args);
|
|
2111
|
+
ideal fry = imap(St,fareyResult);
|
|
2112
|
+
if(Jp[1] == fry[1])
|
|
2113
|
+
{
|
|
2114
|
+
setring St;
|
|
2115
|
+
return(1);
|
|
2116
|
+
}
|
|
2117
|
+
setring St;
|
|
2118
|
+
return(0);
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2122
|
+
|
|
2123
|
+
static proc finalTest_massey(string Command, list L, ideal fareyresult)
|
|
2124
|
+
{
|
|
2125
|
+
// check that whether the relation -L[j+t] = c_0*L[j] + ... + c_{t-1}*L[j+t-1]
|
|
2126
|
+
// for all j >=1 where t= size(L)/2
|
|
2127
|
+
int i, j;
|
|
2128
|
+
poly f = fareyresult[1];
|
|
2129
|
+
int l = size(L);
|
|
2130
|
+
int t = l div 2;
|
|
2131
|
+
number k;
|
|
2132
|
+
for(i = 0; i<= t-1; i++)
|
|
2133
|
+
{
|
|
2134
|
+
k = 0;
|
|
2135
|
+
for(j=0;j<=t-1;j++)
|
|
2136
|
+
{
|
|
2137
|
+
k = k + leadcoef(f[size(f)-j])*L[j+1+i];
|
|
2138
|
+
}
|
|
2139
|
+
if(k != -L[t+i+1])
|
|
2140
|
+
{
|
|
2141
|
+
return(0);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
return(1);
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
/************ modular rational interpolation ************************************/
|
|
2148
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
2149
|
+
|
|
2150
|
+
proc modrationalInterpolation(list D, list E, int vr, list #)
|
|
2151
|
+
"USAGE: modrationalInterpolation(D, E, vr[, D1, E1]); D list, E list, vr int, D1 list, E1 list
|
|
2152
|
+
RETURN: a list L where r/t (r:=L[1], t:=L[2]) is a univariate rational function such that
|
|
2153
|
+
r(D[i])/t(D[i]) = E[i] (or equivalently r/t = g mod f, gcd(r,t)=gcd(f,t)=1 and
|
|
2154
|
+
deg(r) + deg(t) < deg(f)
|
|
2155
|
+
NOTE: Optional parameters D1 and E1 can be provided to update the existing input, that is,
|
|
2156
|
+
to D1+D and E1+E. The rational function r/t is returned as an element in k(var(vr)),
|
|
2157
|
+
where k is a field. This procedure works only in characteristic zero. The elements
|
|
2158
|
+
in the first list must be distinct.
|
|
2159
|
+
SEE ALSO: polyInterpolation, fareypoly
|
|
2160
|
+
EXAMPLE: example modrationalInterpolation; shows an example
|
|
2161
|
+
"
|
|
2162
|
+
{
|
|
2163
|
+
/* D distinct values E values from black box evaluation at D[i] and this procedure
|
|
2164
|
+
* returns a rational function r/t (in lowest terms) such that r(D[i])/t(D[i]) = E[i]
|
|
2165
|
+
* for i = 1, ...,size(D)
|
|
2166
|
+
*/
|
|
2167
|
+
int p = 536870909;
|
|
2168
|
+
if(typeof(E[1]) != "number"){
|
|
2169
|
+
for(int ii = 1; ii <= size(E); ii++){ E[ii] = number(E[ii]);}
|
|
2170
|
+
}
|
|
2171
|
+
list L = D, E, vr;
|
|
2172
|
+
L = L, #;
|
|
2173
|
+
L = modular("Ffmodstd::modinterpolation", list(L), primeTest_Qinterpolation,
|
|
2174
|
+
Modstd::deleteUnluckyPrimes_std, pTest_Qinterpolation, finalTest_Qinterpolation, p);
|
|
2175
|
+
L = L[1][1], L[1][2];
|
|
2176
|
+
return(L);
|
|
2177
|
+
}
|
|
2178
|
+
example
|
|
2179
|
+
{ "EXAMPLE:"; echo = 2;
|
|
2180
|
+
ring rr=0,x,dp;
|
|
2181
|
+
list D = 2,3,4,5,6,7,8,9,10;
|
|
2182
|
+
list E = 8/35, 7/123, 22/1027, 4/391, 44/7779, 29/8405, 74/32771, 23/14763, 112/100003;
|
|
2183
|
+
modrationalInterpolation(D, E, 1);
|
|
2184
|
+
|
|
2185
|
+
ring R = 0, x, dp;
|
|
2186
|
+
list D1 = 2,3,4,5,6;
|
|
2187
|
+
list E1 = 8/35, 7/123, 22/1027, 4/391, 44/7779;
|
|
2188
|
+
modrationalInterpolation(D1, E1, 1);
|
|
2189
|
+
list D = 7,8,9,10;
|
|
2190
|
+
list E = 29/8405, 74/32771, 23/14763, 112/100003;
|
|
2191
|
+
modrationalInterpolation(D, E, 1, D1, E1);
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2195
|
+
|
|
2196
|
+
static proc modinterpolation(list L)
|
|
2197
|
+
{
|
|
2198
|
+
// returns a ration function as list T, where T[1] is the numerator whereas T[2]
|
|
2199
|
+
// is the denominator T[1] and T[2] are not necessarily coprime
|
|
2200
|
+
list S = L[2];
|
|
2201
|
+
list T = L[1];
|
|
2202
|
+
int vr = T[3];
|
|
2203
|
+
T = T[1], T[2];
|
|
2204
|
+
if(size(S) == 0)
|
|
2205
|
+
{
|
|
2206
|
+
T = interpolation_naive(T[1], T[2], vr);
|
|
2207
|
+
T = fareypoly_naive(T[1], T[2]);
|
|
2208
|
+
return(ideal(T[1], T[2]));
|
|
2209
|
+
}
|
|
2210
|
+
else
|
|
2211
|
+
{
|
|
2212
|
+
T[1] = T[1] + S[1];
|
|
2213
|
+
T[2] = T[2] + S[2];
|
|
2214
|
+
T = interpolation_naive(T[1], T[2], vr);
|
|
2215
|
+
T = fareypoly_naive(T[1], T[2]);
|
|
2216
|
+
return(ideal(T[1], T[2]));
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2221
|
+
|
|
2222
|
+
static proc primeTest_Qinterpolation(int p, list L)
|
|
2223
|
+
{
|
|
2224
|
+
//test whether a prime p divides the denominator(s) of L[i] for i=1, ..., size(L)
|
|
2225
|
+
L = L[1];
|
|
2226
|
+
L = L[1][1] + L[1][2];
|
|
2227
|
+
number num;
|
|
2228
|
+
bigint d1,d2,d3;
|
|
2229
|
+
for(int i = 1; i <= size(L); i++)
|
|
2230
|
+
{
|
|
2231
|
+
num = L[i];
|
|
2232
|
+
d1 = bigint(numerator(num));
|
|
2233
|
+
d2 = bigint(denominator(num));
|
|
2234
|
+
if( d1!= 0 and (d1 mod p) == 0)
|
|
2235
|
+
{
|
|
2236
|
+
return(0);
|
|
2237
|
+
}
|
|
2238
|
+
if((d2 mod p) == 0)
|
|
2239
|
+
{
|
|
2240
|
+
return(0);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
return(1);
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2247
|
+
|
|
2248
|
+
static proc pTest_Qinterpolation(string Command, list args, ideal fareyResult,int Testp)
|
|
2249
|
+
{
|
|
2250
|
+
//pTest for modular rational interpolation
|
|
2251
|
+
def St = basering;
|
|
2252
|
+
list lpr = ringlist(St);
|
|
2253
|
+
lpr[1] = Testp;
|
|
2254
|
+
def Stp = ring(lpr);
|
|
2255
|
+
setring Stp;
|
|
2256
|
+
list args = imap(St, args);
|
|
2257
|
+
args = args[1];
|
|
2258
|
+
ideal Jp = modinterpolation(args);
|
|
2259
|
+
ideal fry = imap(St,fareyResult);
|
|
2260
|
+
if(Jp[1] == fry[1] and Jp[2] == fry[2])
|
|
2261
|
+
{
|
|
2262
|
+
setring St;
|
|
2263
|
+
return(1);
|
|
2264
|
+
}
|
|
2265
|
+
setring St;
|
|
2266
|
+
return(0);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2270
|
+
|
|
2271
|
+
static proc finalTest_Qinterpolation(string Command, list L, ideal fareyresult)
|
|
2272
|
+
{
|
|
2273
|
+
/* let r1, r2 = fareyresult, D = L[1], E = L[2]
|
|
2274
|
+
* in the presence of bad evaluation points the conditions (r1/r2)(D[i])=E[i]
|
|
2275
|
+
* cannot be satisfied for all i
|
|
2276
|
+
*/
|
|
2277
|
+
return(1);
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2281
|
+
// ++++++++++++++++++++ polynomial Interpolation for internal use only +++++++
|
|
2282
|
+
|
|
2283
|
+
static proc interpolation_naive(list d, list e,list #)
|
|
2284
|
+
{
|
|
2285
|
+
/* compute a polynomial from given numerical data
|
|
2286
|
+
* size of d and e must be equal
|
|
2287
|
+
* d is list of distinct elements
|
|
2288
|
+
*/
|
|
2289
|
+
|
|
2290
|
+
// optional parameters
|
|
2291
|
+
|
|
2292
|
+
int vr, i, j, s_d;
|
|
2293
|
+
poly f, g;
|
|
2294
|
+
list l;
|
|
2295
|
+
vr = 1;
|
|
2296
|
+
number s,t;
|
|
2297
|
+
if(size(#) == 1)
|
|
2298
|
+
{
|
|
2299
|
+
vr = #[1];
|
|
2300
|
+
}
|
|
2301
|
+
s_d = size(d);
|
|
2302
|
+
f = e[1];
|
|
2303
|
+
g = (var(vr)-d[1]);
|
|
2304
|
+
l = f, g;
|
|
2305
|
+
if(s_d == 1)
|
|
2306
|
+
{
|
|
2307
|
+
return(l);
|
|
2308
|
+
}
|
|
2309
|
+
for(j = 2; j <= s_d; j++)
|
|
2310
|
+
{
|
|
2311
|
+
s = (d[j]-d[1]);
|
|
2312
|
+
t = e[j] - number(subst(f, var(vr), d[j]));
|
|
2313
|
+
for(i = 2; i < j; i++)
|
|
2314
|
+
{
|
|
2315
|
+
s = s*(d[j]-d[i]);
|
|
2316
|
+
}
|
|
2317
|
+
t = t/s;
|
|
2318
|
+
f = f + t*g;
|
|
2319
|
+
g = g*(var(vr)-d[j]);
|
|
2320
|
+
}
|
|
2321
|
+
l = f, g;
|
|
2322
|
+
return(l);
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2326
|
+
// ++++++++++++++++++++ rational Interpolation for internal use only +++++++
|
|
2327
|
+
static proc fareypoly_naive(poly g, poly f, list #)
|
|
2328
|
+
{
|
|
2329
|
+
int const_int=0;
|
|
2330
|
+
if(size(#)>0 or typeof(#[1]) == "int")
|
|
2331
|
+
{
|
|
2332
|
+
const_int = #[1];
|
|
2333
|
+
}
|
|
2334
|
+
poly r1,r2,r3,t1,t2,q_m,r_m,t_m,q1;
|
|
2335
|
+
q_m = 1;
|
|
2336
|
+
if(g == 0)
|
|
2337
|
+
{
|
|
2338
|
+
return(list(poly(0), poly(1)));
|
|
2339
|
+
}
|
|
2340
|
+
if(2*deg(g) < deg(f))
|
|
2341
|
+
{
|
|
2342
|
+
// here the degree of f is large enough
|
|
2343
|
+
return(list(g, poly(1)));
|
|
2344
|
+
}
|
|
2345
|
+
number h = number(1)/lu(g);
|
|
2346
|
+
r2 = g*h;
|
|
2347
|
+
r1 = f/lu(f);
|
|
2348
|
+
t1 = 0;
|
|
2349
|
+
t2 = h;
|
|
2350
|
+
list ls;
|
|
2351
|
+
int i;
|
|
2352
|
+
// a modified while loop in the Extended Euclidean algorithm
|
|
2353
|
+
while(r2 != 0)
|
|
2354
|
+
{
|
|
2355
|
+
i++;
|
|
2356
|
+
ls=division(r1,r2);
|
|
2357
|
+
r3=r2;
|
|
2358
|
+
q1=ls[1][1,1];
|
|
2359
|
+
h=number(1)/lu(ls[2][1]);
|
|
2360
|
+
r2=ls[2][1]*h;
|
|
2361
|
+
r1=r3;
|
|
2362
|
+
r3=t2;
|
|
2363
|
+
t2=(t1-q1*t2)*h;
|
|
2364
|
+
t1=r3;
|
|
2365
|
+
/***** find a quotient q_m whose degree is maximal and polynomials r_m & t_m
|
|
2366
|
+
correspond to q_m *********************************************************/
|
|
2367
|
+
if( deg(q1) > deg(q_m))
|
|
2368
|
+
{
|
|
2369
|
+
q_m = q1;
|
|
2370
|
+
r_m = r1;
|
|
2371
|
+
t_m = t1;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
if(deg(q_m) == 1)
|
|
2375
|
+
{
|
|
2376
|
+
return(list(g, poly(1))); //trivial solution
|
|
2377
|
+
}
|
|
2378
|
+
else
|
|
2379
|
+
{
|
|
2380
|
+
number ut = lu(t_m);
|
|
2381
|
+
return(list(r_m/ut,t_m/ut));
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
|