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,1132 @@
|
|
|
1
|
+
//////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
version="version maxlike.lib 4.2.0.0 Dec_2020 "; //$Id: 510c99c385374bfd3587ddaaa5a2f9d78af1f8d3 $
|
|
3
|
+
category="Algebraic Statistics";
|
|
4
|
+
info="
|
|
5
|
+
LIBRARY: maxlike.lib Procedures to compute maximum likelihood estimates
|
|
6
|
+
AUTHOR: Adrian Koch (kocha at rhrk.uni-kl.de)
|
|
7
|
+
|
|
8
|
+
REFERENCES:
|
|
9
|
+
Lior Pachter, Bernd Sturmfels; Algebraic Statistics for Computational Biology;
|
|
10
|
+
published by Cambridge University Press
|
|
11
|
+
|
|
12
|
+
PROCEDURES:
|
|
13
|
+
likeIdeal(I,u); the likelihood ideal with respect to I and u
|
|
14
|
+
logHessian(I,u); modified Hessian of the loglikelihood function
|
|
15
|
+
getMaxPoints(Iu,H,prec,[..]); maximum likelihood estimates
|
|
16
|
+
maxPoints(I,u,prec,[..]); maximum likelihood estimates,combines the procedures above
|
|
17
|
+
maxPointsProb(I,u,prec,[..]); maximum likelihood estimates and probability distributions
|
|
18
|
+
|
|
19
|
+
KEYWORDS: algebraic statistics; likelihood ideal; maximum likelihood estimate
|
|
20
|
+
";
|
|
21
|
+
|
|
22
|
+
LIB "presolve.lib";
|
|
23
|
+
LIB "solve.lib";//already loads the matrix.lib
|
|
24
|
+
LIB "sing.lib";
|
|
25
|
+
|
|
26
|
+
static proc onesmat(n,m)
|
|
27
|
+
{//returns an nxm matrix filled with ones
|
|
28
|
+
matrix M[n][m];
|
|
29
|
+
int i,j;
|
|
30
|
+
for(i=1; i<=n; i++)
|
|
31
|
+
{
|
|
32
|
+
for(j=1; j<=m; j++)
|
|
33
|
+
{
|
|
34
|
+
M[i,j]=1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return(M);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
proc likeIdeal(ideal I, intvec u)
|
|
41
|
+
"USAGE: likeIdeal(I,u); ideal I, intvec u
|
|
42
|
+
I represents the algebraic statistical model and u is the data vector under
|
|
43
|
+
considerarion.
|
|
44
|
+
RETURN: ideal: the likelihood ideal with respect to I and u
|
|
45
|
+
EXAMPLE: example likeIdeal; shows an example
|
|
46
|
+
"
|
|
47
|
+
{//I contains the polys f_i giving the alg.stat.model: theta -> (f1(theta),...,fm(theta))
|
|
48
|
+
//this is an implementation of the first part of 3.3 MLE, namely pages 102-104
|
|
49
|
+
//i.e. it computes an ideal Iu such that V(Iu) contains all critical points
|
|
50
|
+
//of the parameter-log-likelihood-function given by the polys in I
|
|
51
|
+
//(more precisely, V(Iu) is the smallest
|
|
52
|
+
//variety with that property) (cf. elimination theory)
|
|
53
|
+
//(I must have the same number of elements as u)
|
|
54
|
+
def r=basering;
|
|
55
|
+
int n=nvars(basering);
|
|
56
|
+
int m=size(I);
|
|
57
|
+
ring bigring = 0, (t(1..n),z(1..m)), dp;
|
|
58
|
+
ideal I=fetch(r,I);
|
|
59
|
+
|
|
60
|
+
// here we generate the zf(theta)-part of Ju
|
|
61
|
+
matrix Z=diag(ideal(z(1..m)));
|
|
62
|
+
matrix F=diag(I);
|
|
63
|
+
matrix ZF1=Z*F-diag(1,m);
|
|
64
|
+
ideal J1=ideal(ZF1);
|
|
65
|
+
|
|
66
|
+
//here we generate the theta-part of Ju
|
|
67
|
+
matrix O=onesmat(m,m);
|
|
68
|
+
matrix U=diag(u);
|
|
69
|
+
matrix UZ=O*U*Z;
|
|
70
|
+
//compute the derivatives, but take only the submatrix corresponding to the variables
|
|
71
|
+
//in the original ring (other entries are 0)
|
|
72
|
+
matrix D=jacob(I);
|
|
73
|
+
intvec rD=1..nrows(D);
|
|
74
|
+
intvec cD=1..n;
|
|
75
|
+
matrix Dsub=submat(D,rD,cD);
|
|
76
|
+
matrix S=UZ*Dsub;
|
|
77
|
+
ideal J2=ideal(S);
|
|
78
|
+
|
|
79
|
+
// put the two parts together
|
|
80
|
+
ideal Ju=J1+J2;
|
|
81
|
+
poly el=1;
|
|
82
|
+
int i;
|
|
83
|
+
for(i=1; i<=m; i++)
|
|
84
|
+
{
|
|
85
|
+
el=el*z(i);
|
|
86
|
+
}
|
|
87
|
+
ideal Iu=eliminate(Ju,el);
|
|
88
|
+
setring r;
|
|
89
|
+
ideal Iu=fetch(bigring,Iu);
|
|
90
|
+
return(Iu);
|
|
91
|
+
}
|
|
92
|
+
example
|
|
93
|
+
{ "EXAMPLE:"; echo=2;
|
|
94
|
+
ring r = 0,(x,y),dp;
|
|
95
|
+
poly pA = -10x+2y+25;
|
|
96
|
+
poly pC = 8x-y+25;
|
|
97
|
+
poly pG = 11x-2y+25;
|
|
98
|
+
poly pT = -9x+y+25;
|
|
99
|
+
intvec u = 10,14,15,10;
|
|
100
|
+
ideal I = pA,pC,pG,pT;
|
|
101
|
+
ideal L = likeIdeal(I,u); L;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static proc prodideal(ideal I)
|
|
105
|
+
{//returns the product over all polys in I
|
|
106
|
+
int n=size(I);
|
|
107
|
+
int i;
|
|
108
|
+
poly f=I[1];
|
|
109
|
+
for(i=2; i<=n; i++)
|
|
110
|
+
{
|
|
111
|
+
f=f*I[i];
|
|
112
|
+
}
|
|
113
|
+
return(f);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
proc logHessian(ideal I, intvec u)
|
|
117
|
+
"USAGE: logHessian(I,u); ideal I, intvec u
|
|
118
|
+
I represents the algebraic statistical model and u is the data vector under
|
|
119
|
+
considerarion.
|
|
120
|
+
RETURN: matrix: a modified version of the Hessian matrix of the loglikelihood function
|
|
121
|
+
defined by u and (the given generators of) I.
|
|
122
|
+
NOTE: This matrix has the following property: if it is negative definite at a point,
|
|
123
|
+
then the actual Hessian is also negative definite at that point. The same holds
|
|
124
|
+
for positive definiteness.
|
|
125
|
+
EXAMPLE: example logHessian; shows an example
|
|
126
|
+
"
|
|
127
|
+
{//computes the "Hessian" of the loglikelihoodfunction defined by I and u
|
|
128
|
+
//first we compute the products Fj=prod(f1,...,fm)/fj
|
|
129
|
+
int m=size(I);
|
|
130
|
+
int n=nvars(basering);
|
|
131
|
+
poly F=prodideal(I);
|
|
132
|
+
ideal Fj;
|
|
133
|
+
int j;
|
|
134
|
+
for(j=1; j<=m; j++)
|
|
135
|
+
{
|
|
136
|
+
Fj=Fj+ideal(F/I[j]);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//now, we compute the products of the first partial derivatives for each fj
|
|
140
|
+
matrix J=jacob(I);
|
|
141
|
+
matrix P[n][n];
|
|
142
|
+
list Jprod;
|
|
143
|
+
int i,k;
|
|
144
|
+
poly f;
|
|
145
|
+
for(j=1; j<=m; j++)
|
|
146
|
+
{
|
|
147
|
+
for(i=1; i<=n; i++)
|
|
148
|
+
{
|
|
149
|
+
for(k=i; k<=n; k++)
|
|
150
|
+
{
|
|
151
|
+
f=J[j,i]*J[j,k];
|
|
152
|
+
P[i,k]=f;
|
|
153
|
+
P[k,i]=f;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
Jprod=Jprod+list(P);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//here, we compute the second partial derivatives
|
|
160
|
+
list secondJ=jacob(jacob(I[1]));
|
|
161
|
+
for(j=2; j<=m; j++)
|
|
162
|
+
{
|
|
163
|
+
secondJ=secondJ+list(jacob(jacob(I[j])));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
//finally, we put everything together to get the "Hessian"
|
|
167
|
+
matrix H[n][n];
|
|
168
|
+
f=0;
|
|
169
|
+
for(i=1; i<=n; i++)
|
|
170
|
+
{
|
|
171
|
+
for(k=i; k<=n; k++)
|
|
172
|
+
{
|
|
173
|
+
for(j=1; j<=m; j++)
|
|
174
|
+
{
|
|
175
|
+
f=f+u[j]*Fj[j]*(secondJ[j][i,k]*I[j]-Jprod[j][i,k]);
|
|
176
|
+
}
|
|
177
|
+
H[i,k]=f;
|
|
178
|
+
H[k,i]=f;
|
|
179
|
+
f=0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return(H);
|
|
183
|
+
}
|
|
184
|
+
example
|
|
185
|
+
{ "EXAMPLE:"; echo=2;
|
|
186
|
+
ring r = 0,(x,y),dp;
|
|
187
|
+
poly pA = -10x+2y+25;
|
|
188
|
+
poly pC = 8x-y+25;
|
|
189
|
+
poly pG = 11x-2y+25;
|
|
190
|
+
poly pT = -9x+y+25;
|
|
191
|
+
intvec u = 10,14,15,10;
|
|
192
|
+
ideal I = pA,pC,pG,pT;
|
|
193
|
+
matrix H = logHessian(I,u); H;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static proc is_neg_def(matrix H)
|
|
197
|
+
{//determines whether the given matrix is negative definite
|
|
198
|
+
//returns 1 if it is, 0 if it isn't
|
|
199
|
+
matrix M=H-diag(var(1),ncols(H));
|
|
200
|
+
poly f=det(M);
|
|
201
|
+
list S=laguerre_solve(f);
|
|
202
|
+
//this computes the eigenvalues of H. below, they are checked for neg. definiteness
|
|
203
|
+
int k;
|
|
204
|
+
|
|
205
|
+
//we now check, whether H is negative definite
|
|
206
|
+
//if it is, then we will go through the for-loop completely and return 1 at the end
|
|
207
|
+
//otherwise we return 0
|
|
208
|
+
for(k=1; k<=size(S); k++)
|
|
209
|
+
{
|
|
210
|
+
if(S[k] >= 0)
|
|
211
|
+
{
|
|
212
|
+
return(0);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return(1);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
proc getMaxPoints(ideal Iu, matrix H, int prec, list #)
|
|
221
|
+
"USAGE: getMaxPoints(Iu, H, prec [, \"nodisplay\"]); ideal Iu, matrix H, int prec, int k
|
|
222
|
+
Iu the likelihood ideal, H the (modified) Hessian of the considered algebraic
|
|
223
|
+
statistical model, prec the precision with which to compute the maximum
|
|
224
|
+
likelihood estimates
|
|
225
|
+
RETURN: ring: a complex ring R in which you can find the following two lists:
|
|
226
|
+
- MPOINTS, points in which the loglikelihood function has a local maximum, and
|
|
227
|
+
- LHESSIANS, the (modified) Hessians at those points
|
|
228
|
+
also prints out the points in MPOINTS, unless a fourth argument is given
|
|
229
|
+
NOTE: it is assumed that the likelihood ideal is 0-dimensional
|
|
230
|
+
EXAMPLE: example getMaxPoints; shows an example
|
|
231
|
+
"
|
|
232
|
+
{//goes through the solutions computed by solve and keeps only those which have only
|
|
233
|
+
//(non-negative) real components
|
|
234
|
+
//then it plugs the solutions into the "Hessian" and checks whether or not it is
|
|
235
|
+
//negative definite
|
|
236
|
+
ideal G=groebner(Iu);
|
|
237
|
+
def r=basering;
|
|
238
|
+
int n=nvars(r);
|
|
239
|
+
def s=solve(G,prec,"nodisplay");
|
|
240
|
+
setring s;
|
|
241
|
+
list L;
|
|
242
|
+
list entk;//the k-th entry of SOL
|
|
243
|
+
int c; //will be 1 if we want the entry in our list L, 0 otherwise
|
|
244
|
+
int k,l;
|
|
245
|
+
for(k=1; k<=size(SOL); k++)
|
|
246
|
+
{
|
|
247
|
+
c=1;
|
|
248
|
+
entk=SOL[k];
|
|
249
|
+
for(l=1; l<=size(entk); l++)
|
|
250
|
+
{
|
|
251
|
+
if(impart(entk[l]) != 0)//throw away those with non-zero imaginary part
|
|
252
|
+
{
|
|
253
|
+
c=0;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
if(entk[l] < 0)//and those which are negative
|
|
257
|
+
{
|
|
258
|
+
c=0;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if(c == 1)//is 1 iff all components are real and non-negative
|
|
263
|
+
{
|
|
264
|
+
L=L+list(entk);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
ring R=(complex,prec,i),x(1..n),dp;
|
|
269
|
+
ideal Iu=fetch(r,Iu);
|
|
270
|
+
list L=fetch(s,L);
|
|
271
|
+
list Lk;//k-th entry of L
|
|
272
|
+
matrix H=fetch(r,H);
|
|
273
|
+
matrix Hsubst;
|
|
274
|
+
list hessi;//contains the Hessians with solutions plugged in
|
|
275
|
+
for(k=1; k<=size(L); k++)
|
|
276
|
+
{
|
|
277
|
+
Lk=L[k];
|
|
278
|
+
Hsubst=H;
|
|
279
|
+
for(l=1; l<=size(Lk); l++)
|
|
280
|
+
{
|
|
281
|
+
Hsubst=subst(Hsubst,x(l),Lk[l]);
|
|
282
|
+
}
|
|
283
|
+
hessi=hessi+list(Hsubst);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
//now check all elements of hessi and only keep those which are negative definite
|
|
287
|
+
//also do the respective changes in the list of solutions L
|
|
288
|
+
list hessi2;
|
|
289
|
+
list L2;
|
|
290
|
+
for(k=1; k<=size(L); k++)
|
|
291
|
+
{
|
|
292
|
+
if(1)
|
|
293
|
+
{
|
|
294
|
+
if(is_neg_def(hessi[k]) == 1)
|
|
295
|
+
{
|
|
296
|
+
hessi2=hessi2+list(hessi[k]);
|
|
297
|
+
L2=L2+list(L[k]);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
ring outR=(complex,prec),x(1..n),dp;
|
|
303
|
+
list MPOINTS = imap(R,L2);
|
|
304
|
+
list LHESSIANS = imap(R,hessi2);
|
|
305
|
+
export MPOINTS;
|
|
306
|
+
export LHESSIANS;
|
|
307
|
+
string display="
|
|
308
|
+
// In the ring created by getmaxpoints you can find the lists
|
|
309
|
+
// MPOINTS, containing points in which the loglikelihood function has a local maximum, and
|
|
310
|
+
// LHESSIANS, containing the (modified) Hessians at those points.
|
|
311
|
+
";
|
|
312
|
+
if(size(#)==0) { print(MPOINTS); print(display); }
|
|
313
|
+
return(outR);
|
|
314
|
+
}
|
|
315
|
+
example
|
|
316
|
+
{ "EXAMPLE:"; echo=2;
|
|
317
|
+
ring r = 0,(x,y),dp;
|
|
318
|
+
poly pA = -10x+2y+25;
|
|
319
|
+
poly pC = 8x-y+25;
|
|
320
|
+
poly pG = 11x-2y+25;
|
|
321
|
+
poly pT = -9x+y+25;
|
|
322
|
+
intvec u = 10,14,15,10;
|
|
323
|
+
ideal I = pA,pC,pG,pT;
|
|
324
|
+
ideal L = likeIdeal(I,u);
|
|
325
|
+
matrix H = logHessian(I,u);
|
|
326
|
+
def R = getMaxPoints(L, H, 50);
|
|
327
|
+
setring R;
|
|
328
|
+
MPOINTS;
|
|
329
|
+
LHESSIANS;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
proc maxPoints(ideal I, intvec u, int prec, list #)
|
|
335
|
+
"USAGE: maxPoints(I,u,prec [, \"nodisplay\"]); ideal I, intvec u, int prec
|
|
336
|
+
I represents the algebraic statistical model, u is the data vector under
|
|
337
|
+
considerarion, and prec is the precision to be used in the computations
|
|
338
|
+
RETURN: ring: a complex ring R in which you can find the following two lists:
|
|
339
|
+
- MPOINTS, points in which the loglikelihood function has a local maximum, and
|
|
340
|
+
- LHESSIANS, the (modified) Hessians at those points
|
|
341
|
+
also prints out the points in MPOINTS, unless a fourth argument is given
|
|
342
|
+
NOTE: Just uses likeideal, loghessian and getmaxpoints.
|
|
343
|
+
EXAMPLE: example maxPoints; shows an example
|
|
344
|
+
"
|
|
345
|
+
{
|
|
346
|
+
ideal Iu=likeIdeal(I,u);
|
|
347
|
+
return(getMaxPoints(Iu,logHessian(I,u),prec,#));
|
|
348
|
+
}
|
|
349
|
+
example
|
|
350
|
+
{ "EXAMPLE:"; echo=2;
|
|
351
|
+
ring r = 0,(x,y),dp;
|
|
352
|
+
poly pA = -10x+2y+25;
|
|
353
|
+
poly pC = 8x-y+25;
|
|
354
|
+
poly pG = 11x-2y+25;
|
|
355
|
+
poly pT = -9x+y+25;
|
|
356
|
+
intvec u = 10,14,15,10;
|
|
357
|
+
ideal I = pA,pC,pG,pT;
|
|
358
|
+
def R = maxPoints(I, u, 50);
|
|
359
|
+
setring R;
|
|
360
|
+
MPOINTS;
|
|
361
|
+
LHESSIANS;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
proc maxPointsProb(ideal I, intvec u, int prec, list #)
|
|
366
|
+
"USAGE: maxPointsProb(I,u,prec [, \"nodisplay\"]); ideal I, intvec u, int prec
|
|
367
|
+
I represents the algebraic statistical model, u is the data vector under
|
|
368
|
+
considerarion, and prec is the precision to be used in the computations
|
|
369
|
+
RETURN: ring: a complex ring R in which you can find the following two lists:
|
|
370
|
+
- MPOINTS, points in which the loglikelihood function has a local maximum,
|
|
371
|
+
- LHESSIANS, the (modified) Hessians at those points, and
|
|
372
|
+
- VALS, the resulting probability distributions (that is, the values of the
|
|
373
|
+
polynomials given by I at the points in MPOINTS).
|
|
374
|
+
Also prints out the points in MPOINTS, unless a fourth argument is given.
|
|
375
|
+
NOTE: Does not compute the likelihood ideal via elimination, but rather computes
|
|
376
|
+
the critical points by projection.
|
|
377
|
+
EXAMPLE: example maxPointsProb; shows an example
|
|
378
|
+
"
|
|
379
|
+
{//as opposed to (get)maxpoints, which first eliminates and then solves, this procedure
|
|
380
|
+
//solves and then projects
|
|
381
|
+
//furthermore, it also creates a list of the values the generators of I have at the
|
|
382
|
+
//points in MPOINTS (that is, a list of the probability distributions)
|
|
383
|
+
matrix H=logHessian(I,u);
|
|
384
|
+
def r=basering;
|
|
385
|
+
int n=nvars(basering);
|
|
386
|
+
int m=size(I);
|
|
387
|
+
ring bigring = 0, (t(1..n),z(1..m)), dp;
|
|
388
|
+
ideal I=fetch(r,I);
|
|
389
|
+
|
|
390
|
+
// here we generate the zf(theta)-part of Ju
|
|
391
|
+
matrix Z=diag(ideal(z(1..m)));
|
|
392
|
+
matrix F=diag(I);
|
|
393
|
+
matrix ZF1=Z*F-diag(1,m);
|
|
394
|
+
ideal J1=ideal(ZF1);
|
|
395
|
+
|
|
396
|
+
//here we generate the theta-part of Ju
|
|
397
|
+
matrix O=onesmat(m,m);
|
|
398
|
+
matrix U=diag(u);
|
|
399
|
+
matrix UZ=O*U*Z;
|
|
400
|
+
//compute the derivatives, but take only the submatrix corresponding to the variables
|
|
401
|
+
//in the original ring (other entries are 0)
|
|
402
|
+
matrix D=jacob(I);
|
|
403
|
+
intvec rD=1..nrows(D);
|
|
404
|
+
intvec cD=1..n;
|
|
405
|
+
matrix Dsub=submat(D,rD,cD);
|
|
406
|
+
matrix S=UZ*Dsub;
|
|
407
|
+
ideal J2=ideal(S);
|
|
408
|
+
|
|
409
|
+
// put the two parts together
|
|
410
|
+
ideal Ju=J1+J2;
|
|
411
|
+
def s=solve(Ju,prec,"nodisplay");
|
|
412
|
+
|
|
413
|
+
setring s;
|
|
414
|
+
list L;
|
|
415
|
+
list entk;//the k-th entry of SOL
|
|
416
|
+
int c; //will be 1 if we want the entry in our list L, 0 otherwise
|
|
417
|
+
int k,l;
|
|
418
|
+
for(k=1; k<=size(SOL); k++)
|
|
419
|
+
{
|
|
420
|
+
c=1;
|
|
421
|
+
entk=SOL[k];
|
|
422
|
+
entk=entk[1..n];
|
|
423
|
+
for(l=1; l<=size(entk); l++)
|
|
424
|
+
{
|
|
425
|
+
if(impart(entk[l]) != 0)//throw away those with non-zero imaginary part
|
|
426
|
+
{
|
|
427
|
+
c=0;
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
if(entk[l] < 0)//and those which are negative
|
|
431
|
+
{
|
|
432
|
+
c=0;
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
if(c == 1)//is 1 iff all components are real and non-negative
|
|
437
|
+
{
|
|
438
|
+
L=L+list(entk);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
ring R=(complex,prec,i),x(1..n),dp;
|
|
443
|
+
list L=fetch(s,L);
|
|
444
|
+
list Lk;//k-th entry of L
|
|
445
|
+
matrix H=fetch(r,H);
|
|
446
|
+
matrix Hsubst;
|
|
447
|
+
list hessi;//contains the Hessians with solutions plugged in
|
|
448
|
+
for(k=1; k<=size(L); k++)
|
|
449
|
+
{
|
|
450
|
+
Lk=L[k];
|
|
451
|
+
Hsubst=H;
|
|
452
|
+
for(l=1; l<=size(Lk); l++)
|
|
453
|
+
{
|
|
454
|
+
Hsubst=subst(Hsubst,x(l),Lk[l]);
|
|
455
|
+
}
|
|
456
|
+
hessi=hessi+list(Hsubst);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
//now check all elements of hessi and only keep those which are neg def
|
|
461
|
+
//also do the respective changes in the list of solutions L
|
|
462
|
+
list hessi2;
|
|
463
|
+
list L2;
|
|
464
|
+
for(k=1; k<=size(L); k++)
|
|
465
|
+
{
|
|
466
|
+
if(1)
|
|
467
|
+
{
|
|
468
|
+
if(is_neg_def(hessi[k]) == 1)
|
|
469
|
+
{
|
|
470
|
+
hessi2=hessi2+list(hessi[k]);
|
|
471
|
+
L2=L2+list(L[k]);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
//Output
|
|
478
|
+
ideal I=fetch(r,I);
|
|
479
|
+
list p, vals, VAL;
|
|
480
|
+
int j;
|
|
481
|
+
poly f;
|
|
482
|
+
for(l=1; l<=size(L2); l++)
|
|
483
|
+
{
|
|
484
|
+
p=L2[l];
|
|
485
|
+
for(j=1; j<=size(I); j++)
|
|
486
|
+
{
|
|
487
|
+
f=I[j];
|
|
488
|
+
for(k=1; k<=nvars(basering); k++)
|
|
489
|
+
{
|
|
490
|
+
f=subst(f,var(k),p[k]);
|
|
491
|
+
}
|
|
492
|
+
vals=vals+list(f);
|
|
493
|
+
}
|
|
494
|
+
VAL=VAL+list(vals);
|
|
495
|
+
vals=list();
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
ring outR=(complex,prec),x(1..n),dp;
|
|
499
|
+
list MPOINTS = imap(R,L2);
|
|
500
|
+
list LHESSIANS = imap(R,hessi2);
|
|
501
|
+
list VALS = imap(R,VAL);
|
|
502
|
+
export MPOINTS;
|
|
503
|
+
export LHESSIANS;
|
|
504
|
+
export VALS;
|
|
505
|
+
string display="
|
|
506
|
+
// In the ring created by getmaxpoints you can find the lists
|
|
507
|
+
// MPOINTS, containing points in which the loglikelihood function has a local maximum,
|
|
508
|
+
// LHESSIANS, containing the (modified) Hessians at those points, and
|
|
509
|
+
// VALS, containing the probability distributions at those points.
|
|
510
|
+
";
|
|
511
|
+
if(size(#)==0) { print(MPOINTS); print(display); }
|
|
512
|
+
return(outR);
|
|
513
|
+
}
|
|
514
|
+
example
|
|
515
|
+
{ "EXAMPLE:"; echo=2;
|
|
516
|
+
ring r = 0,(x,y),dp;
|
|
517
|
+
poly pA = -10x+2y+25;
|
|
518
|
+
poly pC = 8x-y+25;
|
|
519
|
+
poly pG = 11x-2y+25;
|
|
520
|
+
poly pT = -9x+y+25;
|
|
521
|
+
intvec u = 10,14,15,10;
|
|
522
|
+
ideal I = pA,pC,pG,pT;
|
|
523
|
+
def R = maxPointsProb(I, u, 50);
|
|
524
|
+
setring R;
|
|
525
|
+
MPOINTS;
|
|
526
|
+
LHESSIANS;
|
|
527
|
+
VALS;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
531
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
532
|
+
/////////////////////////// a few more examples /////////////////////////////////////
|
|
533
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
534
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
535
|
+
//Here, we present an example of a data vector for which the likelihood function has more
|
|
536
|
+
//than one biologically meaningful local maximum.
|
|
537
|
+
//You can generate DNA sequence data, which has this data vector, using Seq-Gen with the
|
|
538
|
+
//following input:
|
|
539
|
+
//Tree: (Taxon1:0.6074796219,Taxon2:4.7911951859,Taxon3:0.5522879636);
|
|
540
|
+
//Seq-Gen options: -mHKY -l7647 -n1 -z28503
|
|
541
|
+
//You can find Seq-Gen at http://tree.bio.ed.ac.uk/software/seqgen/
|
|
542
|
+
//
|
|
543
|
+
//- write(":w ThreeTaxonClaw.tree",
|
|
544
|
+
//- "(Taxon1:0.6074796219,Taxon2:4.7911951859,Taxon3:0.5522879636);");
|
|
545
|
+
//- int i=system("sh",
|
|
546
|
+
//- "seq-gen -mHKY -l7647 -n1 -z28503 -q < ThreeTaxonClaw.tree > ThreeTaxonC
|
|
547
|
+
//law.dat");
|
|
548
|
+
//- intvec u=getintvec("ThreeTaxonClaw.dat");
|
|
549
|
+
//
|
|
550
|
+
|
|
551
|
+
/*
|
|
552
|
+
proc bad_seq_gen_example()
|
|
553
|
+
{
|
|
554
|
+
ring R = 0,(mu1,mu2,mu3),dp;
|
|
555
|
+
poly f1 = mu1*mu2*mu3 + 3*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
556
|
+
poly f2 = 6*mu1*1/3*(1-mu2)*1/3*(1-mu3) + 6*1/3*(1-mu1)*mu2*1/3*(1-mu3) +
|
|
557
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*mu3 + 6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
558
|
+
poly f3 = 3*mu1*mu2*1/3*(1-mu3) + 3*1/3*(1-mu1)*1/3*(1-mu2)*mu3 +
|
|
559
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
560
|
+
poly f4 = 3*mu1*1/3*(1-mu2)*mu3 + 3*1/3*(1-mu1)*mu2*1/3*(1-mu3) +
|
|
561
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
562
|
+
poly f5 = 3*1/3*(1-mu1)*mu2*mu3 + 3*mu1*1/3*(1-mu2)*1/3*(1-mu3) +
|
|
563
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
564
|
+
ideal I = f1,f2,f3,f4,f5;
|
|
565
|
+
intvec u = 770,2234,1156,2331,1156;
|
|
566
|
+
maxPoints(I,u,50);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
proc bad_seq_gen_example2()
|
|
571
|
+
{//same example, but a different method of computing the local maxima
|
|
572
|
+
ring bigring = 0,(mu1,mu2,mu3,z1,z2,z3,z4,z5),dp;
|
|
573
|
+
poly f1 = mu1*mu2*mu3 + 3*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
574
|
+
poly f2 = 6*mu1*1/3*(1-mu2)*1/3*(1-mu3) + 6*1/3*(1-mu1)*mu2*1/3*(1-mu3) +
|
|
575
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*mu3 + 6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
576
|
+
poly f3 = 3*mu1*mu2*1/3*(1-mu3) + 3*1/3*(1-mu1)*1/3*(1-mu2)*mu3 +
|
|
577
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
578
|
+
poly f4 = 3*mu1*1/3*(1-mu2)*mu3 + 3*1/3*(1-mu1)*mu2*1/3*(1-mu3) +
|
|
579
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
580
|
+
poly f5 = 3*1/3*(1-mu1)*mu2*mu3 + 3*mu1*1/3*(1-mu2)*1/3*(1-mu3) +
|
|
581
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
582
|
+
ideal I = f1,f2,f3,f4,f5;
|
|
583
|
+
intvec u=770,2234,1156,2331,1156;
|
|
584
|
+
|
|
585
|
+
ideal Ju = z1*f1-1, z2*f2-1, z3*f3-1, z4*f4-1, z5*f5-1,
|
|
586
|
+
u[1]*z1*diff(f1,mu1) + u[2]*z2*diff(f2,mu1) + u[3]*z3*diff(f3,mu1)
|
|
587
|
+
+ u[4]*z4*diff(f4,mu1) + u[5]*z5*diff(f5,mu1),
|
|
588
|
+
u[1]*z1*diff(f1,mu2) + u[2]*z2*diff(f2,mu2) + u[3]*z3*diff(f3,mu2)
|
|
589
|
+
+ u[4]*z4*diff(f4,mu2) + u[5]*z5*diff(f5,mu2),
|
|
590
|
+
u[1]*z1*diff(f1,mu3) + u[2]*z2*diff(f2,mu3) + u[3]*z3*diff(f3,mu3)
|
|
591
|
+
+ u[4]*z4*diff(f4,mu3) + u[5]*z5*diff(f5,mu3);
|
|
592
|
+
ideal Iu = eliminate( Ju, z1*z2*z3*z4*z5 );
|
|
593
|
+
|
|
594
|
+
ring smallring = 0,(mu1,mu2,mu3),dp;
|
|
595
|
+
ideal Iu=imap(bigring,Iu);
|
|
596
|
+
ideal G=groebner(Iu);
|
|
597
|
+
solve(G,20);
|
|
598
|
+
|
|
599
|
+
ideal I = imap(bigring,I);
|
|
600
|
+
matrix H = logHessian(I,u);
|
|
601
|
+
ring complexring=(complex,20),(mu1,mu2,mu3),dp;
|
|
602
|
+
matrix H = imap(smallring,H);
|
|
603
|
+
H = subst(H,mu1,0.59152696273711385658);
|
|
604
|
+
H = subst(H,mu2,0.2529957197544537399);
|
|
605
|
+
H = subst(H,mu3,0.59152696273711385658);
|
|
606
|
+
H;
|
|
607
|
+
matrix M = H-diag(var(1),ncols(H));
|
|
608
|
+
laguerre_solve(det(M));
|
|
609
|
+
|
|
610
|
+
H = imap(smallring,H);
|
|
611
|
+
H = subst(H,mu1,0.55724214001951940648);
|
|
612
|
+
H = subst(H,mu2,0.25295468429185774898);
|
|
613
|
+
H = subst(H,mu3,0.62963746147721704588);
|
|
614
|
+
H;
|
|
615
|
+
M = H-diag(var(1),ncols(H));
|
|
616
|
+
laguerre_solve(det(M));
|
|
617
|
+
|
|
618
|
+
H = imap(smallring,H);
|
|
619
|
+
H = subst(H,mu1,0.62963746147721704588);
|
|
620
|
+
H = subst(H,mu2,0.25295468429185774898);
|
|
621
|
+
H = subst(H,mu3,0.55724214001951940648);
|
|
622
|
+
H;
|
|
623
|
+
M = H-diag(var(1),ncols(H));
|
|
624
|
+
laguerre_solve(det(M));
|
|
625
|
+
}
|
|
626
|
+
*/
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
630
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
631
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
632
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
633
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
634
|
+
//These are some of the procedures I used to generate and test examples for my Master
|
|
635
|
+
//thesis. To use the ones incorporating Seq-Gen, you may have to adjust the shell command
|
|
636
|
+
//with which Singular calls Seq-Gen. You can find Seq-Gen at
|
|
637
|
+
//http://tree.bio.ed.ac.uk/software/seqgen/
|
|
638
|
+
//As the names of the procedures suggest, we always use the Jukes-Cantor model.
|
|
639
|
+
//They also tell you which of them use Seq-Gen.
|
|
640
|
+
|
|
641
|
+
/*
|
|
642
|
+
proc getguaranteedmaxPoints(ideal Iu, matrix H, list #)
|
|
643
|
+
{//an older version of the procedures above
|
|
644
|
+
ideal G=groebner(Iu);
|
|
645
|
+
def r=basering;
|
|
646
|
+
int n=nvars(r);
|
|
647
|
+
def s=solve(G,50,"nodisplay");
|
|
648
|
+
setring s;
|
|
649
|
+
list L;
|
|
650
|
+
list entk;//the k-th entry of SOL
|
|
651
|
+
int c; //will be 1 if we want the entry in our list L, 0 otherwise
|
|
652
|
+
int k,l;
|
|
653
|
+
for(k=1; k<=size(SOL); k++)
|
|
654
|
+
{
|
|
655
|
+
c=1;
|
|
656
|
+
entk=SOL[k];
|
|
657
|
+
for(l=1; l<=size(entk); l++)
|
|
658
|
+
{
|
|
659
|
+
if(impart(entk[l]) != 0)//throw away those with non-zero imaginary part
|
|
660
|
+
{
|
|
661
|
+
c=0;
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
if(entk[l] < 0)//and those which are negative
|
|
665
|
+
{
|
|
666
|
+
c=0;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if(c == 1)//is 1 iff all components are real and non-negative
|
|
671
|
+
{
|
|
672
|
+
L=L+list(entk);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
ring R=(complex,50,i),x(1..n),dp;
|
|
677
|
+
ideal Iu=fetch(r,Iu);
|
|
678
|
+
list L=fetch(s,L);
|
|
679
|
+
list Lk;//k-th entry of L
|
|
680
|
+
matrix H=fetch(r,H);
|
|
681
|
+
matrix Hsubst;
|
|
682
|
+
list hessi;//contains the Hessians with solutions plugged in
|
|
683
|
+
for(k=1; k<=size(L); k++)
|
|
684
|
+
{
|
|
685
|
+
Lk=L[k];
|
|
686
|
+
Hsubst=H;
|
|
687
|
+
for(l=1; l<=size(Lk); l++)
|
|
688
|
+
{
|
|
689
|
+
Hsubst=subst(Hsubst,x(l),Lk[l]);
|
|
690
|
+
}
|
|
691
|
+
hessi=hessi+list(Hsubst);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
//now check all elements of hessi and only keep those which aren't neg def or indef
|
|
695
|
+
//also do the respective changes in the list of solutions L
|
|
696
|
+
list hessi2;
|
|
697
|
+
list L2;
|
|
698
|
+
for(k=1; k<=size(L); k++)
|
|
699
|
+
{
|
|
700
|
+
if(1)
|
|
701
|
+
{
|
|
702
|
+
if(is_neg_def(hessi[k]) == 1)
|
|
703
|
+
{
|
|
704
|
+
hessi2=hessi2+list(hessi[k]);
|
|
705
|
+
L2=L2+list(L[k]);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if(size(#)>0)
|
|
711
|
+
{
|
|
712
|
+
list L2k;
|
|
713
|
+
c=0;//counts the number of biologically meaningful parameter vectors
|
|
714
|
+
int constrhold=1;//will be set to 0 temporarily if the constraints don't hold
|
|
715
|
+
for(k=1; k<=size(L2); k++)
|
|
716
|
+
{
|
|
717
|
+
L2k=L2[k];
|
|
718
|
+
for(l=1; l<=size(L2k); l++)
|
|
719
|
+
{
|
|
720
|
+
if(L2k[l] <= 1/4)
|
|
721
|
+
{
|
|
722
|
+
constrhold=0;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
if(L2k[l] > 1)
|
|
726
|
+
{
|
|
727
|
+
constrhold=0;
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if(constrhold == 1)
|
|
733
|
+
{
|
|
734
|
+
c++;
|
|
735
|
+
}
|
|
736
|
+
constrhold=1;
|
|
737
|
+
}
|
|
738
|
+
return(c);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
print(L2);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
proc getintvec(string linkstr)
|
|
746
|
+
{
|
|
747
|
+
//compares the sequences generated by seq-gen and outputs the frequencies
|
|
748
|
+
//u123, udis, u12, u13 and u23 (so only helpful, when we are considering three taxons)
|
|
749
|
+
//(distinguishes between the non-sequence-lines of the seq-gen-outputfile and those
|
|
750
|
+
//with sequences in them by the length of the lines, so use
|
|
751
|
+
//sequences with at least 20 nucleotides)
|
|
752
|
+
string st=read(linkstr);
|
|
753
|
+
string taxon, tax;
|
|
754
|
+
int i,j;
|
|
755
|
+
list taxons;
|
|
756
|
+
|
|
757
|
+
//first, get the DNA sequences as strings and store them in the list taxons
|
|
758
|
+
for (i=1; i<=size(st); i=i+1)
|
|
759
|
+
{
|
|
760
|
+
while (st[i]!=newline and i<=size(st))
|
|
761
|
+
{
|
|
762
|
+
taxon=taxon+st[i];
|
|
763
|
+
i=i+1;
|
|
764
|
+
}
|
|
765
|
+
if (size(taxon)>=20)
|
|
766
|
+
{
|
|
767
|
+
for(j=2; j<=size(taxon); j++)
|
|
768
|
+
{
|
|
769
|
+
if( (taxon[j-1] == " ") and (taxon[j] != " ") )
|
|
770
|
+
{
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
tax=taxon[j..size(taxon)];//removes the part of the line containing the name
|
|
775
|
+
//of the taxon: in the textfile generated by seq-gen there are a few spaces
|
|
776
|
+
//between the name of the taxon and the corresponding sequence
|
|
777
|
+
taxons=taxons+list(tax);
|
|
778
|
+
}
|
|
779
|
+
taxon="";
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
//then compare the strings in the list taxons, store the frequencies in the intvec u
|
|
783
|
+
intvec u=0,0,0,0,0;//u123,udis,u12,u13,u23
|
|
784
|
+
for(i=1; i<=size(taxons[1]); i++)
|
|
785
|
+
{
|
|
786
|
+
if((taxons[1][i] == taxons[2][i]) and (taxons[2][i] == taxons[3][i]))
|
|
787
|
+
{
|
|
788
|
+
u[1]=u[1]+1;
|
|
789
|
+
i++;
|
|
790
|
+
continue;//continue does not execute the increment statement of the loop
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
if(taxons[1][i] == taxons[2][i])
|
|
794
|
+
{
|
|
795
|
+
u[3]=u[3]+1;
|
|
796
|
+
i++;
|
|
797
|
+
continue;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if(taxons[1][i] == taxons[3][i])
|
|
801
|
+
{
|
|
802
|
+
u[4]=u[4]+1;
|
|
803
|
+
i++;
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
if(taxons[2][i] == taxons[3][i])
|
|
808
|
+
{
|
|
809
|
+
u[5]=u[5]+1;
|
|
810
|
+
i++;
|
|
811
|
+
continue;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
u[2]=u[2]+1;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return(u);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
proc randintvec(int s, int a)
|
|
821
|
+
{//s the length of the intvecs, a the upper bound of the entries:
|
|
822
|
+
//computes intvecs of length s and entries between 1 and a
|
|
823
|
+
intvec u;
|
|
824
|
+
int i;
|
|
825
|
+
for(i=1; i<=s; i++)
|
|
826
|
+
{
|
|
827
|
+
u[i]=random(1,a);
|
|
828
|
+
}
|
|
829
|
+
return(u);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
proc checkrandomJC69run(int a, int sta, int up)
|
|
833
|
+
{//a number of random intvecs to be considered, sta the starting point of random,
|
|
834
|
+
//up the upper bound of the entries of the intvecs
|
|
835
|
+
ring r=0,(mu1,mu2,mu3),dp;
|
|
836
|
+
poly f1=mu1*mu2*mu3+3*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
837
|
+
poly f2=6*mu1*1/3*(1-mu2)*1/3*(1-mu3)+6*1/3*(1-mu1)*mu2*1/3*(1-mu3)+
|
|
838
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*mu3+6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
839
|
+
poly f3=3*mu1*mu2*1/3*(1-mu3)+3*1/3*(1-mu1)*1/3*(1-mu2)*mu3+
|
|
840
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
841
|
+
poly f4=3*mu1*1/3*(1-mu2)*mu3+3*1/3*(1-mu1)*mu2*1/3*(1-mu3)+
|
|
842
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
843
|
+
poly f5=3*1/3*(1-mu1)*mu2*mu3+3*mu1*1/3*(1-mu2)*1/3*(1-mu3)+
|
|
844
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
845
|
+
ideal I=f1,f2,f3,f4,f5;
|
|
846
|
+
|
|
847
|
+
link lu=":a UsedIntvecsJC69rand.txt";
|
|
848
|
+
link lf=":a FailedJC69rand.txt";
|
|
849
|
+
|
|
850
|
+
system("random",sta);
|
|
851
|
+
ideal Iu,G;
|
|
852
|
+
int d, nzd, num;
|
|
853
|
+
int i;
|
|
854
|
+
intvec u;
|
|
855
|
+
int eatoutput;
|
|
856
|
+
string display, writestr;
|
|
857
|
+
writestr=newline+newline+"number of random intvecs: "+string(a)+"; random seed: ";
|
|
858
|
+
writestr=writestr+string(sta)+"; upper bound:"+string(up)+newline;
|
|
859
|
+
write(lu,writestr);
|
|
860
|
+
write(lf,writestr);
|
|
861
|
+
for(i=1; i<=a; i++)
|
|
862
|
+
{
|
|
863
|
+
u=randintvec(5,up);
|
|
864
|
+
writestr=string(u);
|
|
865
|
+
write(lu,writestr);
|
|
866
|
+
|
|
867
|
+
Iu=likeIdeal(I,u);
|
|
868
|
+
|
|
869
|
+
Iu=std(Iu);
|
|
870
|
+
//Iu=groebner(Iu);
|
|
871
|
+
d=dim(Iu);
|
|
872
|
+
if(d != 0)
|
|
873
|
+
{
|
|
874
|
+
nzd++;
|
|
875
|
+
display="-*-*-*- not 0-dim. for u= "+string(u)+", i= "+string(i)+" -*-*-*-";
|
|
876
|
+
print(display);
|
|
877
|
+
write(lf,display);
|
|
878
|
+
i++;
|
|
879
|
+
continue;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
eatoutput=getguaranteedmaxPoints(Iu,logHessian(I,u),1);
|
|
883
|
+
|
|
884
|
+
if(eatoutput >= 2)
|
|
885
|
+
{
|
|
886
|
+
num++;
|
|
887
|
+
write(lf,writestr+"; number: "+string(eatoutput));
|
|
888
|
+
display="-*-*-*- Failed for u= "+string(u)+", i= "+string(i)+" -*-*-*-";
|
|
889
|
+
print(display);
|
|
890
|
+
display="";
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
display="-------------- i = "+string(i)+" --------------";
|
|
895
|
+
display=display+newline+"not zero-dimensional in "+string(nzd)+" cases"+newline;
|
|
896
|
+
display=display+"no unique maximum in "+string(num)+" cases"+newline;
|
|
897
|
+
print(display);
|
|
898
|
+
write(lf,display);
|
|
899
|
+
|
|
900
|
+
close(lu);
|
|
901
|
+
close(lf);
|
|
902
|
+
|
|
903
|
+
return(nzd,num);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
proc checkseqgenJC69run(int a, int sd, int len)
|
|
907
|
+
{//a number of random intvecs to be considered, sd the random seed for seq-gen,
|
|
908
|
+
//up the upper bound of the entries of the intvecs
|
|
909
|
+
ring r=0,(mu1,mu2,mu3),dp;
|
|
910
|
+
poly f1=mu1*mu2*mu3+3*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
911
|
+
poly f2=6*mu1*1/3*(1-mu2)*1/3*(1-mu3)+6*1/3*(1-mu1)*mu2*1/3*(1-mu3)+
|
|
912
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*mu3+6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
913
|
+
poly f3=3*mu1*mu2*1/3*(1-mu3)+3*1/3*(1-mu1)*1/3*(1-mu2)*mu3+
|
|
914
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
915
|
+
poly f4=3*mu1*1/3*(1-mu2)*mu3+3*1/3*(1-mu1)*mu2*1/3*(1-mu3)+
|
|
916
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
917
|
+
poly f5=3*1/3*(1-mu1)*mu2*mu3+3*mu1*1/3*(1-mu2)*1/3*(1-mu3)+
|
|
918
|
+
6*1/3*(1-mu1)*1/3*(1-mu2)*1/3*(1-mu3);
|
|
919
|
+
ideal I=f1,f2,f3,f4,f5;
|
|
920
|
+
|
|
921
|
+
link lu=":a UsedIntvecsJC69seqgen.txt";
|
|
922
|
+
link lf=":a FailedJC69seqgen.txt";
|
|
923
|
+
|
|
924
|
+
string readstr="ThreeTaxonClaw.dat";
|
|
925
|
+
ideal Iu,G;
|
|
926
|
+
int d, nzd, num;
|
|
927
|
+
int i;
|
|
928
|
+
intvec u;
|
|
929
|
+
int eatoutput;
|
|
930
|
+
string display, writestr, shcmd;
|
|
931
|
+
writestr=newline+newline+"number of seqgened intvecs: "+string(a)+"; random seed: ";
|
|
932
|
+
writestr=writestr+string(sd)+"; sequence length: "+string(len)+newline;
|
|
933
|
+
write(lu,writestr);
|
|
934
|
+
write(lf,writestr);
|
|
935
|
+
for(i=1; i<=a; i++)
|
|
936
|
+
{
|
|
937
|
+
shcmd="seq-gen ";
|
|
938
|
+
shcmd=shcmd+"-mHKY -l"+string(len)+" -n1 -z"+string(sd);
|
|
939
|
+
shcmd=shcmd+" -q < ThreeTaxonClaw.tree > ThreeTaxonClaw.dat";
|
|
940
|
+
sd++;
|
|
941
|
+
eatoutput=system("sh",shcmd);
|
|
942
|
+
u=getintvec(readstr);
|
|
943
|
+
writestr=string(u);
|
|
944
|
+
write(lu,writestr);
|
|
945
|
+
|
|
946
|
+
Iu=likeIdeal(I,u);
|
|
947
|
+
|
|
948
|
+
Iu=std(Iu);
|
|
949
|
+
//Iu=groebner(Iu);
|
|
950
|
+
d=dim(Iu);
|
|
951
|
+
if(d != 0)
|
|
952
|
+
{
|
|
953
|
+
nzd++;
|
|
954
|
+
display="-*-*-*- not 0-dim. for u= "+string(u)+", i= "+string(i)+" -*-*-*-";
|
|
955
|
+
print(display);
|
|
956
|
+
write(lf,display);
|
|
957
|
+
i++;
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
eatoutput=getguaranteedmaxPoints(Iu,logHessian(I,u),1);
|
|
962
|
+
|
|
963
|
+
if(eatoutput >= 2)
|
|
964
|
+
{
|
|
965
|
+
num++;
|
|
966
|
+
write(lf,writestr+"; number: "+string(eatoutput));
|
|
967
|
+
display="-*-*-*- no unique maximum for u= "+
|
|
968
|
+
string(u)+", i= "+string(i)+" -*-*-*-";
|
|
969
|
+
print(display);
|
|
970
|
+
display="";
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
display="-------------- i = "+string(i)+" --------------";
|
|
975
|
+
display=display+newline+"not zero-dimensional in "+string(nzd)+" cases"+newline;
|
|
976
|
+
display=display+"no unique maximum in "+string(num)+" cases"+newline;
|
|
977
|
+
print(display);
|
|
978
|
+
write(lf,display);
|
|
979
|
+
|
|
980
|
+
close(lu);
|
|
981
|
+
close(lf);
|
|
982
|
+
|
|
983
|
+
return(nzd,num);
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
proc randclawtree(int a)
|
|
987
|
+
{
|
|
988
|
+
ring r=(complex,10),x,dp;
|
|
989
|
+
number n1,n2,n3;
|
|
990
|
+
int n;
|
|
991
|
+
int i;
|
|
992
|
+
for(i=1; i<=a; i++)
|
|
993
|
+
{
|
|
994
|
+
n=random(1,1000000);
|
|
995
|
+
n1=number(n)/1000000;
|
|
996
|
+
n2=number(random(1,1000000-n))/1000000;
|
|
997
|
+
n3=1-n1-n2;
|
|
998
|
+
print("(Taxon1:"+string(n1)+",Taxon2:"+string(n2)+",Taxon3:"+string(n3)+");");
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
proc checkrandomJC69writebeginning(int r, int a, int sta, int up)
|
|
1003
|
+
{
|
|
1004
|
+
string writestr=newline+newline+newline+newline+newline+newline;
|
|
1005
|
+
writestr=writestr+"*****************************************************"+newline;
|
|
1006
|
+
writestr=writestr+"starting new loop with the following parameters"+newline;
|
|
1007
|
+
writestr=writestr+"number of runs: "+string(r)+newline;
|
|
1008
|
+
writestr=writestr+"number of intvecs per run: "+string(a)+newline;
|
|
1009
|
+
writestr=writestr+"starting random seed: "+string(sta)+newline;
|
|
1010
|
+
writestr=writestr+"upper bound for the entries of the intvecs: "+string(up)+newline;
|
|
1011
|
+
writestr=writestr+"*****************************************************";
|
|
1012
|
+
|
|
1013
|
+
link lu=":a UsedIntvecsJC69rand.txt";
|
|
1014
|
+
link lf=":a FailedJC69rand.txt";
|
|
1015
|
+
write(lu,writestr);
|
|
1016
|
+
write(lf,writestr);
|
|
1017
|
+
close(lu);
|
|
1018
|
+
close(lf);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
proc checkrandomJC69writeend(int r, int a, int sta, int up, int s, int t)
|
|
1022
|
+
{
|
|
1023
|
+
writestr=newline+newline+newline;
|
|
1024
|
+
writestr=writestr+"*****************************************************"+newline;
|
|
1025
|
+
writestr=writestr+"ending loop with the following parameters"+newline;
|
|
1026
|
+
writestr=writestr+"number of runs: "+string(r)+newline;
|
|
1027
|
+
writestr=writestr+"number of intvecs per run: "+string(a)+newline;
|
|
1028
|
+
writestr=writestr+"starting random seed: "+string(sta)+newline;
|
|
1029
|
+
writestr=writestr+"upper bound for the entries of the intvecs: "+string(up)+newline;
|
|
1030
|
+
writestr=writestr+newline+"in the whole loop, there were a total of"+newline;
|
|
1031
|
+
writestr=writestr+" "+string(s)+" examples with non-zero-dim. likeideal"+newline;
|
|
1032
|
+
writestr=writestr+" "+string(t)+
|
|
1033
|
+
" examples with more than one biol. meaningful local maximum";
|
|
1034
|
+
writestr=writestr+newline+"*****************************************************";
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
write(lu,writestr);
|
|
1038
|
+
write(lf,writestr);
|
|
1039
|
+
close(lu);
|
|
1040
|
+
close(lf);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
proc checkrandomJC69loop(int r, int a, int sta, int up, int s, int t)
|
|
1044
|
+
{
|
|
1045
|
+
//r the number of runs, a the number of intvecs per run, sta the starting random
|
|
1046
|
+
//seed, up the upper bound for the entries of the intvecs
|
|
1047
|
+
checkrandomJC69writebeginning(r,a,sta,up);
|
|
1048
|
+
|
|
1049
|
+
int nzd, num, i, s, t;
|
|
1050
|
+
for(i=1; i<=r; i++)
|
|
1051
|
+
{
|
|
1052
|
+
(nzd,num)=checkrandomJC69run(a,sta,up);
|
|
1053
|
+
sta++;
|
|
1054
|
+
s=s+nzd;
|
|
1055
|
+
t=t+num;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
checkrandomJC69writeend(r,a,sta,up,s,t);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
proc checkseqgenJC69writebeginning(int r, int a, int sd, int sta, int len, int p)
|
|
1063
|
+
{
|
|
1064
|
+
string writestr=newline+newline+newline+newline+newline+newline;
|
|
1065
|
+
writestr=writestr+"*****************************************************"+newline;
|
|
1066
|
+
writestr=writestr+"starting new loop with the following parameters"+newline;
|
|
1067
|
+
writestr=writestr+"number of runs: "+string(r)+newline;
|
|
1068
|
+
writestr=writestr+"number of intvecs per run: "+string(a)+newline;
|
|
1069
|
+
writestr=writestr+"starting random seed for seqgen: "+string(sd)+newline;
|
|
1070
|
+
writestr=writestr+"starting random seed for random: "+string(sta)+newline;
|
|
1071
|
+
writestr=writestr+"starting length of the generated sequences: "+string(len)+newline;
|
|
1072
|
+
writestr=writestr+"*****************************************************";
|
|
1073
|
+
|
|
1074
|
+
link lu=":a UsedIntvecsJC69seqgen.txt";
|
|
1075
|
+
link lf=":a FailedJC69seqgen.txt";
|
|
1076
|
+
write(lu,writestr);
|
|
1077
|
+
write(lf,writestr);
|
|
1078
|
+
close(lu);
|
|
1079
|
+
close(lf);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
proc checkseqgenJC69writeend(int r, int a, int sd, int sta,
|
|
1084
|
+
int len, int p, int s, int t, intvec ls)
|
|
1085
|
+
{
|
|
1086
|
+
writestr=newline+newline+newline;
|
|
1087
|
+
writestr=writestr+"*****************************************************"+newline;
|
|
1088
|
+
writestr=writestr+"ending loop with the following parameters"+newline;
|
|
1089
|
+
writestr=writestr+"number of runs: "+string(r)+newline;
|
|
1090
|
+
writestr=writestr+"number of intvecs per run: "+string(a)+newline;
|
|
1091
|
+
writestr=writestr+"starting random seed for seqgen: "+string(sd)+newline;
|
|
1092
|
+
writestr=writestr+"starting random seed for random: "+string(sta)+newline;
|
|
1093
|
+
writestr=writestr+"length of the generated sequences: "+string(len)+newline;
|
|
1094
|
+
writestr=writestr+newline+"in the whole loop, there were a total of"+newline;
|
|
1095
|
+
writestr=writestr+" "+string(s)+" examples with non-zero-dim. likeideal"+newline;
|
|
1096
|
+
writestr=writestr+" "+string(t)+
|
|
1097
|
+
" examples with more than one biol. meaningful local maximum";
|
|
1098
|
+
writestr=writestr+newline+"*****************************************************";
|
|
1099
|
+
writestr=writestr+"used lengths:"+newline+string(ls);
|
|
1100
|
+
writestr=writestr+newline+"*****************************************************";
|
|
1101
|
+
|
|
1102
|
+
write(lu,writestr);
|
|
1103
|
+
write(lf,writestr);
|
|
1104
|
+
close(lu);
|
|
1105
|
+
close(lf);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
proc checkseqgenJC69loop(int r, int a, int sd, int sta, int len, int p)
|
|
1109
|
+
{
|
|
1110
|
+
//r the number of runs, a the number of intvecs per run, sd the starting random
|
|
1111
|
+
//seed, len the starting length, p the amount len will increase (on average)
|
|
1112
|
+
//after each run (via + random(1,2*p-1))
|
|
1113
|
+
//sta the random seed for random
|
|
1114
|
+
|
|
1115
|
+
checkseqgenJC69writebeginning(r,a,sd,sta,len,p);
|
|
1116
|
+
|
|
1117
|
+
system("random",sta);
|
|
1118
|
+
intvec ls;
|
|
1119
|
+
int nzd, num, i, s, t;
|
|
1120
|
+
for(i=1; i<=r; i++)
|
|
1121
|
+
{
|
|
1122
|
+
(nzd,num)=checkseqgenJC69run(a,sd,len);
|
|
1123
|
+
sd++;
|
|
1124
|
+
ls[i]=len;
|
|
1125
|
+
len=len+random(1,2*p-1);
|
|
1126
|
+
s=s+nzd;
|
|
1127
|
+
t=t+num;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
checkseqgenJC69writeend(r,a,sd,sta,len,p,s,t,ls);
|
|
1131
|
+
}
|
|
1132
|
+
*/
|