passagemath-singular 10.6.31rc3__cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.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-aarch64-linux-gnu.so +0 -0
- passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
- passagemath_singular-10.6.31rc3.dist-info/RECORD +490 -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-6a2a8666.4.1.so +0 -0
- passagemath_singular.libs/libcddgmp-ac579979.so.0.1.3 +0 -0
- passagemath_singular.libs/libfactory-4-66e33516.4.1.so +0 -0
- passagemath_singular.libs/libflint-81de1160.so.21.0.0 +0 -0
- passagemath_singular.libs/libgf2x-fbd36f80.so.3.0.0 +0 -0
- passagemath_singular.libs/libgfortran-e1b7dfc8.so.5.0.0 +0 -0
- passagemath_singular.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
- passagemath_singular.libs/libgsl-e3525837.so.28.0.0 +0 -0
- passagemath_singular.libs/libmpfr-e0f11cf3.so.6.2.1 +0 -0
- passagemath_singular.libs/libntl-0043a3a2.so.44.0.1 +0 -0
- passagemath_singular.libs/libomalloc-0-06512335.9.6.so +0 -0
- passagemath_singular.libs/libopenblasp-r0-4c5b64b1.3.29.so +0 -0
- passagemath_singular.libs/libpolys-4-cb7246b5.4.1.so +0 -0
- passagemath_singular.libs/libreadline-28330744.so.8.2 +0 -0
- passagemath_singular.libs/libsingular_resources-4-8c425241.4.1.so +0 -0
- passagemath_singular.libs/libtinfo-f81c2d16.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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-linux-gnu.so +0 -0
- sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
- sage/algebras/quatalg/quaternion_algebra_element.cpython-314-aarch64-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-aarch64-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-aarch64-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-aarch64-linux-gnu.so +0 -0
- sage/libs/singular/option.pyx +671 -0
- sage/libs/singular/polynomial.cpython-314-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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,1835 @@
|
|
|
1
|
+
//////////////////////////////////////////////////////////////////////
|
|
2
|
+
version="version cisimplicial.lib 4.1.2.0 Feb_2019 "; // $Id: adac96344b14eee8923363275182a2b9fcceeb84 $
|
|
3
|
+
category= "Commutative Algebra";
|
|
4
|
+
info="
|
|
5
|
+
LIBRARY: cisimplicial.lib. Determines if the toric ideal of
|
|
6
|
+
a simplicial toric variety is a complete intersection
|
|
7
|
+
|
|
8
|
+
AUTHORS: I.Bermejo, ibermejo@ull.es
|
|
9
|
+
@* I.Garcia-Marco, iggarcia@ull.es
|
|
10
|
+
|
|
11
|
+
OVERVIEW:
|
|
12
|
+
A library for determining if a simplicial toric ideal is a complete
|
|
13
|
+
intersection with NO NEED of computing explicitly a system of generators
|
|
14
|
+
of such ideal. The procedures are based on two papers:
|
|
15
|
+
I. Bermejo, I. Garcia-Marco and J.J. Salazar-Gonzalez: 'An algorithm for
|
|
16
|
+
checking whether the toric ideal of an affine monomial curve is a complete
|
|
17
|
+
intersection', J. Symbolic Computation 42 (2007) pags: 971--991 and
|
|
18
|
+
I.Bermejo and I. Garcia-Marco: 'Complete intersections in simplicial toric
|
|
19
|
+
varieties', Preprint (2010)
|
|
20
|
+
|
|
21
|
+
PROCEDURES:
|
|
22
|
+
minMult(a,b); computes the minimum multiple of a that belongs to the
|
|
23
|
+
semigroup generated by b
|
|
24
|
+
belongSemigroup(v,A[,n]); checks whether A*x = v has a nonnegative
|
|
25
|
+
integral solution
|
|
26
|
+
oneDimBelongSemigroup(n,v[,m]); checks whether v*x = n has a
|
|
27
|
+
nonnegative integral solution
|
|
28
|
+
cardGroup(A); computes the cardinal of Z^m / ZA
|
|
29
|
+
isCI(A); checks whether I(A) is a complete intersection
|
|
30
|
+
";
|
|
31
|
+
|
|
32
|
+
LIB "general.lib";
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/////////////////////////////////////////////////////////////////////
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
static proc Multiple(intvec v, intmat A, list #)
|
|
39
|
+
"
|
|
40
|
+
USAGE: Multiple(v,A[,n]); v is an integral vector, A is an integral matrix, n is an integer.
|
|
41
|
+
RETURN: 0 if none of the [n first] columns of A divides the vector v or an intvec otherwise.
|
|
42
|
+
In this case v = answer[2] * (answer[1]-th column of A).
|
|
43
|
+
ASSUME: nrows(v) = nrows(A) [and n <= nrows(A)].
|
|
44
|
+
"
|
|
45
|
+
{
|
|
46
|
+
|
|
47
|
+
intvec answer;
|
|
48
|
+
if (v == 0)
|
|
49
|
+
{
|
|
50
|
+
answer[1] = 1;
|
|
51
|
+
answer[2] = 0;
|
|
52
|
+
return (answer);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
int last;
|
|
56
|
+
int e = size(#);
|
|
57
|
+
if (e > 0)
|
|
58
|
+
{
|
|
59
|
+
last = #[1];
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
{
|
|
63
|
+
last = ncols(A);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
int i,j,s;
|
|
67
|
+
for (j = 1; j <= last; j++)
|
|
68
|
+
{
|
|
69
|
+
s = 0;
|
|
70
|
+
for (i = 1; i <= nrows(A); i++)
|
|
71
|
+
{
|
|
72
|
+
if ((v[i] == 0)&&(A[i,j] != 0))
|
|
73
|
+
{
|
|
74
|
+
// it is not multiple of A_j
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
if (v[i] != 0)
|
|
78
|
+
{
|
|
79
|
+
if (A[i,j] == 0)
|
|
80
|
+
{
|
|
81
|
+
// it is not multiple of A_j
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
if (s == 0)
|
|
85
|
+
{
|
|
86
|
+
s = v[i] div A[i,j];
|
|
87
|
+
}
|
|
88
|
+
if (v[i] != s * A[i,j])
|
|
89
|
+
{
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (i == nrows(A))
|
|
94
|
+
{
|
|
95
|
+
answer[1] = j;
|
|
96
|
+
answer[2] = s;
|
|
97
|
+
// v = s * A_j
|
|
98
|
+
return (answer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// None of the columns of A divides v
|
|
104
|
+
return (0);
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/////////////////////////////////////////////////////////////////////
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
proc oneDimBelongSemigroup(int n, intvec v, list #)
|
|
112
|
+
"
|
|
113
|
+
USAGE: oneDimBelongSemigroup(n,v[,m]); v is an integral vector,
|
|
114
|
+
n is a positive integer[, m is a positive integer].
|
|
115
|
+
RETURN: counters, a vector with nonnegative entries such that
|
|
116
|
+
v*counters = n. If it does not exist such a vector, it returns 0.
|
|
117
|
+
If a third parameter m is introduced, it will only consider the
|
|
118
|
+
first m entries of v.
|
|
119
|
+
ASSUME: v is an integral vector with positive entries.
|
|
120
|
+
EXAMPLE: example oneDimBelongSemigroup; shows some examples.
|
|
121
|
+
"
|
|
122
|
+
{
|
|
123
|
+
//--------------------------- initialisation ---------------------------------
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
int i, j;
|
|
127
|
+
int PartialSum;
|
|
128
|
+
int num;
|
|
129
|
+
int e = size(#);
|
|
130
|
+
|
|
131
|
+
if (e > 0)
|
|
132
|
+
{
|
|
133
|
+
num = #[1];
|
|
134
|
+
}
|
|
135
|
+
else
|
|
136
|
+
{
|
|
137
|
+
num = nrows(v);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
intvec v2 = v[1..num];
|
|
141
|
+
intvec counter, belong;
|
|
142
|
+
belong[num] = 0;
|
|
143
|
+
counter[num] = 0;
|
|
144
|
+
for (i = 1; i <= num; i++)
|
|
145
|
+
{
|
|
146
|
+
if (n % v[i] == 0)
|
|
147
|
+
{
|
|
148
|
+
// ---- n is multiple of v[i]
|
|
149
|
+
belong[i] = n div v[i];
|
|
150
|
+
return (belong);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (num == 1)
|
|
155
|
+
{
|
|
156
|
+
// ---- num = 1 and n is not multiple of v[1] --> FALSE
|
|
157
|
+
return(0);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
PartialSum = 0;
|
|
161
|
+
|
|
162
|
+
intvec w = sort(v2)[1];
|
|
163
|
+
intvec cambio = sort(v2)[2];
|
|
164
|
+
|
|
165
|
+
// ---- Iterative procedure to determine if n is in the semigroup generated by v
|
|
166
|
+
while (1)
|
|
167
|
+
{
|
|
168
|
+
if (n >= PartialSum)
|
|
169
|
+
{
|
|
170
|
+
if (((n - PartialSum) % w[1]) == 0)
|
|
171
|
+
{
|
|
172
|
+
// ---- n belongs to the semigroup generated by v,
|
|
173
|
+
belong[cambio[1]] = (n - PartialSum) div w[1];
|
|
174
|
+
for (j = 2; j <= num; j++)
|
|
175
|
+
{
|
|
176
|
+
belong[cambio[j]] = counter[j];
|
|
177
|
+
}
|
|
178
|
+
return(belong);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
i = num;
|
|
182
|
+
while (!defined(end))
|
|
183
|
+
{
|
|
184
|
+
if (i == 1)
|
|
185
|
+
{
|
|
186
|
+
// ---- Stop, n is not in the semigroup
|
|
187
|
+
return(0);
|
|
188
|
+
}
|
|
189
|
+
if (i > 1)
|
|
190
|
+
{
|
|
191
|
+
// counters control
|
|
192
|
+
if (w[i] > n - PartialSum)
|
|
193
|
+
{
|
|
194
|
+
PartialSum = PartialSum - (counter[i]*w[i]);
|
|
195
|
+
counter[i] = 0;
|
|
196
|
+
i--;
|
|
197
|
+
}
|
|
198
|
+
else
|
|
199
|
+
{
|
|
200
|
+
counter[i] = counter[i] + 1;
|
|
201
|
+
PartialSum = PartialSum + w[i];
|
|
202
|
+
int end;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
kill end;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
example
|
|
210
|
+
{ "EXAMPLE:";echo=2;
|
|
211
|
+
int a = 95;
|
|
212
|
+
intvec v = 18,51,13;
|
|
213
|
+
oneDimBelongSemigroup(a,v);
|
|
214
|
+
"// 95 = 1*18 + 1*25 + 2*13";
|
|
215
|
+
oneDimBelongSemigroup(a,v,2);
|
|
216
|
+
"// 95 is not a combination of 18 and 52;";
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
/////////////////////////////////////////////////////////////////////
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
proc SBelongSemigroup (intvec v, intmat A, list #)
|
|
225
|
+
"
|
|
226
|
+
USAGE: SBelongSemigroup(v,A[,k]); v is an integral vector, A is an
|
|
227
|
+
integral matrix, n is a positive integer.
|
|
228
|
+
RETURN: counters, a vector with nonnegative entries such that
|
|
229
|
+
A*counters = v. If it does not exist such vector, it returns 0.
|
|
230
|
+
If a third parameter k is introduced, it will only consider the
|
|
231
|
+
first k columns of A.
|
|
232
|
+
ASSUME: A is an m x n matrix with nonnegative entries, n >= m, for every
|
|
233
|
+
i,j <= m, i != j then A[i,j] = 0, v has nonnegative entries and
|
|
234
|
+
nrows(v) = nrows(A);
|
|
235
|
+
"
|
|
236
|
+
{
|
|
237
|
+
|
|
238
|
+
int last;
|
|
239
|
+
int e = size(#);
|
|
240
|
+
if (e > 0)
|
|
241
|
+
{
|
|
242
|
+
last = #[1];
|
|
243
|
+
}
|
|
244
|
+
else
|
|
245
|
+
{
|
|
246
|
+
last = ncols(A);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
intvec counters;
|
|
250
|
+
counters[last] = 0;
|
|
251
|
+
|
|
252
|
+
int i, j, k, l;
|
|
253
|
+
intvec d;
|
|
254
|
+
for (i = 1; i <= nrows(A); i++)
|
|
255
|
+
{
|
|
256
|
+
d[i] = A[i,i];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
i = 1;
|
|
260
|
+
while ((i < nrows(v)) && (v[i] % d[i] == 0))
|
|
261
|
+
{
|
|
262
|
+
i++;
|
|
263
|
+
}
|
|
264
|
+
if (v[i] % d[i] == 0)
|
|
265
|
+
{
|
|
266
|
+
// v is a combination of the first nrows(A) columns
|
|
267
|
+
for (j = 1; j <= nrows(v); j++)
|
|
268
|
+
{
|
|
269
|
+
counters[j] = v[j] div d[j];
|
|
270
|
+
}
|
|
271
|
+
return(counters);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
int gcdrow;
|
|
275
|
+
for (i = 1; i <= nrows(A); i++)
|
|
276
|
+
{
|
|
277
|
+
gcdrow = d[i];
|
|
278
|
+
for (j = nrows(A)+1; j <= last; j++)
|
|
279
|
+
{
|
|
280
|
+
if (A[i,j] != 0)
|
|
281
|
+
{
|
|
282
|
+
gcdrow = gcd(gcdrow,A[i,j]);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (v[i] % gcdrow != 0)
|
|
286
|
+
{
|
|
287
|
+
return (0);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
intvec swap;
|
|
292
|
+
for (i = 1; i <= last; i++)
|
|
293
|
+
{
|
|
294
|
+
swap[i] = i;
|
|
295
|
+
}
|
|
296
|
+
for (i = nrows(A) + 1; i <= last; i++)
|
|
297
|
+
{
|
|
298
|
+
for (j = 1; j <= nrows(v); j++)
|
|
299
|
+
{
|
|
300
|
+
if (A[j,i] > v[j])
|
|
301
|
+
{
|
|
302
|
+
swap[i] = 0;
|
|
303
|
+
for (k = 1; k <= nrows(A); k++)
|
|
304
|
+
{
|
|
305
|
+
A[k,i] = A[k,last];
|
|
306
|
+
}
|
|
307
|
+
swap[i] = swap[last];
|
|
308
|
+
last--;
|
|
309
|
+
i--;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (nrows(A) == last)
|
|
315
|
+
{
|
|
316
|
+
return (0);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
intvec order;
|
|
321
|
+
order[last] = 0;
|
|
322
|
+
for (i = nrows(A) + 1; i <= last; i++)
|
|
323
|
+
{
|
|
324
|
+
order[i] = 1;
|
|
325
|
+
for (j = 1; j <= nrows(A); j++)
|
|
326
|
+
{
|
|
327
|
+
if (A[j,i] > 0)
|
|
328
|
+
{
|
|
329
|
+
order[i] = lcm(order[i], d[j] div gcd(A[j,i],d[j]));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
intvec counters2;
|
|
335
|
+
counters2[last] = 0;
|
|
336
|
+
|
|
337
|
+
// A full enumeration is performed
|
|
338
|
+
while(1)
|
|
339
|
+
{
|
|
340
|
+
i = nrows(counters2);
|
|
341
|
+
while (1)
|
|
342
|
+
{
|
|
343
|
+
j = 1;
|
|
344
|
+
if (counters2[i] < order[i] - 1)
|
|
345
|
+
{
|
|
346
|
+
while ((j < nrows(A)) and (v[j] >= A[j,i]))
|
|
347
|
+
{
|
|
348
|
+
j++;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if ((v[j] < A[j,i])||(counters2[i] == order[i] - 1))
|
|
352
|
+
{
|
|
353
|
+
// A_j is not < v componentwise or counters2 = order[i]
|
|
354
|
+
// we cannot increase counters2[i]
|
|
355
|
+
if (counters2[i] != 0)
|
|
356
|
+
{
|
|
357
|
+
for (k = 1; k <= nrows(v); k++)
|
|
358
|
+
{
|
|
359
|
+
v[k] = v[k] + counters2[i] * A[k,i];
|
|
360
|
+
}
|
|
361
|
+
counters2[i] = 0;
|
|
362
|
+
}
|
|
363
|
+
i--;
|
|
364
|
+
if (i <= nrows(A))
|
|
365
|
+
{
|
|
366
|
+
// A*x = v has not nonnegative integral solution
|
|
367
|
+
return(0);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else
|
|
371
|
+
{
|
|
372
|
+
// j = nrows(A), then A_j < v (componentwise)
|
|
373
|
+
// we add one unit to counters2[i]
|
|
374
|
+
for (k = 1; k <= nrows(v); k++)
|
|
375
|
+
{
|
|
376
|
+
v[k] = v[k] - A[k,i];
|
|
377
|
+
}
|
|
378
|
+
counters2[i] = counters2[i] + 1;
|
|
379
|
+
|
|
380
|
+
l = 1;
|
|
381
|
+
while ((l < nrows(v)) and (v[l] % d[l] == 0))
|
|
382
|
+
{
|
|
383
|
+
l++;
|
|
384
|
+
}
|
|
385
|
+
if (v[l] % d[l] == 0)
|
|
386
|
+
{
|
|
387
|
+
// v is a combination of the first nrows(A) columns
|
|
388
|
+
for (k = 1; k <= nrows(v); k++)
|
|
389
|
+
{
|
|
390
|
+
counters[k] = v[k] div d[k];
|
|
391
|
+
}
|
|
392
|
+
for (k = nrows(v) + 1; k <= nrows(counters2); k++)
|
|
393
|
+
{
|
|
394
|
+
counters[swap[k]] = counters2[k];
|
|
395
|
+
}
|
|
396
|
+
// A*counters = v
|
|
397
|
+
return(counters);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
/////////////////////////////////////////////////////////////////////
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
proc belongSemigroup (intvec v, intmat A, list #)
|
|
412
|
+
"
|
|
413
|
+
USAGE: belongSemigroup(v,A[,k]); v is an integral vector, A is an
|
|
414
|
+
integral matrix, n is a positive integer.
|
|
415
|
+
RETURN: counters, a vector with nonnegative entries such that
|
|
416
|
+
A*counters = v. If it does not exist such a vector, it returns 0.
|
|
417
|
+
If a third parameter k is introduced, it will only consider the
|
|
418
|
+
first k columns of A.
|
|
419
|
+
ASSUME: A is a matrix with nonnegative entries, nonzero columns,
|
|
420
|
+
v is a nonnegative vector and nrows(v) = nrows(A).
|
|
421
|
+
EXAMPLE: example belongSemigroup; shows some examples.
|
|
422
|
+
"
|
|
423
|
+
{
|
|
424
|
+
int inputlast;
|
|
425
|
+
int e = size(#);
|
|
426
|
+
if (e > 0)
|
|
427
|
+
{
|
|
428
|
+
inputlast = #[1];
|
|
429
|
+
}
|
|
430
|
+
else
|
|
431
|
+
{
|
|
432
|
+
inputlast = ncols(A);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
int i, j, k;
|
|
436
|
+
intvec counters;
|
|
437
|
+
int last = inputlast;
|
|
438
|
+
|
|
439
|
+
if (last == 0)
|
|
440
|
+
{
|
|
441
|
+
return (counters);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
intvec swap;
|
|
445
|
+
for (i = 1; i <= last; i++)
|
|
446
|
+
{
|
|
447
|
+
swap[i] = i;
|
|
448
|
+
}
|
|
449
|
+
for (i = 1; i <= last; i++)
|
|
450
|
+
{
|
|
451
|
+
for (j = 1; j <= nrows(v); j++)
|
|
452
|
+
{
|
|
453
|
+
if (A[j,i] > v[j])
|
|
454
|
+
{
|
|
455
|
+
swap[i] = 0;
|
|
456
|
+
for (k = 1; k <= nrows(A); k++)
|
|
457
|
+
{
|
|
458
|
+
A[k,i] = A[k,last];
|
|
459
|
+
}
|
|
460
|
+
swap[i] = swap[last];
|
|
461
|
+
last--;
|
|
462
|
+
i--;
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (last == 0)
|
|
469
|
+
{
|
|
470
|
+
return (0);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
intvec multip = Multiple(v, A, last);
|
|
474
|
+
|
|
475
|
+
if (multip != 0)
|
|
476
|
+
{
|
|
477
|
+
intvec counters2;
|
|
478
|
+
counters2[inputlast] = 0;
|
|
479
|
+
// v = mult.value * ((mult.column)-th column of A)
|
|
480
|
+
counters2[swap[multip[1]]] = multip[2];
|
|
481
|
+
return (counters2);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
counters[last] = 0;
|
|
485
|
+
// A full enumeration is performed
|
|
486
|
+
// Example: si v = (3,2,6), a1 = (1,0,0), a2 = (0,1,1), a3 = (0,0,1), then counters will take the
|
|
487
|
+
// following values:
|
|
488
|
+
// 000, 001, 002, 003, 004, 005, 006, 010, 011, 012, 013, 014, 015, 020, 021, 022, 023, 024 ---> 324
|
|
489
|
+
while(1)
|
|
490
|
+
{
|
|
491
|
+
i = nrows(counters);
|
|
492
|
+
while (1)
|
|
493
|
+
{
|
|
494
|
+
j = 1;
|
|
495
|
+
while (j <= nrows(A))
|
|
496
|
+
{
|
|
497
|
+
if (v[j] < A[j,i])
|
|
498
|
+
{
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
j++;
|
|
502
|
+
}
|
|
503
|
+
if (j <= nrows(A))
|
|
504
|
+
{
|
|
505
|
+
if (counters[i] != 0)
|
|
506
|
+
{
|
|
507
|
+
for (k = 1; k <= nrows(A); k++)
|
|
508
|
+
{
|
|
509
|
+
v[k] = v[k] + counters[i] * A[k,i];
|
|
510
|
+
}
|
|
511
|
+
counters[i] = 0;
|
|
512
|
+
}
|
|
513
|
+
i--;
|
|
514
|
+
if (i < 2)
|
|
515
|
+
{
|
|
516
|
+
// Does not belong
|
|
517
|
+
return (0);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
else
|
|
521
|
+
{
|
|
522
|
+
for (k = 1; k <= nrows(A); k++)
|
|
523
|
+
{
|
|
524
|
+
v[k] = v[k] - A[k,i];
|
|
525
|
+
}
|
|
526
|
+
counters[i] = counters[i] + 1;
|
|
527
|
+
multip = Multiple(v, A, i);
|
|
528
|
+
if (multip != 0)
|
|
529
|
+
{
|
|
530
|
+
// v belongs, we return the solution counters so that A * counters = v
|
|
531
|
+
counters[multip[1]] = multip[2];
|
|
532
|
+
intvec counters2;
|
|
533
|
+
counters2[inputlast] = 0;
|
|
534
|
+
for (i = 1; i <= last; i++)
|
|
535
|
+
{
|
|
536
|
+
counters2[swap[i]] = counters[i];
|
|
537
|
+
}
|
|
538
|
+
return (counters2);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
example
|
|
547
|
+
{ "EXAMPLE:"; echo=2;
|
|
548
|
+
intmat A[3][4] = 10,3,2,1,2,1,1,3,5,0,1,2;
|
|
549
|
+
print(A);
|
|
550
|
+
intvec v = 23,12,10;
|
|
551
|
+
belongSemigroup(v,A);
|
|
552
|
+
"// A * (1,3,1,2) = v";
|
|
553
|
+
belongSemigroup(v,A,3);
|
|
554
|
+
"// v is not a combination of the first 3 columns of A";
|
|
555
|
+
intvec w = 12,4,1;
|
|
556
|
+
belongSemigroup(w,A);
|
|
557
|
+
"// w is not a combination of the columns of A";
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/////////////////////////////////////////////////////////////////////
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
proc cardGroup(intmat A, list #)
|
|
565
|
+
"
|
|
566
|
+
USAGE: cardGroup(A[,n]); A is a matrix with integral coefficients.
|
|
567
|
+
RETURN: It returns a bigint. If we denote by ZA the group generated
|
|
568
|
+
by the columns of the matrix A, then it returns the number of
|
|
569
|
+
elements of the group of Z^m / ZA, where m = number of rows of A.
|
|
570
|
+
If a second parameter n is introduced, it will
|
|
571
|
+
only consider the first n columns of A. It returns 0 if Z^m / ZA
|
|
572
|
+
is infinite; this is, when rank ZA < m.
|
|
573
|
+
EXAMPLE: example cardGroup; shows an example.
|
|
574
|
+
"
|
|
575
|
+
{
|
|
576
|
+
int i, j, k, l;
|
|
577
|
+
int coef1, coef2, aux;
|
|
578
|
+
bigint aux2, aux3;
|
|
579
|
+
list gcdiv;
|
|
580
|
+
|
|
581
|
+
int last;
|
|
582
|
+
int e = size(#);
|
|
583
|
+
if (e > 0)
|
|
584
|
+
{
|
|
585
|
+
last = #[1];
|
|
586
|
+
}
|
|
587
|
+
else
|
|
588
|
+
{
|
|
589
|
+
last = ncols(A);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// First we put the matrix A in diagonal form.
|
|
593
|
+
for (i = 1; i <= nrows(A); i++)
|
|
594
|
+
{
|
|
595
|
+
j = i;
|
|
596
|
+
while (A[i,j] == 0)
|
|
597
|
+
{
|
|
598
|
+
j++;
|
|
599
|
+
if (j > last)
|
|
600
|
+
{
|
|
601
|
+
return (0);
|
|
602
|
+
// Group is infinite
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
if (j > i)
|
|
606
|
+
{
|
|
607
|
+
for (k = i; k <= nrows(A); k++)
|
|
608
|
+
{
|
|
609
|
+
// swap columns to have a nonzero pivot
|
|
610
|
+
aux = A[k,i];
|
|
611
|
+
A[k,i] = A[k,j];
|
|
612
|
+
A[k,j] = aux;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
for (k = j+1; k <= last; k++)
|
|
616
|
+
{
|
|
617
|
+
if (A[i,k] != 0)
|
|
618
|
+
{
|
|
619
|
+
gcdiv = extgcd(A[i,i],A[i,k]);
|
|
620
|
+
coef1 = A[i,k] div gcdiv[1];
|
|
621
|
+
coef2 = A[i,i] div gcdiv[1];
|
|
622
|
+
for (l = i; l <= nrows(A); l++)
|
|
623
|
+
{
|
|
624
|
+
// Perform elemental operations in the matrix
|
|
625
|
+
// to put A in diagonal form
|
|
626
|
+
aux2 = bigint(gcdiv[2]) * bigint(A[l,i]) + bigint(gcdiv[3]) * bigint(A[l,k]);
|
|
627
|
+
aux3 = bigint(coef1) * bigint(A[l,i]) - bigint(coef2) * bigint(A[l,k]);
|
|
628
|
+
A[l,k] = int(aux3);
|
|
629
|
+
A[l,i] = int(aux2);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// Once the matrix is in diagonal form, we only have to multiply
|
|
636
|
+
// the diagonal elements
|
|
637
|
+
|
|
638
|
+
bigint determinant = bigint(A[1,1]);
|
|
639
|
+
bigint entry;
|
|
640
|
+
for (i = 2; i <= nrows(A); i++)
|
|
641
|
+
{
|
|
642
|
+
entry = bigint(A[i,i]);
|
|
643
|
+
determinant = determinant * entry;
|
|
644
|
+
}
|
|
645
|
+
determinant = absValue(determinant);
|
|
646
|
+
return(determinant);
|
|
647
|
+
|
|
648
|
+
}
|
|
649
|
+
example
|
|
650
|
+
{ "EXAMPLE:"; echo=2;
|
|
651
|
+
intmat A[3][5] = 24, 0, 0, 8, 3,
|
|
652
|
+
0, 24, 0, 10, 6,
|
|
653
|
+
0, 0, 24, 5, 9;
|
|
654
|
+
cardGroup(A);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
658
|
+
|
|
659
|
+
proc minMult(int a, intvec b)
|
|
660
|
+
"
|
|
661
|
+
USAGE: minMult (a, b); a integer, b integer vector.
|
|
662
|
+
RETURN: an integer k, the minimum positive integer such that k*a belongs to the
|
|
663
|
+
semigroup generated by the integers in b.
|
|
664
|
+
ASSUME: a is a positive integer, b is a vector of positive integers.
|
|
665
|
+
EXAMPLE: example minMult; shows an example.
|
|
666
|
+
"
|
|
667
|
+
{
|
|
668
|
+
//--------------------------- initialisation ---------------------------------
|
|
669
|
+
int i, j, min, max;
|
|
670
|
+
int n = nrows(b);
|
|
671
|
+
|
|
672
|
+
if (n == 1)
|
|
673
|
+
{
|
|
674
|
+
// ---- trivial case
|
|
675
|
+
return(b[1]/gcd(a,b[1]));
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
max = b[1];
|
|
679
|
+
for (i = 2; i <= n; i++)
|
|
680
|
+
{
|
|
681
|
+
if (b[i] > max)
|
|
682
|
+
{
|
|
683
|
+
max = b[i];
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
int NumNodes = a + max; //----Number of nodes in the graph
|
|
687
|
+
|
|
688
|
+
int dist = 1;
|
|
689
|
+
// ---- Auxiliary structures to obtain the shortest path between the nodes 1 and a+1 of this graph
|
|
690
|
+
intvec queue = 1;
|
|
691
|
+
intvec queue2;
|
|
692
|
+
|
|
693
|
+
// ---- Control vector:
|
|
694
|
+
// control[i] = 0 -> node not reached yet
|
|
695
|
+
// control[i] = 1 -> node in queue1
|
|
696
|
+
// control[i] = 2 -> node in queue2
|
|
697
|
+
// control[i] = 3 -> node already processed
|
|
698
|
+
intvec control;
|
|
699
|
+
control[1] = 3; // Starting node
|
|
700
|
+
control[a + max] = 0; // Ending node
|
|
701
|
+
int current = 1; // Current node
|
|
702
|
+
int next; // Node connected to current by arc (current, next)
|
|
703
|
+
|
|
704
|
+
int ElemQueue, ElemQueue2;
|
|
705
|
+
int PosQueue = 1;
|
|
706
|
+
|
|
707
|
+
// Algoritmo de Dijkstra
|
|
708
|
+
while (1)
|
|
709
|
+
{
|
|
710
|
+
if (current <= a)
|
|
711
|
+
{
|
|
712
|
+
// ---- current <= a, arcs are (current, current + b[i])
|
|
713
|
+
for (i = 1; i <= n; i++)
|
|
714
|
+
{
|
|
715
|
+
next = current + b[i];
|
|
716
|
+
if (next == a+1)
|
|
717
|
+
{
|
|
718
|
+
kill control;
|
|
719
|
+
kill queue;
|
|
720
|
+
kill queue2;
|
|
721
|
+
return (dist);
|
|
722
|
+
}
|
|
723
|
+
if ((control[next] == 0)||(control[next] == 2))
|
|
724
|
+
{
|
|
725
|
+
control[next] = 1;
|
|
726
|
+
queue = queue, next;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (current > a)
|
|
731
|
+
{
|
|
732
|
+
// ---- current > a, the only possible ars is (current, current - a)
|
|
733
|
+
next = current - a;
|
|
734
|
+
if (control[next] == 0)
|
|
735
|
+
{
|
|
736
|
+
control[next] = 2;
|
|
737
|
+
queue2[nrows(queue2) + 1] = next;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
PosQueue++;
|
|
741
|
+
if (PosQueue <= nrows(queue))
|
|
742
|
+
{
|
|
743
|
+
current = queue[PosQueue];
|
|
744
|
+
}
|
|
745
|
+
else
|
|
746
|
+
{
|
|
747
|
+
dist++;
|
|
748
|
+
if (control[a+1] == 2)
|
|
749
|
+
{
|
|
750
|
+
return(dist);
|
|
751
|
+
}
|
|
752
|
+
queue = queue2[2..nrows(queue2)];
|
|
753
|
+
current = queue[1];
|
|
754
|
+
PosQueue = 1;
|
|
755
|
+
queue2 = 0;
|
|
756
|
+
}
|
|
757
|
+
control[current] = 3;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
example
|
|
761
|
+
{ "EXAMPLE:";echo=2;
|
|
762
|
+
int a = 46;
|
|
763
|
+
intvec b = 13,17,59;
|
|
764
|
+
minMult(a,b);
|
|
765
|
+
"// 3*a = 8*b[1] + 2*b[2]"
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
/////////////////////////////////////////////////////////////////////
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
static proc CheckMin (int posiblemin, intmat A, int column, list #)
|
|
773
|
+
"
|
|
774
|
+
USAGE: CheckMin(posiblemin,A,column[,n]); posiblemin is an integer,
|
|
775
|
+
A is an integral matrix and column and last are integers.
|
|
776
|
+
RETURN: 1 if posiblemin is the minimum value x such that x * (column-th column of A)
|
|
777
|
+
belongs to the semigroup generated by all the columns of A except
|
|
778
|
+
A_column. It returns 0 otherwise. If an extra parameter n is
|
|
779
|
+
introduced then it will only consider the first n columns of A.
|
|
780
|
+
ASSUME: 1 <= column <= ncols(A), A does not have negative entries or zero columns
|
|
781
|
+
"
|
|
782
|
+
{
|
|
783
|
+
|
|
784
|
+
// If one can write (posiblemin-1)*A_column as a non-trivial combination of the
|
|
785
|
+
// columns of A, then posiblemin is > to the real minimum
|
|
786
|
+
intvec counters, multip;
|
|
787
|
+
counters[ncols(A)] = 0;
|
|
788
|
+
|
|
789
|
+
int i,j,k;
|
|
790
|
+
int last;
|
|
791
|
+
|
|
792
|
+
int e = size(#);
|
|
793
|
+
if (e > 0)
|
|
794
|
+
{
|
|
795
|
+
last = #[1];
|
|
796
|
+
}
|
|
797
|
+
else
|
|
798
|
+
{
|
|
799
|
+
last = ncols(A);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
intvec v, aux;
|
|
803
|
+
for (i = 1; i <= nrows(A); i++)
|
|
804
|
+
{
|
|
805
|
+
v[i] = (posiblemin-1)*A[i,column];
|
|
806
|
+
// We swap A_column with A_1
|
|
807
|
+
aux[i] = A[i,1];
|
|
808
|
+
A[i,1] = A[i,column];
|
|
809
|
+
A[i,column] = aux[i];
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
for (i = 2; i <= last; i++)
|
|
813
|
+
{
|
|
814
|
+
for (j = 1; j <= nrows(v); j++)
|
|
815
|
+
{
|
|
816
|
+
if (A[j,i] > v[j])
|
|
817
|
+
{
|
|
818
|
+
for (k = 1; k <= nrows(A); k++)
|
|
819
|
+
{
|
|
820
|
+
A[k,i] = A[k,last];
|
|
821
|
+
}
|
|
822
|
+
last--;
|
|
823
|
+
i--;
|
|
824
|
+
break;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// A full enumeration is performed
|
|
830
|
+
while(1)
|
|
831
|
+
{
|
|
832
|
+
i = last;
|
|
833
|
+
while (1)
|
|
834
|
+
{
|
|
835
|
+
j = 1;
|
|
836
|
+
while (j <= nrows(A))
|
|
837
|
+
{
|
|
838
|
+
if (v[j] < A[j,i])
|
|
839
|
+
{
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
j++;
|
|
843
|
+
}
|
|
844
|
+
if (j <= nrows(A))
|
|
845
|
+
{
|
|
846
|
+
if (counters[i] != 0)
|
|
847
|
+
{
|
|
848
|
+
for (k = 1; k <= nrows(A); k++)
|
|
849
|
+
{
|
|
850
|
+
v[k] = v[k] + counters[i] * A[k,i];
|
|
851
|
+
}
|
|
852
|
+
counters[i] = 0;
|
|
853
|
+
}
|
|
854
|
+
i--;
|
|
855
|
+
if (i == 1)
|
|
856
|
+
{
|
|
857
|
+
// The only solution is that v = (posiblemin-1)*A.col[1]
|
|
858
|
+
return (1);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
else
|
|
862
|
+
{
|
|
863
|
+
for (k = 1; k <= nrows(A); k++)
|
|
864
|
+
{
|
|
865
|
+
v[k] = v[k] - A[k,i];
|
|
866
|
+
}
|
|
867
|
+
counters[i] = counters[i]+1;
|
|
868
|
+
multip = Multiple(v, A, i);
|
|
869
|
+
if (multip != 0)
|
|
870
|
+
{
|
|
871
|
+
return (0);
|
|
872
|
+
}
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/////////////////////////////////////////////////////////////////////
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
static proc SimplicialCheckMin (int posiblemin, intmat A, int column, list #)
|
|
883
|
+
"
|
|
884
|
+
USAGE: SimplicialCheckMin(posiblemin,A,column[,last]); posiblemin is an integer,
|
|
885
|
+
A is an integral matrix and column and last are integers.
|
|
886
|
+
RETURN: 1 if posiblemin is less or equal to the minimum value x such that
|
|
887
|
+
x * A_column belongs to the semigroup generated by all the columns of A
|
|
888
|
+
except A_column. It returns 0 otherwise. If an extra parameter last is
|
|
889
|
+
introduced then it will only consider the first n columns of A.
|
|
890
|
+
ASSUME: 1 <= column <= ncols(A), A does not have negative entries or zero columns
|
|
891
|
+
A[i,j] = 0 for all 1 <= i,j <= nrows(A) where i != j
|
|
892
|
+
"
|
|
893
|
+
{
|
|
894
|
+
// If one can write (posiblemin-1)*A_column as a non-trivial combination of the
|
|
895
|
+
// columns of A, then posiblemin is > than the real minimum
|
|
896
|
+
|
|
897
|
+
int last;
|
|
898
|
+
int e = size(#);
|
|
899
|
+
if (e > 0)
|
|
900
|
+
{
|
|
901
|
+
last = #[1];
|
|
902
|
+
}
|
|
903
|
+
else
|
|
904
|
+
{
|
|
905
|
+
last = ncols(A);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
int i, j, k, l;
|
|
909
|
+
intvec d, v;
|
|
910
|
+
for (i = 1; i <= nrows(A); i++)
|
|
911
|
+
{
|
|
912
|
+
d[i] = A[i,i];
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
for (i = 1; i <= nrows(A); i++)
|
|
916
|
+
{
|
|
917
|
+
v[i] = A[i,column] * (posiblemin-1);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
i = 1;
|
|
921
|
+
while ((i < nrows(v)) && (v[i] % d[i] == 0))
|
|
922
|
+
{
|
|
923
|
+
i++;
|
|
924
|
+
}
|
|
925
|
+
if (v[i] % d[i] == 0)
|
|
926
|
+
{
|
|
927
|
+
// v is a combination of the first nrows(A) columns
|
|
928
|
+
return(0);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
int aux;
|
|
932
|
+
for (i = 1; i <= nrows(A); i++)
|
|
933
|
+
{
|
|
934
|
+
aux = A[i,nrows(A)+1];
|
|
935
|
+
A[i,nrows(A)+1] = A[i,column];
|
|
936
|
+
A[i,column] = aux;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
for (i = nrows(A) + 2; i <= last; i++)
|
|
940
|
+
{
|
|
941
|
+
for (j = 1; j <= nrows(v); j++)
|
|
942
|
+
{
|
|
943
|
+
if (A[j,i] > v[j])
|
|
944
|
+
{
|
|
945
|
+
for (k = 1; k <= nrows(A); k++)
|
|
946
|
+
{
|
|
947
|
+
A[k,i] = A[k,last];
|
|
948
|
+
}
|
|
949
|
+
last--;
|
|
950
|
+
i--;
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
intvec order;
|
|
957
|
+
order[last] = 0;
|
|
958
|
+
for (i = nrows(A) + 1; i <= last; i++)
|
|
959
|
+
{
|
|
960
|
+
order[i] = 1;
|
|
961
|
+
for (j = 1; j <= nrows(A); j++)
|
|
962
|
+
{
|
|
963
|
+
if (A[j,i] > 0)
|
|
964
|
+
{
|
|
965
|
+
order[i] = lcm(order[i], d[j] div gcd(A[j,i],d[j]));
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
if (order[nrows(A)+1] < posiblemin-1)
|
|
972
|
+
{
|
|
973
|
+
return (0);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
order[nrows(A)+1] = posiblemin-1;
|
|
977
|
+
|
|
978
|
+
intvec counters;
|
|
979
|
+
counters[last] = 0;
|
|
980
|
+
|
|
981
|
+
// A full enumeration is performed
|
|
982
|
+
while(1)
|
|
983
|
+
{
|
|
984
|
+
i = last;
|
|
985
|
+
while (1)
|
|
986
|
+
{
|
|
987
|
+
j = 1;
|
|
988
|
+
if (counters[i] < order[i] - 1)
|
|
989
|
+
{
|
|
990
|
+
while ((j < nrows(A)) and (v[j] >= A[j,i]))
|
|
991
|
+
{
|
|
992
|
+
j++;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
if ((v[j] < A[j,i])||(counters[i] == order[i] - 1))
|
|
996
|
+
{
|
|
997
|
+
// A_j is not < v componentwise or counters = order[i]-1
|
|
998
|
+
// we cannot increase counters[i]
|
|
999
|
+
if (counters[i] != 0)
|
|
1000
|
+
{
|
|
1001
|
+
for (k = 1; k <= nrows(v); k++)
|
|
1002
|
+
{
|
|
1003
|
+
v[k] = v[k] + counters[i] * A[k,i];
|
|
1004
|
+
}
|
|
1005
|
+
counters[i] = 0;
|
|
1006
|
+
}
|
|
1007
|
+
i--;
|
|
1008
|
+
if (i <= nrows(A))
|
|
1009
|
+
{
|
|
1010
|
+
// A*x = v has not nonnegative integral solution different
|
|
1011
|
+
// from the trivial one
|
|
1012
|
+
return(1);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
else
|
|
1016
|
+
{
|
|
1017
|
+
// j = nrows(A), then A_j < v (componentwise)
|
|
1018
|
+
// we add one unit to counters[i]
|
|
1019
|
+
for (k = 1; k <= nrows(v); k++)
|
|
1020
|
+
{
|
|
1021
|
+
v[k] = v[k] - A[k,i];
|
|
1022
|
+
}
|
|
1023
|
+
counters[i] = counters[i] + 1;
|
|
1024
|
+
|
|
1025
|
+
l = 1;
|
|
1026
|
+
while ((l < nrows(v)) and (v[l] % d[l] == 0))
|
|
1027
|
+
{
|
|
1028
|
+
l++;
|
|
1029
|
+
}
|
|
1030
|
+
if (v[l] % d[l] == 0)
|
|
1031
|
+
{
|
|
1032
|
+
// v is a combination of the first nrows(A) columns
|
|
1033
|
+
return(0);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
/////////////////////////////////////////////////////////////////////
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
static proc Proportional(intvec a, intvec b)
|
|
1048
|
+
"
|
|
1049
|
+
USAGE: Proportional(a,b); a,b integral vectors
|
|
1050
|
+
RETURN: 1 if nrows(a) = nrows(b) and the vectors a and b are proportional;
|
|
1051
|
+
this is, there exist a rational number k such that k*a = b, and
|
|
1052
|
+
0 otherwise
|
|
1053
|
+
ASSUME: a, b are nonzero vectors
|
|
1054
|
+
"
|
|
1055
|
+
{
|
|
1056
|
+
|
|
1057
|
+
if (nrows(a) != nrows(b))
|
|
1058
|
+
{
|
|
1059
|
+
return (0)
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
int i, pivot;
|
|
1063
|
+
pivot = 1;
|
|
1064
|
+
while (a[pivot] == 0)
|
|
1065
|
+
{
|
|
1066
|
+
if (b[pivot] != 0)
|
|
1067
|
+
{
|
|
1068
|
+
// Not proportional
|
|
1069
|
+
return (0);
|
|
1070
|
+
}
|
|
1071
|
+
pivot++;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
if (b[pivot] == 0)
|
|
1075
|
+
{
|
|
1076
|
+
// Not proportional
|
|
1077
|
+
return (0);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
for (i = pivot + 1; i <= nrows(a); i++)
|
|
1081
|
+
{
|
|
1082
|
+
if (a[i] * b[pivot] != a[pivot] * b[i])
|
|
1083
|
+
{
|
|
1084
|
+
// Not proportional
|
|
1085
|
+
return (0);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
return (1);
|
|
1089
|
+
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/////////////////////////////////////////////////////////////////////
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
static proc StimatesMin(intmat A, int column, intvec line, list #)
|
|
1096
|
+
"
|
|
1097
|
+
USAGE: StimatesMin(A,column,line[,n]); A is an integral matrix, column is
|
|
1098
|
+
an integer, line is an integral vector and n is an integer.
|
|
1099
|
+
RETURN: The minimum integer k such that k * A_column belongs to the
|
|
1100
|
+
semigroup generated by all the columns of A except A_column. It
|
|
1101
|
+
returns 0 if it is not necessary to compute for the main program.
|
|
1102
|
+
If an extra parameter n is introuduced it considers the first n
|
|
1103
|
+
columns of A.
|
|
1104
|
+
ASSUME: 1 <= column [<= n] <= ncols(A), A has nonnegative entries, line is
|
|
1105
|
+
a vector such that line[i] = line[j] if and only if the i-th and
|
|
1106
|
+
j-th columns of A are proportional
|
|
1107
|
+
"
|
|
1108
|
+
{
|
|
1109
|
+
|
|
1110
|
+
int last;
|
|
1111
|
+
int e = size(#);
|
|
1112
|
+
if (e > 0)
|
|
1113
|
+
{
|
|
1114
|
+
last = #[1];
|
|
1115
|
+
}
|
|
1116
|
+
else
|
|
1117
|
+
{
|
|
1118
|
+
last = nrows(line);
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
intvec current;
|
|
1122
|
+
int i,j,k;
|
|
1123
|
+
for (i = 1; i <= nrows(A); i++)
|
|
1124
|
+
{
|
|
1125
|
+
current[i] = A[i,column];
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
int nonzero = 1;
|
|
1129
|
+
while (current[nonzero] == 0)
|
|
1130
|
+
{
|
|
1131
|
+
nonzero++;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// We will only consider those columns A_j such that line[j] = line[column]
|
|
1135
|
+
intvec prop, jthcolumn;
|
|
1136
|
+
for (j = 1; j <= last; j++)
|
|
1137
|
+
{
|
|
1138
|
+
if (j != column)
|
|
1139
|
+
{
|
|
1140
|
+
if (line[column] == line[j])
|
|
1141
|
+
{
|
|
1142
|
+
prop[nrows(prop)+1] = A[nonzero,j];
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
int posiblemin = 0;
|
|
1147
|
+
if (prop[nrows(prop)] > 0)
|
|
1148
|
+
{
|
|
1149
|
+
// 1-dim minimum
|
|
1150
|
+
posiblemin = minMult(current[nonzero],prop);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
if (line[column] <= nrows(A))
|
|
1154
|
+
{
|
|
1155
|
+
// It is not necessary to do CheckMin
|
|
1156
|
+
return(posiblemin);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
if (posiblemin > 0)
|
|
1161
|
+
{
|
|
1162
|
+
if (SimplicialCheckMin(posiblemin, A, column, last))
|
|
1163
|
+
{
|
|
1164
|
+
// It is the real minimum, otherwise minimum < posiblemin
|
|
1165
|
+
return (posiblemin);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
// Not necessary to compute the minimum explicitly
|
|
1169
|
+
return (0);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/////////////////////////////////////////////////////////////////////
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
proc isCI(intmat A)
|
|
1176
|
+
"
|
|
1177
|
+
USAGE: isCI(A); A is an integral matrix
|
|
1178
|
+
RETURN: 1 if the simplicial toric ideal I(A) is a complete intersection
|
|
1179
|
+
and 0 otherwise. If printlevel > 0 and I(A) is a complete
|
|
1180
|
+
intersection it also shows a minimal set of generators of I(A)
|
|
1181
|
+
ASSUME: A is an m x n integral matrix with nonnegative entries and for
|
|
1182
|
+
every 1 <= i <= m, there exist a column in A whose i-th coordinate
|
|
1183
|
+
is not null and the rest are 0.
|
|
1184
|
+
EXAMPLE: example isCI; shows some examples
|
|
1185
|
+
"
|
|
1186
|
+
{
|
|
1187
|
+
//--------------------------- initialisation ---------------------------------
|
|
1188
|
+
|
|
1189
|
+
intvec d;
|
|
1190
|
+
intvec minimum;
|
|
1191
|
+
intvec swap; // swap[i] = j if and only if the i-th column of B equals the j-th column of A
|
|
1192
|
+
intvec line; // line[i] = line[j] if and only if the i-th and the j-th column of B are proportional
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
int n, m; // Size of the input
|
|
1196
|
+
int i,j,k,l,t;
|
|
1197
|
+
|
|
1198
|
+
n = ncols(A);
|
|
1199
|
+
m = nrows(A);
|
|
1200
|
+
intmat B[m][n]; // auxiliary matrix
|
|
1201
|
+
intmat support[2*n-m][n]; // support[i,j] = 1 if and only if a_j belongs to V_i
|
|
1202
|
+
if (printlevel > 0)
|
|
1203
|
+
{
|
|
1204
|
+
ring r = 0,x(1..n),dp;
|
|
1205
|
+
ideal toric; // In case I(A) is a complete intersection, we obtain a
|
|
1206
|
+
// minimal set of generators
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
for (i = 1; i <= n; i++)
|
|
1210
|
+
{
|
|
1211
|
+
int zero = 0;
|
|
1212
|
+
swap[i] = i;
|
|
1213
|
+
for (j = 1; j <= m; j++)
|
|
1214
|
+
{
|
|
1215
|
+
B[j,i] = A[j,i];
|
|
1216
|
+
if (B[j,i] > 0)
|
|
1217
|
+
{
|
|
1218
|
+
zero++;
|
|
1219
|
+
}
|
|
1220
|
+
if (B[j,i] < 0)
|
|
1221
|
+
{
|
|
1222
|
+
print("// There are negative entries in the matrix");
|
|
1223
|
+
return (0);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
if (zero == 0)
|
|
1227
|
+
{
|
|
1228
|
+
print ("// There is a zero column in the matrix");
|
|
1229
|
+
return (0);
|
|
1230
|
+
}
|
|
1231
|
+
kill zero;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
//--------------------------- preprocessing the input ---------------------------------
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
int aux, found;
|
|
1238
|
+
|
|
1239
|
+
// We write B in a standard form; this is, for 1 <= i,j <= m, j != i then B[i,j] = 0
|
|
1240
|
+
for (i = 1; i <= m; i++)
|
|
1241
|
+
{
|
|
1242
|
+
j = i;
|
|
1243
|
+
found = 0;
|
|
1244
|
+
while (j <= n)
|
|
1245
|
+
{
|
|
1246
|
+
if (B[i,j] != 0)
|
|
1247
|
+
{
|
|
1248
|
+
k = 1;
|
|
1249
|
+
while ((k == i)||(B[k,j] == 0))
|
|
1250
|
+
{
|
|
1251
|
+
k++;
|
|
1252
|
+
if (k == m+1)
|
|
1253
|
+
{
|
|
1254
|
+
for (l = 1; l <= m; l++)
|
|
1255
|
+
{
|
|
1256
|
+
aux = B[l,j];
|
|
1257
|
+
B[l,j] = B[l,i];
|
|
1258
|
+
B[l,i] = aux;
|
|
1259
|
+
}
|
|
1260
|
+
aux = swap[j];
|
|
1261
|
+
swap[j] = swap[i];
|
|
1262
|
+
swap[i] = aux;
|
|
1263
|
+
found = 1;
|
|
1264
|
+
break;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
if (found == 1)
|
|
1269
|
+
{
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1272
|
+
j++;
|
|
1273
|
+
}
|
|
1274
|
+
if (j == n+1)
|
|
1275
|
+
{
|
|
1276
|
+
print("// There exists an i such that no column in A has the i-th coordinate positive and the rest are 0.");
|
|
1277
|
+
// It is not simplicial
|
|
1278
|
+
return (0);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
// Initialisation of variables
|
|
1283
|
+
int numgens = 0; // number of generators built
|
|
1284
|
+
|
|
1285
|
+
for (i = 1; i <= n; i++)
|
|
1286
|
+
{
|
|
1287
|
+
support[i,i] = 1;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
intvec ithcolumn, jthcolumn, belong;
|
|
1291
|
+
int numcols = ncols(B);
|
|
1292
|
+
line[numcols] = 0;
|
|
1293
|
+
|
|
1294
|
+
// line[i] = line[j] if and only if B_i and B_j are proportional.
|
|
1295
|
+
// Moreover for i = 1,...,nrows(B) we have that line[i]= i
|
|
1296
|
+
for (i = 1; i <= numcols; i++)
|
|
1297
|
+
{
|
|
1298
|
+
if (line[i] == 0)
|
|
1299
|
+
{
|
|
1300
|
+
for (j = 1; j <= nrows(B); j++)
|
|
1301
|
+
{
|
|
1302
|
+
ithcolumn[j] = B[j,i];
|
|
1303
|
+
}
|
|
1304
|
+
line[i] = i;
|
|
1305
|
+
for (j = i+1; j <= numcols; j++)
|
|
1306
|
+
{
|
|
1307
|
+
for (k = 1; k <= nrows(B); k++)
|
|
1308
|
+
{
|
|
1309
|
+
jthcolumn[k] = B[k,j];
|
|
1310
|
+
}
|
|
1311
|
+
if (Proportional(ithcolumn, jthcolumn))
|
|
1312
|
+
{
|
|
1313
|
+
line[j] = i;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
//----------------- We apply reduction ---------------
|
|
1320
|
+
|
|
1321
|
+
bigint det1, det2;
|
|
1322
|
+
int minim, swapiold, lineiold;
|
|
1323
|
+
int change = 1;
|
|
1324
|
+
|
|
1325
|
+
det1 = cardGroup(B,numcols);
|
|
1326
|
+
while (change == 1)
|
|
1327
|
+
{
|
|
1328
|
+
change = 0;
|
|
1329
|
+
for (i = 1; i <= numcols; i++)
|
|
1330
|
+
{
|
|
1331
|
+
for (j = 1; j <= m; j++)
|
|
1332
|
+
{
|
|
1333
|
+
ithcolumn[j] = B[j,i];
|
|
1334
|
+
B[j,i] = B[j,numcols];
|
|
1335
|
+
}
|
|
1336
|
+
swapiold = swap[i];
|
|
1337
|
+
swap[i] = swap[numcols];
|
|
1338
|
+
lineiold = line[i];
|
|
1339
|
+
line[i] = line[numcols];
|
|
1340
|
+
det2 = cardGroup(B,numcols-1);
|
|
1341
|
+
minim = int(det2/det1);
|
|
1342
|
+
if (lineiold > m)
|
|
1343
|
+
{
|
|
1344
|
+
belong = SBelongSemigroup(minim*ithcolumn,B,numcols-1);
|
|
1345
|
+
if (belong != 0)
|
|
1346
|
+
{
|
|
1347
|
+
// It belongs, we remove the ith column
|
|
1348
|
+
if (printlevel > 0)
|
|
1349
|
+
{
|
|
1350
|
+
// Create a generator
|
|
1351
|
+
poly mon1 = x(swapiold)^(minim);
|
|
1352
|
+
poly mon2 = 1;
|
|
1353
|
+
for (j = 1; j <= nrows(belong); j++)
|
|
1354
|
+
{
|
|
1355
|
+
mon2 = mon2 * x(swap[j])^(belong[j]);
|
|
1356
|
+
}
|
|
1357
|
+
toric = toric, mon1-mon2;
|
|
1358
|
+
kill mon1;
|
|
1359
|
+
kill mon2;
|
|
1360
|
+
}
|
|
1361
|
+
det1 = det2;
|
|
1362
|
+
change = 1;
|
|
1363
|
+
numgens++;
|
|
1364
|
+
numcols--;
|
|
1365
|
+
i--;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
else
|
|
1369
|
+
{
|
|
1370
|
+
// line[i] <= m
|
|
1371
|
+
intvec semigroup, supportmon;
|
|
1372
|
+
int position;
|
|
1373
|
+
for (j = 1; j <= numcols-1; j++)
|
|
1374
|
+
{
|
|
1375
|
+
if (line[j] == lineiold)
|
|
1376
|
+
{
|
|
1377
|
+
position = j;
|
|
1378
|
+
semigroup = semigroup, B[lineiold,j];
|
|
1379
|
+
supportmon = supportmon, swap[j];
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
if (semigroup == 0)
|
|
1383
|
+
{
|
|
1384
|
+
belong = 0;
|
|
1385
|
+
}
|
|
1386
|
+
else
|
|
1387
|
+
{
|
|
1388
|
+
semigroup = semigroup[2..nrows(semigroup)];
|
|
1389
|
+
supportmon = supportmon[2..nrows(supportmon)];
|
|
1390
|
+
belong = oneDimBelongSemigroup(minim*ithcolumn[lineiold],semigroup);
|
|
1391
|
+
}
|
|
1392
|
+
if (belong != 0)
|
|
1393
|
+
{
|
|
1394
|
+
// It belongs, we remove the ith column
|
|
1395
|
+
if (printlevel > 0)
|
|
1396
|
+
{
|
|
1397
|
+
// We create a generator
|
|
1398
|
+
poly mon1,mon2;
|
|
1399
|
+
mon1 = x(swapiold)^(minim);
|
|
1400
|
+
mon2 = 1;
|
|
1401
|
+
for (j = 1; j <= nrows(supportmon); j++)
|
|
1402
|
+
{
|
|
1403
|
+
mon2 = mon2 * x(supportmon[j])^(belong[j]);
|
|
1404
|
+
}
|
|
1405
|
+
toric = toric, mon1-mon2;
|
|
1406
|
+
kill mon1, mon2;
|
|
1407
|
+
}
|
|
1408
|
+
det1 = det2;
|
|
1409
|
+
numcols--;
|
|
1410
|
+
numgens++;
|
|
1411
|
+
change = 1;
|
|
1412
|
+
if (i <= m)
|
|
1413
|
+
{
|
|
1414
|
+
// We put again B in standard form
|
|
1415
|
+
if (position != i)
|
|
1416
|
+
{
|
|
1417
|
+
for (j = 1; j <= m; j++)
|
|
1418
|
+
{
|
|
1419
|
+
aux = B[j,position];
|
|
1420
|
+
B[j,position] = B[j,i];
|
|
1421
|
+
B[j,i] = aux;
|
|
1422
|
+
}
|
|
1423
|
+
aux = swap[i];
|
|
1424
|
+
swap[i] = swap[position];
|
|
1425
|
+
swap[position] = aux;
|
|
1426
|
+
aux = line[i];
|
|
1427
|
+
line[i] = line[position];
|
|
1428
|
+
line[position] = aux;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
i--;
|
|
1432
|
+
}
|
|
1433
|
+
kill position;
|
|
1434
|
+
kill semigroup;
|
|
1435
|
+
kill supportmon;
|
|
1436
|
+
}
|
|
1437
|
+
if (belong == 0)
|
|
1438
|
+
{
|
|
1439
|
+
for (j = 1; j <= m; j++)
|
|
1440
|
+
{
|
|
1441
|
+
B[j,i] = ithcolumn[j];
|
|
1442
|
+
}
|
|
1443
|
+
swap[i] = swapiold;
|
|
1444
|
+
line[i] = lineiold;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
// Initialisation of variables
|
|
1450
|
+
minimum[numcols] = 0;
|
|
1451
|
+
|
|
1452
|
+
//----------------- We run the first part of the algorithm ---------------
|
|
1453
|
+
|
|
1454
|
+
// Estimation of m_i with i = 1,...,n
|
|
1455
|
+
for (i = 1; i <= numcols; i++)
|
|
1456
|
+
{
|
|
1457
|
+
minimum[i] = StimatesMin(B,i,line,numcols);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
int nonzero;
|
|
1461
|
+
int stagenumber = 0;
|
|
1462
|
+
change = 1;
|
|
1463
|
+
while (change == 1)
|
|
1464
|
+
{
|
|
1465
|
+
// If for every i,j we have that m_i*B_i != m_j*B_j we leave the while loop
|
|
1466
|
+
change = 0;
|
|
1467
|
+
for (i = 1; (i <= numcols) && (change == 0); i++)
|
|
1468
|
+
{
|
|
1469
|
+
if (minimum[i] != 0)
|
|
1470
|
+
{
|
|
1471
|
+
for (j = i+1; (j <= numcols) && (change == 0); j++)
|
|
1472
|
+
{
|
|
1473
|
+
if ((minimum[j] != 0)&&(line[i] == line[j]))
|
|
1474
|
+
{
|
|
1475
|
+
// We look for a nonzero entry in B_i
|
|
1476
|
+
nonzero = 1;
|
|
1477
|
+
while (B[nonzero,i] == 0)
|
|
1478
|
+
{
|
|
1479
|
+
nonzero++;
|
|
1480
|
+
}
|
|
1481
|
+
if (minimum[i]*B[nonzero,i] == minimum[j]*B[nonzero,j])
|
|
1482
|
+
{
|
|
1483
|
+
// m_i b_i = m_j b_j
|
|
1484
|
+
numgens++;
|
|
1485
|
+
stagenumber++;
|
|
1486
|
+
if (swap[i] <= n)
|
|
1487
|
+
{
|
|
1488
|
+
// For k = swap[i], we have that V_k = {b_i}, so m_i b_i belongs to V_k
|
|
1489
|
+
if (printlevel > 0)
|
|
1490
|
+
{
|
|
1491
|
+
poly mon1 = x(swap[i])^(minimum[i]);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
else
|
|
1495
|
+
{
|
|
1496
|
+
// We check whether m_i b_i belongs to the semigroup generated by V_k
|
|
1497
|
+
// where k = swap[i]. All vectors in V_k are proportional to b_i
|
|
1498
|
+
intvec checkbelong;
|
|
1499
|
+
int miai;
|
|
1500
|
+
intvec supporti;
|
|
1501
|
+
miai = minimum[i]*B[nonzero,i];
|
|
1502
|
+
for (k = 1; k <= n; k++)
|
|
1503
|
+
{
|
|
1504
|
+
if (support[swap[i],k])
|
|
1505
|
+
{
|
|
1506
|
+
supporti = supporti, k;
|
|
1507
|
+
checkbelong[nrows(supporti)-1] = A[nonzero,k];
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
// 1-dim belong semigroup
|
|
1511
|
+
belong = oneDimBelongSemigroup(miai,checkbelong);
|
|
1512
|
+
if (belong == 0)
|
|
1513
|
+
{
|
|
1514
|
+
// It does not belong
|
|
1515
|
+
print ("// It is NOT a complete intersection");
|
|
1516
|
+
return (0);
|
|
1517
|
+
}
|
|
1518
|
+
if (printlevel > 0)
|
|
1519
|
+
{
|
|
1520
|
+
poly mon1 = 1;
|
|
1521
|
+
// It belongs, we construct a monomial of the new generator
|
|
1522
|
+
for (k = 1; k < nrows(supporti); k++)
|
|
1523
|
+
{
|
|
1524
|
+
mon1 = mon1 * x(supporti[k+1])^(belong[k]);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
kill miai;
|
|
1528
|
+
kill checkbelong;
|
|
1529
|
+
kill supporti;
|
|
1530
|
+
}
|
|
1531
|
+
if (swap[j] <= n)
|
|
1532
|
+
{
|
|
1533
|
+
// For k = swap[j], we have that V_k = {b_j}, so m_j b_j belongs to V_k
|
|
1534
|
+
if (printlevel > 0)
|
|
1535
|
+
{
|
|
1536
|
+
poly mon2 = x(swap[j])^(minimum[j]);
|
|
1537
|
+
toric = toric, mon1-mon2;
|
|
1538
|
+
kill mon1;
|
|
1539
|
+
kill mon2;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
else
|
|
1543
|
+
{
|
|
1544
|
+
// We check whether m_j b_j belongs to the semigroup generated by V_k
|
|
1545
|
+
// where k = swap[j]. All vectors in V_k are proportional to b_j
|
|
1546
|
+
intvec checkbelong;
|
|
1547
|
+
int mjaj;
|
|
1548
|
+
intvec supportj;
|
|
1549
|
+
nonzero = 1;
|
|
1550
|
+
while (B[nonzero,j] == 0)
|
|
1551
|
+
{
|
|
1552
|
+
nonzero++;
|
|
1553
|
+
}
|
|
1554
|
+
mjaj = minimum[j]*B[nonzero,j];
|
|
1555
|
+
for (k = 1; k <= n; k++)
|
|
1556
|
+
{
|
|
1557
|
+
if (support[swap[j],k])
|
|
1558
|
+
{
|
|
1559
|
+
supportj = supportj, k;
|
|
1560
|
+
checkbelong[nrows(supportj)-1] = A[nonzero,k];
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
// 1-dim belong semigroup
|
|
1564
|
+
belong = oneDimBelongSemigroup(mjaj,checkbelong);
|
|
1565
|
+
if (belong == 0)
|
|
1566
|
+
{
|
|
1567
|
+
// It does not belong
|
|
1568
|
+
print ("// It is NOT a complete intersection");
|
|
1569
|
+
return (0);
|
|
1570
|
+
}
|
|
1571
|
+
if (printlevel > 0)
|
|
1572
|
+
{
|
|
1573
|
+
poly mon2 = 1;
|
|
1574
|
+
// It belongs, we construct the second monomial of the generator
|
|
1575
|
+
for (k = 1; k < nrows(supportj); k++)
|
|
1576
|
+
{
|
|
1577
|
+
mon2 = mon2 * x(supportj[k+1])^(belong[k]);
|
|
1578
|
+
}
|
|
1579
|
+
toric = toric,mon1-mon2;
|
|
1580
|
+
kill mon1;
|
|
1581
|
+
kill mon2;
|
|
1582
|
+
}
|
|
1583
|
+
kill checkbelong;
|
|
1584
|
+
kill mjaj;
|
|
1585
|
+
kill supportj;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
// Now we remove b_i, b_j from B and we add gcd(b_i,b_j)
|
|
1589
|
+
change = 1;
|
|
1590
|
+
for (k = 1; k <= n; k++)
|
|
1591
|
+
{
|
|
1592
|
+
// V_{support.nrows} = V_i + V_j
|
|
1593
|
+
support[n+stagenumber,k] = support[swap[i],k] + support[swap[j],k];
|
|
1594
|
+
}
|
|
1595
|
+
// line[i] does not change
|
|
1596
|
+
line[j] = line[numcols];
|
|
1597
|
+
swap[i] = n+stagenumber;
|
|
1598
|
+
swap[j] = swap[numcols];
|
|
1599
|
+
k = 1;
|
|
1600
|
+
while (B[k,i] == 0)
|
|
1601
|
+
{
|
|
1602
|
+
k++;
|
|
1603
|
+
}
|
|
1604
|
+
int dp;
|
|
1605
|
+
dp = gcd(B[k,i], B[k,j]);
|
|
1606
|
+
int factor = B[k,i] div dp;
|
|
1607
|
+
B[k,i] = dp;
|
|
1608
|
+
k++;
|
|
1609
|
+
kill dp;
|
|
1610
|
+
while (k <= nrows(B))
|
|
1611
|
+
{
|
|
1612
|
+
B[k,i] = B[k,i] / factor;
|
|
1613
|
+
k++;
|
|
1614
|
+
}
|
|
1615
|
+
kill factor;
|
|
1616
|
+
for (k = 1; k <= nrows(B); k++)
|
|
1617
|
+
{
|
|
1618
|
+
B[k,j] = B[k,numcols];
|
|
1619
|
+
}
|
|
1620
|
+
minimum[j] = minimum[numcols];
|
|
1621
|
+
numcols--;
|
|
1622
|
+
// We compute a new m_i
|
|
1623
|
+
minimum[i] = StimatesMin(B,i,line,numcols);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
//--------------------------- We apply reduction ---------------------------------
|
|
1632
|
+
|
|
1633
|
+
intvec minZ;
|
|
1634
|
+
for (i = 1; i <= n+stagenumber; i++)
|
|
1635
|
+
{
|
|
1636
|
+
minZ[i] = 1;
|
|
1637
|
+
}
|
|
1638
|
+
det1 = cardGroup(B,numcols);
|
|
1639
|
+
int posaux;
|
|
1640
|
+
intvec counters1,counters2;
|
|
1641
|
+
|
|
1642
|
+
while (numgens < n - m)
|
|
1643
|
+
{
|
|
1644
|
+
change = 0;
|
|
1645
|
+
i = nrows(B) + 1;
|
|
1646
|
+
while ((i <= numcols)&&(numgens < n-m))
|
|
1647
|
+
{
|
|
1648
|
+
// The vector we are going to study
|
|
1649
|
+
for (j = 1; j <= nrows(B); j++)
|
|
1650
|
+
{
|
|
1651
|
+
ithcolumn[j] = B[j,i];
|
|
1652
|
+
B[j,i] = B[j,numcols];
|
|
1653
|
+
}
|
|
1654
|
+
posaux = swap[i];
|
|
1655
|
+
swap[i] = swap[numcols];
|
|
1656
|
+
|
|
1657
|
+
numcols--;
|
|
1658
|
+
|
|
1659
|
+
det2 = cardGroup(B,numcols);
|
|
1660
|
+
minim = int(det2/det1);
|
|
1661
|
+
|
|
1662
|
+
if (minim != 1)
|
|
1663
|
+
{
|
|
1664
|
+
// If minimum = 1, we have previously checked that current does not belong to
|
|
1665
|
+
// the semigroup generated by the columns of B.
|
|
1666
|
+
|
|
1667
|
+
for (j = 1; j <= nrows(B); j++)
|
|
1668
|
+
{
|
|
1669
|
+
ithcolumn[j] = ithcolumn[j]*minim;
|
|
1670
|
+
}
|
|
1671
|
+
minZ[posaux] = minim * minZ[posaux];
|
|
1672
|
+
det1 = det2; // det1 *= minimum
|
|
1673
|
+
|
|
1674
|
+
intvec support1, support2;
|
|
1675
|
+
nonzero = 1;
|
|
1676
|
+
while (ithcolumn[nonzero] == 0)
|
|
1677
|
+
{
|
|
1678
|
+
nonzero++;
|
|
1679
|
+
if (nonzero > nrows(ithcolumn))
|
|
1680
|
+
{
|
|
1681
|
+
print("// ERROR");
|
|
1682
|
+
return (0);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
int currentnonzero = ithcolumn[nonzero];
|
|
1686
|
+
intvec B1;
|
|
1687
|
+
for (j = 1; j <= n; j++)
|
|
1688
|
+
{
|
|
1689
|
+
if (support[posaux,j])
|
|
1690
|
+
{
|
|
1691
|
+
// a_j is proportional to b_i = a_posaux
|
|
1692
|
+
support1 = support1, j;
|
|
1693
|
+
B1[nrows(support1)-1] = A[nonzero,j];
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
// 1-dim belongsemigroup
|
|
1697
|
+
counters1 = oneDimBelongSemigroup(currentnonzero, B1);
|
|
1698
|
+
kill currentnonzero;
|
|
1699
|
+
kill B1;
|
|
1700
|
+
if (counters1 != 0)
|
|
1701
|
+
{
|
|
1702
|
+
intmat B2[m][n];
|
|
1703
|
+
// It belongs, now we have to check if current belongs to the semigroup
|
|
1704
|
+
// generated by the columns of B2
|
|
1705
|
+
for (j = 1; j <= numcols; j++)
|
|
1706
|
+
{
|
|
1707
|
+
for (k = 1; k <= n; k++)
|
|
1708
|
+
{
|
|
1709
|
+
if (support[swap[j],k])
|
|
1710
|
+
{
|
|
1711
|
+
// a_k may not be proportional to b_i = a_posaux
|
|
1712
|
+
support2 = support2, k;
|
|
1713
|
+
for (l = 1; l <= m; l++)
|
|
1714
|
+
{
|
|
1715
|
+
B2[l,nrows(support2)-1] = A[l,k];
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
// We write B2 in standard form
|
|
1721
|
+
for (l = 1; l <= m; l++)
|
|
1722
|
+
{
|
|
1723
|
+
j = l;
|
|
1724
|
+
found = 0;
|
|
1725
|
+
while (found == 0)
|
|
1726
|
+
{
|
|
1727
|
+
if (B2[l,j] != 0)
|
|
1728
|
+
{
|
|
1729
|
+
k = 1;
|
|
1730
|
+
while ((k == l)||(B2[k,j] == 0))
|
|
1731
|
+
{
|
|
1732
|
+
k++;
|
|
1733
|
+
if (k == m + 1)
|
|
1734
|
+
{
|
|
1735
|
+
for (t = 1; t <= m; t++)
|
|
1736
|
+
{
|
|
1737
|
+
jthcolumn[t] = B2[t,j];
|
|
1738
|
+
B2[t,j] = B2[t,l];
|
|
1739
|
+
B2[t,l] = jthcolumn[t];
|
|
1740
|
+
}
|
|
1741
|
+
aux = support2[j+1];
|
|
1742
|
+
support2[j+1] = support2[l+1];
|
|
1743
|
+
support2[l+1] = aux;
|
|
1744
|
+
found = 1;
|
|
1745
|
+
break;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
j++;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
// m-dim belong semigroup
|
|
1754
|
+
counters2 = SBelongSemigroup(ithcolumn, B2, nrows(support2)-1);
|
|
1755
|
+
kill B2;
|
|
1756
|
+
|
|
1757
|
+
if (counters2 != 0)
|
|
1758
|
+
{
|
|
1759
|
+
// current belongs, we construct the new generator
|
|
1760
|
+
numgens++;
|
|
1761
|
+
if (printlevel > 0)
|
|
1762
|
+
{
|
|
1763
|
+
poly mon1, mon2;
|
|
1764
|
+
mon1 = 1;
|
|
1765
|
+
mon2 = 1;
|
|
1766
|
+
for (j = 1; j < nrows(support1); j++)
|
|
1767
|
+
{
|
|
1768
|
+
mon1 = mon1 * x(support1[j+1])^(counters1[j]);
|
|
1769
|
+
}
|
|
1770
|
+
for (j = 1; j < nrows(support2); j++)
|
|
1771
|
+
{
|
|
1772
|
+
mon2 = mon2 * x(support2[j+1])^(counters2[j]);
|
|
1773
|
+
}
|
|
1774
|
+
toric = toric, mon1-mon2;
|
|
1775
|
+
kill mon1;
|
|
1776
|
+
kill mon2;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
if (i != numcols)
|
|
1780
|
+
{
|
|
1781
|
+
i--;
|
|
1782
|
+
}
|
|
1783
|
+
change = 1; // We have removed a column of B
|
|
1784
|
+
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
kill support1,support2;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
if ((counters1 == 0)||(counters2 == 0)||(minim == 1))
|
|
1791
|
+
{
|
|
1792
|
+
// We swap again the columns in B
|
|
1793
|
+
for (j = 1; j <= m; j++)
|
|
1794
|
+
{
|
|
1795
|
+
B[j,i] = ithcolumn[j];
|
|
1796
|
+
}
|
|
1797
|
+
numcols++;
|
|
1798
|
+
swap[numcols] = swap[i];
|
|
1799
|
+
swap[i] = posaux;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
if ((i == numcols)&&(change == 0))
|
|
1803
|
+
{
|
|
1804
|
+
print(" // It is NOT a Complete Intersection.");
|
|
1805
|
+
return (0);
|
|
1806
|
+
}
|
|
1807
|
+
i++;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// We have removed all possible columns
|
|
1812
|
+
if (printlevel > 0)
|
|
1813
|
+
{
|
|
1814
|
+
print("// Generators of the toric ideal");
|
|
1815
|
+
toric = simplify(toric,2);
|
|
1816
|
+
toric;
|
|
1817
|
+
}
|
|
1818
|
+
print("// It is a complete intersection");
|
|
1819
|
+
return(1);
|
|
1820
|
+
}
|
|
1821
|
+
example
|
|
1822
|
+
{ "EXAMPLE:"; echo=2;
|
|
1823
|
+
intmat A[2][5] = 60,0,140,150,21,0,60,140,150,21;
|
|
1824
|
+
print(A);
|
|
1825
|
+
printlevel = 0;
|
|
1826
|
+
isCI(A);
|
|
1827
|
+
printlevel = 1;
|
|
1828
|
+
isCI(A);
|
|
1829
|
+
intmat B[3][5] = 12,0,0,1,2,0,10,0,3,2,0,0,8,3,3;
|
|
1830
|
+
print(B);
|
|
1831
|
+
isCI(B);
|
|
1832
|
+
printlevel=0;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
|