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,780 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-singular
|
|
2
|
+
r"""
|
|
3
|
+
Shared Memory Managers for F-Symbol Attributes
|
|
4
|
+
|
|
5
|
+
This module provides an implementation for shared dictionary like
|
|
6
|
+
state attributes required by the orthogonal F-matrix solver.
|
|
7
|
+
|
|
8
|
+
Currently, the attributes only work when the base field of the
|
|
9
|
+
:class:`FMatrix` factory is a cyclotomic field.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# ****************************************************************************
|
|
13
|
+
# Copyright (C) 2021 Guillermo Aboumrad <gh_willieab>
|
|
14
|
+
#
|
|
15
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
16
|
+
# https://www.gnu.org/licenses/
|
|
17
|
+
# ****************************************************************************
|
|
18
|
+
|
|
19
|
+
cimport cython
|
|
20
|
+
cimport numpy as np
|
|
21
|
+
from cysignals.memory cimport sig_malloc
|
|
22
|
+
from multiprocessing import shared_memory
|
|
23
|
+
from sage.algebras.fusion_rings.poly_tup_engine cimport poly_to_tup, tup_fixes_sq, _flatten_coeffs
|
|
24
|
+
from sage.rings.integer cimport Integer
|
|
25
|
+
from sage.rings.rational cimport Rational
|
|
26
|
+
from sage.rings.polynomial.multi_polynomial cimport MPolynomial_libsingular
|
|
27
|
+
from sage.rings.polynomial.polydict cimport ETuple
|
|
28
|
+
|
|
29
|
+
import numpy as np
|
|
30
|
+
from os import getpid
|
|
31
|
+
|
|
32
|
+
cdef class KSHandler:
|
|
33
|
+
r"""
|
|
34
|
+
A shared memory backed dict-like structure to manage the
|
|
35
|
+
``_ks`` attribute of an F-matrix.
|
|
36
|
+
|
|
37
|
+
This structure implements a representation of the known squares dictionary
|
|
38
|
+
using a structured NumPy array backed by a contiguous shared memory
|
|
39
|
+
object.
|
|
40
|
+
|
|
41
|
+
The structure mimics a dictionary of ``(idx, known_sq)`` pairs. Each
|
|
42
|
+
integer index corresponds to a variable and each ``known_sq`` is an
|
|
43
|
+
element of the F-matrix factory's base cyclotomic field.
|
|
44
|
+
|
|
45
|
+
Each cyclotomic coefficient is stored as a list of numerators and a
|
|
46
|
+
list of denominators representing the rational coefficients. The
|
|
47
|
+
structured array also maintains ``known`` attribute that indicates
|
|
48
|
+
whether the structure contains an entry corresponding to the given index.
|
|
49
|
+
|
|
50
|
+
The parent process should construct this object without a
|
|
51
|
+
``name`` attribute. Children processes use the ``name`` attribute,
|
|
52
|
+
accessed via ``self.shm.name`` to attach to the shared memory block.
|
|
53
|
+
|
|
54
|
+
INPUT:
|
|
55
|
+
|
|
56
|
+
- ``n_slots`` -- the total number of F-symbols
|
|
57
|
+
- ``field`` -- F-matrix's base cyclotomic field
|
|
58
|
+
- ``use_mp`` -- boolean indicating whether to construct a shared
|
|
59
|
+
memory block to back ``self``
|
|
60
|
+
- ``init_data`` -- dictionary or :class:`KSHandler` object containing
|
|
61
|
+
known squares for initialization, e.g., from a solver checkpoint
|
|
62
|
+
- ``name`` -- the name of a shared memory object (used by child processes
|
|
63
|
+
for attaching)
|
|
64
|
+
|
|
65
|
+
.. NOTE::
|
|
66
|
+
|
|
67
|
+
To properly dispose of shared memory resources,
|
|
68
|
+
``self.shm.unlink()`` must be called before exiting.
|
|
69
|
+
|
|
70
|
+
.. WARNING::
|
|
71
|
+
|
|
72
|
+
This structure *cannot* modify an entry that
|
|
73
|
+
has already been set.
|
|
74
|
+
|
|
75
|
+
EXAMPLES::
|
|
76
|
+
|
|
77
|
+
sage: from sage.algebras.fusion_rings.shm_managers import KSHandler
|
|
78
|
+
sage: # Create shared data structure
|
|
79
|
+
sage: f = FusionRing("A1", 2).get_fmatrix(inject_variables=True, new=True)
|
|
80
|
+
creating variables fx1..fx14
|
|
81
|
+
Defining fx0, fx1, fx2, fx3, fx4, fx5, fx6, fx7, fx8, fx9, fx10, fx11, fx12, fx13
|
|
82
|
+
sage: n = f._poly_ring.ngens()
|
|
83
|
+
sage: f.start_worker_pool()
|
|
84
|
+
sage: ks = KSHandler(n, f._field, use_mp=True)
|
|
85
|
+
sage: # In the same shell or in a different shell, attach to fvars
|
|
86
|
+
sage: name = ks.shm.name
|
|
87
|
+
sage: ks2 = KSHandler(n, f._field, name=name, use_mp=True)
|
|
88
|
+
sage: from sage.algebras.fusion_rings.poly_tup_engine import poly_to_tup
|
|
89
|
+
sage: eqns = [fx1**2 - 4, fx3**2 + f._field.gen()**4 - 1/19*f._field.gen()**2]
|
|
90
|
+
sage: ks.update([poly_to_tup(p) for p in eqns])
|
|
91
|
+
sage: for idx, sq in ks.items():
|
|
92
|
+
....: print("Index: {}, square: {}".format(idx, sq))
|
|
93
|
+
....:
|
|
94
|
+
Index: 1, square: 4
|
|
95
|
+
Index: 3, square: -zeta32^4 + 1/19*zeta32^2
|
|
96
|
+
sage: ks.shm.unlink()
|
|
97
|
+
sage: f.shutdown_worker_pool()
|
|
98
|
+
"""
|
|
99
|
+
def __init__(self, n_slots, field, use_mp=False, init_data=None, name=None):
|
|
100
|
+
r"""
|
|
101
|
+
Initialize ``self``.
|
|
102
|
+
|
|
103
|
+
EXAMPLES::
|
|
104
|
+
|
|
105
|
+
sage: from sage.algebras.fusion_rings.shm_managers import KSHandler
|
|
106
|
+
sage: # Create shared data structure
|
|
107
|
+
sage: f = FusionRing("A1", 2).get_fmatrix(inject_variables=True, new=True)
|
|
108
|
+
creating variables fx1..fx14
|
|
109
|
+
Defining fx0, fx1, fx2, fx3, fx4, fx5, fx6, fx7, fx8, fx9, fx10, fx11, fx12, fx13
|
|
110
|
+
sage: n = f._poly_ring.ngens()
|
|
111
|
+
sage: f.start_worker_pool()
|
|
112
|
+
sage: ks = KSHandler(n, f._field, use_mp=True)
|
|
113
|
+
sage: TestSuite(ks).run()
|
|
114
|
+
sage: ks.shm.unlink()
|
|
115
|
+
sage: f.shutdown_worker_pool()
|
|
116
|
+
"""
|
|
117
|
+
cdef int n, d
|
|
118
|
+
if init_data is None:
|
|
119
|
+
init_data = {}
|
|
120
|
+
self.field = field
|
|
121
|
+
n = n_slots
|
|
122
|
+
d = self.field.degree()
|
|
123
|
+
ks_t = np.dtype([
|
|
124
|
+
('known', 'bool', (1, )),
|
|
125
|
+
('nums', 'i8', (d, )),
|
|
126
|
+
('denoms', 'u8', (d, ))
|
|
127
|
+
])
|
|
128
|
+
self.obj_cache = [None]*n
|
|
129
|
+
if use_mp:
|
|
130
|
+
if name is None:
|
|
131
|
+
self.shm = shared_memory.SharedMemory(create=True, size=n*ks_t.itemsize)
|
|
132
|
+
else:
|
|
133
|
+
self.shm = shared_memory.SharedMemory(name=name)
|
|
134
|
+
self.ks_dat = np.ndarray((n, ), dtype=ks_t, buffer=self.shm.buf)
|
|
135
|
+
else:
|
|
136
|
+
self.ks_dat = np.ndarray((n, ), dtype=ks_t)
|
|
137
|
+
if name is None:
|
|
138
|
+
self.ks_dat['known'] = np.zeros((n, 1), dtype='bool')
|
|
139
|
+
self.ks_dat['nums'] = np.zeros((n, d), dtype='i8')
|
|
140
|
+
self.ks_dat['denoms'] = np.ones((n, d), dtype='u8')
|
|
141
|
+
# Populate initializer data
|
|
142
|
+
for idx, sq in init_data.items():
|
|
143
|
+
self.setitem(idx, sq)
|
|
144
|
+
|
|
145
|
+
@cython.nonecheck(False)
|
|
146
|
+
@cython.wraparound(False)
|
|
147
|
+
@cython.boundscheck(False)
|
|
148
|
+
cdef NumberFieldElement_absolute get(self, int idx):
|
|
149
|
+
r"""
|
|
150
|
+
Retrieve the known square corresponding to the given index,
|
|
151
|
+
if it exists.
|
|
152
|
+
"""
|
|
153
|
+
if not self.ks_dat['known'][idx]:
|
|
154
|
+
raise KeyError('index {} does not correspond to a known square'.format(idx))
|
|
155
|
+
if self.obj_cache[idx] is not None:
|
|
156
|
+
return self.obj_cache[idx]
|
|
157
|
+
cdef int d
|
|
158
|
+
cdef list rat
|
|
159
|
+
cdef Py_ssize_t i
|
|
160
|
+
cdef np.ndarray[np.int64_t, ndim=1] nums = self.ks_dat['nums'][idx]
|
|
161
|
+
# cdef np.int64_t[::1] num_view = nums
|
|
162
|
+
cdef np.ndarray[np.uint64_t, ndim=1] denoms = self.ks_dat['denoms'][idx]
|
|
163
|
+
# cdef np.uint64_t[::1] denom_view = denoms
|
|
164
|
+
cdef np.int64_t num
|
|
165
|
+
cdef np.uint64_t denom
|
|
166
|
+
cdef NumberFieldElement_absolute cyc_coeff
|
|
167
|
+
cdef Rational quo
|
|
168
|
+
d = self.field.degree()
|
|
169
|
+
rat = list()
|
|
170
|
+
for i in range(d):
|
|
171
|
+
num = nums[i]
|
|
172
|
+
denom = denoms[i]
|
|
173
|
+
quo = Integer(num) / Integer(denom)
|
|
174
|
+
rat.append(quo)
|
|
175
|
+
cyc_coeff = self.field(rat)
|
|
176
|
+
self.obj_cache[idx] = cyc_coeff
|
|
177
|
+
return cyc_coeff
|
|
178
|
+
|
|
179
|
+
cpdef update(self, list eqns):
|
|
180
|
+
r"""
|
|
181
|
+
Update ``self``'s ``shared_memory``-backed dictionary of known
|
|
182
|
+
squares. Keys are variable indices and corresponding values
|
|
183
|
+
are the squares.
|
|
184
|
+
|
|
185
|
+
EXAMPLES::
|
|
186
|
+
|
|
187
|
+
sage: f = FusionRing("B5", 1).get_fmatrix()
|
|
188
|
+
sage: f._reset_solver_state()
|
|
189
|
+
sage: for idx, sq in f._ks.items():
|
|
190
|
+
....: k
|
|
191
|
+
....:
|
|
192
|
+
sage: f.get_orthogonality_constraints()
|
|
193
|
+
[fx0^2 - 1,
|
|
194
|
+
fx1^2 - 1,
|
|
195
|
+
fx2^2 - 1,
|
|
196
|
+
fx3^2 - 1,
|
|
197
|
+
fx4^2 - 1,
|
|
198
|
+
fx5^2 - 1,
|
|
199
|
+
fx6^2 - 1,
|
|
200
|
+
fx7^2 - 1,
|
|
201
|
+
fx8^2 - 1,
|
|
202
|
+
fx9^2 - 1,
|
|
203
|
+
fx10^2 + fx12^2 - 1,
|
|
204
|
+
fx10*fx11 + fx12*fx13,
|
|
205
|
+
fx10*fx11 + fx12*fx13,
|
|
206
|
+
fx11^2 + fx13^2 - 1]
|
|
207
|
+
sage: f.get_orthogonality_constraints(output=False)
|
|
208
|
+
sage: f._ks.update(f.ideal_basis)
|
|
209
|
+
sage: for idx, sq in f._ks.items():
|
|
210
|
+
....: print(idx, "-->", sq)
|
|
211
|
+
....:
|
|
212
|
+
0 --> 1
|
|
213
|
+
1 --> 1
|
|
214
|
+
2 --> 1
|
|
215
|
+
3 --> 1
|
|
216
|
+
4 --> 1
|
|
217
|
+
5 --> 1
|
|
218
|
+
6 --> 1
|
|
219
|
+
7 --> 1
|
|
220
|
+
8 --> 1
|
|
221
|
+
9 --> 1
|
|
222
|
+
|
|
223
|
+
.. WARNING::
|
|
224
|
+
|
|
225
|
+
This method assumes every polynomial in ``eqns`` is *monic*.
|
|
226
|
+
"""
|
|
227
|
+
cdef ETuple lm
|
|
228
|
+
cdef list rhs
|
|
229
|
+
cdef Py_ssize_t i, idx
|
|
230
|
+
cdef tuple eq_tup
|
|
231
|
+
for i in range(len(eqns)):
|
|
232
|
+
eq_tup = eqns[i]
|
|
233
|
+
if tup_fixes_sq(eq_tup):
|
|
234
|
+
rhs = [-v for v in eq_tup[-1][1]]
|
|
235
|
+
# eq_tup is guaranteed univariate, so we extract variable idx from lm
|
|
236
|
+
lm = eq_tup[0][0]
|
|
237
|
+
idx = lm._data[0]
|
|
238
|
+
try:
|
|
239
|
+
self.setitem(idx, rhs)
|
|
240
|
+
except OverflowError:
|
|
241
|
+
print("KS overflowed on index {} with value {}".format(idx, self.field(rhs)))
|
|
242
|
+
|
|
243
|
+
@cython.nonecheck(False)
|
|
244
|
+
@cython.wraparound(False)
|
|
245
|
+
@cython.infer_types(False)
|
|
246
|
+
cdef setitem(self, int idx, rhs):
|
|
247
|
+
"""
|
|
248
|
+
Create an entry corresponding to the given index.
|
|
249
|
+
|
|
250
|
+
The ``rhs`` parameter may be a cyclotomic coefficient or its
|
|
251
|
+
list/tuple representation.
|
|
252
|
+
"""
|
|
253
|
+
cdef Py_ssize_t i
|
|
254
|
+
cdef np.ndarray[np.int64_t, ndim=1] nums = self.ks_dat['nums'][idx]
|
|
255
|
+
cdef np.ndarray[np.uint64_t, ndim=1] denoms = self.ks_dat['denoms'][idx]
|
|
256
|
+
cdef np.int64_t num
|
|
257
|
+
cdef np.uint64_t denom
|
|
258
|
+
cdef Rational quo
|
|
259
|
+
self.ks_dat['known'][idx] = True
|
|
260
|
+
if not isinstance(rhs, list):
|
|
261
|
+
rhs = rhs._coefficients()
|
|
262
|
+
for i in range(len(rhs)):
|
|
263
|
+
quo = rhs[i]
|
|
264
|
+
num = quo.numerator()
|
|
265
|
+
denom = quo.denominator()
|
|
266
|
+
if num > 2**32:
|
|
267
|
+
print("WARNING: Large num encountered in KS", num)
|
|
268
|
+
if denom > 2**32:
|
|
269
|
+
print("WARNING: Large denom encountered in KS", denom)
|
|
270
|
+
nums[i] = num
|
|
271
|
+
denoms[i] = denom
|
|
272
|
+
|
|
273
|
+
cdef bint contains(self, int idx) noexcept:
|
|
274
|
+
r"""
|
|
275
|
+
Determine whether ``self`` contains entry corresponding to given
|
|
276
|
+
``idx``.
|
|
277
|
+
"""
|
|
278
|
+
return self.ks_dat[idx]['known']
|
|
279
|
+
|
|
280
|
+
def __eq__(self, KSHandler other):
|
|
281
|
+
r"""
|
|
282
|
+
Test for equality.
|
|
283
|
+
|
|
284
|
+
TESTS::
|
|
285
|
+
|
|
286
|
+
sage: f = FusionRing("C2", 2).get_fmatrix()
|
|
287
|
+
sage: f._reset_solver_state()
|
|
288
|
+
sage: f.get_orthogonality_constraints(output=False)
|
|
289
|
+
sage: from sage.algebras.fusion_rings.shm_managers import KSHandler
|
|
290
|
+
sage: n = f._poly_ring.ngens()
|
|
291
|
+
sage: f.start_worker_pool()
|
|
292
|
+
sage: ks = KSHandler(n, f._field, use_mp=True, init_data=f._ks)
|
|
293
|
+
sage: # In the same shell or in a different one, attach to shared memory handler
|
|
294
|
+
sage: name = ks.shm.name
|
|
295
|
+
sage: k2 = KSHandler(n, f._field, name=name, use_mp=True)
|
|
296
|
+
sage: ks == k2
|
|
297
|
+
True
|
|
298
|
+
sage: ks.shm.unlink()
|
|
299
|
+
sage: f.shutdown_worker_pool()
|
|
300
|
+
"""
|
|
301
|
+
return all(other.get(idx) == sq for idx, sq in self.items())
|
|
302
|
+
|
|
303
|
+
def __reduce__(self):
|
|
304
|
+
r"""
|
|
305
|
+
Provide pickling / unpickling support for ``self``.
|
|
306
|
+
|
|
307
|
+
TESTS::
|
|
308
|
+
|
|
309
|
+
sage: f = FusionRing("A3", 1).get_fmatrix()
|
|
310
|
+
sage: f._reset_solver_state()
|
|
311
|
+
sage: loads(dumps(f._ks)) == f._ks
|
|
312
|
+
True
|
|
313
|
+
sage: f.find_orthogonal_solution(verbose=False) # long time
|
|
314
|
+
sage: loads(dumps(f._ks)) == f._ks
|
|
315
|
+
True
|
|
316
|
+
"""
|
|
317
|
+
d = {i: sq for i, sq in self.items()}
|
|
318
|
+
return make_KSHandler, (self.ks_dat.size, self.field, d)
|
|
319
|
+
|
|
320
|
+
def items(self):
|
|
321
|
+
r"""
|
|
322
|
+
Iterate through existing entries using Python dict-style syntax.
|
|
323
|
+
|
|
324
|
+
EXAMPLES::
|
|
325
|
+
|
|
326
|
+
sage: f = FusionRing("A3", 1).get_fmatrix()
|
|
327
|
+
sage: f._reset_solver_state()
|
|
328
|
+
sage: f.get_orthogonality_constraints(output=False)
|
|
329
|
+
sage: f._ks.update(f.ideal_basis)
|
|
330
|
+
sage: for idx, sq in f._ks.items():
|
|
331
|
+
....: print("Index: {}, sq: {}".format(idx, sq))
|
|
332
|
+
....:
|
|
333
|
+
Index: 0, sq: 1
|
|
334
|
+
Index: 1, sq: 1
|
|
335
|
+
Index: 2, sq: 1
|
|
336
|
+
Index: 3, sq: 1
|
|
337
|
+
Index: 4, sq: 1
|
|
338
|
+
...
|
|
339
|
+
Index: 25, sq: 1
|
|
340
|
+
Index: 26, sq: 1
|
|
341
|
+
"""
|
|
342
|
+
cdef Py_ssize_t i
|
|
343
|
+
for i in range(self.ks_dat.size):
|
|
344
|
+
if self.ks_dat['known'][i]:
|
|
345
|
+
yield i, self.get(i)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def make_KSHandler(n_slots, field, init_data):
|
|
349
|
+
r"""
|
|
350
|
+
Provide pickling / unpickling support for :class:`KSHandler`.
|
|
351
|
+
|
|
352
|
+
TESTS::
|
|
353
|
+
|
|
354
|
+
sage: f = FusionRing("B4", 1).get_fmatrix()
|
|
355
|
+
sage: f._reset_solver_state()
|
|
356
|
+
sage: loads(dumps(f._ks)) == f._ks # indirect doctest
|
|
357
|
+
True
|
|
358
|
+
sage: f.find_orthogonal_solution(verbose=False) # long time
|
|
359
|
+
sage: loads(dumps(f._ks)) == f._ks # indirect doctest
|
|
360
|
+
True
|
|
361
|
+
"""
|
|
362
|
+
return KSHandler(n_slots, field, init_data=init_data)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
cdef class FvarsHandler:
|
|
366
|
+
r"""
|
|
367
|
+
A shared memory backed dict-like structure to manage the
|
|
368
|
+
``_fvars`` attribute of an F-matrix.
|
|
369
|
+
|
|
370
|
+
This structure implements a representation of the F-symbols dictionary
|
|
371
|
+
using a structured NumPy array backed by a contiguous shared memory
|
|
372
|
+
object.
|
|
373
|
+
|
|
374
|
+
The monomial data is stored in the ``exp_data`` structure. Monomial
|
|
375
|
+
exponent data is stored contiguously and ``ticks`` are used to
|
|
376
|
+
indicate different monomials.
|
|
377
|
+
|
|
378
|
+
Coefficient data is stored in the ``coeff_nums`` and ``coeff_denom``
|
|
379
|
+
arrays. The ``coeff_denom`` array stores the value
|
|
380
|
+
``d = coeff.denominator()`` for each cyclotomic coefficient. The
|
|
381
|
+
``coeff_nums`` array stores the values
|
|
382
|
+
``c.numerator() * d for c in coeff._coefficients()``, the abridged
|
|
383
|
+
list representation of the cyclotomic coefficient ``coeff``.
|
|
384
|
+
|
|
385
|
+
Each entry also has a boolean ``modified`` attribute, indicating
|
|
386
|
+
whether it has been modified by the parent process. Entry retrieval
|
|
387
|
+
is cached in each process, so each process must check whether
|
|
388
|
+
entries have been modified before attempting retrieval.
|
|
389
|
+
|
|
390
|
+
The parent process should construct this object without a
|
|
391
|
+
``name`` attribute. Children processes use the ``name`` attribute,
|
|
392
|
+
accessed via ``self.shm.name`` to attach to the shared memory block.
|
|
393
|
+
|
|
394
|
+
INPUT:
|
|
395
|
+
|
|
396
|
+
- ``n_slots`` -- number of generators of the underlying polynomial ring
|
|
397
|
+
- ``field`` -- base field for polynomial ring
|
|
398
|
+
- ``idx_to_sextuple`` -- map relating a single integer index to a sextuple
|
|
399
|
+
of ``FusionRing`` elements
|
|
400
|
+
- ``init_data`` -- dictionary or :class:`FvarsHandler` object containing
|
|
401
|
+
known squares for initialization, e.g., from a solver checkpoint
|
|
402
|
+
- ``use_mp`` -- integer indicating the number of child processes
|
|
403
|
+
used for multiprocessing; if running serially, use 0
|
|
404
|
+
- ``pids_name`` -- the name of a ``ShareableList`` containing the
|
|
405
|
+
process ``pid``'s for every process in the pool (including the
|
|
406
|
+
parent process)
|
|
407
|
+
- ``name`` -- the name of a shared memory object
|
|
408
|
+
(used by child processes for attaching)
|
|
409
|
+
- ``max_terms`` -- maximum number of terms in each entry; since
|
|
410
|
+
we use contiguous C-style memory blocks, the size of the block
|
|
411
|
+
must be known in advance
|
|
412
|
+
- ``n_bytes`` -- the number of bytes that should be allocated for
|
|
413
|
+
each numerator and each denominator stored by the structure
|
|
414
|
+
|
|
415
|
+
.. NOTE::
|
|
416
|
+
|
|
417
|
+
To properly dispose of shared memory resources,
|
|
418
|
+
``self.shm.unlink()`` must be called before exiting.
|
|
419
|
+
|
|
420
|
+
.. NOTE::
|
|
421
|
+
|
|
422
|
+
If you ever encounter an :exc:`OverflowError` when running the
|
|
423
|
+
:meth:`FMatrix.find_orthogonal_solution` solver, consider
|
|
424
|
+
increasing the parameter ``n_bytes``.
|
|
425
|
+
|
|
426
|
+
.. WARNING::
|
|
427
|
+
|
|
428
|
+
The current data structure supports up to `2^16` entries,
|
|
429
|
+
with each monomial in each entry having at most 254
|
|
430
|
+
nonzero terms. On average, each of the ``max_terms`` monomials
|
|
431
|
+
can have at most 30 terms.
|
|
432
|
+
|
|
433
|
+
EXAMPLES::
|
|
434
|
+
|
|
435
|
+
sage: from sage.algebras.fusion_rings.shm_managers import FvarsHandler
|
|
436
|
+
sage: # Create shared data structure
|
|
437
|
+
sage: f = FusionRing("A2", 1).get_fmatrix(inject_variables=True, new=True)
|
|
438
|
+
creating variables fx1..fx8
|
|
439
|
+
Defining fx0, fx1, fx2, fx3, fx4, fx5, fx6, fx7
|
|
440
|
+
sage: f.start_worker_pool()
|
|
441
|
+
sage: n_proc = f.pool._processes
|
|
442
|
+
sage: pids_name = f._pid_list.shm.name
|
|
443
|
+
sage: fvars = FvarsHandler(8, f._field, f._idx_to_sextuple, use_mp=n_proc, pids_name=pids_name)
|
|
444
|
+
sage: # In the same shell or in a different shell, attach to fvars
|
|
445
|
+
sage: name = fvars.shm.name
|
|
446
|
+
sage: fvars2 = FvarsHandler(8, f._field, f._idx_to_sextuple, name=name , use_mp=n_proc, pids_name=pids_name)
|
|
447
|
+
sage: from sage.algebras.fusion_rings.poly_tup_engine import poly_to_tup
|
|
448
|
+
sage: rhs = tuple((exp, tuple(c._coefficients())) for exp, c in poly_to_tup(fx5**5))
|
|
449
|
+
sage: fvars[f2, f1, f2, f2, f0, f0] = rhs
|
|
450
|
+
sage: f._tup_to_fpoly(fvars2[f2, f1, f2, f2, f0, f0])
|
|
451
|
+
fx5^5
|
|
452
|
+
sage: fvars.shm.unlink()
|
|
453
|
+
sage: f.shutdown_worker_pool()
|
|
454
|
+
"""
|
|
455
|
+
def __init__(self, n_slots, field, idx_to_sextuple, init_data=None,
|
|
456
|
+
use_mp=0,
|
|
457
|
+
pids_name=None, name=None, max_terms=20, n_bytes=32):
|
|
458
|
+
r"""
|
|
459
|
+
Initialize ``self``.
|
|
460
|
+
|
|
461
|
+
EXAMPLES::
|
|
462
|
+
|
|
463
|
+
sage: from sage.algebras.fusion_rings.shm_managers import FvarsHandler
|
|
464
|
+
sage: # Create shared data structure
|
|
465
|
+
sage: f = FusionRing("A2", 1).get_fmatrix(inject_variables=True, new=True)
|
|
466
|
+
creating variables fx1..fx8
|
|
467
|
+
Defining fx0, fx1, fx2, fx3, fx4, fx5, fx6, fx7
|
|
468
|
+
sage: f.start_worker_pool()
|
|
469
|
+
sage: n_proc = f.pool._processes
|
|
470
|
+
sage: pids_name = f._pid_list.shm.name
|
|
471
|
+
sage: fvars = FvarsHandler(8, f._field, f._idx_to_sextuple, use_mp=n_proc, pids_name=pids_name)
|
|
472
|
+
sage: TestSuite(fvars).run(skip='_test_pickling')
|
|
473
|
+
sage: fvars.shm.unlink()
|
|
474
|
+
sage: f.shutdown_worker_pool()
|
|
475
|
+
"""
|
|
476
|
+
self.field = field
|
|
477
|
+
self.obj_cache = dict()
|
|
478
|
+
cdef int d = self.field.degree()
|
|
479
|
+
self.bytes = n_bytes
|
|
480
|
+
cdef int slots = self.bytes // 8
|
|
481
|
+
cdef int n_proc = use_mp + 1
|
|
482
|
+
if init_data is None:
|
|
483
|
+
init_data = {}
|
|
484
|
+
self.fvars_t = np.dtype([
|
|
485
|
+
('modified', np.int8, (n_proc, )),
|
|
486
|
+
('ticks', 'u1', (max_terms, )),
|
|
487
|
+
('exp_data', 'u2', (max_terms*30, )),
|
|
488
|
+
('coeff_nums', np.int64, (max_terms, d, slots)),
|
|
489
|
+
('coeff_denom', np.uint64, (max_terms, d, slots))
|
|
490
|
+
])
|
|
491
|
+
self.sext_to_idx = {s: i for i, s in idx_to_sextuple.items()}
|
|
492
|
+
self.ngens = n_slots
|
|
493
|
+
if use_mp:
|
|
494
|
+
if name is None:
|
|
495
|
+
self.shm = shared_memory.SharedMemory(create=True, size=self.ngens*self.fvars_t.itemsize)
|
|
496
|
+
else:
|
|
497
|
+
self.shm = shared_memory.SharedMemory(name=name)
|
|
498
|
+
self.fvars = np.ndarray((self.ngens, ), dtype=self.fvars_t, buffer=self.shm.buf)
|
|
499
|
+
self.pid_list = shared_memory.ShareableList(name=pids_name)
|
|
500
|
+
self.child_id = -1
|
|
501
|
+
else:
|
|
502
|
+
self.fvars = np.ndarray((self.ngens, ), dtype=self.fvars_t)
|
|
503
|
+
self.child_id = 0
|
|
504
|
+
# Populate with initialization data
|
|
505
|
+
for sextuple, fvar in init_data.items():
|
|
506
|
+
if isinstance(fvar, MPolynomial_libsingular):
|
|
507
|
+
fvar = _flatten_coeffs(poly_to_tup(fvar))
|
|
508
|
+
if isinstance(fvar, NumberFieldElement_absolute):
|
|
509
|
+
fvar = ((ETuple({}, self.ngens), tuple(fvar._coefficients())), )
|
|
510
|
+
if isinstance(fvar, tuple):
|
|
511
|
+
transformed = list()
|
|
512
|
+
for exp, c in fvar:
|
|
513
|
+
if isinstance(c, NumberFieldElement_absolute):
|
|
514
|
+
transformed.append((exp, tuple(c._coefficients())))
|
|
515
|
+
if transformed:
|
|
516
|
+
fvar = tuple(transformed)
|
|
517
|
+
self[sextuple] = fvar
|
|
518
|
+
|
|
519
|
+
@cython.nonecheck(False)
|
|
520
|
+
@cython.wraparound(False)
|
|
521
|
+
@cython.boundscheck(False)
|
|
522
|
+
def __getitem__(self, sextuple):
|
|
523
|
+
r"""
|
|
524
|
+
Retrieve a record from the shared memory data structure by
|
|
525
|
+
unflattening its representation and constructing relevant Python
|
|
526
|
+
objects.
|
|
527
|
+
|
|
528
|
+
This method returns a tuple of ``(ETuple, coeff)`` pairs,
|
|
529
|
+
where ``coeff`` is an element of ``self.field``.
|
|
530
|
+
|
|
531
|
+
EXAMPLES::
|
|
532
|
+
|
|
533
|
+
sage: from sage.algebras.fusion_rings.shm_managers import FvarsHandler
|
|
534
|
+
sage: from sage.algebras.fusion_rings.poly_tup_engine import poly_to_tup
|
|
535
|
+
sage: f = FusionRing("B7", 1).get_fmatrix(inject_variables=True, new=True)
|
|
536
|
+
creating variables fx1..fx14
|
|
537
|
+
Defining fx0, fx1, fx2, fx3, fx4, fx5, fx6, fx7, fx8, fx9, fx10, fx11, fx12, fx13
|
|
538
|
+
sage: f.start_worker_pool()
|
|
539
|
+
sage: n_proc = f.pool._processes
|
|
540
|
+
sage: pids_name = f._pid_list.shm.name
|
|
541
|
+
sage: fvars = FvarsHandler(14, f._field, f._idx_to_sextuple, use_mp=n_proc, pids_name=pids_name)
|
|
542
|
+
sage: rhs = tuple((exp, tuple(c._coefficients()))
|
|
543
|
+
....: for exp, c in poly_to_tup(1/8*fx0**15 - 23/79*fx2*fx13**3 - 799/2881*fx1*fx2**5*fx10))
|
|
544
|
+
sage: fvars[(f1, f2, f1, f2, f2, f2)] = rhs
|
|
545
|
+
sage: rhs = tuple((exp, tuple(c._coefficients())) for exp, c in poly_to_tup(f._poly_ring.zero()))
|
|
546
|
+
sage: fvars[f2, f2, f2, f2, f0, f0] = rhs
|
|
547
|
+
sage: rhs = tuple((exp, tuple(c._coefficients())) for exp, c in poly_to_tup(-1/19*f._poly_ring.one()))
|
|
548
|
+
sage: fvars[f2, f1, f2, f1, f2, f2] = rhs
|
|
549
|
+
sage: s, t, r = (f1, f2, f1, f2, f2, f2), (f2, f2, f2, f2, f0, f0), (f2, f1, f2, f1, f2, f2)
|
|
550
|
+
sage: f._tup_to_fpoly(fvars[s]) == 1/8*fx0**15 - 23/79*fx2*fx13**3 - 799/2881*fx1*fx2**5*fx10
|
|
551
|
+
True
|
|
552
|
+
sage: f._tup_to_fpoly(fvars[t]) == 0
|
|
553
|
+
True
|
|
554
|
+
sage: f._tup_to_fpoly(fvars[r]) == -1/19
|
|
555
|
+
True
|
|
556
|
+
sage: fvars.shm.unlink()
|
|
557
|
+
sage: f.shutdown_worker_pool()
|
|
558
|
+
|
|
559
|
+
.. NOTE::
|
|
560
|
+
|
|
561
|
+
This method implements caching. Only the parent process is allowed
|
|
562
|
+
to modify the shared fvars structure. Each process builds its own
|
|
563
|
+
cache, so each process must update its cache before retrieving a
|
|
564
|
+
modified entry, tagged via its ``modified`` property.
|
|
565
|
+
"""
|
|
566
|
+
if sextuple not in self.sext_to_idx:
|
|
567
|
+
raise KeyError('invalid sextuple {}'.format(sextuple))
|
|
568
|
+
cdef Py_ssize_t idx = self.sext_to_idx[sextuple]
|
|
569
|
+
# Each process builds its own cache, so each process must know
|
|
570
|
+
# whether the entry it wants to retrieve has been modified.
|
|
571
|
+
# Each process needs to know where to look, so we use an index
|
|
572
|
+
# every process agrees on. The pid_list[0] belongs to the main process.
|
|
573
|
+
if self.child_id < 0:
|
|
574
|
+
self.child_id = self.pid_list.index(getpid())
|
|
575
|
+
if idx in self.obj_cache:
|
|
576
|
+
if self.fvars['modified'][idx, self.child_id]:
|
|
577
|
+
del self.obj_cache[idx]
|
|
578
|
+
else:
|
|
579
|
+
return self.obj_cache[idx]
|
|
580
|
+
cdef ETuple e, exp
|
|
581
|
+
cdef int count, nnz
|
|
582
|
+
cdef Integer num
|
|
583
|
+
cdef list poly_tup, rats
|
|
584
|
+
cdef NumberFieldElement_absolute cyc_coeff
|
|
585
|
+
cdef Py_ssize_t cum, i, j, k
|
|
586
|
+
cdef Rational quo
|
|
587
|
+
cdef tuple ret
|
|
588
|
+
# Define memory views to reduce Python overhead and ensure correct typing
|
|
589
|
+
cdef np.ndarray[np.uint8_t, ndim=1] ticks = self.fvars['ticks'][idx]
|
|
590
|
+
cdef np.ndarray[np.uint16_t, ndim=1] exp_data = self.fvars['exp_data'][idx]
|
|
591
|
+
cdef np.ndarray[np.int64_t, ndim=3] nums = self.fvars['coeff_nums'][idx]
|
|
592
|
+
cdef np.ndarray[np.uint64_t, ndim=3] denoms = self.fvars['coeff_denom'][idx]
|
|
593
|
+
cdef np.ndarray[np.int8_t, ndim=1] modified = self.fvars['modified'][idx]
|
|
594
|
+
e = ETuple({}, self.ngens)
|
|
595
|
+
poly_tup = list()
|
|
596
|
+
cum = 0
|
|
597
|
+
count = np.count_nonzero(ticks)
|
|
598
|
+
for i in range(count):
|
|
599
|
+
# Construct new ETuple for each monomial
|
|
600
|
+
exp = e._new()
|
|
601
|
+
# Handle constant coeff
|
|
602
|
+
nnz = ticks[i] if ticks[i] < 255 else 0
|
|
603
|
+
exp._nonzero = nnz
|
|
604
|
+
if nnz:
|
|
605
|
+
exp._data = <int*>sig_malloc(sizeof(int)*nnz*2)
|
|
606
|
+
for j in range(2*nnz):
|
|
607
|
+
exp._data[j] = <int>exp_data[cum]
|
|
608
|
+
cum += 1
|
|
609
|
+
|
|
610
|
+
# Construct cyclotomic field coefficient
|
|
611
|
+
rats = list()
|
|
612
|
+
for k in range(self.field.degree()):
|
|
613
|
+
num = Integer(list(nums[i, k]), 2**63)
|
|
614
|
+
denom = Integer(list(denoms[i, k]), 2**64)
|
|
615
|
+
quo = num / denom
|
|
616
|
+
rats.append(quo)
|
|
617
|
+
cyc_coeff = self.field(rats)
|
|
618
|
+
poly_tup.append((exp, cyc_coeff))
|
|
619
|
+
ret = tuple(poly_tup)
|
|
620
|
+
# Cache object and reset modified
|
|
621
|
+
self.obj_cache[idx] = ret
|
|
622
|
+
modified[self.child_id] = 0
|
|
623
|
+
return ret
|
|
624
|
+
|
|
625
|
+
@cython.nonecheck(False)
|
|
626
|
+
@cython.wraparound(False)
|
|
627
|
+
def __setitem__(self, sextuple, fvar):
|
|
628
|
+
r"""
|
|
629
|
+
Given a sextuple of labels and a tuple of ``(ETuple, cyc_coeff)`` pairs,
|
|
630
|
+
create or overwrite an entry in the shared data structure
|
|
631
|
+
corresponding to the given sextuple.
|
|
632
|
+
|
|
633
|
+
EXAMPLES::
|
|
634
|
+
|
|
635
|
+
sage: from sage.algebras.fusion_rings.shm_managers import FvarsHandler
|
|
636
|
+
sage: from sage.algebras.fusion_rings.poly_tup_engine import poly_to_tup
|
|
637
|
+
sage: f = FusionRing("A3", 1).get_fmatrix(inject_variables=True, new=True)
|
|
638
|
+
creating variables fx1..fx27
|
|
639
|
+
Defining fx0, ..., fx26
|
|
640
|
+
sage: f.start_worker_pool()
|
|
641
|
+
sage: n_proc = f.pool._processes
|
|
642
|
+
sage: pids_name = f._pid_list.shm.name
|
|
643
|
+
sage: fvars = FvarsHandler(27, f._field, f._idx_to_sextuple, use_mp=n_proc, pids_name=pids_name)
|
|
644
|
+
sage: rhs = tuple((exp, tuple(c._coefficients()))
|
|
645
|
+
....: for exp, c in poly_to_tup(1/8*fx0**15 - 23/79*fx2*fx21**3 - 799/2881*fx1*fx2**5*fx10))
|
|
646
|
+
sage: fvars[(f3, f2, f1, f2, f1, f3)] = rhs
|
|
647
|
+
sage: rhs = tuple((exp, tuple(c._coefficients())) for exp, c in poly_to_tup(f._poly_ring.zero()))
|
|
648
|
+
sage: fvars[f3, f2, f3, f0, f1, f1] = rhs
|
|
649
|
+
sage: rhs = tuple((exp, tuple(c._coefficients())) for exp, c in poly_to_tup(-1/19*f._poly_ring.one()))
|
|
650
|
+
sage: fvars[f3, f3, f3, f1, f2, f2] = rhs
|
|
651
|
+
sage: s, t, r = (f3, f2, f1, f2, f1, f3), (f3, f2, f3, f0, f1, f1), (f3, f3, f3, f1, f2, f2)
|
|
652
|
+
sage: f._tup_to_fpoly(fvars[s]) == 1/8*fx0**15 - 23/79*fx2*fx21**3 - 799/2881*fx1*fx2**5*fx10
|
|
653
|
+
True
|
|
654
|
+
sage: f._tup_to_fpoly(fvars[t]) == 0
|
|
655
|
+
True
|
|
656
|
+
sage: f._tup_to_fpoly(fvars[r]) == -1/19
|
|
657
|
+
True
|
|
658
|
+
sage: fvars.shm.unlink()
|
|
659
|
+
sage: f.shutdown_worker_pool()
|
|
660
|
+
"""
|
|
661
|
+
cdef ETuple exp
|
|
662
|
+
cdef Integer num, denom
|
|
663
|
+
cdef tuple coeff_tup
|
|
664
|
+
cdef Py_ssize_t cum, i, idx, j, k, t
|
|
665
|
+
cdef Rational r
|
|
666
|
+
idx = self.sext_to_idx[sextuple]
|
|
667
|
+
# Clear entry before inserting
|
|
668
|
+
self.fvars[idx] = np.zeros((1, ), dtype=self.fvars_t)
|
|
669
|
+
# Define memory views to reduce Python overhead and ensure correct typing
|
|
670
|
+
cdef np.ndarray[np.uint8_t, ndim=1] ticks = self.fvars['ticks'][idx]
|
|
671
|
+
cdef np.ndarray[np.uint16_t, ndim=1] exp_data = self.fvars['exp_data'][idx]
|
|
672
|
+
cdef np.ndarray[np.int64_t, ndim=3] nums = self.fvars['coeff_nums'][idx]
|
|
673
|
+
cdef np.ndarray[np.uint64_t, ndim=3] denoms = self.fvars['coeff_denom'][idx]
|
|
674
|
+
cdef np.ndarray[np.int8_t, ndim=1] modified = self.fvars['modified'][idx]
|
|
675
|
+
cdef list digits
|
|
676
|
+
# Initialize denominators to 1
|
|
677
|
+
denoms[:, :, 0] = 1
|
|
678
|
+
cum = 0
|
|
679
|
+
i = 0
|
|
680
|
+
for exp, coeff_tup in fvar:
|
|
681
|
+
# Handle constant coefficient
|
|
682
|
+
if exp._nonzero > 0:
|
|
683
|
+
ticks[i] = exp._nonzero
|
|
684
|
+
else:
|
|
685
|
+
ticks[i] = -1
|
|
686
|
+
for j in range(2*exp._nonzero):
|
|
687
|
+
exp_data[cum] = exp._data[j]
|
|
688
|
+
cum += 1
|
|
689
|
+
k = 0
|
|
690
|
+
for r in coeff_tup:
|
|
691
|
+
num, denom = r.as_integer_ratio()
|
|
692
|
+
if abs(num) > 2**63 or denom > 2**63:
|
|
693
|
+
print("Large integers encountered in FvarsHandler", num, denom)
|
|
694
|
+
if abs(num) < 2**63:
|
|
695
|
+
nums[i, k, 0] = num
|
|
696
|
+
else:
|
|
697
|
+
digits = num.digits(2**63)
|
|
698
|
+
# assert len(digits) <= self.bytes // 8, "Numerator {} is too large for shared FvarsHandler. Use at least {} bytes...".format(num, num.nbits()//8+1)
|
|
699
|
+
for t in range(len(digits)):
|
|
700
|
+
nums[i, k, t] = <np.int64_t>digits[t]
|
|
701
|
+
if denom < 2**64:
|
|
702
|
+
denoms[i, k, 0] = denom
|
|
703
|
+
else:
|
|
704
|
+
digits = denom.digits(2**64)
|
|
705
|
+
# assert len(digits) <= self.bytes // 8, "Denominator {} is too large for shared FvarsHandler. Use at least {} bytes...".format(denom, denom.nbits()//8+1)
|
|
706
|
+
for t in range(len(digits)):
|
|
707
|
+
denoms[i, k, t] = <np.uint64_t>digits[t]
|
|
708
|
+
k += 1
|
|
709
|
+
i += 1
|
|
710
|
+
modified[:] = 1
|
|
711
|
+
|
|
712
|
+
def __reduce__(self):
|
|
713
|
+
r"""
|
|
714
|
+
Provide pickling / unpickling support for ``self``.
|
|
715
|
+
|
|
716
|
+
TESTS::
|
|
717
|
+
|
|
718
|
+
sage: f = FusionRing("F4", 1).get_fmatrix()
|
|
719
|
+
sage: from sage.algebras.fusion_rings.shm_managers import FvarsHandler
|
|
720
|
+
sage: n = f._poly_ring.ngens()
|
|
721
|
+
sage: f.start_worker_pool()
|
|
722
|
+
sage: n_proc = f.pool._processes
|
|
723
|
+
sage: pids_name = f._pid_list.shm.name
|
|
724
|
+
sage: fvars = FvarsHandler(n, f._field, f._idx_to_sextuple, init_data=f._fvars, use_mp=n_proc, pids_name=pids_name)
|
|
725
|
+
sage: for s, fvar in loads(dumps(fvars)).items():
|
|
726
|
+
....: assert f._fvars[s] == f._tup_to_fpoly(fvar)
|
|
727
|
+
....:
|
|
728
|
+
sage: fvars.shm.unlink()
|
|
729
|
+
sage: f.shutdown_worker_pool()
|
|
730
|
+
"""
|
|
731
|
+
n = self.fvars.size
|
|
732
|
+
idx_map = {i: s for s, i in self.sext_to_idx.items()}
|
|
733
|
+
d = {s: fvar for s, fvar in self.items()}
|
|
734
|
+
return make_FvarsHandler, (n, self.field, idx_map, d)
|
|
735
|
+
|
|
736
|
+
def items(self):
|
|
737
|
+
r"""
|
|
738
|
+
Iterate through key-value pairs in the data structure as if it
|
|
739
|
+
were a Python dict.
|
|
740
|
+
|
|
741
|
+
As in a Python dict, the key-value pairs are yielded in no particular
|
|
742
|
+
order.
|
|
743
|
+
|
|
744
|
+
EXAMPLES::
|
|
745
|
+
|
|
746
|
+
sage: f = FusionRing("G2", 1).get_fmatrix(inject_variables=True, new=True)
|
|
747
|
+
creating variables fx1..fx5
|
|
748
|
+
Defining fx0, fx1, fx2, fx3, fx4
|
|
749
|
+
sage: from sage.algebras.fusion_rings.shm_managers import FvarsHandler
|
|
750
|
+
sage: shared_fvars = FvarsHandler(5, f._field, f._idx_to_sextuple, init_data=f._fvars)
|
|
751
|
+
sage: for sextuple, fvar in shared_fvars.items():
|
|
752
|
+
....: if sextuple == (f1, f1, f1, f1, f1, f1):
|
|
753
|
+
....: f._tup_to_fpoly(fvar)
|
|
754
|
+
....:
|
|
755
|
+
fx4
|
|
756
|
+
"""
|
|
757
|
+
for sextuple in self.sext_to_idx:
|
|
758
|
+
yield sextuple, self[sextuple]
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
def make_FvarsHandler(n, field, idx_map, init_data):
|
|
762
|
+
r"""
|
|
763
|
+
Provide pickling / unpickling support for :class:`FvarsHandler`.
|
|
764
|
+
|
|
765
|
+
TESTS::
|
|
766
|
+
|
|
767
|
+
sage: f = FusionRing("G2", 1).get_fmatrix()
|
|
768
|
+
sage: from sage.algebras.fusion_rings.shm_managers import FvarsHandler
|
|
769
|
+
sage: n = f._poly_ring.ngens()
|
|
770
|
+
sage: f.start_worker_pool()
|
|
771
|
+
sage: n_proc = f.pool._processes
|
|
772
|
+
sage: pids_name = f._pid_list.shm.name
|
|
773
|
+
sage: fvars = FvarsHandler(n, f._field, f._idx_to_sextuple, init_data=f._fvars, use_mp=n_proc, pids_name=pids_name)
|
|
774
|
+
sage: for s, fvar in loads(dumps(fvars)).items(): # indirect doctest
|
|
775
|
+
....: assert f._fvars[s] == f._tup_to_fpoly(fvar)
|
|
776
|
+
....:
|
|
777
|
+
sage: fvars.shm.unlink()
|
|
778
|
+
sage: f.shutdown_worker_pool()
|
|
779
|
+
"""
|
|
780
|
+
return FvarsHandler(n, field, idx_map, init_data=init_data)
|