passagemath-singular 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-singular might be problematic. Click here for more details.

Files changed (493) hide show
  1. PySingular.cpython-314-x86_64-linux-musl.so +0 -0
  2. passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
  3. passagemath_singular-10.6.31rc3.dist-info/RECORD +493 -0
  4. passagemath_singular-10.6.31rc3.dist-info/WHEEL +5 -0
  5. passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
  6. passagemath_singular.libs/libSingular-4-67059f19.4.1.so +0 -0
  7. passagemath_singular.libs/libcddgmp-30166d29.so.0.1.3 +0 -0
  8. passagemath_singular.libs/libfactory-4-9d37bcf4.4.1.so +0 -0
  9. passagemath_singular.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
  10. passagemath_singular.libs/libgcc_s-0cd532bd.so.1 +0 -0
  11. passagemath_singular.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
  12. passagemath_singular.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
  13. passagemath_singular.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  14. passagemath_singular.libs/libgsl-42cda06f.so.28.0.0 +0 -0
  15. passagemath_singular.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
  16. passagemath_singular.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
  17. passagemath_singular.libs/libntl-26885ca2.so.44.0.1 +0 -0
  18. passagemath_singular.libs/libomalloc-0-e9ff96db.9.6.so +0 -0
  19. passagemath_singular.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
  20. passagemath_singular.libs/libpolys-4-8bcf8e7d.4.1.so +0 -0
  21. passagemath_singular.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
  22. passagemath_singular.libs/libreadline-06542304.so.8.2 +0 -0
  23. passagemath_singular.libs/libsingular_resources-4-73bf7623.4.1.so +0 -0
  24. passagemath_singular.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  25. sage/algebras/all__sagemath_singular.py +3 -0
  26. sage/algebras/fusion_rings/all.py +19 -0
  27. sage/algebras/fusion_rings/f_matrix.py +2448 -0
  28. sage/algebras/fusion_rings/fast_parallel_fmats_methods.cpython-314-x86_64-linux-musl.so +0 -0
  29. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +5 -0
  30. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +538 -0
  31. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.cpython-314-x86_64-linux-musl.so +0 -0
  32. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +3 -0
  33. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +331 -0
  34. sage/algebras/fusion_rings/fusion_double.py +899 -0
  35. sage/algebras/fusion_rings/fusion_ring.py +1580 -0
  36. sage/algebras/fusion_rings/poly_tup_engine.cpython-314-x86_64-linux-musl.so +0 -0
  37. sage/algebras/fusion_rings/poly_tup_engine.pxd +24 -0
  38. sage/algebras/fusion_rings/poly_tup_engine.pyx +579 -0
  39. sage/algebras/fusion_rings/shm_managers.cpython-314-x86_64-linux-musl.so +0 -0
  40. sage/algebras/fusion_rings/shm_managers.pxd +24 -0
  41. sage/algebras/fusion_rings/shm_managers.pyx +780 -0
  42. sage/algebras/letterplace/all.py +1 -0
  43. sage/algebras/letterplace/free_algebra_element_letterplace.cpython-314-x86_64-linux-musl.so +0 -0
  44. sage/algebras/letterplace/free_algebra_element_letterplace.pxd +18 -0
  45. sage/algebras/letterplace/free_algebra_element_letterplace.pyx +755 -0
  46. sage/algebras/letterplace/free_algebra_letterplace.cpython-314-x86_64-linux-musl.so +0 -0
  47. sage/algebras/letterplace/free_algebra_letterplace.pxd +35 -0
  48. sage/algebras/letterplace/free_algebra_letterplace.pyx +914 -0
  49. sage/algebras/letterplace/letterplace_ideal.cpython-314-x86_64-linux-musl.so +0 -0
  50. sage/algebras/letterplace/letterplace_ideal.pyx +408 -0
  51. sage/algebras/quatalg/all.py +2 -0
  52. sage/algebras/quatalg/quaternion_algebra.py +4778 -0
  53. sage/algebras/quatalg/quaternion_algebra_cython.cpython-314-x86_64-linux-musl.so +0 -0
  54. sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
  55. sage/algebras/quatalg/quaternion_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  56. sage/algebras/quatalg/quaternion_algebra_element.pxd +29 -0
  57. sage/algebras/quatalg/quaternion_algebra_element.pyx +2176 -0
  58. sage/all__sagemath_singular.py +11 -0
  59. sage/ext_data/all__sagemath_singular.py +1 -0
  60. sage/ext_data/singular/function_field/core.lib +98 -0
  61. sage/interfaces/all__sagemath_singular.py +1 -0
  62. sage/interfaces/singular.py +2835 -0
  63. sage/libs/all__sagemath_singular.py +1 -0
  64. sage/libs/singular/__init__.py +1 -0
  65. sage/libs/singular/decl.pxd +1168 -0
  66. sage/libs/singular/function.cpython-314-x86_64-linux-musl.so +0 -0
  67. sage/libs/singular/function.pxd +87 -0
  68. sage/libs/singular/function.pyx +1901 -0
  69. sage/libs/singular/function_factory.py +61 -0
  70. sage/libs/singular/groebner_strategy.cpython-314-x86_64-linux-musl.so +0 -0
  71. sage/libs/singular/groebner_strategy.pxd +22 -0
  72. sage/libs/singular/groebner_strategy.pyx +582 -0
  73. sage/libs/singular/option.cpython-314-x86_64-linux-musl.so +0 -0
  74. sage/libs/singular/option.pyx +671 -0
  75. sage/libs/singular/polynomial.cpython-314-x86_64-linux-musl.so +0 -0
  76. sage/libs/singular/polynomial.pxd +39 -0
  77. sage/libs/singular/polynomial.pyx +661 -0
  78. sage/libs/singular/ring.cpython-314-x86_64-linux-musl.so +0 -0
  79. sage/libs/singular/ring.pxd +58 -0
  80. sage/libs/singular/ring.pyx +893 -0
  81. sage/libs/singular/singular.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/libs/singular/singular.pxd +72 -0
  83. sage/libs/singular/singular.pyx +1944 -0
  84. sage/libs/singular/standard_options.py +145 -0
  85. sage/matrix/all__sagemath_singular.py +1 -0
  86. sage/matrix/matrix_mpolynomial_dense.cpython-314-x86_64-linux-musl.so +0 -0
  87. sage/matrix/matrix_mpolynomial_dense.pxd +7 -0
  88. sage/matrix/matrix_mpolynomial_dense.pyx +615 -0
  89. sage/rings/all__sagemath_singular.py +1 -0
  90. sage/rings/function_field/all__sagemath_singular.py +1 -0
  91. sage/rings/function_field/derivations_polymod.py +911 -0
  92. sage/rings/function_field/element_polymod.cpython-314-x86_64-linux-musl.so +0 -0
  93. sage/rings/function_field/element_polymod.pyx +406 -0
  94. sage/rings/function_field/function_field_polymod.py +2611 -0
  95. sage/rings/function_field/ideal_polymod.py +1775 -0
  96. sage/rings/function_field/order_polymod.py +1475 -0
  97. sage/rings/function_field/place_polymod.py +681 -0
  98. sage/rings/polynomial/all__sagemath_singular.py +1 -0
  99. sage/rings/polynomial/multi_polynomial_ideal_libsingular.cpython-314-x86_64-linux-musl.so +0 -0
  100. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +5 -0
  101. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +339 -0
  102. sage/rings/polynomial/multi_polynomial_libsingular.cpython-314-x86_64-linux-musl.so +0 -0
  103. sage/rings/polynomial/multi_polynomial_libsingular.pxd +30 -0
  104. sage/rings/polynomial/multi_polynomial_libsingular.pyx +6277 -0
  105. sage/rings/polynomial/plural.cpython-314-x86_64-linux-musl.so +0 -0
  106. sage/rings/polynomial/plural.pxd +48 -0
  107. sage/rings/polynomial/plural.pyx +3171 -0
  108. sage/symbolic/all__sagemath_singular.py +1 -0
  109. sage/symbolic/comparison_impl.pxi +428 -0
  110. sage/symbolic/constants_c_impl.pxi +178 -0
  111. sage/symbolic/expression.cpython-314-x86_64-linux-musl.so +0 -0
  112. sage/symbolic/expression.pxd +7 -0
  113. sage/symbolic/expression.pyx +14200 -0
  114. sage/symbolic/getitem_impl.pxi +202 -0
  115. sage/symbolic/pynac.pxi +572 -0
  116. sage/symbolic/pynac_constant_impl.pxi +133 -0
  117. sage/symbolic/pynac_function_impl.pxi +206 -0
  118. sage/symbolic/pynac_impl.pxi +2576 -0
  119. sage/symbolic/pynac_wrap.h +124 -0
  120. sage/symbolic/series_impl.pxi +272 -0
  121. sage/symbolic/substitution_map_impl.pxi +94 -0
  122. sage_wheels/bin/ESingular +0 -0
  123. sage_wheels/bin/Singular +0 -0
  124. sage_wheels/bin/TSingular +0 -0
  125. sage_wheels/lib/singular/MOD/cohomo.la +41 -0
  126. sage_wheels/lib/singular/MOD/cohomo.so +0 -0
  127. sage_wheels/lib/singular/MOD/customstd.la +41 -0
  128. sage_wheels/lib/singular/MOD/customstd.so +0 -0
  129. sage_wheels/lib/singular/MOD/freealgebra.la +41 -0
  130. sage_wheels/lib/singular/MOD/freealgebra.so +0 -0
  131. sage_wheels/lib/singular/MOD/gfanlib.la +41 -0
  132. sage_wheels/lib/singular/MOD/gfanlib.so +0 -0
  133. sage_wheels/lib/singular/MOD/gitfan.la +41 -0
  134. sage_wheels/lib/singular/MOD/gitfan.so +0 -0
  135. sage_wheels/lib/singular/MOD/interval.la +41 -0
  136. sage_wheels/lib/singular/MOD/interval.so +0 -0
  137. sage_wheels/lib/singular/MOD/loctriv.la +41 -0
  138. sage_wheels/lib/singular/MOD/loctriv.so +0 -0
  139. sage_wheels/lib/singular/MOD/machinelearning.la +41 -0
  140. sage_wheels/lib/singular/MOD/machinelearning.so +0 -0
  141. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.la +41 -0
  142. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.so +0 -0
  143. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.la +41 -0
  144. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.so +0 -0
  145. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.la +41 -0
  146. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.so +0 -0
  147. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.la +41 -0
  148. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.so +0 -0
  149. sage_wheels/lib/singular/MOD/partialgb.la +41 -0
  150. sage_wheels/lib/singular/MOD/partialgb.so +0 -0
  151. sage_wheels/lib/singular/MOD/pyobject.la +41 -0
  152. sage_wheels/lib/singular/MOD/pyobject.so +0 -0
  153. sage_wheels/lib/singular/MOD/singmathic.la +41 -0
  154. sage_wheels/lib/singular/MOD/singmathic.so +0 -0
  155. sage_wheels/lib/singular/MOD/sispasm.la +41 -0
  156. sage_wheels/lib/singular/MOD/sispasm.so +0 -0
  157. sage_wheels/lib/singular/MOD/subsets.la +41 -0
  158. sage_wheels/lib/singular/MOD/subsets.so +0 -0
  159. sage_wheels/lib/singular/MOD/systhreads.la +41 -0
  160. sage_wheels/lib/singular/MOD/systhreads.so +0 -0
  161. sage_wheels/lib/singular/MOD/syzextra.la +41 -0
  162. sage_wheels/lib/singular/MOD/syzextra.so +0 -0
  163. sage_wheels/libexec/singular/MOD/change_cost +0 -0
  164. sage_wheels/libexec/singular/MOD/singularsurf +11 -0
  165. sage_wheels/libexec/singular/MOD/singularsurf_jupyter +9 -0
  166. sage_wheels/libexec/singular/MOD/singularsurf_win +10 -0
  167. sage_wheels/libexec/singular/MOD/solve_IP +0 -0
  168. sage_wheels/libexec/singular/MOD/surfex +16 -0
  169. sage_wheels/libexec/singular/MOD/toric_ideal +0 -0
  170. sage_wheels/share/factory/gftables/10201 +342 -0
  171. sage_wheels/share/factory/gftables/1024 +37 -0
  172. sage_wheels/share/factory/gftables/10609 +356 -0
  173. sage_wheels/share/factory/gftables/11449 +384 -0
  174. sage_wheels/share/factory/gftables/11881 +398 -0
  175. sage_wheels/share/factory/gftables/121 +6 -0
  176. sage_wheels/share/factory/gftables/12167 +408 -0
  177. sage_wheels/share/factory/gftables/125 +7 -0
  178. sage_wheels/share/factory/gftables/12769 +428 -0
  179. sage_wheels/share/factory/gftables/128 +7 -0
  180. sage_wheels/share/factory/gftables/1331 +47 -0
  181. sage_wheels/share/factory/gftables/1369 +48 -0
  182. sage_wheels/share/factory/gftables/14641 +490 -0
  183. sage_wheels/share/factory/gftables/15625 +523 -0
  184. sage_wheels/share/factory/gftables/16 +3 -0
  185. sage_wheels/share/factory/gftables/16129 +540 -0
  186. sage_wheels/share/factory/gftables/16384 +549 -0
  187. sage_wheels/share/factory/gftables/16807 +563 -0
  188. sage_wheels/share/factory/gftables/1681 +58 -0
  189. sage_wheels/share/factory/gftables/169 +8 -0
  190. sage_wheels/share/factory/gftables/17161 +574 -0
  191. sage_wheels/share/factory/gftables/1849 +64 -0
  192. sage_wheels/share/factory/gftables/18769 +628 -0
  193. sage_wheels/share/factory/gftables/19321 +646 -0
  194. sage_wheels/share/factory/gftables/19683 +659 -0
  195. sage_wheels/share/factory/gftables/2048 +71 -0
  196. sage_wheels/share/factory/gftables/2187 +75 -0
  197. sage_wheels/share/factory/gftables/2197 +76 -0
  198. sage_wheels/share/factory/gftables/2209 +76 -0
  199. sage_wheels/share/factory/gftables/22201 +742 -0
  200. sage_wheels/share/factory/gftables/22801 +762 -0
  201. sage_wheels/share/factory/gftables/2401 +82 -0
  202. sage_wheels/share/factory/gftables/243 +11 -0
  203. sage_wheels/share/factory/gftables/24389 +815 -0
  204. sage_wheels/share/factory/gftables/24649 +824 -0
  205. sage_wheels/share/factory/gftables/25 +3 -0
  206. sage_wheels/share/factory/gftables/256 +11 -0
  207. sage_wheels/share/factory/gftables/26569 +888 -0
  208. sage_wheels/share/factory/gftables/27 +3 -0
  209. sage_wheels/share/factory/gftables/27889 +932 -0
  210. sage_wheels/share/factory/gftables/2809 +96 -0
  211. sage_wheels/share/factory/gftables/28561 +954 -0
  212. sage_wheels/share/factory/gftables/289 +12 -0
  213. sage_wheels/share/factory/gftables/29791 +995 -0
  214. sage_wheels/share/factory/gftables/29929 +1000 -0
  215. sage_wheels/share/factory/gftables/3125 +107 -0
  216. sage_wheels/share/factory/gftables/32 +4 -0
  217. sage_wheels/share/factory/gftables/32041 +1070 -0
  218. sage_wheels/share/factory/gftables/32761 +1094 -0
  219. sage_wheels/share/factory/gftables/32768 +1095 -0
  220. sage_wheels/share/factory/gftables/343 +14 -0
  221. sage_wheels/share/factory/gftables/3481 +118 -0
  222. sage_wheels/share/factory/gftables/361 +14 -0
  223. sage_wheels/share/factory/gftables/36481 +1218 -0
  224. sage_wheels/share/factory/gftables/3721 +126 -0
  225. sage_wheels/share/factory/gftables/37249 +1244 -0
  226. sage_wheels/share/factory/gftables/38809 +1296 -0
  227. sage_wheels/share/factory/gftables/39601 +1322 -0
  228. sage_wheels/share/factory/gftables/4 +3 -0
  229. sage_wheels/share/factory/gftables/4096 +139 -0
  230. sage_wheels/share/factory/gftables/44521 +1486 -0
  231. sage_wheels/share/factory/gftables/4489 +152 -0
  232. sage_wheels/share/factory/gftables/49 +4 -0
  233. sage_wheels/share/factory/gftables/4913 +166 -0
  234. sage_wheels/share/factory/gftables/49729 +1660 -0
  235. sage_wheels/share/factory/gftables/5041 +170 -0
  236. sage_wheels/share/factory/gftables/50653 +1691 -0
  237. sage_wheels/share/factory/gftables/512 +20 -0
  238. sage_wheels/share/factory/gftables/51529 +1720 -0
  239. sage_wheels/share/factory/gftables/52441 +1750 -0
  240. sage_wheels/share/factory/gftables/529 +20 -0
  241. sage_wheels/share/factory/gftables/5329 +180 -0
  242. sage_wheels/share/factory/gftables/54289 +1812 -0
  243. sage_wheels/share/factory/gftables/57121 +1906 -0
  244. sage_wheels/share/factory/gftables/58081 +1938 -0
  245. sage_wheels/share/factory/gftables/59049 +1971 -0
  246. sage_wheels/share/factory/gftables/6241 +210 -0
  247. sage_wheels/share/factory/gftables/625 +23 -0
  248. sage_wheels/share/factory/gftables/63001 +2102 -0
  249. sage_wheels/share/factory/gftables/64 +5 -0
  250. sage_wheels/share/factory/gftables/6561 +221 -0
  251. sage_wheels/share/factory/gftables/6859 +231 -0
  252. sage_wheels/share/factory/gftables/6889 +232 -0
  253. sage_wheels/share/factory/gftables/729 +27 -0
  254. sage_wheels/share/factory/gftables/7921 +266 -0
  255. sage_wheels/share/factory/gftables/8 +3 -0
  256. sage_wheels/share/factory/gftables/81 +5 -0
  257. sage_wheels/share/factory/gftables/8192 +276 -0
  258. sage_wheels/share/factory/gftables/841 +30 -0
  259. sage_wheels/share/factory/gftables/9 +3 -0
  260. sage_wheels/share/factory/gftables/9409 +316 -0
  261. sage_wheels/share/factory/gftables/961 +34 -0
  262. sage_wheels/share/info/singular.info +191898 -0
  263. sage_wheels/share/singular/LIB/GND.lib +1359 -0
  264. sage_wheels/share/singular/LIB/JMBTest.lib +976 -0
  265. sage_wheels/share/singular/LIB/JMSConst.lib +1363 -0
  266. sage_wheels/share/singular/LIB/KVequiv.lib +699 -0
  267. sage_wheels/share/singular/LIB/SingularityDBM.lib +491 -0
  268. sage_wheels/share/singular/LIB/VecField.lib +1542 -0
  269. sage_wheels/share/singular/LIB/absfact.lib +959 -0
  270. sage_wheels/share/singular/LIB/ainvar.lib +730 -0
  271. sage_wheels/share/singular/LIB/aksaka.lib +419 -0
  272. sage_wheels/share/singular/LIB/alexpoly.lib +2542 -0
  273. sage_wheels/share/singular/LIB/algebra.lib +1193 -0
  274. sage_wheels/share/singular/LIB/all.lib +136 -0
  275. sage_wheels/share/singular/LIB/arcpoint.lib +514 -0
  276. sage_wheels/share/singular/LIB/arnold.lib +4553 -0
  277. sage_wheels/share/singular/LIB/arnoldclassify.lib +2058 -0
  278. sage_wheels/share/singular/LIB/arr.lib +3486 -0
  279. sage_wheels/share/singular/LIB/assprimeszerodim.lib +755 -0
  280. sage_wheels/share/singular/LIB/autgradalg.lib +3361 -0
  281. sage_wheels/share/singular/LIB/bfun.lib +1964 -0
  282. sage_wheels/share/singular/LIB/bimodules.lib +774 -0
  283. sage_wheels/share/singular/LIB/brillnoether.lib +226 -0
  284. sage_wheels/share/singular/LIB/brnoeth.lib +5017 -0
  285. sage_wheels/share/singular/LIB/central.lib +2169 -0
  286. sage_wheels/share/singular/LIB/chern.lib +4162 -0
  287. sage_wheels/share/singular/LIB/cimonom.lib +571 -0
  288. sage_wheels/share/singular/LIB/cisimplicial.lib +1835 -0
  289. sage_wheels/share/singular/LIB/classify.lib +3239 -0
  290. sage_wheels/share/singular/LIB/classify2.lib +1462 -0
  291. sage_wheels/share/singular/LIB/classifyMapGerms.lib +1515 -0
  292. sage_wheels/share/singular/LIB/classify_aeq.lib +3253 -0
  293. sage_wheels/share/singular/LIB/classifyceq.lib +2092 -0
  294. sage_wheels/share/singular/LIB/classifyci.lib +1133 -0
  295. sage_wheels/share/singular/LIB/combinat.lib +91 -0
  296. sage_wheels/share/singular/LIB/compregb.lib +276 -0
  297. sage_wheels/share/singular/LIB/control.lib +1636 -0
  298. sage_wheels/share/singular/LIB/crypto.lib +3795 -0
  299. sage_wheels/share/singular/LIB/curveInv.lib +667 -0
  300. sage_wheels/share/singular/LIB/curvepar.lib +1817 -0
  301. sage_wheels/share/singular/LIB/customstd.lib +100 -0
  302. sage_wheels/share/singular/LIB/deRham.lib +5979 -0
  303. sage_wheels/share/singular/LIB/decodegb.lib +2134 -0
  304. sage_wheels/share/singular/LIB/decomp.lib +1655 -0
  305. sage_wheels/share/singular/LIB/deflation.lib +872 -0
  306. sage_wheels/share/singular/LIB/deform.lib +925 -0
  307. sage_wheels/share/singular/LIB/difform.lib +3055 -0
  308. sage_wheels/share/singular/LIB/divisors.lib +750 -0
  309. sage_wheels/share/singular/LIB/dmod.lib +5817 -0
  310. sage_wheels/share/singular/LIB/dmodapp.lib +3269 -0
  311. sage_wheels/share/singular/LIB/dmodideal.lib +1211 -0
  312. sage_wheels/share/singular/LIB/dmodloc.lib +2645 -0
  313. sage_wheels/share/singular/LIB/dmodvar.lib +818 -0
  314. sage_wheels/share/singular/LIB/dummy.lib +17 -0
  315. sage_wheels/share/singular/LIB/elim.lib +1009 -0
  316. sage_wheels/share/singular/LIB/ellipticcovers.lib +548 -0
  317. sage_wheels/share/singular/LIB/enumpoints.lib +146 -0
  318. sage_wheels/share/singular/LIB/equising.lib +2127 -0
  319. sage_wheels/share/singular/LIB/ffmodstd.lib +2384 -0
  320. sage_wheels/share/singular/LIB/ffsolve.lib +1289 -0
  321. sage_wheels/share/singular/LIB/findifs.lib +778 -0
  322. sage_wheels/share/singular/LIB/finitediff.lib +1768 -0
  323. sage_wheels/share/singular/LIB/finvar.lib +7989 -0
  324. sage_wheels/share/singular/LIB/fpadim.lib +2429 -0
  325. sage_wheels/share/singular/LIB/fpalgebras.lib +1666 -0
  326. sage_wheels/share/singular/LIB/fpaprops.lib +1462 -0
  327. sage_wheels/share/singular/LIB/freegb.lib +3853 -0
  328. sage_wheels/share/singular/LIB/general.lib +1350 -0
  329. sage_wheels/share/singular/LIB/gfan.lib +1768 -0
  330. sage_wheels/share/singular/LIB/gitfan.lib +3130 -0
  331. sage_wheels/share/singular/LIB/gkdim.lib +99 -0
  332. sage_wheels/share/singular/LIB/gmspoly.lib +589 -0
  333. sage_wheels/share/singular/LIB/gmssing.lib +1739 -0
  334. sage_wheels/share/singular/LIB/goettsche.lib +909 -0
  335. sage_wheels/share/singular/LIB/graal.lib +1366 -0
  336. sage_wheels/share/singular/LIB/gradedModules.lib +2541 -0
  337. sage_wheels/share/singular/LIB/graphics.lib +360 -0
  338. sage_wheels/share/singular/LIB/grobcov.lib +7706 -0
  339. sage_wheels/share/singular/LIB/groups.lib +1123 -0
  340. sage_wheels/share/singular/LIB/grwalk.lib +507 -0
  341. sage_wheels/share/singular/LIB/hdepth.lib +194 -0
  342. sage_wheels/share/singular/LIB/help.cnf +57 -0
  343. sage_wheels/share/singular/LIB/hess.lib +1946 -0
  344. sage_wheels/share/singular/LIB/hnoether.lib +4292 -0
  345. sage_wheels/share/singular/LIB/hodge.lib +400 -0
  346. sage_wheels/share/singular/LIB/homolog.lib +1965 -0
  347. sage_wheels/share/singular/LIB/hyperel.lib +975 -0
  348. sage_wheels/share/singular/LIB/inout.lib +679 -0
  349. sage_wheels/share/singular/LIB/integralbasis.lib +6224 -0
  350. sage_wheels/share/singular/LIB/interval.lib +1418 -0
  351. sage_wheels/share/singular/LIB/intprog.lib +778 -0
  352. sage_wheels/share/singular/LIB/invar.lib +443 -0
  353. sage_wheels/share/singular/LIB/involut.lib +980 -0
  354. sage_wheels/share/singular/LIB/jacobson.lib +1215 -0
  355. sage_wheels/share/singular/LIB/kskernel.lib +534 -0
  356. sage_wheels/share/singular/LIB/latex.lib +3146 -0
  357. sage_wheels/share/singular/LIB/lejeune.lib +651 -0
  358. sage_wheels/share/singular/LIB/linalg.lib +2040 -0
  359. sage_wheels/share/singular/LIB/locnormal.lib +212 -0
  360. sage_wheels/share/singular/LIB/lrcalc.lib +526 -0
  361. sage_wheels/share/singular/LIB/makedbm.lib +294 -0
  362. sage_wheels/share/singular/LIB/mathml.lib +813 -0
  363. sage_wheels/share/singular/LIB/matrix.lib +1372 -0
  364. sage_wheels/share/singular/LIB/maxlike.lib +1132 -0
  365. sage_wheels/share/singular/LIB/methods.lib +212 -0
  366. sage_wheels/share/singular/LIB/moddiq.lib +322 -0
  367. sage_wheels/share/singular/LIB/modfinduni.lib +181 -0
  368. sage_wheels/share/singular/LIB/modnormal.lib +218 -0
  369. sage_wheels/share/singular/LIB/modprimdec.lib +1278 -0
  370. sage_wheels/share/singular/LIB/modquotient.lib +269 -0
  371. sage_wheels/share/singular/LIB/modstd.lib +1024 -0
  372. sage_wheels/share/singular/LIB/modular.lib +545 -0
  373. sage_wheels/share/singular/LIB/modules.lib +2561 -0
  374. sage_wheels/share/singular/LIB/modwalk.lib +609 -0
  375. sage_wheels/share/singular/LIB/mondromy.lib +1016 -0
  376. sage_wheels/share/singular/LIB/monomialideal.lib +3851 -0
  377. sage_wheels/share/singular/LIB/mprimdec.lib +2353 -0
  378. sage_wheels/share/singular/LIB/mregular.lib +1863 -0
  379. sage_wheels/share/singular/LIB/multigrading.lib +5629 -0
  380. sage_wheels/share/singular/LIB/ncHilb.lib +777 -0
  381. sage_wheels/share/singular/LIB/ncModslimgb.lib +791 -0
  382. sage_wheels/share/singular/LIB/ncalg.lib +16311 -0
  383. sage_wheels/share/singular/LIB/ncall.lib +31 -0
  384. sage_wheels/share/singular/LIB/ncdecomp.lib +468 -0
  385. sage_wheels/share/singular/LIB/ncfactor.lib +13371 -0
  386. sage_wheels/share/singular/LIB/ncfrac.lib +1023 -0
  387. sage_wheels/share/singular/LIB/nchilbert.lib +448 -0
  388. sage_wheels/share/singular/LIB/nchomolog.lib +759 -0
  389. sage_wheels/share/singular/LIB/ncloc.lib +361 -0
  390. sage_wheels/share/singular/LIB/ncpreim.lib +795 -0
  391. sage_wheels/share/singular/LIB/ncrat.lib +2849 -0
  392. sage_wheels/share/singular/LIB/nctools.lib +1887 -0
  393. sage_wheels/share/singular/LIB/nets.lib +1456 -0
  394. sage_wheels/share/singular/LIB/nfmodstd.lib +1000 -0
  395. sage_wheels/share/singular/LIB/nfmodsyz.lib +732 -0
  396. sage_wheels/share/singular/LIB/noether.lib +1106 -0
  397. sage_wheels/share/singular/LIB/normal.lib +8700 -0
  398. sage_wheels/share/singular/LIB/normaliz.lib +2226 -0
  399. sage_wheels/share/singular/LIB/ntsolve.lib +362 -0
  400. sage_wheels/share/singular/LIB/numerAlg.lib +560 -0
  401. sage_wheels/share/singular/LIB/numerDecom.lib +2261 -0
  402. sage_wheels/share/singular/LIB/olga.lib +1933 -0
  403. sage_wheels/share/singular/LIB/orbitparam.lib +351 -0
  404. sage_wheels/share/singular/LIB/parallel.lib +319 -0
  405. sage_wheels/share/singular/LIB/paraplanecurves.lib +3110 -0
  406. sage_wheels/share/singular/LIB/perron.lib +202 -0
  407. sage_wheels/share/singular/LIB/pfd.lib +2223 -0
  408. sage_wheels/share/singular/LIB/phindex.lib +642 -0
  409. sage_wheels/share/singular/LIB/pointid.lib +673 -0
  410. sage_wheels/share/singular/LIB/polybori.lib +1430 -0
  411. sage_wheels/share/singular/LIB/polyclass.lib +525 -0
  412. sage_wheels/share/singular/LIB/polylib.lib +1174 -0
  413. sage_wheels/share/singular/LIB/polymake.lib +1902 -0
  414. sage_wheels/share/singular/LIB/presolve.lib +1533 -0
  415. sage_wheels/share/singular/LIB/primdec.lib +9576 -0
  416. sage_wheels/share/singular/LIB/primdecint.lib +1782 -0
  417. sage_wheels/share/singular/LIB/primitiv.lib +401 -0
  418. sage_wheels/share/singular/LIB/puiseuxexpansions.lib +1631 -0
  419. sage_wheels/share/singular/LIB/purityfiltration.lib +960 -0
  420. sage_wheels/share/singular/LIB/qhmoduli.lib +1561 -0
  421. sage_wheels/share/singular/LIB/qmatrix.lib +293 -0
  422. sage_wheels/share/singular/LIB/random.lib +455 -0
  423. sage_wheels/share/singular/LIB/ratgb.lib +489 -0
  424. sage_wheels/share/singular/LIB/realclassify.lib +5759 -0
  425. sage_wheels/share/singular/LIB/realizationMatroids.lib +772 -0
  426. sage_wheels/share/singular/LIB/realrad.lib +1197 -0
  427. sage_wheels/share/singular/LIB/recover.lib +2628 -0
  428. sage_wheels/share/singular/LIB/redcgs.lib +3984 -0
  429. sage_wheels/share/singular/LIB/reesclos.lib +465 -0
  430. sage_wheels/share/singular/LIB/resbinomial.lib +2802 -0
  431. sage_wheels/share/singular/LIB/resgraph.lib +789 -0
  432. sage_wheels/share/singular/LIB/resjung.lib +820 -0
  433. sage_wheels/share/singular/LIB/resolve.lib +5110 -0
  434. sage_wheels/share/singular/LIB/resources.lib +170 -0
  435. sage_wheels/share/singular/LIB/reszeta.lib +5473 -0
  436. sage_wheels/share/singular/LIB/ring.lib +1328 -0
  437. sage_wheels/share/singular/LIB/ringgb.lib +343 -0
  438. sage_wheels/share/singular/LIB/rinvar.lib +1153 -0
  439. sage_wheels/share/singular/LIB/rootisolation.lib +1481 -0
  440. sage_wheels/share/singular/LIB/rootsmr.lib +709 -0
  441. sage_wheels/share/singular/LIB/rootsur.lib +886 -0
  442. sage_wheels/share/singular/LIB/rstandard.lib +607 -0
  443. sage_wheels/share/singular/LIB/rwalk.lib +336 -0
  444. sage_wheels/share/singular/LIB/sagbi.lib +1353 -0
  445. sage_wheels/share/singular/LIB/sagbiNormaliz.lib +1622 -0
  446. sage_wheels/share/singular/LIB/sagbiNormaliz0.lib +1498 -0
  447. sage_wheels/share/singular/LIB/sagbigrob.lib +449 -0
  448. sage_wheels/share/singular/LIB/schreyer.lib +321 -0
  449. sage_wheels/share/singular/LIB/schubert.lib +2551 -0
  450. sage_wheels/share/singular/LIB/sets.lib +524 -0
  451. sage_wheels/share/singular/LIB/sheafcoh.lib +1663 -0
  452. sage_wheels/share/singular/LIB/signcond.lib +437 -0
  453. sage_wheels/share/singular/LIB/sing.lib +1094 -0
  454. sage_wheels/share/singular/LIB/sing4ti2.lib +419 -0
  455. sage_wheels/share/singular/LIB/solve.lib +2243 -0
  456. sage_wheels/share/singular/LIB/spcurve.lib +1077 -0
  457. sage_wheels/share/singular/LIB/spectrum.lib +62 -0
  458. sage_wheels/share/singular/LIB/sresext.lib +757 -0
  459. sage_wheels/share/singular/LIB/ssi.lib +143 -0
  460. sage_wheels/share/singular/LIB/standard.lib +2769 -0
  461. sage_wheels/share/singular/LIB/stanleyreisner.lib +473 -0
  462. sage_wheels/share/singular/LIB/stdmodule.lib +547 -0
  463. sage_wheels/share/singular/LIB/stratify.lib +1070 -0
  464. sage_wheels/share/singular/LIB/surf.lib +506 -0
  465. sage_wheels/share/singular/LIB/surf_jupyter.lib +223 -0
  466. sage_wheels/share/singular/LIB/surfacesignature.lib +522 -0
  467. sage_wheels/share/singular/LIB/surfex.lib +1462 -0
  468. sage_wheels/share/singular/LIB/swalk.lib +877 -0
  469. sage_wheels/share/singular/LIB/symodstd.lib +1570 -0
  470. sage_wheels/share/singular/LIB/systhreads.lib +74 -0
  471. sage_wheels/share/singular/LIB/tasks.lib +1324 -0
  472. sage_wheels/share/singular/LIB/tateProdCplxNegGrad.lib +2412 -0
  473. sage_wheels/share/singular/LIB/teachstd.lib +858 -0
  474. sage_wheels/share/singular/LIB/template.lib +116 -0
  475. sage_wheels/share/singular/LIB/toric.lib +1119 -0
  476. sage_wheels/share/singular/LIB/transformation.lib +116 -0
  477. sage_wheels/share/singular/LIB/triang.lib +1197 -0
  478. sage_wheels/share/singular/LIB/tropical.lib +8741 -0
  479. sage_wheels/share/singular/LIB/tropicalEllipticCovers.lib +2922 -0
  480. sage_wheels/share/singular/LIB/tropicalNewton.lib +1128 -0
  481. sage_wheels/share/singular/LIB/tst.lib +1108 -0
  482. sage_wheels/share/singular/LIB/weierstr.lib +241 -0
  483. sage_wheels/share/singular/LIB/zeroset.lib +1478 -0
  484. sage_wheels/share/singular/emacs/.emacs-general +184 -0
  485. sage_wheels/share/singular/emacs/.emacs-singular +234 -0
  486. sage_wheels/share/singular/emacs/COPYING +44 -0
  487. sage_wheels/share/singular/emacs/cmd-cmpl.el +241 -0
  488. sage_wheels/share/singular/emacs/ex-cmpl.el +1681 -0
  489. sage_wheels/share/singular/emacs/hlp-cmpl.el +4318 -0
  490. sage_wheels/share/singular/emacs/lib-cmpl.el +179 -0
  491. sage_wheels/share/singular/emacs/singular.el +4273 -0
  492. sage_wheels/share/singular/emacs/singular.xpm +39 -0
  493. sage_wheels/share/singular/singular.idx +5002 -0
@@ -0,0 +1,893 @@
1
+ # sage_setup: distribution = sagemath-singular
2
+ """
3
+ Wrapper for Singular's Rings
4
+
5
+ AUTHORS:
6
+
7
+ - Martin Albrecht (2009-07): initial implementation
8
+
9
+ - Kwankyu Lee (2010-06): added matrix term order support
10
+
11
+ - Miguel Marco (2021): added transcendental extensions over Q
12
+ """
13
+ # ****************************************************************************
14
+ # Copyright (C) 2009 Martin Albrecht <malb@informatik.uni-bremen.de>
15
+ #
16
+ # Distributed under the terms of the GNU General Public License (GPL)
17
+ # https://www.gnu.org/licenses/
18
+ # ****************************************************************************
19
+
20
+ from sage.cpython.string cimport str_to_bytes, bytes_to_str
21
+
22
+ from sage.libs.gmp.types cimport __mpz_struct
23
+ from sage.libs.gmp.mpz cimport mpz_init_set
24
+
25
+ from sage.libs.singular.decl cimport ring, currRing
26
+ from sage.libs.singular.decl cimport rChangeCurrRing, rComplete, rDelete, idInit
27
+ from sage.libs.singular.decl cimport omAlloc0, omStrDup, omAlloc
28
+ from sage.libs.singular.decl cimport ringorder_dp, ringorder_Dp, ringorder_lp, ringorder_ip, ringorder_ds, ringorder_Ds, ringorder_ls, ringorder_M, ringorder_c, ringorder_C, ringorder_wp, ringorder_Wp, ringorder_ws, ringorder_Ws, ringorder_a, rRingOrder_t
29
+ from sage.libs.singular.decl cimport prCopyR
30
+ from sage.libs.singular.decl cimport n_unknown, n_algExt, n_transExt, n_Z, n_Zn, n_Znm, n_Z2m
31
+ from sage.libs.singular.decl cimport n_coeffType
32
+ from sage.libs.singular.decl cimport rDefault, GFInfo, ZnmInfo, nInitChar, AlgExtInfo, TransExtInfo
33
+
34
+
35
+ from sage.rings.integer cimport Integer
36
+ from sage.rings.integer_ring cimport IntegerRing_class
37
+ import sage.rings.abc
38
+ from sage.rings.number_field.number_field_base cimport NumberField
39
+ from sage.rings.rational_field import RationalField
40
+ from sage.rings.finite_rings.finite_field_base import FiniteField as FiniteField_generic
41
+
42
+ from sage.rings.polynomial.term_order import TermOrder
43
+ from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomial_libsingular, MPolynomialRing_libsingular
44
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
45
+
46
+ from sage.rings.polynomial.polynomial_ring import PolynomialRing_field
47
+
48
+ from sage.rings.fraction_field import FractionField_generic
49
+
50
+ from cpython.object cimport Py_EQ, Py_NE
51
+
52
+ from collections import defaultdict
53
+
54
+
55
+ # mapping str --> SINGULAR representation
56
+ order_dict = {
57
+ "dp": ringorder_dp,
58
+ "Dp": ringorder_Dp,
59
+ "lp": ringorder_lp,
60
+ "ip": ringorder_ip,
61
+ "ds": ringorder_ds,
62
+ "Ds": ringorder_Ds,
63
+ "ls": ringorder_ls,
64
+ "wp": ringorder_wp,
65
+ "Wp": ringorder_Wp,
66
+ "ws": ringorder_ws,
67
+ "Ws": ringorder_Ws,
68
+ "a": ringorder_a,
69
+ }
70
+
71
+ cdef extern from "singular/Singular/libsingular.h":
72
+ cdef char * rSimpleOrdStr(rRingOrder_t)
73
+
74
+ if bytes_to_str(rSimpleOrdStr(ringorder_ip)) == "rp":
75
+ # compatibility for singular 4.3.2p10 and before
76
+ order_dict["rp"] = ringorder_ip
77
+ # also patch term_order mappings
78
+ from sage.rings.polynomial import term_order
79
+ term_order.singular_name_mapping['invlex'] = 'rp'
80
+ term_order.inv_singular_name_mapping['rp'] = 'invlex'
81
+
82
+ #############################################################################
83
+ cdef ring *singular_ring_new(base_ring, n, names, term_order) except NULL:
84
+ r"""
85
+ Create a new Singular ring over the ``base_ring`` in ``n``
86
+ variables with the names ``names`` and the term order
87
+ ``term_order``.
88
+
89
+ INPUT:
90
+
91
+ - ``base_ring`` -- a Sage ring
92
+
93
+ - ``n`` -- the number of variables (> 0)
94
+
95
+ - ``names`` -- list of names of length ``n``
96
+
97
+ - ``term_order`` -- a term ordering
98
+
99
+ EXAMPLES::
100
+
101
+ sage: P.<x,y,z> = QQ[]
102
+ sage: P
103
+ Multivariate Polynomial Ring in x, y, z over Rational Field
104
+
105
+ sage: P.term_order()
106
+ Degree reverse lexicographic term order
107
+
108
+ sage: P = PolynomialRing(GF(127),3,names='abc', order='lex')
109
+ sage: P
110
+ Multivariate Polynomial Ring in a, b, c over Finite Field of size 127
111
+
112
+ sage: P.term_order()
113
+ Lexicographic term order
114
+
115
+ sage: z = QQ['z'].0
116
+ sage: K.<s> = NumberField(z^2 - 2)
117
+ sage: P.<x,y> = PolynomialRing(K, 2)
118
+
119
+ sage: P.<x,y,z> = ZZ[]; P
120
+ Multivariate Polynomial Ring in x, y, z over Integer Ring
121
+
122
+ sage: P.<x,y,z> = Zmod(2^10)[]; P
123
+ Multivariate Polynomial Ring in x, y, z over Ring of integers modulo 1024
124
+
125
+ sage: P.<x,y,z> = Zmod(3^10)[]; P
126
+ Multivariate Polynomial Ring in x, y, z over Ring of integers modulo 59049
127
+
128
+ sage: P.<x,y,z> = Zmod(2^100)[]; P
129
+ Multivariate Polynomial Ring in x, y, z over Ring of integers modulo 1267650600228229401496703205376
130
+
131
+ sage: P.<x,y,z> = Zmod(2521352)[]; P
132
+ Multivariate Polynomial Ring in x, y, z over Ring of integers modulo 2521352
133
+
134
+ sage: P.<x,y,z> = Zmod(25213521351515232)[]; P
135
+ Multivariate Polynomial Ring in x, y, z over Ring of integers modulo 25213521351515232
136
+
137
+ sage: K = PolynomialRing(QQ, 's,t').fraction_field()
138
+ sage: P.<x,y> = K[]; P
139
+ Multivariate Polynomial Ring in x, y over Fraction Field of Multivariate Polynomial Ring in s, t over Rational Field
140
+
141
+ sage: F = PolynomialRing(FiniteField(7),'a,b').fraction_field()
142
+ sage: R.<x,y,z> = F[]
143
+ sage: R
144
+ Multivariate Polynomial Ring in x, y, z over Fraction Field of Multivariate Polynomial Ring in a, b over Finite Field of size 7
145
+
146
+ TESTS:
147
+
148
+ Check that ``degneglex`` and ``degrevlex`` are the same up to reversal of
149
+ variables (:issue:`29635`)::
150
+
151
+ sage: R = PolynomialRing(QQ, 'x', 4, order='degrevlex')
152
+ sage: S = PolynomialRing(QQ, tuple(reversed(R.gens())), order='degneglex')
153
+ sage: L = [v for d in (0..4) for v in IntegerVectors(d, 4)]
154
+ sage: sorted([R.monomial(*e) for e in L]) == sorted([S.monomial(*e) for e in L])
155
+ True
156
+
157
+ Check that we are using the libsingular backend instead of the pexpect one::
158
+
159
+ sage: F = PolynomialRing(FiniteField(7),'a,b').fraction_field()
160
+ sage: R.<x,y,z> = F[]
161
+ sage: from sage.libs.singular.function import singular_function
162
+ sage: sing_print = singular_function('print')
163
+ sage: print(sing_print(R))
164
+ polynomial ring, over a field, global ordering
165
+ // coefficients: ZZ/7(a, b)...
166
+ // number of vars : 3
167
+ // block 1 : ordering dp
168
+ // : names x y z
169
+ // block 2 : ordering C
170
+
171
+ ::
172
+
173
+ sage: F = PolynomialRing(QQ, 's,t').fraction_field()
174
+ sage: R.<x,y,z> = F[]
175
+ sage: from sage.libs.singular.function import singular_function
176
+ sage: print(sing_print(R))
177
+ polynomial ring, over a field, global ordering
178
+ // coefficients: QQ(s, t)...
179
+ // number of vars : 3
180
+ // block 1 : ordering dp
181
+ // : names x y z
182
+ // block 2 : ordering C
183
+
184
+ Small primes::
185
+
186
+ sage: R = PolynomialRing(GF(2), ("a", "b"), implementation="singular"); print(sing_print(R))
187
+ polynomial ring, over a field, global ordering
188
+ // coefficients: ZZ/2...
189
+ // number of vars : 2
190
+ // block 1 : ordering dp
191
+ // : names a b
192
+ // block 2 : ordering C
193
+ sage: R = PolynomialRing(GF(3), ("a", "b"), implementation="singular"); print(sing_print(R))
194
+ polynomial ring, over a field, global ordering
195
+ // coefficients: ZZ/3...
196
+ // number of vars : 2
197
+ // block 1 : ordering dp
198
+ // : names a b
199
+ // block 2 : ordering C
200
+ sage: R = PolynomialRing(GF(1000000007), ("a", "b"), implementation="singular"); print(sing_print(R))
201
+ polynomial ring, over a field, global ordering
202
+ // coefficients: ZZ/1000000007...
203
+ // number of vars : 2
204
+ // block 1 : ordering dp
205
+ // : names a b
206
+ // block 2 : ordering C
207
+
208
+ When ``Zmod`` is used, use a different Singular type
209
+ (note that the print is wrong, the field in fact doesn't have zero-divisors)::
210
+
211
+ sage: R = PolynomialRing(Zmod(2), ("a", "b"), implementation="singular"); print(sing_print(R))
212
+ polynomial ring, over a ring (with zero-divisors), global ordering
213
+ // coefficients: ZZ/(2)...
214
+ // number of vars : 2
215
+ // block 1 : ordering dp
216
+ // : names a b
217
+ // block 2 : ordering C
218
+ sage: R = PolynomialRing(Zmod(3), ("a", "b"), implementation="singular"); print(sing_print(R))
219
+ polynomial ring, over a ring (with zero-divisors), global ordering
220
+ // coefficients: ZZ/(3)...
221
+ // number of vars : 2
222
+ // block 1 : ordering dp
223
+ // : names a b
224
+ // block 2 : ordering C
225
+
226
+ Large prime (note that the print is wrong, the field in fact doesn't have zero-divisors)::
227
+
228
+ sage: R = PolynomialRing(GF(2^128+51), ("a", "b"), implementation="singular"); print(sing_print(R))
229
+ polynomial ring, over a ring (with zero-divisors), global ordering
230
+ // coefficients: ZZ/bigint(340282366920938463463374607431768211507)...
231
+ // number of vars : 2
232
+ // block 1 : ordering dp
233
+ // : names a b
234
+ // block 2 : ordering C
235
+
236
+ Finite field with large degree (note that if stack size is too small and the exponent is too large
237
+ a stack overflow may happen inside libsingular)::
238
+
239
+ sage: R = PolynomialRing(GF(2^160), ("a", "b"), implementation="singular"); print(sing_print(R))
240
+ polynomial ring, over a field, global ordering
241
+ // coefficients: ZZ/2[z160]/(z160^160+z160^159+z160^155+z160^154+z160^153+z160^152+z160^151+z160^149+z160^148+z160^147+z160^146+z160^145+z160^144+z160^143+z160^141+z160^139+z160^137+z160^131+z160^129+z160^128+z160^127+z160^126+z160^123+z160^122+z160^121+z160^117+z160^116+z160^115+z160^113+z160^111+z160^110+z160^108+z160^106+z160^102+z160^100+z160^99+z160^97+z160^96+z160^95+z160^94+z160^93+z160^92+z160^91+z160^87+z160^86+z160^82+z160^80+z160^79+z160^78+z160^74+z160^73+z160^72+z160^71+z160^70+z160^67+z160^66+z160^65+z160^62+z160^59+z160^58+z160^57+z160^55+z160^54+z160^53+z160^52+z160^51+z160^49+z160^47+z160^44+z160^40+z160^35+z160^32+z160^30+z160^28+z160^27+z160^26+z160^24+z160^23+z160^21+z160^20+z160^18+z160^16+z160^11+z160^10+z160^8+z160^7+1)...
242
+ // number of vars : 2
243
+ // block 1 : ordering dp
244
+ // : names a b
245
+ // block 2 : ordering C
246
+
247
+ Integer modulo small power of 2::
248
+
249
+ sage: R = PolynomialRing(Zmod(2^32), ("a", "b"), implementation="singular"); print(sing_print(R))
250
+ polynomial ring, over a ring (with zero-divisors), global ordering
251
+ // coefficients: ZZ/(2^32)...
252
+ // number of vars : 2
253
+ // block 1 : ordering dp
254
+ // : names a b
255
+ // block 2 : ordering C
256
+
257
+ Integer modulo large power of 2::
258
+
259
+ sage: R = PolynomialRing(Zmod(2^1000), ("a", "b"), implementation="singular"); print(sing_print(R))
260
+ polynomial ring, over a ring (with zero-divisors), global ordering
261
+ // coefficients: ZZ/(bigint(2)^1000)...
262
+ // number of vars : 2
263
+ // block 1 : ordering dp
264
+ // : names a b
265
+ // block 2 : ordering C
266
+
267
+ Integer modulo large power of odd prime::
268
+
269
+ sage: R = PolynomialRing(Zmod(3^300), ("a", "b"), implementation="singular"); print(sing_print(R))
270
+ polynomial ring, over a ring (with zero-divisors), global ordering
271
+ // coefficients: ZZ/(bigint(3)^300)...
272
+ // number of vars : 2
273
+ // block 1 : ordering dp
274
+ // : names a b
275
+ // block 2 : ordering C
276
+
277
+ Integer modulo non-prime::
278
+
279
+ sage: R = PolynomialRing(Zmod(15^20), ("a", "b"), implementation="singular"); print(sing_print(R))
280
+ polynomial ring, over a ring (with zero-divisors), global ordering
281
+ // coefficients: ZZ/bigint(332525673007965087890625)...
282
+ // number of vars : 2
283
+ // block 1 : ordering dp
284
+ // : names a b
285
+ // block 2 : ordering C
286
+
287
+ Non-prime finite field with large characteristic (not supported, see :issue:`33319`)::
288
+
289
+ sage: PolynomialRing(GF((2^31+11)^2), ("a", "b"), implementation="singular")
290
+ Traceback (most recent call last):
291
+ ...
292
+ TypeError: characteristic must be <= 2147483647.
293
+ """
294
+ cdef long cexponent
295
+ cdef GFInfo* _param
296
+ cdef ZnmInfo _info
297
+ cdef ring* _ring
298
+ cdef char **_names
299
+ cdef char **_ext_names
300
+ cdef int i,j
301
+ cdef int nblcks
302
+ cdef int offset
303
+ cdef int nvars
304
+ cdef int characteristic
305
+ cdef Integer ch, modbase
306
+ cdef int ringorder_column_pos
307
+ cdef int ringorder_column_asc
308
+
309
+ cdef int ngens
310
+
311
+ cdef n_coeffType ringtype = n_unknown
312
+ cdef MPolynomialRing_libsingular k
313
+ cdef MPolynomial_libsingular minpoly
314
+ cdef AlgExtInfo extParam
315
+ cdef TransExtInfo trextParam
316
+ cdef n_coeffType _type = n_unknown
317
+
318
+ #cdef cfInitCharProc myfunctionptr;
319
+
320
+ _ring = NULL
321
+
322
+ n = int(n)
323
+ if n < 1:
324
+ raise NotImplementedError(f"polynomials in {n} variables are not supported in Singular")
325
+
326
+ nvars = n
327
+ order = TermOrder(term_order, n)
328
+
329
+ cdef nbaseblcks = len(order.blocks())
330
+ nblcks = nbaseblcks + order.singular_moreblocks() + 1 # one block for ringorder column
331
+ offset = 0
332
+
333
+ if (order._singular_ringorder_column is None or
334
+ order._singular_ringorder_column < 0 or
335
+ order._singular_ringorder_column >= 2*nbaseblcks+2):
336
+ ringorder_column_pos = nbaseblcks
337
+ ringorder_column_type = ringorder_C
338
+ else:
339
+ ringorder_column_pos = order._singular_ringorder_column // 2
340
+ ringorder_column_type = (ringorder_C if order._singular_ringorder_column % 2 == 0
341
+ else ringorder_c)
342
+
343
+ _names = <char**>omAlloc0(sizeof(char*)*(len(names)))
344
+ for i from 0 <= i < n:
345
+ _name = str_to_bytes(names[i])
346
+ _names[i] = omStrDup(_name)
347
+
348
+ # from the SINGULAR source code documentation for the rInit function
349
+ ## characteristic --------------------------------------------------
350
+ ## input: 0 ch=0 : Q parameter=NULL ffChar=FALSE float_len (done)
351
+ ## 0 1 : Q(a,...) *names FALSE (done)
352
+ ## 0 -1 : R NULL FALSE 0
353
+ ## 0 -1 : R NULL FALSE prec. >6
354
+ ## 0 -1 : C *names FALSE prec. 0..?
355
+ ## p p : Fp NULL FALSE (done)
356
+ ## p -p : Fp(a) *names FALSE (done)
357
+ ## q q : GF(q=p^n) *names TRUE (todo)
358
+
359
+ _wvhdl = <int **>omAlloc0((nblcks + 2) * sizeof(int *))
360
+ _order = <rRingOrder_t *>omAlloc0((nblcks + 2) * sizeof(int))
361
+ _block0 = <int *>omAlloc0((nblcks + 2) * sizeof(int))
362
+ _block1 = <int *>omAlloc0((nblcks + 2) * sizeof(int))
363
+
364
+ cdef int idx = 0
365
+ for i from 0 <= i < nbaseblcks:
366
+ if i == ringorder_column_pos:
367
+ _order[idx] = ringorder_column_type
368
+ idx += 1
369
+ s = order[i].singular_str()
370
+ if s[0] == 'M': # matrix order
371
+ _order[idx] = ringorder_M
372
+ mtx = order[i].matrix().list()
373
+ wv = <int *>omAlloc0(len(mtx)*sizeof(int))
374
+ for j in range(len(mtx)):
375
+ wv[j] = int(mtx[j])
376
+ _wvhdl[idx] = wv
377
+ elif s[0] == 'w' or s[0] == 'W': # weighted degree orders
378
+ _order[idx] = order_dict.get(s[:2], ringorder_dp)
379
+ wts = order[i].weights()
380
+ wv = <int *>omAlloc0(len(wts)*sizeof(int))
381
+ for j in range(len(wts)):
382
+ wv[j] = int(wts[j])
383
+ _wvhdl[idx] = wv
384
+ elif s[0] == '(' and order[i].name() == 'degneglex': # "(a(1:n),ls(n))"
385
+ _order[idx] = ringorder_a
386
+ if not order[i]: # may be zero for arbitrary-length orders
387
+ nlen = n
388
+ else:
389
+ nlen = len(order[i])
390
+
391
+ _wvhdl[idx] = <int *>omAlloc0(len(order[i])*sizeof(int))
392
+ for j in range(nlen):
393
+ _wvhdl[idx][j] = 1
394
+ _block0[idx] = offset + 1 # same like subsequent ls block
395
+ _block1[idx] = offset + nlen
396
+
397
+ idx += 1 # we need one more block here
398
+ _order[idx] = ringorder_ls
399
+
400
+ else: # ordinary orders
401
+ _order[idx] = order_dict.get(s, ringorder_dp)
402
+
403
+ _block0[idx] = offset + 1
404
+ if not order[i]: # may be zero in some cases
405
+ _block1[idx] = offset + n
406
+ else:
407
+ _block1[idx] = offset + len(order[i])
408
+ offset = _block1[idx]
409
+ idx += 1
410
+
411
+ if ringorder_column_pos >= nbaseblcks:
412
+ _order[idx] = ringorder_column_type
413
+
414
+ if isinstance(base_ring, RationalField):
415
+ characteristic = 0
416
+ _ring = rDefault(characteristic, nvars, _names, nblcks,
417
+ _order, _block0, _block1, _wvhdl)
418
+
419
+ elif isinstance(base_ring, FractionField_generic) and isinstance(base_ring.base(), (MPolynomialRing_libsingular, PolynomialRing_field)) and isinstance(base_ring.base().base_ring(), RationalField):
420
+ characteristic = 1
421
+ k = PolynomialRing(RationalField(),
422
+ names=base_ring.variable_names(), order='lex',
423
+ implementation='singular')
424
+
425
+ ngens = len(k.gens())
426
+
427
+ _ext_names = <char**>omAlloc0(ngens*sizeof(char*))
428
+ for i in range(ngens):
429
+ _name = str_to_bytes(k._names[i])
430
+ _ext_names[i] = omStrDup(_name)
431
+
432
+ _cfr = rDefault( 0, ngens, _ext_names )
433
+ rComplete(_cfr, 1)
434
+
435
+ trextParam.r = _cfr
436
+
437
+ _cf = nInitChar(n_transExt, <void *>&trextParam)
438
+
439
+ if (_cf is NULL):
440
+ raise RuntimeError("Failed to allocate _cf ring.")
441
+
442
+ _ring = rDefault (_cf, nvars, _names, nblcks, _order, _block0, _block1, _wvhdl)
443
+
444
+ elif isinstance(base_ring, FractionField_generic) and isinstance(base_ring.base(), (MPolynomialRing_libsingular, PolynomialRing_field)) and isinstance(base_ring.base().base_ring(), FiniteField_generic):
445
+ if not base_ring.base_ring().is_prime_field():
446
+ raise NotImplementedError("Transcental extension are not implemented for non-prime finite fields")
447
+ characteristic = int(base_ring.characteristic())
448
+ k = PolynomialRing(base_ring.base_ring(),
449
+ names=base_ring.variable_names(), order='lex', implementation='singular')
450
+
451
+ ngens = len(k.gens())
452
+
453
+ _ext_names = <char**>omAlloc0(ngens*sizeof(char*))
454
+ for i in range(ngens):
455
+ _name = str_to_bytes(k._names[i])
456
+ _ext_names[i] = omStrDup(_name)
457
+
458
+ _cfr = rDefault( characteristic, ngens, _ext_names )
459
+ rComplete(_cfr, 1)
460
+
461
+ trextParam.r = _cfr
462
+
463
+ _cf = nInitChar(n_transExt, <void *>&trextParam)
464
+
465
+ if (_cf is NULL):
466
+ raise RuntimeError("Failed to allocate _cf ring.")
467
+
468
+ _ring = rDefault (_cf, nvars, _names, nblcks, _order, _block0, _block1, _wvhdl)
469
+
470
+ elif isinstance(base_ring, NumberField) and base_ring.is_absolute():
471
+ characteristic = 1
472
+ k = PolynomialRing(RationalField(),
473
+ name=base_ring.variable_name(), order='lex', implementation='singular')
474
+
475
+ minpoly = base_ring.polynomial()(k.gen())
476
+
477
+ _ext_names = <char**>omAlloc0(sizeof(char*))
478
+ extname = k.gen()
479
+ _name = str_to_bytes(k._names[0])
480
+ _ext_names[0] = omStrDup(_name)
481
+ _cfr = rDefault( 0, 1, _ext_names )
482
+
483
+ _cfr.qideal = idInit(1,1)
484
+ rComplete(_cfr, 1)
485
+ _cfr.qideal.m[0] = prCopyR(minpoly._poly, k._ring, _cfr)
486
+ extParam.r = _cfr
487
+
488
+ # _type = nRegister(n_algExt, <cfInitCharProc> naInitChar);
489
+ _cf = nInitChar( n_algExt, <void *>&extParam) #
490
+
491
+ if (_cf is NULL):
492
+ raise RuntimeError("Failed to allocate _cf ring.")
493
+
494
+ _ring = rDefault (_cf, nvars, _names, nblcks, _order, _block0, _block1, _wvhdl)
495
+
496
+ elif isinstance(base_ring, IntegerRing_class):
497
+ _cf = nInitChar( n_Z, NULL) # integer coefficient ring
498
+ _ring = rDefault (_cf, nvars, _names, nblcks, _order, _block0, _block1, _wvhdl)
499
+
500
+ elif isinstance(base_ring, sage.rings.abc.IntegerModRing):
501
+
502
+ ch = base_ring.characteristic()
503
+ if ch < 2:
504
+ raise NotImplementedError(f"polynomials over {base_ring} are not supported in Singular")
505
+
506
+ isprime = ch.is_prime()
507
+
508
+ if isprime and ch <= 2147483647 and isinstance(base_ring, FiniteField_generic):
509
+ # don't use this branch for e.g. Zmod(5)
510
+ characteristic = base_ring.characteristic()
511
+
512
+ # example for simpler ring creation interface without monomial orderings:
513
+ #_ring = rDefault(characteristic, nvars, _names)
514
+
515
+ _ring = rDefault(characteristic, nvars, _names, nblcks, _order, _block0, _block1, _wvhdl)
516
+
517
+ else:
518
+ modbase, cexponent = ch.perfect_power()
519
+
520
+ if modbase == 2 and cexponent > 1:
521
+ _cf = nInitChar(n_Z2m, <void *>cexponent)
522
+
523
+ elif modbase.is_prime() and cexponent > 1:
524
+ _info.base = <__mpz_struct *>omAlloc(sizeof(__mpz_struct))
525
+ mpz_init_set(_info.base, modbase.value)
526
+ _info.exp = cexponent
527
+ _cf = nInitChar(n_Znm, <void *>&_info)
528
+
529
+ else:
530
+ _info.base = <__mpz_struct *>omAlloc(sizeof(__mpz_struct))
531
+ mpz_init_set(_info.base, ch.value)
532
+ _info.exp = 1
533
+ _cf = nInitChar(n_Zn, <void *>&_info)
534
+ _ring = rDefault(_cf, nvars, _names, nblcks, _order, _block0, _block1, _wvhdl)
535
+
536
+ elif isinstance(base_ring, FiniteField_generic):
537
+ assert not base_ring.is_prime_field() # would have been handled above
538
+ if base_ring.characteristic() > 2147483647:
539
+ raise TypeError("characteristic must be <= 2147483647.")
540
+
541
+ # TODO: This is lazy, it should only call Singular stuff not PolynomialRing()
542
+ k = PolynomialRing(base_ring.prime_subfield(),
543
+ name=base_ring.variable_name(), order='lex',
544
+ implementation='singular')
545
+ minpoly = base_ring.polynomial()(k.gen())
546
+
547
+ _ext_names = <char**>omAlloc0(sizeof(char*))
548
+ _name = str_to_bytes(k._names[0])
549
+ _ext_names[0] = omStrDup(_name)
550
+ _cfr = rDefault(<int>base_ring.characteristic(), 1, _ext_names)
551
+
552
+ _cfr.qideal = idInit(1,1)
553
+ rComplete(_cfr, 1)
554
+ _cfr.qideal.m[0] = prCopyR(minpoly._poly, k._ring, _cfr)
555
+ extParam.r = _cfr
556
+ _cf = nInitChar( n_algExt, <void *>&extParam)
557
+
558
+ if (_cf is NULL):
559
+ raise RuntimeError("Failed to allocate _cf ring.")
560
+
561
+ _ring = rDefault (_cf, nvars, _names, nblcks, _order, _block0, _block1, _wvhdl)
562
+
563
+ else:
564
+ raise NotImplementedError(f"polynomials over {base_ring} are not supported in Singular")
565
+
566
+ if _ring is NULL:
567
+ raise ValueError("Failed to allocate Singular ring.")
568
+
569
+ _ring.ShortOut = 0
570
+
571
+ rChangeCurrRing(_ring)
572
+
573
+ wrapped_ring = wrap_ring(_ring)
574
+ if wrapped_ring in ring_refcount_dict:
575
+ raise ValueError('newly created ring already in dictionary??')
576
+ ring_refcount_dict[wrapped_ring] = 1
577
+
578
+ rComplete(_ring, 1)
579
+
580
+ _ring.ShortOut = 0
581
+
582
+ if order.is_local():
583
+ assert _ring.OrdSgn == -1
584
+ if order.is_global():
585
+ assert _ring.OrdSgn == 1
586
+
587
+ return _ring
588
+
589
+
590
+ #############################################################################
591
+ ring_refcount_dict = defaultdict(int)
592
+
593
+
594
+ cdef class ring_wrapper_Py():
595
+ r"""
596
+ Python object wrapping the ring pointer.
597
+
598
+ This is useful to store ring pointers in Python containers.
599
+
600
+ You must not construct instances of this class yourself, use
601
+ :func:`wrap_ring` instead.
602
+
603
+ EXAMPLES::
604
+
605
+ sage: from sage.libs.singular.ring import ring_wrapper_Py
606
+ sage: ring_wrapper_Py
607
+ <class 'sage.libs.singular.ring.ring_wrapper_Py'>
608
+ """
609
+
610
+ cdef ring* _ring
611
+
612
+ def __cinit__(self):
613
+ """
614
+ The Cython constructor.
615
+
616
+ EXAMPLES::
617
+
618
+ sage: from sage.libs.singular.ring import ring_wrapper_Py
619
+ sage: t = ring_wrapper_Py(); t
620
+ The ring pointer 0x0
621
+
622
+ These are just wrappers around a pointer, so it isn't really meaningful
623
+ to pickle them::
624
+
625
+ sage: TestSuite(t).run(skip='_test_pickling')
626
+ """
627
+ self._ring = NULL
628
+
629
+ def __hash__(self):
630
+ """
631
+ Return a hash value so that instances can be used as dictionary keys.
632
+
633
+ OUTPUT: integer
634
+
635
+ EXAMPLES::
636
+
637
+ sage: from sage.libs.singular.ring import ring_wrapper_Py
638
+ sage: t = ring_wrapper_Py()
639
+ sage: t.__hash__()
640
+ 0
641
+ """
642
+ return <long>(self._ring)
643
+
644
+ def __repr__(self):
645
+ """
646
+ Return a string representation.
647
+
648
+ OUTPUT: string
649
+
650
+ EXAMPLES::
651
+
652
+ sage: from sage.libs.singular.ring import ring_wrapper_Py
653
+ sage: t = ring_wrapper_Py()
654
+ sage: t
655
+ The ring pointer 0x0
656
+ sage: t.__repr__()
657
+ 'The ring pointer 0x0'
658
+ """
659
+ return 'The ring pointer '+hex(self.__hash__())
660
+
661
+ # This could be written using __eq__ but that does not work
662
+ # due to https://github.com/cython/cython/issues/2019
663
+ def __richcmp__(ring_wrapper_Py self, other, int op):
664
+ """
665
+ Equality comparison between two ``ring_wrapper_Py`` instances,
666
+ for use when hashing.
667
+
668
+ INPUT:
669
+
670
+ - ``right`` -- a :class:`ring_wrapper_Py`
671
+
672
+ OUTPUT: ``True`` if both ``ring_wrapper_Py`` wrap the same pointer
673
+
674
+ EXAMPLES::
675
+
676
+ sage: from sage.libs.singular.ring import (ring_wrapper_Py,
677
+ ....: currRing_wrapper)
678
+ sage: t = ring_wrapper_Py()
679
+ sage: t == t
680
+ True
681
+ sage: P.<x,y,z> = QQ[]
682
+ sage: t2 = currRing_wrapper()
683
+ sage: t3 = currRing_wrapper()
684
+ sage: t == t2
685
+ False
686
+ sage: t2 == t3
687
+ True
688
+ sage: t2 != t3
689
+ False
690
+ sage: t2 == None
691
+ False
692
+ """
693
+ if not (op == Py_EQ or op == Py_NE):
694
+ return NotImplemented
695
+
696
+ if type(other) is not ring_wrapper_Py:
697
+ return op != Py_EQ
698
+
699
+ r = <ring_wrapper_Py>other
700
+ return (self._ring == r._ring) == (op == Py_EQ)
701
+
702
+
703
+ cdef wrap_ring(ring* R):
704
+ """
705
+ Wrap a C ring pointer into a Python object.
706
+
707
+ INPUT:
708
+
709
+ - ``R`` -- a singular ring (a C datastructure)
710
+
711
+ OUTPUT:
712
+
713
+ A Python object :class:`ring_wrapper_Py` wrapping the C pointer.
714
+ """
715
+ cdef ring_wrapper_Py W = ring_wrapper_Py()
716
+ W._ring = R
717
+ return W
718
+
719
+
720
+ cdef ring *singular_ring_reference(ring *existing_ring) except NULL:
721
+ """
722
+ Refcount the ring ``existing_ring``.
723
+
724
+ INPUT:
725
+
726
+ - ``existing_ring`` -- a Singular ring
727
+
728
+ OUTPUT:
729
+
730
+ The same ring with its refcount increased. If ``existing_ring``
731
+ has not been refcounted yet, it will be after calling this function.
732
+ If initially ``existing_ring`` was refcounted once, then after
733
+ calling this function `n` times, you need to call :func:`singular_ring_delete`
734
+ `n+1` times to actually deallocate the ring.
735
+
736
+ EXAMPLES::
737
+
738
+ sage: import gc
739
+ sage: _ = gc.collect()
740
+ sage: from sage.rings.polynomial.multi_polynomial_libsingular import MPolynomialRing_libsingular
741
+ sage: from sage.libs.singular.groebner_strategy import GroebnerStrategy
742
+ sage: from sage.libs.singular.ring import ring_refcount_dict
743
+ sage: n = len(ring_refcount_dict)
744
+ sage: prev_rings = set(ring_refcount_dict)
745
+ sage: P = MPolynomialRing_libsingular(GF(541), 2, ('x', 'y'), TermOrder('degrevlex', 2))
746
+ sage: ring_ptr = set(ring_refcount_dict).difference(prev_rings).pop()
747
+ sage: ring_ptr # random output
748
+ The ring pointer 0x7f78a646b8d0
749
+ sage: ring_refcount_dict[ring_ptr]
750
+ 3
751
+
752
+ sage: strat = GroebnerStrategy(Ideal([P.gen(0) + P.gen(1)]))
753
+ sage: ring_refcount_dict[ring_ptr]
754
+ 6
755
+
756
+ sage: del strat
757
+ sage: _ = gc.collect()
758
+ sage: ring_refcount_dict[ring_ptr]
759
+ 4
760
+
761
+ sage: del P
762
+ sage: _ = gc.collect()
763
+ sage: ring_ptr in ring_refcount_dict
764
+ True
765
+ """
766
+ if existing_ring is NULL:
767
+ raise ValueError('singular_ring_reference(ring*) called with NULL pointer.')
768
+
769
+ cdef object r = wrap_ring(existing_ring)
770
+ ring_refcount_dict[r] += 1
771
+ return existing_ring
772
+
773
+
774
+ #############################################################################
775
+ cdef void singular_ring_delete(ring *doomed) noexcept:
776
+ """
777
+ Carefully deallocate the ring, without changing "currRing" (since
778
+ this method can be called at unpredictable times due to garbage
779
+ collection).
780
+
781
+ TESTS:
782
+
783
+ This example caused a segmentation fault with a previous version
784
+ of this method::
785
+
786
+ sage: import gc
787
+ sage: from sage.rings.polynomial.multi_polynomial_libsingular import MPolynomialRing_libsingular
788
+ sage: R1 = MPolynomialRing_libsingular(GF(5), 2, ('x', 'y'), TermOrder('degrevlex', 2))
789
+ sage: R2 = MPolynomialRing_libsingular(GF(11), 2, ('x', 'y'), TermOrder('degrevlex', 2))
790
+ sage: R3 = MPolynomialRing_libsingular(GF(13), 2, ('x', 'y'), TermOrder('degrevlex', 2))
791
+ sage: _ = gc.collect()
792
+ sage: foo = R1.gen(0)
793
+ sage: del foo
794
+ sage: del R1
795
+ sage: _ = gc.collect()
796
+ sage: del R2
797
+ sage: _ = gc.collect()
798
+ sage: del R3
799
+ sage: _ = gc.collect()
800
+ """
801
+ if doomed is NULL:
802
+ # When this is called with a NULL pointer, we do nothing.
803
+ # This is analogous to the libc function free().
804
+ return
805
+
806
+ if not ring_refcount_dict: # arbitrary finalization order when we shut Sage down
807
+ return
808
+
809
+ cdef ring_wrapper_Py r = wrap_ring(doomed)
810
+ ring_refcount_dict[r] -= 1
811
+ if ring_refcount_dict[r] > 0:
812
+ return
813
+
814
+ del ring_refcount_dict[r]
815
+
816
+ global currRing
817
+ cdef ring *oldRing = currRing
818
+ if currRing == doomed:
819
+ rDelete(doomed)
820
+ currRing = <ring*>NULL
821
+ else:
822
+ rChangeCurrRing(doomed)
823
+ rDelete(doomed)
824
+ rChangeCurrRing(oldRing)
825
+
826
+
827
+ #############################################################################
828
+ # helpers for debugging
829
+
830
+ cpdef poison_currRing(frame, event, arg):
831
+ """
832
+ Poison the ``currRing`` pointer.
833
+
834
+ This function sets the ``currRing`` to an illegal value. By
835
+ setting it as the python debug hook, you can poison the currRing
836
+ before every evaluated Python command (but not within Cython
837
+ code).
838
+
839
+ INPUT:
840
+
841
+ - ``frame``, ``event``, ``arg`` -- the standard arguments for the
842
+ CPython debugger hook; they are not used
843
+
844
+ OUTPUT:
845
+
846
+ Returns itself, which ensures that :func:`poison_currRing` will
847
+ stay in the debugger hook.
848
+
849
+ EXAMPLES::
850
+
851
+ sage: previous_trace_func = sys.gettrace() # None if no debugger running
852
+ sage: from sage.libs.singular.ring import poison_currRing
853
+ sage: sys.settrace(poison_currRing)
854
+ sage: sys.gettrace()
855
+ <built-in function poison_currRing>
856
+ sage: sys.settrace(previous_trace_func) # switch it off again
857
+ """
858
+ global currRing
859
+ currRing = <ring*>NULL
860
+ return poison_currRing
861
+
862
+
863
+ cpdef print_currRing():
864
+ """
865
+ Print the ``currRing`` pointer.
866
+
867
+ EXAMPLES::
868
+
869
+ sage: from sage.libs.singular.ring import print_currRing
870
+ sage: print_currRing() # random output
871
+ DEBUG: currRing == 0x7fc6fa6ec480
872
+
873
+ sage: from sage.libs.singular.ring import poison_currRing
874
+ sage: _ = poison_currRing(None, None, None)
875
+ sage: print_currRing()
876
+ DEBUG: currRing == 0x0
877
+ """
878
+ cdef size_t addr = <size_t>currRing
879
+ print("DEBUG: currRing == " + str(hex(addr)))
880
+
881
+
882
+ def currRing_wrapper():
883
+ """
884
+ Return a wrapper for the current ring, for use in debugging
885
+ ``ring_refcount_dict``.
886
+
887
+ EXAMPLES::
888
+
889
+ sage: from sage.libs.singular.ring import currRing_wrapper
890
+ sage: currRing_wrapper()
891
+ The ring pointer ...
892
+ """
893
+ return wrap_ring(currRing)