passagemath-singular 10.6.31rc3__cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_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-gnu.so +0 -0
- passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
- passagemath_singular-10.6.31rc3.dist-info/RECORD +491 -0
- passagemath_singular-10.6.31rc3.dist-info/WHEEL +6 -0
- passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
- passagemath_singular.libs/libSingular-4-20aec911.4.1.so +0 -0
- passagemath_singular.libs/libcddgmp-21acf0c6.so.0.1.3 +0 -0
- passagemath_singular.libs/libfactory-4-fcee31da.4.1.so +0 -0
- passagemath_singular.libs/libflint-66e12231.so.21.0.0 +0 -0
- passagemath_singular.libs/libgf2x-a4cdec90.so.3.0.0 +0 -0
- passagemath_singular.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
- passagemath_singular.libs/libgmp-6e109695.so.10.5.0 +0 -0
- passagemath_singular.libs/libgsl-cda90e79.so.28.0.0 +0 -0
- passagemath_singular.libs/libmpfr-82690d50.so.6.2.1 +0 -0
- passagemath_singular.libs/libntl-e6f0d543.so.44.0.1 +0 -0
- passagemath_singular.libs/libomalloc-0-5c9e866e.9.6.so +0 -0
- passagemath_singular.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
- passagemath_singular.libs/libpolys-4-5c0a87e0.4.1.so +0 -0
- passagemath_singular.libs/libquadmath-2284e583.so.0.0.0 +0 -0
- passagemath_singular.libs/libreadline-ea270e21.so.8.2 +0 -0
- passagemath_singular.libs/libsingular_resources-4-a1aafc6d.4.1.so +0 -0
- passagemath_singular.libs/libtinfo-ceb117d9.so.6.3 +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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.so +0 -0
- sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
- sage/algebras/quatalg/quaternion_algebra_element.cpython-314-x86_64-linux-gnu.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-gnu.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-gnu.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-gnu.so +0 -0
- sage/libs/singular/option.pyx +671 -0
- sage/libs/singular/polynomial.cpython-314-x86_64-linux-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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-gnu.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,2628 @@
|
|
|
1
|
+
//////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
version="version recover.lib 4.3.1.0 Jun_2022 "; // $Id: 0b86b815895bfc3d0b1098ba4a7d3b3a568d5cda $
|
|
3
|
+
category="Algebraic Geometry";
|
|
4
|
+
info="
|
|
5
|
+
LIBRARY: recover.lib Hybrid numerical/symbolical algorithms for algebraic geometry
|
|
6
|
+
AUTHOR: Adrian Koch (kocha at rhrk.uni-kl.de)
|
|
7
|
+
|
|
8
|
+
OVERVIEW: In this library you'll find implementations of some of the algorithms presented
|
|
9
|
+
in the paper listed below: Bertini is used to compute a witness set of a given
|
|
10
|
+
ideal I. Then a lattice basis reduction algorithm is used to recover exact
|
|
11
|
+
results from the inexact numerical data. More precisely, we obtain elements
|
|
12
|
+
of prime components of I, the radical of I, or an elimination ideal of I.
|
|
13
|
+
|
|
14
|
+
NOTE that Bertini may create quite a lot of files in the current directory
|
|
15
|
+
(or overwrite files which have the same names as the files it wants to create).
|
|
16
|
+
It also prints information to the screen.
|
|
17
|
+
|
|
18
|
+
The usefulness of the results of the exactness recovery algorithms heavily
|
|
19
|
+
depends on the quality of the witness set and the quality of the lattice basis
|
|
20
|
+
reduction algorithm.
|
|
21
|
+
The procedures requiring a witness set as part of their input use a simple,
|
|
22
|
+
unsofisticated version of the LLL algorithm.
|
|
23
|
+
|
|
24
|
+
REFERENCES:
|
|
25
|
+
Daniel Bates, Jonathan Hauenstein, Timothy McCoy, Chris Peterson, and Andrew Sommese;
|
|
26
|
+
Recovering exact results from inexact numerical data in algebraic geometry;
|
|
27
|
+
Published in Experimental Mathematics 22(1) on pages 38-50 in 2013
|
|
28
|
+
|
|
29
|
+
KEYWORDS: numerical algebraic geometry; hybrid algorithms; exactness recovery; solving; bertini
|
|
30
|
+
|
|
31
|
+
PROCEDURES:
|
|
32
|
+
substAll(v,p); poly: ring variables in v substituted by elements of p
|
|
33
|
+
veronese(d,p); ideal: image of p under the degree d Veronese embedding
|
|
34
|
+
getRelations(p,..); list of ideals: homogeneous polynomial relations between
|
|
35
|
+
components of p
|
|
36
|
+
getRelationsRadical(p,..); modified version of getRelations
|
|
37
|
+
gaussRowWithoutPerm(M); matrix: a row-reduced form of M
|
|
38
|
+
gaussColWithoutPerm(M); matrix: a column-reduced form of M
|
|
39
|
+
getWitnessSet(); extracts the witness set from the file \"main_data\" produced
|
|
40
|
+
by Bertini
|
|
41
|
+
writeBertiniInput(J); writes the input-file for bertini with the polynomials in J
|
|
42
|
+
as functions
|
|
43
|
+
num_prime_decom(I,..); is supposed to compute a prime decomposition of the radical of I
|
|
44
|
+
num_prime_decom1(P,..); is supposed to compute a prime decomposition for the ideal
|
|
45
|
+
represented by the witness point set P
|
|
46
|
+
num_radical_via_decom(I,..);
|
|
47
|
+
compute elements of the radical of I by using num_prime_decom
|
|
48
|
+
num_radical_via_randlincom(I,..);
|
|
49
|
+
computes elements of the radical of I by using a different method
|
|
50
|
+
num_radical1(P,..); computes elements of the radical via num_prime_decom1
|
|
51
|
+
num_radical2(P,..); computes elements of the radical using a different method
|
|
52
|
+
num_elim(I,f,..); computes elements of the elimination ideal of I w.r.t. the
|
|
53
|
+
variables specified by f
|
|
54
|
+
num_elim1(P,..,v); computes elements of the elimination ideal of the ideal
|
|
55
|
+
represented by the witness point set P (w.r.t. the variables
|
|
56
|
+
specified in v)
|
|
57
|
+
realLLL(M); simple version of the LLL-algorithm;works only over real numbers
|
|
58
|
+
";
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
LIB "matrix.lib";
|
|
62
|
+
LIB "linalg.lib";
|
|
63
|
+
LIB "inout.lib";
|
|
64
|
+
LIB "crypto.lib";
|
|
65
|
+
|
|
66
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
67
|
+
/////////////////////// static procs for rounding ///////////////////////////////
|
|
68
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
69
|
+
|
|
70
|
+
static proc getposi(string s)
|
|
71
|
+
{//returns the position of the . in a complex number, or 0 if there is no . in s
|
|
72
|
+
int i;
|
|
73
|
+
for(i=1; i<=size(s); i++)
|
|
74
|
+
{
|
|
75
|
+
if(s[i] == "."){return(i);}
|
|
76
|
+
}
|
|
77
|
+
return(0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static proc string2digit(string ti)
|
|
81
|
+
{
|
|
82
|
+
intvec v=0,1,2,3,4,5,6,7,8,9;
|
|
83
|
+
int i;
|
|
84
|
+
for(i=1; i<=size(v); i++)
|
|
85
|
+
{
|
|
86
|
+
if( ti == string(v[i]) )
|
|
87
|
+
{
|
|
88
|
+
return(poly(v[i]));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static proc string2poly(string t)
|
|
94
|
+
{
|
|
95
|
+
poly r=string2digit(t[1]);
|
|
96
|
+
int i;
|
|
97
|
+
for(i=2; i<=size(t); i++)
|
|
98
|
+
{
|
|
99
|
+
r=r*10+string2digit(t[i]);
|
|
100
|
+
}
|
|
101
|
+
return(r);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static proc roundstringpoly(string s, int posi)
|
|
105
|
+
{//returns the
|
|
106
|
+
string t;
|
|
107
|
+
//first check, whether s is negative or not
|
|
108
|
+
int e=0;
|
|
109
|
+
if(s[1]=="-")
|
|
110
|
+
{
|
|
111
|
+
e=1;
|
|
112
|
+
t=s[2..(posi-1)];//start at the second symbol (to drop the minus)
|
|
113
|
+
}
|
|
114
|
+
else
|
|
115
|
+
{
|
|
116
|
+
t=s[1..(posi-1)];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
poly r=string2poly(t);//this is always the rounded-down version of the absolute value
|
|
120
|
+
//of r
|
|
121
|
+
//we have to check now, whether we should have rounded up
|
|
122
|
+
//for that, we check the digit after the .
|
|
123
|
+
if(string2digit(s[posi+1]) >= 5)
|
|
124
|
+
{
|
|
125
|
+
r=r+1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if(e == 1)
|
|
129
|
+
{//readjust the sign, if needed
|
|
130
|
+
r=-r;
|
|
131
|
+
}
|
|
132
|
+
return(r);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static proc roundpoly(poly r)
|
|
136
|
+
{
|
|
137
|
+
string s=string(r);
|
|
138
|
+
int posi=getposi(s);
|
|
139
|
+
if(posi == 0)
|
|
140
|
+
{//there is no . in r, so r is an integer
|
|
141
|
+
return(r);
|
|
142
|
+
}
|
|
143
|
+
return(roundstringpoly(s, posi));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
147
|
+
///////////////////////// Veronese embedding ////////////////////////////////
|
|
148
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
149
|
+
|
|
150
|
+
proc substAll(poly v, list p)
|
|
151
|
+
"USAGE: substAll(v,p); poly v, list p
|
|
152
|
+
RETURN: poly: the polynomial obtained from v by substituting the elements of p for the
|
|
153
|
+
ring variables
|
|
154
|
+
NOTE: The list p should have as many elements as there are ring variables.
|
|
155
|
+
EXAMPLE: example substAll; shows an example
|
|
156
|
+
"
|
|
157
|
+
{//substitutes the elements of p for the ring variables
|
|
158
|
+
//used to obtain the value of the veronese map
|
|
159
|
+
int i;
|
|
160
|
+
poly f=v;
|
|
161
|
+
for(i=1; i<=nvars(basering); i++)
|
|
162
|
+
{
|
|
163
|
+
f=subst(f,var(i),p[i]);
|
|
164
|
+
}
|
|
165
|
+
return(f);
|
|
166
|
+
}
|
|
167
|
+
example
|
|
168
|
+
{ "EXAMPLE:"; echo=2;
|
|
169
|
+
ring r=0,(x,y,z),dp;
|
|
170
|
+
poly v=x+y+z;
|
|
171
|
+
list p=7/11,5/11,-1/11;
|
|
172
|
+
poly f=substAll(v,p);
|
|
173
|
+
f;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
proc veronese(int d, list p)
|
|
177
|
+
"USAGE: veronese(d,p); int d, list p
|
|
178
|
+
RETURN: ideal: the image of the point p under the degree d Veronese embedding
|
|
179
|
+
NOTE: The list p should have as many elements as there are ring variables.
|
|
180
|
+
The order of the points in the returned ideal corresponds to the order of the
|
|
181
|
+
monomials in maxideal(d).
|
|
182
|
+
SEE ALSO: maxideal
|
|
183
|
+
EXAMPLE: example veronese; shows an example
|
|
184
|
+
"
|
|
185
|
+
{//image of p under the degree d Veronese embedding
|
|
186
|
+
ideal V=maxideal(d);
|
|
187
|
+
int i;
|
|
188
|
+
poly v;
|
|
189
|
+
int len=size(V);
|
|
190
|
+
for(i=1; i <= len; i++)
|
|
191
|
+
{
|
|
192
|
+
v=V[i];
|
|
193
|
+
v=substAll(v,p);
|
|
194
|
+
V[i]=v;
|
|
195
|
+
}
|
|
196
|
+
return(V);
|
|
197
|
+
}
|
|
198
|
+
example
|
|
199
|
+
{ "EXAMPLE:"; echo=2;
|
|
200
|
+
ring R=0,(x,y,z),dp;
|
|
201
|
+
list p=2,3,5;
|
|
202
|
+
ideal V=veronese(1,p);
|
|
203
|
+
V;
|
|
204
|
+
V=veronese(2,p);
|
|
205
|
+
V;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
static proc veronese_radical(int d, list P)
|
|
209
|
+
{//returns a random linear combination of the images of the points in P under the
|
|
210
|
+
//degree d Veronese embedding
|
|
211
|
+
list p;//one of the points in P
|
|
212
|
+
ideal Vp;//the Veronese embedding of p
|
|
213
|
+
int i;
|
|
214
|
+
for(i=1; i<=size(P); i++)
|
|
215
|
+
{
|
|
216
|
+
p=P[i];
|
|
217
|
+
Vp=veronese(d,p);
|
|
218
|
+
P[i]=Vp;
|
|
219
|
+
}
|
|
220
|
+
//so we've replaced the points p with their images under the Veronese embedding
|
|
221
|
+
//now we do a random linear combination of all these images
|
|
222
|
+
|
|
223
|
+
//first, we rand some factors
|
|
224
|
+
int di=10**7;
|
|
225
|
+
int de=1;
|
|
226
|
+
ideal F=poly(random(de,di))/di;
|
|
227
|
+
poly f;
|
|
228
|
+
for(i=2; i<=size(P); i++)
|
|
229
|
+
{
|
|
230
|
+
f=poly(random(de,di))/di;
|
|
231
|
+
F=F,f;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
//then we compute the linear combination
|
|
235
|
+
poly v;
|
|
236
|
+
int j;
|
|
237
|
+
for(j=1; j<=size(P); j++)
|
|
238
|
+
{
|
|
239
|
+
Vp=P[j];
|
|
240
|
+
v=v+F[j]*Vp[1];
|
|
241
|
+
}
|
|
242
|
+
ideal V=v;
|
|
243
|
+
int len=size(maxideal(d));
|
|
244
|
+
for(i=2; i<=len; i++)
|
|
245
|
+
{
|
|
246
|
+
v=0;
|
|
247
|
+
for(j=1; j<=size(P); j++)
|
|
248
|
+
{
|
|
249
|
+
Vp=P[j];
|
|
250
|
+
v=v+F[j]*Vp[i];
|
|
251
|
+
}
|
|
252
|
+
V=V,v;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return(V);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
259
|
+
////////////////////////// some static procs //////////////////////////
|
|
260
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
261
|
+
|
|
262
|
+
static proc randlincom(ideal V, int len)
|
|
263
|
+
{//produces a random linear combination of the real vectors defined by the real and the
|
|
264
|
+
//imaginary part of V, respectively
|
|
265
|
+
//(V is the image of a complex point p under a veronese embedding)
|
|
266
|
+
poly randre,randim;
|
|
267
|
+
int di=10**9;
|
|
268
|
+
int de=1;
|
|
269
|
+
//we get one of 2(di-de) numbers between (-)de/di and (-)1
|
|
270
|
+
randre=(-1)**random(1,2)*poly(random(de,di))/di;
|
|
271
|
+
randim=(-1)**random(1,2)*poly(random(de,di))/di;
|
|
272
|
+
|
|
273
|
+
ideal lincom=randre*repart(leadcoef(V[1]))+randim*impart(leadcoef(V[1]));
|
|
274
|
+
|
|
275
|
+
int i;
|
|
276
|
+
for(i=2; i<=len; i++)
|
|
277
|
+
{
|
|
278
|
+
lincom=lincom,randre*repart(leadcoef(V[i]))+randim*impart(leadcoef(V[i]));
|
|
279
|
+
}
|
|
280
|
+
return(lincom);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
static proc getmatrix(ideal V, bigint C, int len)
|
|
284
|
+
{//constructs the stacked matrix, but with randlincom(V,len) instead of V
|
|
285
|
+
ideal rl=randlincom(V,len);
|
|
286
|
+
matrix v=transpose(matrix(rl));
|
|
287
|
+
matrix E=diag(1,len);
|
|
288
|
+
v=C*v;
|
|
289
|
+
E=concat(E,v);
|
|
290
|
+
E=transpose(E);
|
|
291
|
+
return(E);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
static proc getpolys(matrix B, int d)
|
|
295
|
+
{//takes the integer parts* of the columns of B and uses them as coefficients in a
|
|
296
|
+
//homogeneous poly of degree d
|
|
297
|
+
//i.e. the first nrows-1 entries
|
|
298
|
+
ideal V=maxideal(d);
|
|
299
|
+
poly r=0;//will be one of the relation-polys
|
|
300
|
+
ideal R;//will contain all the relations
|
|
301
|
+
intvec rM=1..(nrows(B)-1);
|
|
302
|
+
intvec cM=1..ncols(B);
|
|
303
|
+
matrix M=submat(B,rM,cM);//B without the last row
|
|
304
|
+
//poly nu=poly(10)**(2*d);
|
|
305
|
+
int i,j;
|
|
306
|
+
for(i=1; i<=ncols(M); i++)
|
|
307
|
+
{
|
|
308
|
+
if(absValue(B[nrows(B),i]) < 10)//if(is_almost_zero(B,i,d))
|
|
309
|
+
{//we should check first, if the value of the generated poly in p (i.e. the last
|
|
310
|
+
//entry of the respective column in B) is "almost" 0
|
|
311
|
+
if(1)
|
|
312
|
+
{
|
|
313
|
+
for(j=1; j<=size(V); j++)
|
|
314
|
+
{
|
|
315
|
+
r=r+M[j,i]*V[j];
|
|
316
|
+
}
|
|
317
|
+
R=R,r;
|
|
318
|
+
r=0;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
R=simplify(R,2);//gets rid of the zeroes
|
|
323
|
+
return(R);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
static proc getD(ideal J)
|
|
327
|
+
{
|
|
328
|
+
//computes the maximal degree among elements of J
|
|
329
|
+
int maxdeg,c,i;
|
|
330
|
+
poly g;
|
|
331
|
+
for(i=1; i<=size(J); i++)
|
|
332
|
+
{
|
|
333
|
+
g=J[i];
|
|
334
|
+
c=deg(g);
|
|
335
|
+
if(c > maxdeg)
|
|
336
|
+
{
|
|
337
|
+
maxdeg=c;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return(maxdeg);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
344
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
345
|
+
/////////////////////////// use_LLL procedures //////////////////////////////////
|
|
346
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
347
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
static proc mat2list(bigintmat B)
|
|
351
|
+
{
|
|
352
|
+
list c;//column of B
|
|
353
|
+
list M;//the matrix: list of column-lists
|
|
354
|
+
|
|
355
|
+
int i,j;
|
|
356
|
+
for(i=1; i<=ncols(B); i++)
|
|
357
|
+
{
|
|
358
|
+
for(j=1; j<=nrows(B); j++)
|
|
359
|
+
{
|
|
360
|
+
c=c+list(B[j,i]);
|
|
361
|
+
}
|
|
362
|
+
M=M+list(c);
|
|
363
|
+
c=list();
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return(M);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
static proc list2bigintmat(list L);
|
|
370
|
+
{
|
|
371
|
+
int c=size(L);
|
|
372
|
+
int r=size(L[1]);
|
|
373
|
+
bigintmat B[r][c];
|
|
374
|
+
list Li;
|
|
375
|
+
int i,j;
|
|
376
|
+
for(i=1; i<=c; i++)
|
|
377
|
+
{
|
|
378
|
+
Li=L[i];
|
|
379
|
+
for(j=1; j<=r; j++)
|
|
380
|
+
{
|
|
381
|
+
B[j,i]=Li[j];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return(B);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
static proc bigint2poly(bigint b)
|
|
389
|
+
{
|
|
390
|
+
poly p;
|
|
391
|
+
string bs=string(b);
|
|
392
|
+
|
|
393
|
+
int st=1;
|
|
394
|
+
int c;
|
|
395
|
+
if(bs[1] == "-")
|
|
396
|
+
{
|
|
397
|
+
st=2;
|
|
398
|
+
c=1;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
int i;
|
|
403
|
+
for(i=st; i<=size(bs); i++)
|
|
404
|
+
{
|
|
405
|
+
p=p*10+string2intdigit(bs[i]);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
if(c == 1)
|
|
410
|
+
{
|
|
411
|
+
return(-p);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return(p);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
static proc bigintmat2matrix(bigintmat B)
|
|
418
|
+
{//type conversion via matrix(B) does not work
|
|
419
|
+
int r=nrows(B);
|
|
420
|
+
int c=ncols(B);
|
|
421
|
+
matrix M[r][c];
|
|
422
|
+
|
|
423
|
+
int i,j;
|
|
424
|
+
for(i=1; i<=r; i++)
|
|
425
|
+
{
|
|
426
|
+
for(j=1; j<=c; j++)
|
|
427
|
+
{
|
|
428
|
+
M[i,j]=bigint2poly(B[i,j]);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return(M);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
static proc use_LLL(matrix A)
|
|
436
|
+
{
|
|
437
|
+
//first, we round the entries in the last row of A
|
|
438
|
+
int r=nrows(A);
|
|
439
|
+
int c=ncols(A);
|
|
440
|
+
int i;
|
|
441
|
+
for(i=1; i<=c; i++)
|
|
442
|
+
{
|
|
443
|
+
A[r,i]=roundpoly(A[r,i]);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
//now, all entries of A are integers, but still have type poly
|
|
447
|
+
//so we convert A to a bigintmat B
|
|
448
|
+
bigintmat B=mat2bigintmat(A);
|
|
449
|
+
|
|
450
|
+
//apply LLL
|
|
451
|
+
list M=mat2list(B);
|
|
452
|
+
list L=LLL(M);
|
|
453
|
+
B=list2bigintmat(L);
|
|
454
|
+
|
|
455
|
+
return(bigintmat2matrix(B));
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
static proc use_LLL_bigintmat(matrix A)
|
|
460
|
+
{//returns a bigintmat instead of a matrix
|
|
461
|
+
//first, we round the entries in the last row of A
|
|
462
|
+
int r=nrows(A);
|
|
463
|
+
int c=ncols(A);
|
|
464
|
+
int i;
|
|
465
|
+
for(i=1; i<=c; i++)
|
|
466
|
+
{
|
|
467
|
+
A[r,i]=roundpoly(A[r,i]);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
//now, all entries of A are integers, but still have type poly
|
|
471
|
+
//so we convert A to a bigintmat B
|
|
472
|
+
bigintmat B=mat2bigintmat(A);
|
|
473
|
+
|
|
474
|
+
//apply LLL
|
|
475
|
+
list M=mat2list(B);
|
|
476
|
+
list L=LLL(M);
|
|
477
|
+
B=list2bigintmat(L);
|
|
478
|
+
|
|
479
|
+
return(B);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
static proc use_FLINT_LLL(matrix A)
|
|
483
|
+
{
|
|
484
|
+
//first, we round the entries in the last row of A
|
|
485
|
+
int r=nrows(A);
|
|
486
|
+
int c=ncols(A);
|
|
487
|
+
int i;
|
|
488
|
+
for(i=1; i<=c; i++)
|
|
489
|
+
{
|
|
490
|
+
A[r,i]=roundpoly(A[r,i]);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
//now, all entries of A are integers, but still have type poly
|
|
494
|
+
//so we convert A to a bigintmat B
|
|
495
|
+
bigintmat B=mat2bigintmat(A);
|
|
496
|
+
|
|
497
|
+
//apply LLL
|
|
498
|
+
bigintmat BB=system("LLL_Flint",B);
|
|
499
|
+
|
|
500
|
+
return(BB);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
static proc use_NTL_LLL(matrix A)
|
|
504
|
+
{
|
|
505
|
+
//first, we round the entries in the last row of A
|
|
506
|
+
int r=nrows(A);
|
|
507
|
+
int c=ncols(A);
|
|
508
|
+
int i;
|
|
509
|
+
for(i=1; i<=c; i++)
|
|
510
|
+
{
|
|
511
|
+
A[r,i]=roundpoly(A[r,i]);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
//now, all entries of A are integers, but still have type poly
|
|
516
|
+
//so we convert A to a bigintmat B
|
|
517
|
+
bigintmat B=mat2bigintmat(A);
|
|
518
|
+
|
|
519
|
+
def br=basering;
|
|
520
|
+
ring newr=0,x,dp;
|
|
521
|
+
matrix A=bigintmat2matrix(B);
|
|
522
|
+
|
|
523
|
+
//NTL wants the lattice-vectors as row-vectors and returns a matrix of row-vectors
|
|
524
|
+
A=transpose(A);
|
|
525
|
+
matrix AA=system("LLL",A);
|
|
526
|
+
AA=transpose(AA);
|
|
527
|
+
bigintmat BB=mat2bigintmat(AA);
|
|
528
|
+
setring br;
|
|
529
|
+
|
|
530
|
+
return(BB);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
534
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
535
|
+
/////////////////////////// the main procedure(s) //////////////////////////////////
|
|
536
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
537
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
538
|
+
|
|
539
|
+
proc getRelations(list p, int D, bigint C)
|
|
540
|
+
"USAGE: getRelations(p,D,C); list p, int D, bigint C
|
|
541
|
+
RETURN: list K: a list of ideals; the ideals contain homogeneous polynomial relations of
|
|
542
|
+
degree <=D between the components of the point p
|
|
543
|
+
NOTE: This procedure uses only the images of the one point p under the Veronese
|
|
544
|
+
embeddings to find homogeneous polynomial relations.
|
|
545
|
+
SEE ALSO: getRelationsRadical
|
|
546
|
+
EXAMPLE: example getRelations; shows an example
|
|
547
|
+
"
|
|
548
|
+
{//uses degree d Veronese embeddings (for all d<=D) and LLL-algorithm to find
|
|
549
|
+
//(homogeneous) polynomial relations between the entries of p
|
|
550
|
+
//C is the Value with which the Veronese embedding is being multiplied (cf getmatrix)
|
|
551
|
+
|
|
552
|
+
if(nvars(basering) != size(p) )
|
|
553
|
+
{
|
|
554
|
+
ERROR("Number of variables not equal to the number of components of p.");
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
//get the precision
|
|
558
|
+
list RL=ringlist(basering);
|
|
559
|
+
RL=RL[1];
|
|
560
|
+
RL=RL[2];
|
|
561
|
+
int Prec=RL[2];
|
|
562
|
+
|
|
563
|
+
list P=list(p);
|
|
564
|
+
|
|
565
|
+
int d,i,len;
|
|
566
|
+
intvec rm;
|
|
567
|
+
ideal vd,Kd;
|
|
568
|
+
list K;
|
|
569
|
+
matrix A,B;
|
|
570
|
+
for(d=1; d<=D; d++)
|
|
571
|
+
{
|
|
572
|
+
vd=veronese(d,p);
|
|
573
|
+
len=size(maxideal(d));
|
|
574
|
+
A=getmatrix(vd,C,len);
|
|
575
|
+
B=realLLL(A);
|
|
576
|
+
|
|
577
|
+
Kd=getpolys(B,d);
|
|
578
|
+
|
|
579
|
+
if(size(Kd) == 0)//i.e. Kd has only zero-entries
|
|
580
|
+
{//then dont add Kd to the list of relations
|
|
581
|
+
d++;
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
rm=check_is_zero_lincomradical(Prec,Kd,P);
|
|
587
|
+
for(i=1; i<=size(rm); i++)
|
|
588
|
+
{
|
|
589
|
+
if( rm[i] == 1 )
|
|
590
|
+
{
|
|
591
|
+
Kd[i] = 0;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
Kd=simplify(Kd,2);
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
if(size(Kd) == 0)//i.e. Kd has only zero-entries
|
|
599
|
+
{//then dont add Kd to the list of relations
|
|
600
|
+
d++;
|
|
601
|
+
continue;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
K=K+list(Kd);
|
|
605
|
+
}
|
|
606
|
+
return(K);
|
|
607
|
+
}
|
|
608
|
+
example
|
|
609
|
+
{ "EXAMPLE:"; echo=2;
|
|
610
|
+
ring r=(complex,50),(x,y,z),dp;
|
|
611
|
+
list p=1,-1,0.5;
|
|
612
|
+
getRelations(p,2,10000);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
proc getRelationsRadical(list P, int D, bigint C)
|
|
616
|
+
"USAGE: getRelationsRadical(P,D,C); list P, int D, bigint C
|
|
617
|
+
RETURN: list K: a list of ideals; the ideals contain homogeneous polynomial relations of
|
|
618
|
+
degree <=D between the components of the points in P
|
|
619
|
+
NOTE: This procedure uses random linear combination of the Veronese embeddings of all
|
|
620
|
+
points in P to find homogeneous polynomial relations.
|
|
621
|
+
SEE ALSO: getRelations
|
|
622
|
+
EXAMPLE: example getRelationsRadical; shows an example
|
|
623
|
+
"
|
|
624
|
+
{//here we compute random linear combinations of the degree d Veronese embeddings of the
|
|
625
|
+
//points in P and then proceed as in getRelations to get homogeneous polynomials
|
|
626
|
+
//which vanish on all points in P (with high probability)
|
|
627
|
+
|
|
628
|
+
if(nvars(basering) != size(P[1]) )
|
|
629
|
+
{
|
|
630
|
+
ERROR("Number of variables not equal to the number of components of P[1].");
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
//get the precision
|
|
634
|
+
list RL=ringlist(basering);
|
|
635
|
+
RL=RL[1];
|
|
636
|
+
RL=RL[2];
|
|
637
|
+
int Prec=RL[2];
|
|
638
|
+
|
|
639
|
+
int d,i,len;
|
|
640
|
+
intvec rm;
|
|
641
|
+
ideal vd,Kd;
|
|
642
|
+
list K;
|
|
643
|
+
matrix A,B;
|
|
644
|
+
for(d=1; d<=D; d++)
|
|
645
|
+
{
|
|
646
|
+
vd=veronese_radical(d,P);
|
|
647
|
+
len=size(maxideal(d));
|
|
648
|
+
A=getmatrix(vd,C,len);
|
|
649
|
+
B=realLLL(A);
|
|
650
|
+
Kd=getpolys(B,d);
|
|
651
|
+
|
|
652
|
+
if(size(Kd) == 0)//i.e. Kd has only zero-entries
|
|
653
|
+
{//then dont add Kd to the list of relations
|
|
654
|
+
d++;
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
rm=check_is_zero_lincomradical(Prec,Kd,P);
|
|
660
|
+
for(i=1; i<=size(rm); i++)
|
|
661
|
+
{
|
|
662
|
+
if( rm[i] == 1 )
|
|
663
|
+
{
|
|
664
|
+
Kd[i] = 0;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
Kd=simplify(Kd,2);
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
if(size(Kd) == 0)//i.e. Kd has only zero-entries
|
|
672
|
+
{//then dont add Kd to the list of relations
|
|
673
|
+
d++;
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
K=K+list(Kd);
|
|
678
|
+
}
|
|
679
|
+
return(K);
|
|
680
|
+
}
|
|
681
|
+
example
|
|
682
|
+
{ "EXAMPLE:"; echo=2;
|
|
683
|
+
ring r=(complex,50),(x,y,z),dp;
|
|
684
|
+
list p1=1,-1,0.5;
|
|
685
|
+
list p2=1,0,-1;
|
|
686
|
+
list P=list(p1)+list(p2);
|
|
687
|
+
getRelationsRadical(P,2,10**5);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
691
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
692
|
+
/////////////////////////// Gauss reduction //////////////////////////////////
|
|
693
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
694
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
695
|
+
|
|
696
|
+
static proc find_unused_nonzero(matrix M, int j, intvec used)
|
|
697
|
+
{//look in column j of M for a non-zero entry in an unused row
|
|
698
|
+
//if there is one, return its row index
|
|
699
|
+
//if there isn't, return 0
|
|
700
|
+
int i;
|
|
701
|
+
int r=nrows(M);
|
|
702
|
+
for(i=1; i<=r; i++)
|
|
703
|
+
{
|
|
704
|
+
if(used[i] == 0)
|
|
705
|
+
{
|
|
706
|
+
if(M[i,j] != 0)
|
|
707
|
+
{
|
|
708
|
+
return(i);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return(0);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
proc gaussRowWithoutPerm(matrix M)
|
|
716
|
+
"USAGE: gaussRowWithoutPerm(M); M a matrix of constant polynomials
|
|
717
|
+
RETURN: matrix: basic Gaussian row reduction of M, just without permuting the rows
|
|
718
|
+
EXAMPLE: example gaussRowWithoutPerm; shows an example
|
|
719
|
+
"
|
|
720
|
+
{//M a matrix of constant polys
|
|
721
|
+
int n=ncols(M);
|
|
722
|
+
int r=nrows(M);
|
|
723
|
+
int i,j,k;
|
|
724
|
+
intvec used;//the rows we already used to make entries in other rows 0
|
|
725
|
+
used[r]=0;//makes it a zero-intvec of length r
|
|
726
|
+
//we dont want to change these used rows anymore and we dont want to use them again
|
|
727
|
+
//entry i will be set to 1 if we used row i already
|
|
728
|
+
for(j=1; j<=n; j++)//go through all columns of M
|
|
729
|
+
{
|
|
730
|
+
//find the first non-zero entry
|
|
731
|
+
i=find_unused_nonzero(M,j,used);
|
|
732
|
+
if(i != 0)
|
|
733
|
+
{//and use it to make all non-pivot entries in the column equal to 0
|
|
734
|
+
used[i]=1;
|
|
735
|
+
for(k=1; k<=r; k++)
|
|
736
|
+
{
|
|
737
|
+
if(used[k] == 0)
|
|
738
|
+
{
|
|
739
|
+
if(M[k,j] != 0)
|
|
740
|
+
{
|
|
741
|
+
M=addrow(M,i,-M[k,j]/M[i,j],k);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return(M);
|
|
748
|
+
}
|
|
749
|
+
example
|
|
750
|
+
{ "EXAMPLE:"; echo=2;
|
|
751
|
+
ring r=0,x,dp;
|
|
752
|
+
matrix M[5][4]=0,0,2,1,4,5,1,3,0,9,2,0,8,1,0,6,0,9,4,1;
|
|
753
|
+
print(M);
|
|
754
|
+
print(gaussRowWithoutPerm(M));
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
proc gaussColWithoutPerm(matrix M)
|
|
758
|
+
"USAGE: gaussColWithoutPerm(M); M a matrix of constant polynomials
|
|
759
|
+
RETURN: matrix: basic Gaussian column reduction of M, just without permuting the columns
|
|
760
|
+
EXAMPLE: example gaussColWithoutPerm; shows an example
|
|
761
|
+
"
|
|
762
|
+
{
|
|
763
|
+
matrix T=transpose(M);
|
|
764
|
+
matrix G=gaussRowWithoutPerm(T);
|
|
765
|
+
return(transpose(G));
|
|
766
|
+
}
|
|
767
|
+
example
|
|
768
|
+
{ "EXAMPLE:"; echo=2;
|
|
769
|
+
ring r=0,x,dp;
|
|
770
|
+
matrix M[3][4]=0,1,0,2,1,2,3,4,1,0,5,0;
|
|
771
|
+
print(M);
|
|
772
|
+
print(gaussColWithoutPerm(M));
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
776
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
777
|
+
/////////////////////// static procs needed for minrelations //////////////////////
|
|
778
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
779
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
780
|
+
|
|
781
|
+
static proc multwithmaxideal(ideal I, int a)
|
|
782
|
+
{//returns the ideal IM containing all products of elements of I and maxideal(a)
|
|
783
|
+
ideal M=maxideal(a);
|
|
784
|
+
int sM=size(M);
|
|
785
|
+
ideal IM=I*M[1];
|
|
786
|
+
|
|
787
|
+
int i;
|
|
788
|
+
for(i=2; i<=sM; i++)
|
|
789
|
+
{
|
|
790
|
+
IM=IM,I*M[i];
|
|
791
|
+
}
|
|
792
|
+
return(IM);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
static proc prodofallringvars(int dummy)
|
|
796
|
+
{//returns the product of all ring variables
|
|
797
|
+
poly f=1;
|
|
798
|
+
int i;
|
|
799
|
+
for(i=1; i<=nvars(basering); i++)
|
|
800
|
+
{
|
|
801
|
+
f=f*var(i);
|
|
802
|
+
}
|
|
803
|
+
return(f);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
static proc getcoefmat(ideal IM, int m)
|
|
807
|
+
{//computes the matrix of coefficients of the elements of IM
|
|
808
|
+
//the order of the coefficients in each column corresponds to the order of the
|
|
809
|
+
//monomials in maxideal(m);
|
|
810
|
+
matrix Co;
|
|
811
|
+
ideal M=maxideal(m);
|
|
812
|
+
int sM=size(M);
|
|
813
|
+
matrix C[sM][1];//the coeff vector of an element of IM with the coeffs placed at
|
|
814
|
+
//the appropriate positions
|
|
815
|
+
IM=simplify(IM,2);//be sure that size(IM) is the right thing -> get rid of zeroes
|
|
816
|
+
int sIM=size(IM);
|
|
817
|
+
matrix B;
|
|
818
|
+
poly pr=prodofallringvars(1);
|
|
819
|
+
poly g, Coj;
|
|
820
|
+
int i,j,k;
|
|
821
|
+
for(i=1; i<=sIM; i++)
|
|
822
|
+
{
|
|
823
|
+
g=IM[i];
|
|
824
|
+
Co=coef(g,pr);
|
|
825
|
+
|
|
826
|
+
//we now have to put the coeffs in the appropriate places (corresponding to the
|
|
827
|
+
//position of the respective monomial in maxideal)
|
|
828
|
+
for(j=1; j<=ncols(Co); j++)
|
|
829
|
+
{
|
|
830
|
+
Coj=Co[1,j];//arranged as row vectors
|
|
831
|
+
//compare the monomials of g with the elements of maxideal(m)
|
|
832
|
+
//and when we find a match, place the coef at the appropriate place in C
|
|
833
|
+
for(k=1; k<=sM; k++)
|
|
834
|
+
{
|
|
835
|
+
if(M[k] == Coj)
|
|
836
|
+
{
|
|
837
|
+
C[k,1]=Co[2,j];
|
|
838
|
+
break;//we dont need to check any other elements of M
|
|
839
|
+
//since they are all different
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
if(i==1)
|
|
845
|
+
{
|
|
846
|
+
B=C;
|
|
847
|
+
C=0;
|
|
848
|
+
i++;
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
B=concat(B,C);
|
|
852
|
+
C=0;//reset C to the zero vector
|
|
853
|
+
}
|
|
854
|
+
return(B);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
static proc getconcatcoefmats(list L)
|
|
858
|
+
{//L the first size(L) entries of K
|
|
859
|
+
//returns the concatenated coef matrices
|
|
860
|
+
//more precisely: let m be the degree of the elements of L[size(L)], then we want
|
|
861
|
+
//to know, which homogeneous polynomials of degree m can be written as a combination
|
|
862
|
+
//of polynomials in the ideals contained in L. In particular, we want to know which
|
|
863
|
+
//of the elements of L[size(L)] can be written as a combination of other polys
|
|
864
|
+
//in L and are thereby superfluous (cf superfluousL)
|
|
865
|
+
//what we do here is, we multiply each polynomial (of degree, say, d) in L with a
|
|
866
|
+
//monomial of degree m-d and then store the coefficients of the resulting poly
|
|
867
|
+
//in a matrix
|
|
868
|
+
//(this is rather cumbersome and can probably be improved upon significantly)
|
|
869
|
+
|
|
870
|
+
matrix B,C;
|
|
871
|
+
ideal IM,I;
|
|
872
|
+
int i,d,m;
|
|
873
|
+
poly l;
|
|
874
|
+
int sL=size(L);
|
|
875
|
+
|
|
876
|
+
l=L[sL][1];//the polys are homogeneous; deg rising along L; deg same in L[j]
|
|
877
|
+
//for all j
|
|
878
|
+
m=deg(l);//the max degree
|
|
879
|
+
|
|
880
|
+
if(sL == 1)
|
|
881
|
+
{//then we only consider polys of one certain degree, so we don't have to
|
|
882
|
+
//multiply any of the ideals with any maxideal
|
|
883
|
+
C=getcoefmat(L[1],m);
|
|
884
|
+
return(C);//we dont concatenate anything here, so the initialization of
|
|
885
|
+
//C as the 1x1-zero-matrix is not an issue
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
for(i=1; i<sL; i++)
|
|
889
|
+
{
|
|
890
|
+
I=L[i];
|
|
891
|
+
d=deg(I[1]);
|
|
892
|
+
IM=multwithmaxideal(I,m-d);
|
|
893
|
+
B=getcoefmat(IM,m);
|
|
894
|
+
C=concat(C,B);//will again have as first column the zero vector
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
//if i=sL, the polys in L[i] already have the degree m, so we dont need to multiply
|
|
898
|
+
B=getcoefmat(L[sL],m);
|
|
899
|
+
C=concat(C,B);
|
|
900
|
+
|
|
901
|
+
//C will contain a zero-column at the beginning, because of the
|
|
902
|
+
//initialization of B as the 1x1-mat with single entry 0 + the way
|
|
903
|
+
//concat handles that situation
|
|
904
|
+
return( submat(C,1..nrows(C),2..ncols(C)) );
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
static proc string2intdigit(string ti)
|
|
908
|
+
{//ti a string of size 1, containing an integer digit
|
|
909
|
+
//return the digit
|
|
910
|
+
intvec v=0,1,2,3,4,5,6,7,8,9;
|
|
911
|
+
int i;
|
|
912
|
+
for(i=1; i<=size(v); i++)
|
|
913
|
+
{
|
|
914
|
+
if( ti == string(v[i]) )
|
|
915
|
+
{
|
|
916
|
+
return(v[i]);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return(0);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
static proc string2bigint(string s)
|
|
923
|
+
{
|
|
924
|
+
string t=s;
|
|
925
|
+
int e=0;
|
|
926
|
+
if(s[1]=="-")
|
|
927
|
+
{
|
|
928
|
+
e=1;
|
|
929
|
+
t=s[2..size(s)];//start at the second symbol (to drop the minus)
|
|
930
|
+
}
|
|
931
|
+
bigint r=string2intdigit(t[1]);
|
|
932
|
+
int i;
|
|
933
|
+
for(i=2; i<=size(t); i++)
|
|
934
|
+
{
|
|
935
|
+
r=r*10+string2intdigit(t[i]);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
if(e == 1)
|
|
939
|
+
{//readjust the sign, if needed
|
|
940
|
+
r=-r;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
return(r);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
static proc mat2bigintmat(matrix M)
|
|
947
|
+
{//M a matrix filled with constant polys of integer value
|
|
948
|
+
//return the corresponding bigintmat
|
|
949
|
+
int c=ncols(M);
|
|
950
|
+
int r=nrows(M);
|
|
951
|
+
bigintmat intM[r][c];
|
|
952
|
+
int i,j;
|
|
953
|
+
for(i=1; i<=r; i++)
|
|
954
|
+
{
|
|
955
|
+
for(j=1; j<=c; j++)
|
|
956
|
+
{
|
|
957
|
+
intM[i,j]=string2bigint(string(M[i,j]));
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return(intM);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
static proc findnonzero(matrix M, int j)
|
|
964
|
+
{//look in column j of M for a non-zero entry
|
|
965
|
+
//if there is one, return its row index
|
|
966
|
+
//if there isn't, return 0
|
|
967
|
+
int i;
|
|
968
|
+
int r=nrows(M);
|
|
969
|
+
for(i=1; i<=r; i++)
|
|
970
|
+
{
|
|
971
|
+
if(M[i,j] != 0)
|
|
972
|
+
{
|
|
973
|
+
return(i);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
return(0);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
980
|
+
/////////////////////////////// minrelations ///////////////////////////////////
|
|
981
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
982
|
+
|
|
983
|
+
static proc superfluousL(list L)
|
|
984
|
+
{//returns an intvec containing the indices of the elements (of the ideal with highest
|
|
985
|
+
//degree in L) which can be dropped
|
|
986
|
+
intvec sprfls;
|
|
987
|
+
matrix C=getconcatcoefmats(L);
|
|
988
|
+
bigintmat intC=mat2bigintmat(C);
|
|
989
|
+
int l=size(L[size(L)]);
|
|
990
|
+
|
|
991
|
+
ring ratr=0,x,dp;
|
|
992
|
+
matrix M=bigintmat2matrix(intC);
|
|
993
|
+
M=gaussColWithoutPerm(M);
|
|
994
|
+
int i;
|
|
995
|
+
int c=1;//counts the number of elements (+1) of sprfls
|
|
996
|
+
int k=ncols(M)-l;//the number of cols in M which correspond to polys of lower degree
|
|
997
|
+
//is = ncols(M) - number of elements in L[size(L)]
|
|
998
|
+
for(i=k+1; i<=ncols(M); i++)
|
|
999
|
+
{
|
|
1000
|
+
if( findnonzero(M,i) == 0 )
|
|
1001
|
+
{
|
|
1002
|
+
sprfls[c]=i-k;
|
|
1003
|
+
c++;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
return(sprfls);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
static proc minrelations(list K)
|
|
1010
|
+
{//K a list of homogeneous ideals - all individually of "pure degree d" -
|
|
1011
|
+
//ordered from d=1 up to D
|
|
1012
|
+
|
|
1013
|
+
list L;
|
|
1014
|
+
intvec sprfls;
|
|
1015
|
+
int sj;
|
|
1016
|
+
|
|
1017
|
+
int i,j;
|
|
1018
|
+
ideal Ki;
|
|
1019
|
+
for(i=1; i<=size(K); i++)
|
|
1020
|
+
{
|
|
1021
|
+
L=K[1..i];//will give the list with one ideal as the only entry, when i=1
|
|
1022
|
+
//i=1 would make trouble, if K was a list of lists: then L would be the first
|
|
1023
|
+
//list in K
|
|
1024
|
+
|
|
1025
|
+
sprfls=superfluousL(L);
|
|
1026
|
+
|
|
1027
|
+
if(sprfls[1] == 0)
|
|
1028
|
+
{//then sprfls returned the intvec v=0; so there are no superfluous elements
|
|
1029
|
+
i++;
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
Ki=K[i];
|
|
1034
|
+
for(j=1; j<=size(sprfls); j++)
|
|
1035
|
+
{
|
|
1036
|
+
sj=sprfls[j];
|
|
1037
|
+
Ki[sj]=0;
|
|
1038
|
+
}
|
|
1039
|
+
Ki=simplify(Ki,2);
|
|
1040
|
+
|
|
1041
|
+
if( size(Ki) == 0 )
|
|
1042
|
+
{//then all polys in K[i] can be generated by polys in the K[<i], so we can delete
|
|
1043
|
+
//K[i] from the list
|
|
1044
|
+
|
|
1045
|
+
K=delete(K,i);
|
|
1046
|
+
continue;
|
|
1047
|
+
|
|
1048
|
+
//but we dont want to change i
|
|
1049
|
+
//size(K) adjusts itself, so we're fine there
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
K[i]=Ki;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
return(K);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
1059
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
1060
|
+
//////////////// Procs for Bertini-Singular-Conversation /////////////////////
|
|
1061
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
1062
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
1063
|
+
|
|
1064
|
+
proc getWitnessSet()
|
|
1065
|
+
"USAGE: getWitnessSet();
|
|
1066
|
+
ASSUME: There is a text-document \"main_data\" in the current directory which was
|
|
1067
|
+
produced by Bertini.
|
|
1068
|
+
The basefield is the field of real numbers or the field of complex numbers.
|
|
1069
|
+
RETURN: list; a list P of lists p_i of numbers: P a set of witness points
|
|
1070
|
+
NOTE: Reads the file \"main_data\", searches the strings containing the witness points,
|
|
1071
|
+
and converts them into floating point numbers.
|
|
1072
|
+
EXAMPLE: example getWitnessSet; shows an example
|
|
1073
|
+
"
|
|
1074
|
+
{//goes through the file main_data generated by bertini and returns the witness points
|
|
1075
|
+
//as a list of complex numbers
|
|
1076
|
+
//(the precision specified in the definition of the basering should* be at least as
|
|
1077
|
+
//high as the precision used by/to be expected from bertini)
|
|
1078
|
+
string r;
|
|
1079
|
+
list P,p;
|
|
1080
|
+
int i, j;
|
|
1081
|
+
r=read("main_data");
|
|
1082
|
+
intvec posi=find_string("Estimated",r);
|
|
1083
|
+
intvec endpos=find_string("Multiplicity",r);
|
|
1084
|
+
for(i=1; i<=size(posi); i++)
|
|
1085
|
+
{
|
|
1086
|
+
p=read_point(r,posi[i],endpos[i]);
|
|
1087
|
+
|
|
1088
|
+
if( size(p) == 0 )
|
|
1089
|
+
{
|
|
1090
|
+
ERROR("Bertini nicht erfolgreich");
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
P=P+list( convert_p(p) );
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
return(P);
|
|
1097
|
+
}
|
|
1098
|
+
example
|
|
1099
|
+
{ "EXAMPLE:"; echo=2;
|
|
1100
|
+
//First, we write the input file for bertini, then run bertini
|
|
1101
|
+
ring r=0,(x,y,z),dp;
|
|
1102
|
+
ideal I=(x-y)*(y-z)*(x-z);
|
|
1103
|
+
writeBertiniInput(I,40);
|
|
1104
|
+
system("sh","bertini input");
|
|
1105
|
+
|
|
1106
|
+
//Then we change the ring and extract the witness set from main_data
|
|
1107
|
+
ring R=(complex,40,i),(x,y,z),dp;
|
|
1108
|
+
list P=getWitnessSet();
|
|
1109
|
+
P;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
static proc get_hom_var_group_str(int dummy)
|
|
1114
|
+
{
|
|
1115
|
+
string vg=varstr(basering);
|
|
1116
|
+
int i;
|
|
1117
|
+
for(i=1; i<size(vg); i++)
|
|
1118
|
+
{
|
|
1119
|
+
if(vg[i]==",")
|
|
1120
|
+
{
|
|
1121
|
+
vg=vg[1,i]+" "+vg[(i+1),size(vg)-i];
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
if( vg[i] == "(" )
|
|
1125
|
+
{
|
|
1126
|
+
vg=vg[1,i-1]+vg[(i+1),size(vg)-i];
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
if( vg[i] == ")" )
|
|
1131
|
+
{
|
|
1132
|
+
vg=vg[1,(i-1)]+vg[(i+1),size(vg)-i];
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
i=size(vg);
|
|
1138
|
+
if(vg[i]==",")
|
|
1139
|
+
{
|
|
1140
|
+
vg=vg[1,i];
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
if( vg[i] == "(" )
|
|
1144
|
+
{
|
|
1145
|
+
vg=vg[1,i-1];
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
if( vg[i] == ")" )
|
|
1149
|
+
{
|
|
1150
|
+
vg=vg[1,(i-1)];
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
vg="hom_variable_group "+vg+";"+newline;
|
|
1154
|
+
|
|
1155
|
+
return(vg);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
static proc get_declare_function_str(ideal J)
|
|
1159
|
+
{
|
|
1160
|
+
string dfs;
|
|
1161
|
+
int i;
|
|
1162
|
+
for(i=1; i<=size(J); i++)
|
|
1163
|
+
{
|
|
1164
|
+
if(size(dfs) > 0)
|
|
1165
|
+
{
|
|
1166
|
+
dfs=dfs+", f"+string(i);
|
|
1167
|
+
}
|
|
1168
|
+
else
|
|
1169
|
+
{
|
|
1170
|
+
dfs=dfs+"f"+string(i);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
dfs="function "+dfs+";"+newline;
|
|
1175
|
+
|
|
1176
|
+
return(dfs);
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
static proc remove_brackets(string vg)
|
|
1180
|
+
{//removes any round brackets from a string
|
|
1181
|
+
int i;
|
|
1182
|
+
for(i=1; i<size(vg); i++)
|
|
1183
|
+
{
|
|
1184
|
+
if( vg[i] == "(" )
|
|
1185
|
+
{
|
|
1186
|
+
vg=vg[1,i-1]+vg[(i+1),size(vg)-i];
|
|
1187
|
+
continue;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
if( vg[i] == ")" )
|
|
1191
|
+
{
|
|
1192
|
+
vg=vg[1,(i-1)]+vg[(i+1),size(vg)-i];
|
|
1193
|
+
continue;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
i=size(vg);
|
|
1198
|
+
|
|
1199
|
+
if( vg[i] == "(" )
|
|
1200
|
+
{
|
|
1201
|
+
vg=vg[1,i-1];
|
|
1202
|
+
}
|
|
1203
|
+
if( vg[i] == ")" )
|
|
1204
|
+
{
|
|
1205
|
+
vg=vg[1,(i-1)];
|
|
1206
|
+
}
|
|
1207
|
+
return(vg);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
static proc get_function_str(ideal J)
|
|
1211
|
+
{
|
|
1212
|
+
string fs, m;
|
|
1213
|
+
matrix C;
|
|
1214
|
+
poly fi;
|
|
1215
|
+
int i,j,k;
|
|
1216
|
+
string s;
|
|
1217
|
+
for(i=1; i<=size(J); i++)
|
|
1218
|
+
{
|
|
1219
|
+
fs=fs+"f"+string(i)+" = ";
|
|
1220
|
+
fi=J[i];
|
|
1221
|
+
|
|
1222
|
+
s=string(fi);
|
|
1223
|
+
s=remove_brackets(s);
|
|
1224
|
+
|
|
1225
|
+
fs=fs+s;
|
|
1226
|
+
|
|
1227
|
+
fs=fs+";"+newline;
|
|
1228
|
+
}
|
|
1229
|
+
return(fs);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
static proc get_coef_bound_poly(poly f)
|
|
1233
|
+
{
|
|
1234
|
+
poly pr=prodofallringvars(1);
|
|
1235
|
+
matrix C=coef(f,pr);
|
|
1236
|
+
int c=ncols(C);
|
|
1237
|
+
poly b;
|
|
1238
|
+
int i;
|
|
1239
|
+
for(i=1; i<=c; i++)
|
|
1240
|
+
{
|
|
1241
|
+
b=b+absValue(C[2,i]);
|
|
1242
|
+
}
|
|
1243
|
+
return(b);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
static proc get_coef_bound_ideal(ideal J)
|
|
1247
|
+
{//is supposed to compute the maximum among the sums of coefficients in each individual
|
|
1248
|
+
//polynomial in J
|
|
1249
|
+
if(size(J) == 0){ return(1); }
|
|
1250
|
+
|
|
1251
|
+
J=simplify(J,2);
|
|
1252
|
+
poly b=get_coef_bound_poly(J[1]);
|
|
1253
|
+
poly a;
|
|
1254
|
+
int i;
|
|
1255
|
+
for(i=2; i<=size(J); i++)
|
|
1256
|
+
{
|
|
1257
|
+
a=get_coef_bound_poly(J[i]);
|
|
1258
|
+
if(a > b)
|
|
1259
|
+
{
|
|
1260
|
+
b=a;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
return(string(b));
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
static proc get_prec_in_bits(int Prec)
|
|
1267
|
+
{//log_10(2) is approximately 3,3219281
|
|
1268
|
+
|
|
1269
|
+
//conversion from decimal digits to bits, rounded up
|
|
1270
|
+
int pb = (3322*Prec div 1000) + 1;
|
|
1271
|
+
|
|
1272
|
+
int upb=3328;//upper bound on the precision
|
|
1273
|
+
if( pb > upb )
|
|
1274
|
+
{//bertini allows a maximum of 3328 bits of precision
|
|
1275
|
+
return(upb);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
int lowb=64;//lower bound
|
|
1279
|
+
if( pb < lowb)
|
|
1280
|
+
{//bertini requires a minimum of 64 bits of precision
|
|
1281
|
+
//however, using such a low precision is not recommended, since it will
|
|
1282
|
+
//probably not yield any useful results
|
|
1283
|
+
return(lowb);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
//bertini wants the precision to be a multiple of 32
|
|
1287
|
+
pb = pb + 32 - (pb mod 32);
|
|
1288
|
+
return(pb);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
proc writeBertiniInput(ideal J, int Prec)
|
|
1293
|
+
"USAGE: writeBertiniInput(J); ideal J
|
|
1294
|
+
RETURN: none; writes the input-file for bertini using the polynomials given by J as
|
|
1295
|
+
functions
|
|
1296
|
+
NOTE: Either creates a file named input in the current directory or overwrites the
|
|
1297
|
+
existing one.
|
|
1298
|
+
If you want to pass different parameters to bertini, you can edit the produced
|
|
1299
|
+
input file or redefine this procedure.
|
|
1300
|
+
EXAMPLE: example writeBertiniInput; shows an example
|
|
1301
|
+
"
|
|
1302
|
+
{//writes the input-file for bertini
|
|
1303
|
+
|
|
1304
|
+
//we change the ring so that the names of the ring variables are convenient for us
|
|
1305
|
+
def br=basering;
|
|
1306
|
+
int nv=nvars(br);
|
|
1307
|
+
ring r=0,x(1..nv),dp;
|
|
1308
|
+
ideal J=fetch(br,J);
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
link l=":w ./input";
|
|
1312
|
+
write(l,"CONFIG");
|
|
1313
|
+
write(l,"");
|
|
1314
|
+
write(l,"TRACKTYPE: 1;");
|
|
1315
|
+
write(l,"TRACKTOLBEFOREEG: 1e-8;");
|
|
1316
|
+
write(l,"TRACKTOLDURINGEG: 1e-11;");
|
|
1317
|
+
write(l,"FINALTOL: 1e-14;");
|
|
1318
|
+
write(l,"");
|
|
1319
|
+
write(l,"");
|
|
1320
|
+
write(l,"PrintPathProgress: 1;");
|
|
1321
|
+
write(l,"MPTYPE: 2;");
|
|
1322
|
+
|
|
1323
|
+
int pb=get_prec_in_bits(Prec);
|
|
1324
|
+
write(l,"AMPMaxPrec: "+string(pb)+";");
|
|
1325
|
+
|
|
1326
|
+
string cb=get_coef_bound_ideal(J);
|
|
1327
|
+
write(l,"COEFFBOUND: "+cb+";");
|
|
1328
|
+
|
|
1329
|
+
string db=string(getD(J));
|
|
1330
|
+
write(l,"DEGREEBOUND: "+db+";");
|
|
1331
|
+
write(l,"");
|
|
1332
|
+
write(l,"SHARPENDIGITS: "+string(Prec)+";");
|
|
1333
|
+
|
|
1334
|
+
write(l,"END;");
|
|
1335
|
+
write(l,"");
|
|
1336
|
+
write(l,"");
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
write(l,"INPUT"+newline);
|
|
1340
|
+
|
|
1341
|
+
string vg=get_hom_var_group_str(1);
|
|
1342
|
+
write(l,vg);
|
|
1343
|
+
|
|
1344
|
+
string dfs=get_declare_function_str(J);
|
|
1345
|
+
write(l,dfs);
|
|
1346
|
+
|
|
1347
|
+
string fs=get_function_str(J);
|
|
1348
|
+
write(l,fs);
|
|
1349
|
+
|
|
1350
|
+
write(l,"END;");
|
|
1351
|
+
}
|
|
1352
|
+
example
|
|
1353
|
+
{ "EXAMPLE:"; echo=2;
|
|
1354
|
+
ring r=0,(x,y,z),dp;
|
|
1355
|
+
poly f1=x+y+z;
|
|
1356
|
+
poly f2=x2+xy+y2;
|
|
1357
|
+
ideal I=f1,f2;
|
|
1358
|
+
writeBertiniInput(I,300);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
static proc find_string(string F, string S)
|
|
1362
|
+
{//search in string S for the string F
|
|
1363
|
+
//output all the positions in an intvec v
|
|
1364
|
+
string s;
|
|
1365
|
+
intvec v;
|
|
1366
|
+
int c=1;//counts the number of elements of v
|
|
1367
|
+
|
|
1368
|
+
int i;
|
|
1369
|
+
int a=size(S);
|
|
1370
|
+
int len=size(F);
|
|
1371
|
+
for(i=1; i<=a; i++)
|
|
1372
|
+
{
|
|
1373
|
+
s=S[i,len];
|
|
1374
|
+
if(F==s)
|
|
1375
|
+
{
|
|
1376
|
+
v[c]=i;
|
|
1377
|
+
c++;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
return(v);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
static proc read_point(string r, int po, int endpo)
|
|
1385
|
+
{//reads out a single point from main_data
|
|
1386
|
+
//return as string representing a floating point number split into real and imaginary
|
|
1387
|
+
//part
|
|
1388
|
+
int i, b;
|
|
1389
|
+
for(i=po; i<=size(r); i++)
|
|
1390
|
+
{
|
|
1391
|
+
if(r[i] == newline)
|
|
1392
|
+
{
|
|
1393
|
+
b=i+1;//b is the first character in the line containing components of the point
|
|
1394
|
+
break;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
list p;
|
|
1399
|
+
string pj;
|
|
1400
|
+
int len, strt;
|
|
1401
|
+
strt=b;
|
|
1402
|
+
for(i=b; i<=endpo; i++)
|
|
1403
|
+
{
|
|
1404
|
+
if(r[i] == newline)
|
|
1405
|
+
{
|
|
1406
|
+
len=i-strt;
|
|
1407
|
+
pj=r[strt,len];
|
|
1408
|
+
p=p+list(pj);
|
|
1409
|
+
strt=i+1;
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
return(p);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
static proc string2num(string numstr)
|
|
1417
|
+
{
|
|
1418
|
+
number n=0;
|
|
1419
|
+
|
|
1420
|
+
int c=0;
|
|
1421
|
+
if(numstr[1] == "-")
|
|
1422
|
+
{
|
|
1423
|
+
numstr=numstr[2,size(numstr)-1];
|
|
1424
|
+
c=1;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
int i;
|
|
1428
|
+
for(i=size(numstr); i>=3; i--)
|
|
1429
|
+
{
|
|
1430
|
+
n=n/10+string2intdigit(numstr[i]);
|
|
1431
|
+
}
|
|
1432
|
+
n=n/10+string2intdigit(numstr[1]);
|
|
1433
|
+
|
|
1434
|
+
if(c==1)
|
|
1435
|
+
{
|
|
1436
|
+
n=-n;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
return(n);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
static proc string2e(string estr)
|
|
1443
|
+
{//compute the exponent from the scientific notation
|
|
1444
|
+
int e=0;
|
|
1445
|
+
int c=0;
|
|
1446
|
+
if(estr[1] == "-")
|
|
1447
|
+
{
|
|
1448
|
+
c=1;
|
|
1449
|
+
}
|
|
1450
|
+
else
|
|
1451
|
+
{
|
|
1452
|
+
if(estr[1] != "+")
|
|
1453
|
+
{
|
|
1454
|
+
estr="+"+estr;
|
|
1455
|
+
return(string2e(estr));
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
estr=estr[2,size(estr)-1];
|
|
1460
|
+
|
|
1461
|
+
int i;
|
|
1462
|
+
for(i=1; i<=size(estr); i++)
|
|
1463
|
+
{
|
|
1464
|
+
e=e*10+string2intdigit(estr[i]);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
if(c==1)
|
|
1468
|
+
{
|
|
1469
|
+
e=-e;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
return(e);
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
static proc dismantle_string(string si)
|
|
1476
|
+
{//cuts the string into the real/imaginary parts and their exponents
|
|
1477
|
+
//example of a string si:
|
|
1478
|
+
//1.124564280901713e+00 -2.550064206873323e-01
|
|
1479
|
+
int e1,e2;
|
|
1480
|
+
number im,re;
|
|
1481
|
+
string prt;//the currently considered part of the string
|
|
1482
|
+
int i, len;
|
|
1483
|
+
int strt=1;
|
|
1484
|
+
for(i=1; i<=size(si); i++)
|
|
1485
|
+
{
|
|
1486
|
+
if( si[i] == "e" )
|
|
1487
|
+
{
|
|
1488
|
+
len=i-strt;
|
|
1489
|
+
prt=si[strt,len];
|
|
1490
|
+
re=string2num(prt);
|
|
1491
|
+
break;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
strt=i+1;//start at the character coming after "e"
|
|
1496
|
+
for(i=strt; i<=size(si); i++)
|
|
1497
|
+
{
|
|
1498
|
+
if( si[i] == " " )
|
|
1499
|
+
{
|
|
1500
|
+
len=i-strt;
|
|
1501
|
+
prt=si[strt,len];
|
|
1502
|
+
e1=string2e(prt);
|
|
1503
|
+
break;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
strt=i+1;//start at the character coming after " "
|
|
1508
|
+
for(i=strt; i<=size(si); i++)
|
|
1509
|
+
{
|
|
1510
|
+
if( si[i] == "e" )
|
|
1511
|
+
{
|
|
1512
|
+
len=i-strt;
|
|
1513
|
+
prt=si[strt,len];
|
|
1514
|
+
im=string2num(prt);
|
|
1515
|
+
break;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
strt=i+1;//start at the character coming after "e"
|
|
1520
|
+
len=size(si)-strt+1;
|
|
1521
|
+
prt=si[strt,len];
|
|
1522
|
+
e2=string2e(prt);
|
|
1523
|
+
|
|
1524
|
+
number ten=10;
|
|
1525
|
+
if(0)//e1 < -1000
|
|
1526
|
+
{
|
|
1527
|
+
re=0;
|
|
1528
|
+
}
|
|
1529
|
+
else
|
|
1530
|
+
{
|
|
1531
|
+
re=re*(ten^e1);
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
if(0)//e2 < -1000
|
|
1535
|
+
{
|
|
1536
|
+
im=0;
|
|
1537
|
+
}
|
|
1538
|
+
else
|
|
1539
|
+
{
|
|
1540
|
+
im=im*(ten^e2);
|
|
1541
|
+
}
|
|
1542
|
+
number n=re + IUnit*im;
|
|
1543
|
+
|
|
1544
|
+
return(n);
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
static proc convert_p(list p)
|
|
1549
|
+
{//p a list of strings representing the components of the point p
|
|
1550
|
+
//converts the list of strings to a list of numbers
|
|
1551
|
+
|
|
1552
|
+
//interesting: apparently, since p is a list of strings to begin with, it is not
|
|
1553
|
+
//bound to the basering, so it will exist in the ring r, as well. But, as we change
|
|
1554
|
+
//the entries of p from type string to type number/poly, it gets bound to the ring r,
|
|
1555
|
+
//so it doesn't exist in br anymore. Hence, we have do define list p=fetch.
|
|
1556
|
+
|
|
1557
|
+
|
|
1558
|
+
//we change the ring, so that we know, what the imaginary unit is called, define the
|
|
1559
|
+
//points over that ring and then fetch them to the original ring
|
|
1560
|
+
def br=basering;
|
|
1561
|
+
list l=ringlist(br);
|
|
1562
|
+
l[1][3]="IUnit";
|
|
1563
|
+
def r=ring(l);
|
|
1564
|
+
setring r;
|
|
1565
|
+
|
|
1566
|
+
string si;
|
|
1567
|
+
number pi;
|
|
1568
|
+
int i;
|
|
1569
|
+
for(i=1; i<=size(p); i++)
|
|
1570
|
+
{
|
|
1571
|
+
pi=dismantle_string(p[i]);
|
|
1572
|
+
p[i]=pi;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
setring br;
|
|
1576
|
+
list p=fetch(r,p);
|
|
1577
|
+
|
|
1578
|
+
return(p);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
static proc getP_plus_posis(int dummy)
|
|
1583
|
+
{//goes through the file main_data generated by bertini and returns the witness points
|
|
1584
|
+
//as a list of complex numbers
|
|
1585
|
+
//(the precision specified in the definition of the basering should* be at least as
|
|
1586
|
+
//high as the precision used by/to be expected from bertini)
|
|
1587
|
+
string r;
|
|
1588
|
+
list P,p;
|
|
1589
|
+
int i, j;
|
|
1590
|
+
r=read("main_data");
|
|
1591
|
+
intvec posi=find_string("Estimated",r);
|
|
1592
|
+
intvec endpos=find_string("Multiplicity",r);
|
|
1593
|
+
for(i=1; i<=size(posi); i++)
|
|
1594
|
+
{
|
|
1595
|
+
p=read_point(r,posi[i],endpos[i]);
|
|
1596
|
+
|
|
1597
|
+
if( size(p) == 0 )
|
|
1598
|
+
{
|
|
1599
|
+
ERROR("Bertini nicht erfolgreich");
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
P=P+list( convert_p(p) );
|
|
1603
|
+
}
|
|
1604
|
+
return(posi, endpos, P);
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
static proc getPi_from_main_data(int i, intvec posi, intvec endpos)
|
|
1609
|
+
{//gets only the i-th point in main_data; is used by check_is_zero
|
|
1610
|
+
string r;
|
|
1611
|
+
list P,p;
|
|
1612
|
+
int j;
|
|
1613
|
+
r=read("main_data");
|
|
1614
|
+
p=read_point(r,posi[i],endpos[i]);
|
|
1615
|
+
|
|
1616
|
+
if( size(p) == 0 )
|
|
1617
|
+
{
|
|
1618
|
+
ERROR("Bertini nicht erfolgreich");
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
P=P+list( convert_p(p) );
|
|
1622
|
+
|
|
1623
|
+
return(P);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1627
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1628
|
+
////////////////////////////// Applications //////////////////////////////////
|
|
1629
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1630
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1631
|
+
|
|
1632
|
+
|
|
1633
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1634
|
+
////////////////// static procs to get the relations from the //////////////////////////
|
|
1635
|
+
////////////////// complex to the rational numbers //////////////////
|
|
1636
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1637
|
+
|
|
1638
|
+
static proc get_relations_as_bigintmats(list p, int D, bigint C)
|
|
1639
|
+
{//uses degree d Veronese embeddings (for all d<=D) and LLL-algorithm to find
|
|
1640
|
+
//(homogeneous) polynomial relations between the entries of p
|
|
1641
|
+
//C is the Value with which the Veronese embedding is being multiplied (cf getmatrix)
|
|
1642
|
+
|
|
1643
|
+
//returns the list of the bigintmats computed by the LLL-algorithm
|
|
1644
|
+
//these are then processed further by get_relations_over_rationals after a switch
|
|
1645
|
+
//of rings in the level above
|
|
1646
|
+
|
|
1647
|
+
if(nvars(basering) != size(p) )
|
|
1648
|
+
{
|
|
1649
|
+
ERROR("Number of variables not equal to the number of components of p.");
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
int d,len;
|
|
1653
|
+
list mats;
|
|
1654
|
+
ideal vd;
|
|
1655
|
+
matrix A;
|
|
1656
|
+
bigintmat B;
|
|
1657
|
+
for(d=1; d<=D; d++)
|
|
1658
|
+
{
|
|
1659
|
+
vd=veronese(d,p);
|
|
1660
|
+
len=size(maxideal(d));
|
|
1661
|
+
A=getmatrix(vd,C,len);
|
|
1662
|
+
//B=use_FLINT_LLL(A);
|
|
1663
|
+
B=use_NTL_LLL(A);
|
|
1664
|
+
//B=use_LLL_bigintmat(A);
|
|
1665
|
+
|
|
1666
|
+
mats=mats+list(B);
|
|
1667
|
+
}
|
|
1668
|
+
return(mats);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
static proc get_relations_radical_as_bigintmats(list P, int D, bigint C)
|
|
1672
|
+
{//is to get_relations_as_bigintmats what get_relationsRadical is to get_relations
|
|
1673
|
+
//ie uses a random linear combination of the Veronese embeddings of all points in P
|
|
1674
|
+
//in order to get polynomials which vanish over all points simultaneously
|
|
1675
|
+
|
|
1676
|
+
int d,len;
|
|
1677
|
+
list mats;
|
|
1678
|
+
ideal vd;
|
|
1679
|
+
matrix A;
|
|
1680
|
+
bigintmat B;
|
|
1681
|
+
for(d=1; d<=D; d++)
|
|
1682
|
+
{
|
|
1683
|
+
vd=veronese_radical(d,P);
|
|
1684
|
+
len=size(maxideal(d));
|
|
1685
|
+
A=getmatrix(vd,C,len);
|
|
1686
|
+
//B=use_FLINT_LLL(A);
|
|
1687
|
+
B=mat2bigintmat(A);
|
|
1688
|
+
//B=use_NTL_LLL(A);
|
|
1689
|
+
//B=use_LLL_bigintmat(A);
|
|
1690
|
+
|
|
1691
|
+
mats=mats+list(B);
|
|
1692
|
+
}
|
|
1693
|
+
return(mats);
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
static proc check_is_zero(int Prec, ideal Kd, intvec posi, intvec endpos, int k)
|
|
1697
|
+
{
|
|
1698
|
+
def br=basering;
|
|
1699
|
+
int n=nvars(basering);
|
|
1700
|
+
ring R=(complex,Prec,IUnit),x(1..n),dp;
|
|
1701
|
+
ideal I=fetch(br,Kd);
|
|
1702
|
+
list P=getPi_from_main_data(k, posi, endpos);
|
|
1703
|
+
list p;
|
|
1704
|
+
poly v;
|
|
1705
|
+
number eps=number(10)**(5-Prec);
|
|
1706
|
+
number a;
|
|
1707
|
+
int i,j,c;
|
|
1708
|
+
int len = size(I);
|
|
1709
|
+
intvec rm;
|
|
1710
|
+
rm[len]=0;
|
|
1711
|
+
for(i=1; i<=len; i++)
|
|
1712
|
+
{
|
|
1713
|
+
for(j=1;j<=size(P); j++)
|
|
1714
|
+
{
|
|
1715
|
+
p=P[j];
|
|
1716
|
+
v=substAll(I[i],p);
|
|
1717
|
+
a=number(v);
|
|
1718
|
+
a=absValue(repart(a))+absValue(impart(a));
|
|
1719
|
+
//v=v*( poly(10)**(Prec-10) );
|
|
1720
|
+
if( a > eps)
|
|
1721
|
+
{
|
|
1722
|
+
rm[i] = 1;
|
|
1723
|
+
break;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
return(rm);
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
static proc get_relations_over_rationals(int D, int Prec, list mats, intvec posi,
|
|
1732
|
+
intvec endpos, int k)
|
|
1733
|
+
{//finds the relations by passing the bigintmats to getpolys
|
|
1734
|
+
//returns a list of ideals containing the corresponding polynomials
|
|
1735
|
+
bigintmat B;
|
|
1736
|
+
int d;
|
|
1737
|
+
list K;
|
|
1738
|
+
ideal Kd;
|
|
1739
|
+
intvec rm;
|
|
1740
|
+
int i;
|
|
1741
|
+
|
|
1742
|
+
for(d=1; d<=D; d++)
|
|
1743
|
+
{
|
|
1744
|
+
B=mats[d];
|
|
1745
|
+
Kd=getpolys(bigintmat2matrix(B),d);
|
|
1746
|
+
if(size(Kd) != 0)
|
|
1747
|
+
{
|
|
1748
|
+
rm=check_is_zero(Prec,Kd,posi,endpos,k);
|
|
1749
|
+
|
|
1750
|
+
for(i=1; i<=size(rm); i++)
|
|
1751
|
+
{
|
|
1752
|
+
if( rm[i] == 1 )
|
|
1753
|
+
{
|
|
1754
|
+
Kd[i] = 0;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
Kd=simplify(Kd,2);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
if(size(Kd) == 0)//i.e. Kd has only zero-entries
|
|
1761
|
+
{//then dont add Kd to the list of relations
|
|
1762
|
+
d++;
|
|
1763
|
+
continue;
|
|
1764
|
+
}
|
|
1765
|
+
K=K+list(Kd);
|
|
1766
|
+
}
|
|
1767
|
+
return(K);
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
static proc getP_from_known_posis(intvec posi, intvec endpos)
|
|
1772
|
+
{//goes through the file main_data generated by bertini and returns the witness points
|
|
1773
|
+
//as a list of complex numbers
|
|
1774
|
+
//(the precision specified in the definition of the basering should* be at least as
|
|
1775
|
+
//high as the precision used by/to be expected from bertini)
|
|
1776
|
+
string r;
|
|
1777
|
+
list P,p;
|
|
1778
|
+
int i, j;
|
|
1779
|
+
r=read("main_data");
|
|
1780
|
+
for(i=1; i<=size(posi); i++)
|
|
1781
|
+
{
|
|
1782
|
+
p=read_point(r,posi[i],endpos[i]);
|
|
1783
|
+
|
|
1784
|
+
if( size(p) == 0 )
|
|
1785
|
+
{
|
|
1786
|
+
ERROR("Bertini nicht erfolgreich");
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
P=P+list( convert_p(p) );
|
|
1790
|
+
}
|
|
1791
|
+
return(P);
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
static proc check_is_zero_lincomradical(int Prec, ideal I, list P)
|
|
1795
|
+
{
|
|
1796
|
+
//altered ckeck_is_zero for the linear-combination-of-Veronese-embeddings version
|
|
1797
|
+
//of the procedures
|
|
1798
|
+
list p;
|
|
1799
|
+
poly v;
|
|
1800
|
+
number eps=number(10)**(5-Prec);
|
|
1801
|
+
number a;
|
|
1802
|
+
int i,j,c;
|
|
1803
|
+
int len = size(I);
|
|
1804
|
+
intvec rm;
|
|
1805
|
+
rm[len]=0;
|
|
1806
|
+
for(i=1; i<=len; i++)
|
|
1807
|
+
{
|
|
1808
|
+
for(j=1;j<=size(P); j++)
|
|
1809
|
+
{
|
|
1810
|
+
p=P[j];
|
|
1811
|
+
v=substAll(I[i],p);
|
|
1812
|
+
a=number(v);
|
|
1813
|
+
a=absValue(repart(a))+absValue(impart(a));
|
|
1814
|
+
//v=v*( poly(10)**(Prec-10) );
|
|
1815
|
+
if( a > eps)
|
|
1816
|
+
{
|
|
1817
|
+
rm[i] = 1;
|
|
1818
|
+
break;
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
return(rm);
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
|
|
1826
|
+
static proc get_relations_lincomradical_over_rationals(int D, int Prec, list mats,
|
|
1827
|
+
intvec posi, intvec endpos)
|
|
1828
|
+
{//finds the relations by passing the bigintmats to getpolys
|
|
1829
|
+
//returns a list of ideals containing the corresponding polynomials
|
|
1830
|
+
bigintmat B;
|
|
1831
|
+
int d;
|
|
1832
|
+
list K;
|
|
1833
|
+
ideal Kd;
|
|
1834
|
+
intvec rm;
|
|
1835
|
+
int i;
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
//set up the ring to check whether the supposed relations have value zero at
|
|
1839
|
+
//all the witness points
|
|
1840
|
+
def br=basering;
|
|
1841
|
+
int n=nvars(br);
|
|
1842
|
+
ring cr=(complex,Prec,IUnit),x(1..n),dp;
|
|
1843
|
+
list P=getP_from_known_posis(posi, endpos);
|
|
1844
|
+
ideal I;
|
|
1845
|
+
int le;
|
|
1846
|
+
|
|
1847
|
+
setring br;
|
|
1848
|
+
for(d=1; d<=D; d++)
|
|
1849
|
+
{
|
|
1850
|
+
B=mats[d];
|
|
1851
|
+
Kd=getpolys(bigintmat2matrix(B),d);
|
|
1852
|
+
|
|
1853
|
+
//go to the complex ring to see which candidate relations should be removed
|
|
1854
|
+
setring cr;
|
|
1855
|
+
I=fetch(br,Kd);
|
|
1856
|
+
le=size(I);
|
|
1857
|
+
if(le != 0)
|
|
1858
|
+
{
|
|
1859
|
+
rm=check_is_zero_lincomradical(Prec,I,P);
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
//remove from the ideal over the rational numbers
|
|
1863
|
+
setring br;
|
|
1864
|
+
|
|
1865
|
+
if(le != 0)
|
|
1866
|
+
{
|
|
1867
|
+
for(i=1; i<=size(rm); i++)
|
|
1868
|
+
{
|
|
1869
|
+
if( rm[i] == 1 )
|
|
1870
|
+
{
|
|
1871
|
+
Kd[i] = 0;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
Kd=simplify(Kd,2);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
if(size(Kd) == 0)//i.e. Kd has only zero-entries
|
|
1878
|
+
{//then dont add Kd to the list of relations
|
|
1879
|
+
d++;
|
|
1880
|
+
continue;
|
|
1881
|
+
}
|
|
1882
|
+
K=K+list(Kd);
|
|
1883
|
+
}
|
|
1884
|
+
return(K);
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1888
|
+
////////////////////////////// num_prime_decom /////////////////////////////////
|
|
1889
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
1890
|
+
|
|
1891
|
+
proc num_prime_decom(ideal I, int D, int Prec)
|
|
1892
|
+
"USAGE: num_prime_decom(I,D); ideal I, int D
|
|
1893
|
+
D a bound to the degree of the elements of the components of a prime
|
|
1894
|
+
decomposition of I.
|
|
1895
|
+
RETURN: list of ideals: each of the ideals a prime component of the radical of I
|
|
1896
|
+
REMARKS: Uses Bertini.
|
|
1897
|
+
NOTE: Should only be called from a ring over the rational numbers.
|
|
1898
|
+
EXAMPLE: example num_prime_decom; shows an example
|
|
1899
|
+
"
|
|
1900
|
+
{//App. 3.1: computes a prime decomposition of the radical of I
|
|
1901
|
+
//returns a list of ideals, each of them a prime component
|
|
1902
|
+
def br=basering;
|
|
1903
|
+
int n=nvars(br);
|
|
1904
|
+
list K;//will contain the relations over the basering
|
|
1905
|
+
list Q;//will contain the components
|
|
1906
|
+
ideal M;
|
|
1907
|
+
|
|
1908
|
+
writeBertiniInput(I,Prec);
|
|
1909
|
+
|
|
1910
|
+
//move to a ring over the complex numbers to get the points computed by bertini
|
|
1911
|
+
ring Ri=(complex,Prec,IUnit),x(1..n),dp;
|
|
1912
|
+
system("sh","bertini input");
|
|
1913
|
+
list P;
|
|
1914
|
+
intvec posi, endpos;
|
|
1915
|
+
(posi, endpos, P)=getP_plus_posis(1);
|
|
1916
|
+
int sP=size(P);
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
bigint C=bigint(10)**Prec;//digits of precision
|
|
1920
|
+
list p, mats;
|
|
1921
|
+
int i,j;
|
|
1922
|
+
/* div by 0 in LLL
|
|
1923
|
+
for(i=1; i<=sP; i++)
|
|
1924
|
+
{
|
|
1925
|
+
setring Ri;
|
|
1926
|
+
|
|
1927
|
+
//compute the relations (with LLL, NTL_LLL or FLINT_LLL) in the form of bigintmats
|
|
1928
|
+
p=P[i];
|
|
1929
|
+
mats=get_relations_as_bigintmats(p,D,C);
|
|
1930
|
+
|
|
1931
|
+
|
|
1932
|
+
//move to br again to obtain the relation-polynomials over the rational numbers
|
|
1933
|
+
setring br;
|
|
1934
|
+
K=get_relations_over_rationals(D, Prec, mats, posi, endpos, i);
|
|
1935
|
+
|
|
1936
|
+
if(size(K) == 0)//ie K the empty list
|
|
1937
|
+
{
|
|
1938
|
+
i++;
|
|
1939
|
+
continue;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
K=minrelations(K);
|
|
1943
|
+
//K is now the list of ideals containing min gens in the respective degrees
|
|
1944
|
+
//now, we put these min gens in one ideal
|
|
1945
|
+
M=K[1];
|
|
1946
|
+
for(j=2; j<=size(K); j++)
|
|
1947
|
+
{
|
|
1948
|
+
M=M+K[j];
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
Q=Q+list(M);
|
|
1952
|
+
}
|
|
1953
|
+
*/
|
|
1954
|
+
return(Q);
|
|
1955
|
+
}
|
|
1956
|
+
example
|
|
1957
|
+
{ "EXAMPLE:"; echo=2;
|
|
1958
|
+
ring R=0,(x,y,z),dp;
|
|
1959
|
+
ideal I=(x+y)*(y+2z), (x+y)*(x-3z);
|
|
1960
|
+
int D=2;
|
|
1961
|
+
int Prec=300;
|
|
1962
|
+
num_prime_decom(I,D,Prec);
|
|
1963
|
+
|
|
1964
|
+
//Let us compare that to the result of primdecSY:
|
|
1965
|
+
primdecSY(I);
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
proc num_prime_decom1(list P, int D, bigint C)
|
|
1969
|
+
"USAGE: num_prime_decom1(P,D,C); list P, int D, bigint C
|
|
1970
|
+
P a list of lists representing a witness point set representing an ideal I
|
|
1971
|
+
D should be a bound to the degree of the elements of the components of the
|
|
1972
|
+
prime decomposition of I
|
|
1973
|
+
C the number with which the images of the Veronese embeddings are multiplied
|
|
1974
|
+
RETURN: list of ideals: each of the ideals a prime component of the radical of I
|
|
1975
|
+
NOTE: Should only be called from a ring over the complex numbers.
|
|
1976
|
+
EXAMPLE: example num_prime_decom1; shows an example
|
|
1977
|
+
"
|
|
1978
|
+
{//P a list of lists containing the witness points
|
|
1979
|
+
//returns (or is supposed to return) a list containing the prime components
|
|
1980
|
+
//of the radical of the ideal which is represented by the witness points in P
|
|
1981
|
+
list p,K,Q;
|
|
1982
|
+
int i,j;
|
|
1983
|
+
ideal M;
|
|
1984
|
+
for(i=1; i<=size(P); i++)
|
|
1985
|
+
{
|
|
1986
|
+
p=P[i];
|
|
1987
|
+
K=getRelations(p,D,C);
|
|
1988
|
+
|
|
1989
|
+
if(size(K) == 0)//ie K the empty list
|
|
1990
|
+
{
|
|
1991
|
+
i++;
|
|
1992
|
+
continue;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
K=minrelations(K);
|
|
1996
|
+
//K is now the list of ideals containing min gens in the respective degrees
|
|
1997
|
+
//now, we put these min gens in one ideal
|
|
1998
|
+
M=K[1];
|
|
1999
|
+
for(j=2; j<=size(K); j++)
|
|
2000
|
+
{
|
|
2001
|
+
M=M+K[j];
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
Q=Q+list(M);
|
|
2005
|
+
}
|
|
2006
|
+
return(Q);
|
|
2007
|
+
}
|
|
2008
|
+
example
|
|
2009
|
+
{ "EXAMPLE:"; echo=2;
|
|
2010
|
+
//First, we compute a prime decomposition of the ideal I=x+y;
|
|
2011
|
+
ring R1=(complex,300,IUnit),(x,y),dp;
|
|
2012
|
+
list p1=1,-1;
|
|
2013
|
+
list P=list(p1);
|
|
2014
|
+
int D=2;
|
|
2015
|
+
bigint C=bigint(10)**300;
|
|
2016
|
+
num_prime_decom1(P,D,C);
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
//Now, we try to obtain a prime decomposition of the ideal I=(x+y)*(y+2z), (x+y)*(x-3z);
|
|
2020
|
+
ring R2=(complex,20,IUnit),(x,y,z),dp;
|
|
2021
|
+
p1=1.7381623928,-1.7381623928,0.2819238763;
|
|
2022
|
+
list p2=-3.578512854,2.385675236,-1.192837618;
|
|
2023
|
+
P=p1,p2;
|
|
2024
|
+
num_prime_decom1(P,D,10000);
|
|
2025
|
+
|
|
2026
|
+
//Now, we look at the result of a purely symbolic algorithm
|
|
2027
|
+
ring r2=0,(x,y,z),dp;
|
|
2028
|
+
ideal I=(x+y)*(y+2z), (x+y)*(x-3z);
|
|
2029
|
+
primdecSY(I);
|
|
2030
|
+
|
|
2031
|
+
//If you compare the results, you may find that they don't match.
|
|
2032
|
+
//Most likely, the hybrid algorithm got the second component wrong. This is due to the
|
|
2033
|
+
//way the algorithm looks for homogeneous polynomial relations, and the specific version
|
|
2034
|
+
//of the LLL algorithm used here (an implementation into Singular of a rather simple
|
|
2035
|
+
//version which allows real input). It looks in degree 1, finds one relation and is
|
|
2036
|
+
//thereafter unable to see a second one. Then it moves on to degree 2 and finds
|
|
2037
|
+
//relations containing degree-1 relations as a factor.
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
2042
|
+
//////////////////////////////// num_radical ///////////////////////////////////
|
|
2043
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
2044
|
+
|
|
2045
|
+
|
|
2046
|
+
proc num_radical_via_decom(ideal I, int D, int Prec)
|
|
2047
|
+
"USAGE: num_radical_via_decom(I,D); ideal I, int D
|
|
2048
|
+
D a bound to the degree of the elements of the components.
|
|
2049
|
+
RETURN: ideal: the radical of I
|
|
2050
|
+
REMARKS: Uses Bertini.
|
|
2051
|
+
This procedure merely calls num_prime_decom with the same input and then
|
|
2052
|
+
intersects the returned components.
|
|
2053
|
+
NOTE: Should only be called from a ring over the rational numbers.
|
|
2054
|
+
SEE ALSO: num_prime_decom, num_radical_via_randlincom
|
|
2055
|
+
EXAMPLE: example num_radical_via_decom; shows an example
|
|
2056
|
+
"
|
|
2057
|
+
{//check p.14/15, App. 3.2
|
|
2058
|
+
list Q=num_prime_decom(I,D,Prec);
|
|
2059
|
+
ideal interQ=1;
|
|
2060
|
+
int i;
|
|
2061
|
+
for(i=1; i<=size(Q); i++)
|
|
2062
|
+
{
|
|
2063
|
+
interQ=intersect(interQ,Q[i]);
|
|
2064
|
+
}
|
|
2065
|
+
return(interQ);
|
|
2066
|
+
}
|
|
2067
|
+
example
|
|
2068
|
+
{ "EXAMPLE:"; echo=2;
|
|
2069
|
+
//First, we attempt to compute the radical via the hybrid algorithm.
|
|
2070
|
+
ring R=0,(x,y,z),dp;
|
|
2071
|
+
ideal I=(x+y)^2*(y+2z)^3, (x+y)^3*(x-3z)^2;
|
|
2072
|
+
int D=2;
|
|
2073
|
+
int Prec=300;
|
|
2074
|
+
ideal numRad=num_radical_via_decom(I,D,Prec);
|
|
2075
|
+
numRad;
|
|
2076
|
+
|
|
2077
|
+
//Then we compute the radical symbolically and compare the results.
|
|
2078
|
+
ideal Rad=radical(I);
|
|
2079
|
+
Rad;
|
|
2080
|
+
|
|
2081
|
+
reduce(Rad,std(numRad));
|
|
2082
|
+
|
|
2083
|
+
reduce(numRad,std(Rad));
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
proc num_radical_via_randlincom(ideal I, int D, int Prec)
|
|
2087
|
+
"USAGE: num_radical_via_randlincom(I,D); ideal I, int D
|
|
2088
|
+
D a bound to the degree of the elements of the components.
|
|
2089
|
+
RETURN: ideal: the radical of I
|
|
2090
|
+
REMARKS: Uses Bertini.
|
|
2091
|
+
Instead of using the images of the Veronese embeddings of each individual witness
|
|
2092
|
+
point, this procedure first computes a random linear combination of those images
|
|
2093
|
+
and searches for homogeneous polynomial relations for this linear combination.
|
|
2094
|
+
NOTE: Should only be called from a ring over the rational numbers.
|
|
2095
|
+
SEE ALSO: num_radical_via_decom
|
|
2096
|
+
EXAMPLE: example num_radical_via_randlincom; shows an example
|
|
2097
|
+
"
|
|
2098
|
+
{//check p.14/15, App. 3.2
|
|
2099
|
+
|
|
2100
|
+
bigint C=bigint(10)**Prec;//digits of precision
|
|
2101
|
+
def br=basering;
|
|
2102
|
+
int n=nvars(br);
|
|
2103
|
+
|
|
2104
|
+
writeBertiniInput(I,Prec);
|
|
2105
|
+
|
|
2106
|
+
//move to a ring over the complex numbers to get the points computed by bertini
|
|
2107
|
+
ring Ri=(complex,Prec,IUnit),x(1..n),dp;
|
|
2108
|
+
system("sh","bertini input");
|
|
2109
|
+
list P;
|
|
2110
|
+
intvec posi, endpos;
|
|
2111
|
+
(posi, endpos, P)=getP_plus_posis(1);
|
|
2112
|
+
list mats=get_relations_radical_as_bigintmats(P,D,C);
|
|
2113
|
+
|
|
2114
|
+
setring br;
|
|
2115
|
+
/* div by 0 in LLL
|
|
2116
|
+
list K=get_relations_lincomradical_over_rationals(D,Prec,mats,posi,endpos);
|
|
2117
|
+
*/ list K;
|
|
2118
|
+
|
|
2119
|
+
ideal Q;
|
|
2120
|
+
|
|
2121
|
+
if(size(K) > 0)
|
|
2122
|
+
{
|
|
2123
|
+
K=minrelations(K);
|
|
2124
|
+
Q=K[1];
|
|
2125
|
+
int i;
|
|
2126
|
+
for(i=2; i<=size(K); i++)
|
|
2127
|
+
{
|
|
2128
|
+
Q=Q,K[i];
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
return(Q);
|
|
2133
|
+
}
|
|
2134
|
+
example
|
|
2135
|
+
{ "EXAMPLE:"; echo=2;
|
|
2136
|
+
//First, we attempt to compute the radical via the hybrid algorithm.
|
|
2137
|
+
ring R=0,(x,y,z),dp;
|
|
2138
|
+
ideal I=(x+y)^2*(y+2z)^3, (x+y)^3*(x-3z)^2;
|
|
2139
|
+
int D=2;
|
|
2140
|
+
int Prec=300;
|
|
2141
|
+
ideal numRad=num_radical_via_randlincom(I,D,Prec);
|
|
2142
|
+
numRad;
|
|
2143
|
+
|
|
2144
|
+
//Then we compute the radical symbolically and compare the results.
|
|
2145
|
+
ideal Rad=radical(I);
|
|
2146
|
+
Rad;
|
|
2147
|
+
|
|
2148
|
+
reduce(Rad,std(numRad));
|
|
2149
|
+
|
|
2150
|
+
reduce(numRad,std(Rad));
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
proc num_radical1(list P, int D, bigint C)
|
|
2154
|
+
"USAGE: num_radical1(P,D,C); list P, int D, bigint C
|
|
2155
|
+
P a list of lists representing a witness point set representing an ideal I
|
|
2156
|
+
D should be a bound to the degree of the elements of the components
|
|
2157
|
+
C the number with which the images of the Veronese embeddings are multiplied
|
|
2158
|
+
RETURN: list of ideals: each of the ideals a prime component of the radical of I
|
|
2159
|
+
REMARKS: This procedure merely calls num_prime_decom1 with the same input and then
|
|
2160
|
+
intersects the returned components.
|
|
2161
|
+
NOTE: Should only be called from a ring over the complex numbers.
|
|
2162
|
+
SEE ALSO: num_prime_decom1, num_radical2
|
|
2163
|
+
EXAMPLE: example num_radical1; shows an example
|
|
2164
|
+
"
|
|
2165
|
+
{//computes the radical via num_prime_decom (intersecting the obtained prime decom)
|
|
2166
|
+
list Q=num_prime_decom1(P,D,C);
|
|
2167
|
+
ideal interQ=1;
|
|
2168
|
+
int i;
|
|
2169
|
+
for(i=1; i<=size(Q); i++)
|
|
2170
|
+
{
|
|
2171
|
+
interQ=intersect(interQ,Q[i]);
|
|
2172
|
+
}
|
|
2173
|
+
return(interQ);
|
|
2174
|
+
}
|
|
2175
|
+
example
|
|
2176
|
+
{ "EXAMPLE:"; echo=2;
|
|
2177
|
+
//First, we write the input file for bertini and compute the radical symbolically.
|
|
2178
|
+
ring r=0,(x,y,z),dp;
|
|
2179
|
+
ideal I=4xy2-4z3,-2x2y+5xz2;
|
|
2180
|
+
ideal Rad=radical(I);
|
|
2181
|
+
writeBertiniInput(I,100);
|
|
2182
|
+
|
|
2183
|
+
//Then we attempt to compute the radical via the hybrid algorithm.
|
|
2184
|
+
ring R=(complex,100,i),(x,y,z),dp;
|
|
2185
|
+
system("sh","bertini input");
|
|
2186
|
+
list P=getWitnessSet();
|
|
2187
|
+
int D=2;
|
|
2188
|
+
bigint C=bigint(10)**30;
|
|
2189
|
+
ideal Rad1=num_radical1(P,D,C);
|
|
2190
|
+
|
|
2191
|
+
//Lastly, we compare the results.
|
|
2192
|
+
Rad1;
|
|
2193
|
+
|
|
2194
|
+
ideal Rad=fetch(r,Rad);
|
|
2195
|
+
Rad;
|
|
2196
|
+
|
|
2197
|
+
reduce(Rad,std(Rad1));
|
|
2198
|
+
|
|
2199
|
+
reduce(Rad1,std(Rad));
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
proc num_radical2(list P, int D, bigint C)
|
|
2203
|
+
"USAGE: num_radical2(P,D,C); list P, int D, bigint C
|
|
2204
|
+
P a list of lists representing a witness point set representing an ideal I
|
|
2205
|
+
D should be a bound to the degree of the elements of the components
|
|
2206
|
+
C the number with which the images of the Veronese embeddings are multiplied
|
|
2207
|
+
RETURN: list of ideals: each of the ideals a prime component of the radical of I
|
|
2208
|
+
REMARKS: Instead of using the images of the Veronese embeddings of each individual witness
|
|
2209
|
+
point, this procedure first computes a random linear combination of those images
|
|
2210
|
+
and searches for homogeneous polynomial relations for this linear combination.
|
|
2211
|
+
NOTE: Should only be called from a ring over the complex numbers.
|
|
2212
|
+
SEE ALSO: num_radical1
|
|
2213
|
+
EXAMPLE: example num_radical2; shows an example
|
|
2214
|
+
"
|
|
2215
|
+
{//computes the radical via getRelationsRadical
|
|
2216
|
+
list K=getRelationsRadical(P,D,C);
|
|
2217
|
+
K=minrelations(K);
|
|
2218
|
+
K;
|
|
2219
|
+
//unite the elements of K into one ideal
|
|
2220
|
+
ideal Q=K[1];
|
|
2221
|
+
int i;
|
|
2222
|
+
for(i=2; i<=size(K); i++)
|
|
2223
|
+
{
|
|
2224
|
+
Q=Q,K[i];
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
return(Q);
|
|
2228
|
+
}
|
|
2229
|
+
example
|
|
2230
|
+
{ "EXAMPLE:"; echo=2;
|
|
2231
|
+
//First, we write the input file for bertini and compute the radical symbolically.
|
|
2232
|
+
ring r=0,(x,y,z),dp;
|
|
2233
|
+
ideal I=4xy2-4z3,-2x2y+5xz2;
|
|
2234
|
+
ideal Rad=radical(I);
|
|
2235
|
+
writeBertiniInput(I,100);
|
|
2236
|
+
|
|
2237
|
+
//Then we attempt to compute the radical via the hybrid algorithm.
|
|
2238
|
+
ring R=(complex,100,i),(x,y,z),dp;
|
|
2239
|
+
system("sh","bertini input");
|
|
2240
|
+
list P=getWitnessSet();
|
|
2241
|
+
int D=2;
|
|
2242
|
+
bigint C=bigint(10)**30;
|
|
2243
|
+
ideal Rad2=num_radical2(P,D,C);
|
|
2244
|
+
|
|
2245
|
+
//Lastly, we compare the results.
|
|
2246
|
+
Rad2;
|
|
2247
|
+
|
|
2248
|
+
ideal Rad=fetch(r,Rad);
|
|
2249
|
+
Rad;
|
|
2250
|
+
|
|
2251
|
+
reduce(Rad,std(Rad2));
|
|
2252
|
+
|
|
2253
|
+
reduce(Rad2,std(Rad));
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
2257
|
+
///////////////////////////////// num_elim /////////////////////////////////////
|
|
2258
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
2259
|
+
|
|
2260
|
+
static proc project_p(list p, intvec projvec)
|
|
2261
|
+
{//projects a single point p onto the components specified in projvec
|
|
2262
|
+
list pr;//the projection
|
|
2263
|
+
int i,k;
|
|
2264
|
+
for(i=1; i<=size(projvec); i++)
|
|
2265
|
+
{
|
|
2266
|
+
k=projvec[i];
|
|
2267
|
+
pr=pr+list(p[k]);
|
|
2268
|
+
}
|
|
2269
|
+
return(pr);
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
static proc project_P(list P, intvec projvec)
|
|
2273
|
+
{//projects the points in P onto the components specified in projvec
|
|
2274
|
+
list p;//elements of P
|
|
2275
|
+
list Pr;//the list of projections
|
|
2276
|
+
list pr;//projection of a point p
|
|
2277
|
+
|
|
2278
|
+
int i;
|
|
2279
|
+
for(i=1; i<=size(P); i++)
|
|
2280
|
+
{
|
|
2281
|
+
p=P[i];
|
|
2282
|
+
pr=project_p(p,projvec);
|
|
2283
|
+
Pr=Pr+list(pr);
|
|
2284
|
+
}
|
|
2285
|
+
return(Pr);
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
static proc get_projection_intvec(intvec elvec)
|
|
2289
|
+
{//computes the intvec containing the indices of the variables which are not to be
|
|
2290
|
+
//eliminated
|
|
2291
|
+
int nv=nvars(basering);
|
|
2292
|
+
intvec projvec;
|
|
2293
|
+
int i,j,c,count;//count counts the elements of projvec
|
|
2294
|
+
for(i=1; i<=nv; i++)
|
|
2295
|
+
{
|
|
2296
|
+
c=1;
|
|
2297
|
+
for(j=1; j<=size(elvec); j++)
|
|
2298
|
+
{
|
|
2299
|
+
if(i == elvec[j])
|
|
2300
|
+
{
|
|
2301
|
+
c=0;
|
|
2302
|
+
break;
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
//if i is not among the elements of elvec, store it in projvec
|
|
2307
|
+
if(c == 1)
|
|
2308
|
+
{
|
|
2309
|
+
count++;
|
|
2310
|
+
projvec[count]=i;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
return(projvec);
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
static proc get_elvec(poly f)
|
|
2317
|
+
{//computes the elimination intvec from a product of ring variables
|
|
2318
|
+
if(size(f) != 1)
|
|
2319
|
+
{
|
|
2320
|
+
ERROR("f must be a product of ringvariables, i.e. a monomial.");
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
int n=nvars(basering);
|
|
2324
|
+
intvec elvec;
|
|
2325
|
+
int i, c;
|
|
2326
|
+
for(i=1; i<=n; i++)
|
|
2327
|
+
{
|
|
2328
|
+
if( f/var(i) != 0)
|
|
2329
|
+
{
|
|
2330
|
+
c++;
|
|
2331
|
+
elvec[c]=i;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
return(elvec);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
proc num_elim(ideal I, poly f, int D, int Prec)
|
|
2338
|
+
"USAGE: num_elim(I,f,D); ideal I, poly f, int D
|
|
2339
|
+
f the product of the ring variables you want to eliminate
|
|
2340
|
+
D a bound to the degree of the elements of the components
|
|
2341
|
+
RETURN: ideal: the ideal obtained from I by eliminating the variables specified in f
|
|
2342
|
+
REMARKS: This procedure uses Bertini to compute a set of witness points for I, projects
|
|
2343
|
+
them onto the components corresponding to the variables specified in f and then
|
|
2344
|
+
proceeds as num_radical_via_randlincom.
|
|
2345
|
+
NOTE: Should only be called from a ring over the rational numbers.
|
|
2346
|
+
EXAMPLE: example num_elim; shows an example
|
|
2347
|
+
"
|
|
2348
|
+
{//App. 3.3
|
|
2349
|
+
bigint C=bigint(10)**Prec;//digits of precision
|
|
2350
|
+
|
|
2351
|
+
//first, get elvec and projvec
|
|
2352
|
+
intvec elvec=get_elvec(f);
|
|
2353
|
+
intvec projvec=get_projection_intvec(elvec);
|
|
2354
|
+
writeBertiniInput(I,Prec);
|
|
2355
|
+
|
|
2356
|
+
//define the ring with eliminated variables
|
|
2357
|
+
//we have to compute the relations over this ring, since the number of variables
|
|
2358
|
+
//must be the same as the number of components of the projected point
|
|
2359
|
+
def br=basering;
|
|
2360
|
+
list l=ringlist(br);
|
|
2361
|
+
|
|
2362
|
+
int i;
|
|
2363
|
+
for(i=size(elvec); i>=1; i--)
|
|
2364
|
+
{
|
|
2365
|
+
l[2]=delete(l[2],elvec[i]);
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
def brel=ring(l);
|
|
2369
|
+
int n=nvars(brel);
|
|
2370
|
+
|
|
2371
|
+
//move to a ring over the complex numbers to get the points computed by bertini
|
|
2372
|
+
ring Ri=(complex,Prec,IUnit),x(1..n),dp;
|
|
2373
|
+
system("sh","bertini input");
|
|
2374
|
+
list P;
|
|
2375
|
+
intvec posi, endpos;
|
|
2376
|
+
(posi, endpos, P)=getP_plus_posis(1);
|
|
2377
|
+
list Pr=project_P(P,projvec);
|
|
2378
|
+
list mats=get_relations_radical_as_bigintmats(Pr,D,C);
|
|
2379
|
+
|
|
2380
|
+
setring brel;
|
|
2381
|
+
list K=get_relations_lincomradical_over_rationals(D,Prec,mats,posi,endpos);
|
|
2382
|
+
|
|
2383
|
+
ideal R;
|
|
2384
|
+
if(size(K) > 0)
|
|
2385
|
+
{
|
|
2386
|
+
K=minrelations(K);
|
|
2387
|
+
R=K[1];
|
|
2388
|
+
for(i=2; i<=size(K); i++)
|
|
2389
|
+
{
|
|
2390
|
+
R=R,K[i];
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
setring br;
|
|
2395
|
+
ideal R=imap(brel,R);
|
|
2396
|
+
|
|
2397
|
+
return(R);
|
|
2398
|
+
}
|
|
2399
|
+
example
|
|
2400
|
+
{ "EXAMPLE:"; echo=2;
|
|
2401
|
+
ring r=0,(x,y,z),dp;
|
|
2402
|
+
poly f1=x-y;
|
|
2403
|
+
poly f2=z*(x+3y);
|
|
2404
|
+
poly f3=z*(x2+y2);
|
|
2405
|
+
ideal I=f1,f2,f3;
|
|
2406
|
+
|
|
2407
|
+
//First, we attempt to compute the elimination ideal with the hybrid algorithm.
|
|
2408
|
+
ideal E1=num_elim(I,z,3,200);
|
|
2409
|
+
|
|
2410
|
+
//Now, we compute the elimination ideal symbolically.
|
|
2411
|
+
ideal E2=elim(I,z);
|
|
2412
|
+
|
|
2413
|
+
//Lastly, we compare the results.
|
|
2414
|
+
E1;
|
|
2415
|
+
E2;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
proc num_elim1(list P, int D, bigint C, intvec elvec)
|
|
2419
|
+
"USAGE: num_elim1(P,D,C,v); list P, int D, bigint C, intvec v
|
|
2420
|
+
P a list of lists representing a witness point set representing an ideal J
|
|
2421
|
+
D should be a bound to the degree of the elements of the components
|
|
2422
|
+
C the number with which the images of the Veronese embeddings are multiplied
|
|
2423
|
+
v an intvec specifying the numbers/positions of the variables to be eliminated
|
|
2424
|
+
RETURN: ideal: the ideal obtained from J by eliminating the variables specified in v
|
|
2425
|
+
REMARKS: This procedure just canonically projects the witness points onto the components
|
|
2426
|
+
specified in the intvec v and then applies num_radical1 to the resulting points.
|
|
2427
|
+
NOTE: Should only be called from a ring over the complex numbers.
|
|
2428
|
+
EXAMPLE: example num_elim1; shows an example
|
|
2429
|
+
"
|
|
2430
|
+
{//let J be the ideal represented by the witness points in P
|
|
2431
|
+
//returns (or is supposed to return) the prime decomposition of the radical of the
|
|
2432
|
+
//elimination ideal of J
|
|
2433
|
+
//(where we eliminate the variables with the indices specified in elvec)
|
|
2434
|
+
|
|
2435
|
+
//Note that, since we are in a homogeneous setting eliminating all variables
|
|
2436
|
+
//is quite simple, since we only have to decide, whether its the 0-ideal or the
|
|
2437
|
+
//whole ring. This procedure won't work in that case.
|
|
2438
|
+
|
|
2439
|
+
intvec projvec=get_projection_intvec(elvec);
|
|
2440
|
+
list Pr=project_P(P,projvec);
|
|
2441
|
+
|
|
2442
|
+
//We now have to change the ring we work over: we delete the variables which are
|
|
2443
|
+
//to be eliminated. -> The number of variables and the number of components in
|
|
2444
|
+
//the projected point are the same. Then we can apply our procedure and imap the
|
|
2445
|
+
//results to our original ring, since we didn't change the names of the variables.
|
|
2446
|
+
def br=basering;
|
|
2447
|
+
list l=ringlist(br);
|
|
2448
|
+
|
|
2449
|
+
int i;
|
|
2450
|
+
for(i=size(elvec); i>=1; i--)
|
|
2451
|
+
{
|
|
2452
|
+
l[2]=delete(l[2],elvec[i]);
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
def r=ring(l);
|
|
2456
|
+
setring r;
|
|
2457
|
+
list Pr=fetch(br,Pr);
|
|
2458
|
+
|
|
2459
|
+
ideal R=num_radical1(Pr,D,C);
|
|
2460
|
+
|
|
2461
|
+
setring br;
|
|
2462
|
+
ideal R=imap(r,R);
|
|
2463
|
+
|
|
2464
|
+
return(R);
|
|
2465
|
+
}
|
|
2466
|
+
example
|
|
2467
|
+
{ "EXAMPLE:"; echo=2;
|
|
2468
|
+
//First, we write the input file for bertini and compute the elimination ideal
|
|
2469
|
+
//symbolically.
|
|
2470
|
+
ring r=0,(x,y,z),dp;
|
|
2471
|
+
poly f1=x-y;
|
|
2472
|
+
poly f2=z*(x+3y);
|
|
2473
|
+
poly f3=z*(x2+y2);
|
|
2474
|
+
ideal J=f1,f2,f3;
|
|
2475
|
+
ideal E2=elim(J,z);
|
|
2476
|
+
writeBertiniInput(J,100);
|
|
2477
|
+
|
|
2478
|
+
//Then we attempt to compute the elimination ideal via the hybrid algorithm.
|
|
2479
|
+
ring R=(complex,100,i),(x,y,z),dp;
|
|
2480
|
+
system("sh","bertini input");
|
|
2481
|
+
list P=getWitnessSet();
|
|
2482
|
+
intvec v=3;
|
|
2483
|
+
bigint C=bigint(10)**25;
|
|
2484
|
+
ideal E1=num_elim1(P,2,C,v);
|
|
2485
|
+
|
|
2486
|
+
//Lastly, we compare the results.
|
|
2487
|
+
E1;
|
|
2488
|
+
setring r;
|
|
2489
|
+
E2;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
///////////////////////////////////////////////////////////////////////////////////////
|
|
2493
|
+
///////////////////////////////////////////////////////////////////////////////////////
|
|
2494
|
+
//////////////////////////// lattice basis reduction //////////////////////////////
|
|
2495
|
+
///////////////////////////////////////////////////////////////////////////////////////
|
|
2496
|
+
///////////////////////////////////////////////////////////////////////////////////////
|
|
2497
|
+
//An implementation of a simple LLL algorithm
|
|
2498
|
+
//Works with real numbers
|
|
2499
|
+
//Is only used by those procedures which require the user to provide a witness set,
|
|
2500
|
+
// instead of calling Bertini to compute one.
|
|
2501
|
+
|
|
2502
|
+
static proc eucl(int m, vector u)
|
|
2503
|
+
{//the square of the Euclidean norm of u
|
|
2504
|
+
poly e=inner_product(u,u);
|
|
2505
|
+
return(e);
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
static proc red(int i, module B, module U)
|
|
2509
|
+
{
|
|
2510
|
+
int j;
|
|
2511
|
+
poly r;
|
|
2512
|
+
for(j=i-1; j>=1; j--)
|
|
2513
|
+
{
|
|
2514
|
+
r=roundpoly(U[i][j]);
|
|
2515
|
+
B[i]=B[i]-r*B[j];
|
|
2516
|
+
U[i]=U[i]-r*U[j];
|
|
2517
|
+
}
|
|
2518
|
+
return(B,matrix(U));
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
static proc initBBsU(matrix M)
|
|
2522
|
+
{//the columns of M a basis of a lattice over R
|
|
2523
|
+
int m=nrows(M);
|
|
2524
|
+
int c=ncols(M);
|
|
2525
|
+
module B=M;
|
|
2526
|
+
module Bs=M;
|
|
2527
|
+
poly f,k,u;
|
|
2528
|
+
matrix U=diag(1,c);
|
|
2529
|
+
int i,j;
|
|
2530
|
+
for(i=1; i<=c; i++)
|
|
2531
|
+
{
|
|
2532
|
+
for(j=1; j<=i-1; j++)
|
|
2533
|
+
{
|
|
2534
|
+
f=inner_product(B[i],Bs[j]);
|
|
2535
|
+
k=inner_product(Bs[j],Bs[j]);
|
|
2536
|
+
u=f/k;
|
|
2537
|
+
U[j,i]=u;
|
|
2538
|
+
Bs[i]=Bs[i]-u*Bs[j];
|
|
2539
|
+
}
|
|
2540
|
+
(B,U)=red(i,B,U);
|
|
2541
|
+
}
|
|
2542
|
+
return(B,Bs,U);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
static proc mymax(int i, int k)
|
|
2546
|
+
{
|
|
2547
|
+
if(i >= k)
|
|
2548
|
+
{
|
|
2549
|
+
return(i);
|
|
2550
|
+
}
|
|
2551
|
+
return(k);
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
proc realLLL(matrix M)
|
|
2555
|
+
"USAGE: realLLL(M); matrix M
|
|
2556
|
+
ASSUME: The columns of M represent a basis of a lattice.
|
|
2557
|
+
The groundfield is the field of real number or the field of complex numbers, the
|
|
2558
|
+
elements of M are real numbers.
|
|
2559
|
+
RETURN: matrix: the columns representing an LLL-reduced basis of the lattice given by M
|
|
2560
|
+
EXAMPLE: example realLLL; shows an example
|
|
2561
|
+
"
|
|
2562
|
+
{
|
|
2563
|
+
int n=ncols(M);
|
|
2564
|
+
int m=nrows(M);
|
|
2565
|
+
matrix U;
|
|
2566
|
+
module B,Bs;
|
|
2567
|
+
poly f,k,u;
|
|
2568
|
+
(B,Bs,U)=initBBsU(M);
|
|
2569
|
+
int i=1;
|
|
2570
|
+
int j;
|
|
2571
|
+
while(i<n)
|
|
2572
|
+
{
|
|
2573
|
+
//check whether there is an i sth eucl(Bs[i,i]) <= 4/3*euclid(Bs[i+1,i])
|
|
2574
|
+
//if so, that's fine
|
|
2575
|
+
//if not, b_i and b_i+1 are swapped + we do the necessary changes in Bs and U
|
|
2576
|
+
if(inner_product(B[i],B[i]) <= (301/300)*inner_product(B[i+1],B[i+1]))
|
|
2577
|
+
{
|
|
2578
|
+
i++;
|
|
2579
|
+
}
|
|
2580
|
+
else
|
|
2581
|
+
{
|
|
2582
|
+
Bs[i+1]=Bs[i+1]+U[i,i+1]*Bs[i];
|
|
2583
|
+
f=inner_product(B[i],Bs[i+1]);
|
|
2584
|
+
k=inner_product(Bs[i+1],Bs[i+1]);
|
|
2585
|
+
u=f/k;
|
|
2586
|
+
U[i,i]=u;
|
|
2587
|
+
U[i+1,i]=1;
|
|
2588
|
+
U[i,i+1]=1;
|
|
2589
|
+
U[i+1,i+1]=0;
|
|
2590
|
+
Bs[i]=Bs[i]-U[i,i]*Bs[i+1];
|
|
2591
|
+
U=permcol(U,i,i+1);
|
|
2592
|
+
Bs=permcol(Bs,i,i+1);
|
|
2593
|
+
B=permcol(B,i,i+1);
|
|
2594
|
+
|
|
2595
|
+
for(j=i+2; j<=n; j++)
|
|
2596
|
+
{
|
|
2597
|
+
f=inner_product(B[j],Bs[i]);
|
|
2598
|
+
k=inner_product(Bs[i],Bs[i]);
|
|
2599
|
+
u=f/k;
|
|
2600
|
+
U[i,j]=u;
|
|
2601
|
+
|
|
2602
|
+
f=inner_product(B[j],Bs[i+1]);
|
|
2603
|
+
k=inner_product(Bs[i+1],Bs[i+1]);
|
|
2604
|
+
u=f/k;
|
|
2605
|
+
U[i+1,j]=u;
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
if(absValue(U[i,i+1]) > 1/2)
|
|
2609
|
+
{
|
|
2610
|
+
(B,U)=red(i+1,B,U);
|
|
2611
|
+
}
|
|
2612
|
+
i=mymax(i-1,1);
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
return(B);
|
|
2616
|
+
}
|
|
2617
|
+
example
|
|
2618
|
+
{ "EXAMPLE:"; echo=2;
|
|
2619
|
+
ring r=(real,50),x,dp;
|
|
2620
|
+
matrix M[5][4]=
|
|
2621
|
+
1,0,0,0,
|
|
2622
|
+
0,1,0,0,
|
|
2623
|
+
0,0,1,0,
|
|
2624
|
+
0,0,0,1,
|
|
2625
|
+
5*81726716.91827716, 817267.1691827716, poly(10)**30, 13*81726716.91827716;
|
|
2626
|
+
matrix L=realLLL(M);
|
|
2627
|
+
print(L);
|
|
2628
|
+
}
|