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.

Files changed (491) hide show
  1. PySingular.cpython-314-x86_64-linux-gnu.so +0 -0
  2. passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
  3. passagemath_singular-10.6.31rc3.dist-info/RECORD +491 -0
  4. passagemath_singular-10.6.31rc3.dist-info/WHEEL +6 -0
  5. passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
  6. passagemath_singular.libs/libSingular-4-20aec911.4.1.so +0 -0
  7. passagemath_singular.libs/libcddgmp-21acf0c6.so.0.1.3 +0 -0
  8. passagemath_singular.libs/libfactory-4-fcee31da.4.1.so +0 -0
  9. passagemath_singular.libs/libflint-66e12231.so.21.0.0 +0 -0
  10. passagemath_singular.libs/libgf2x-a4cdec90.so.3.0.0 +0 -0
  11. passagemath_singular.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
  12. passagemath_singular.libs/libgmp-6e109695.so.10.5.0 +0 -0
  13. passagemath_singular.libs/libgsl-cda90e79.so.28.0.0 +0 -0
  14. passagemath_singular.libs/libmpfr-82690d50.so.6.2.1 +0 -0
  15. passagemath_singular.libs/libntl-e6f0d543.so.44.0.1 +0 -0
  16. passagemath_singular.libs/libomalloc-0-5c9e866e.9.6.so +0 -0
  17. passagemath_singular.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
  18. passagemath_singular.libs/libpolys-4-5c0a87e0.4.1.so +0 -0
  19. passagemath_singular.libs/libquadmath-2284e583.so.0.0.0 +0 -0
  20. passagemath_singular.libs/libreadline-ea270e21.so.8.2 +0 -0
  21. passagemath_singular.libs/libsingular_resources-4-a1aafc6d.4.1.so +0 -0
  22. passagemath_singular.libs/libtinfo-ceb117d9.so.6.3 +0 -0
  23. sage/algebras/all__sagemath_singular.py +3 -0
  24. sage/algebras/fusion_rings/all.py +19 -0
  25. sage/algebras/fusion_rings/f_matrix.py +2448 -0
  26. sage/algebras/fusion_rings/fast_parallel_fmats_methods.cpython-314-x86_64-linux-gnu.so +0 -0
  27. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +5 -0
  28. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +538 -0
  29. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.cpython-314-x86_64-linux-gnu.so +0 -0
  30. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +3 -0
  31. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +331 -0
  32. sage/algebras/fusion_rings/fusion_double.py +899 -0
  33. sage/algebras/fusion_rings/fusion_ring.py +1580 -0
  34. sage/algebras/fusion_rings/poly_tup_engine.cpython-314-x86_64-linux-gnu.so +0 -0
  35. sage/algebras/fusion_rings/poly_tup_engine.pxd +24 -0
  36. sage/algebras/fusion_rings/poly_tup_engine.pyx +579 -0
  37. sage/algebras/fusion_rings/shm_managers.cpython-314-x86_64-linux-gnu.so +0 -0
  38. sage/algebras/fusion_rings/shm_managers.pxd +24 -0
  39. sage/algebras/fusion_rings/shm_managers.pyx +780 -0
  40. sage/algebras/letterplace/all.py +1 -0
  41. sage/algebras/letterplace/free_algebra_element_letterplace.cpython-314-x86_64-linux-gnu.so +0 -0
  42. sage/algebras/letterplace/free_algebra_element_letterplace.pxd +18 -0
  43. sage/algebras/letterplace/free_algebra_element_letterplace.pyx +755 -0
  44. sage/algebras/letterplace/free_algebra_letterplace.cpython-314-x86_64-linux-gnu.so +0 -0
  45. sage/algebras/letterplace/free_algebra_letterplace.pxd +35 -0
  46. sage/algebras/letterplace/free_algebra_letterplace.pyx +914 -0
  47. sage/algebras/letterplace/letterplace_ideal.cpython-314-x86_64-linux-gnu.so +0 -0
  48. sage/algebras/letterplace/letterplace_ideal.pyx +408 -0
  49. sage/algebras/quatalg/all.py +2 -0
  50. sage/algebras/quatalg/quaternion_algebra.py +4778 -0
  51. sage/algebras/quatalg/quaternion_algebra_cython.cpython-314-x86_64-linux-gnu.so +0 -0
  52. sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
  53. sage/algebras/quatalg/quaternion_algebra_element.cpython-314-x86_64-linux-gnu.so +0 -0
  54. sage/algebras/quatalg/quaternion_algebra_element.pxd +29 -0
  55. sage/algebras/quatalg/quaternion_algebra_element.pyx +2176 -0
  56. sage/all__sagemath_singular.py +11 -0
  57. sage/ext_data/all__sagemath_singular.py +1 -0
  58. sage/ext_data/singular/function_field/core.lib +98 -0
  59. sage/interfaces/all__sagemath_singular.py +1 -0
  60. sage/interfaces/singular.py +2835 -0
  61. sage/libs/all__sagemath_singular.py +1 -0
  62. sage/libs/singular/__init__.py +1 -0
  63. sage/libs/singular/decl.pxd +1168 -0
  64. sage/libs/singular/function.cpython-314-x86_64-linux-gnu.so +0 -0
  65. sage/libs/singular/function.pxd +87 -0
  66. sage/libs/singular/function.pyx +1901 -0
  67. sage/libs/singular/function_factory.py +61 -0
  68. sage/libs/singular/groebner_strategy.cpython-314-x86_64-linux-gnu.so +0 -0
  69. sage/libs/singular/groebner_strategy.pxd +22 -0
  70. sage/libs/singular/groebner_strategy.pyx +582 -0
  71. sage/libs/singular/option.cpython-314-x86_64-linux-gnu.so +0 -0
  72. sage/libs/singular/option.pyx +671 -0
  73. sage/libs/singular/polynomial.cpython-314-x86_64-linux-gnu.so +0 -0
  74. sage/libs/singular/polynomial.pxd +39 -0
  75. sage/libs/singular/polynomial.pyx +661 -0
  76. sage/libs/singular/ring.cpython-314-x86_64-linux-gnu.so +0 -0
  77. sage/libs/singular/ring.pxd +58 -0
  78. sage/libs/singular/ring.pyx +893 -0
  79. sage/libs/singular/singular.cpython-314-x86_64-linux-gnu.so +0 -0
  80. sage/libs/singular/singular.pxd +72 -0
  81. sage/libs/singular/singular.pyx +1944 -0
  82. sage/libs/singular/standard_options.py +145 -0
  83. sage/matrix/all__sagemath_singular.py +1 -0
  84. sage/matrix/matrix_mpolynomial_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  85. sage/matrix/matrix_mpolynomial_dense.pxd +7 -0
  86. sage/matrix/matrix_mpolynomial_dense.pyx +615 -0
  87. sage/rings/all__sagemath_singular.py +1 -0
  88. sage/rings/function_field/all__sagemath_singular.py +1 -0
  89. sage/rings/function_field/derivations_polymod.py +911 -0
  90. sage/rings/function_field/element_polymod.cpython-314-x86_64-linux-gnu.so +0 -0
  91. sage/rings/function_field/element_polymod.pyx +406 -0
  92. sage/rings/function_field/function_field_polymod.py +2611 -0
  93. sage/rings/function_field/ideal_polymod.py +1775 -0
  94. sage/rings/function_field/order_polymod.py +1475 -0
  95. sage/rings/function_field/place_polymod.py +681 -0
  96. sage/rings/polynomial/all__sagemath_singular.py +1 -0
  97. sage/rings/polynomial/multi_polynomial_ideal_libsingular.cpython-314-x86_64-linux-gnu.so +0 -0
  98. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +5 -0
  99. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +339 -0
  100. sage/rings/polynomial/multi_polynomial_libsingular.cpython-314-x86_64-linux-gnu.so +0 -0
  101. sage/rings/polynomial/multi_polynomial_libsingular.pxd +30 -0
  102. sage/rings/polynomial/multi_polynomial_libsingular.pyx +6277 -0
  103. sage/rings/polynomial/plural.cpython-314-x86_64-linux-gnu.so +0 -0
  104. sage/rings/polynomial/plural.pxd +48 -0
  105. sage/rings/polynomial/plural.pyx +3171 -0
  106. sage/symbolic/all__sagemath_singular.py +1 -0
  107. sage/symbolic/comparison_impl.pxi +428 -0
  108. sage/symbolic/constants_c_impl.pxi +178 -0
  109. sage/symbolic/expression.cpython-314-x86_64-linux-gnu.so +0 -0
  110. sage/symbolic/expression.pxd +7 -0
  111. sage/symbolic/expression.pyx +14200 -0
  112. sage/symbolic/getitem_impl.pxi +202 -0
  113. sage/symbolic/pynac.pxi +572 -0
  114. sage/symbolic/pynac_constant_impl.pxi +133 -0
  115. sage/symbolic/pynac_function_impl.pxi +206 -0
  116. sage/symbolic/pynac_impl.pxi +2576 -0
  117. sage/symbolic/pynac_wrap.h +124 -0
  118. sage/symbolic/series_impl.pxi +272 -0
  119. sage/symbolic/substitution_map_impl.pxi +94 -0
  120. sage_wheels/bin/ESingular +0 -0
  121. sage_wheels/bin/Singular +0 -0
  122. sage_wheels/bin/TSingular +0 -0
  123. sage_wheels/lib/singular/MOD/cohomo.la +41 -0
  124. sage_wheels/lib/singular/MOD/cohomo.so +0 -0
  125. sage_wheels/lib/singular/MOD/customstd.la +41 -0
  126. sage_wheels/lib/singular/MOD/customstd.so +0 -0
  127. sage_wheels/lib/singular/MOD/freealgebra.la +41 -0
  128. sage_wheels/lib/singular/MOD/freealgebra.so +0 -0
  129. sage_wheels/lib/singular/MOD/gfanlib.la +41 -0
  130. sage_wheels/lib/singular/MOD/gfanlib.so +0 -0
  131. sage_wheels/lib/singular/MOD/gitfan.la +41 -0
  132. sage_wheels/lib/singular/MOD/gitfan.so +0 -0
  133. sage_wheels/lib/singular/MOD/interval.la +41 -0
  134. sage_wheels/lib/singular/MOD/interval.so +0 -0
  135. sage_wheels/lib/singular/MOD/loctriv.la +41 -0
  136. sage_wheels/lib/singular/MOD/loctriv.so +0 -0
  137. sage_wheels/lib/singular/MOD/machinelearning.la +41 -0
  138. sage_wheels/lib/singular/MOD/machinelearning.so +0 -0
  139. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.la +41 -0
  140. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.so +0 -0
  141. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.la +41 -0
  142. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.so +0 -0
  143. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.la +41 -0
  144. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.so +0 -0
  145. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.la +41 -0
  146. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.so +0 -0
  147. sage_wheels/lib/singular/MOD/partialgb.la +41 -0
  148. sage_wheels/lib/singular/MOD/partialgb.so +0 -0
  149. sage_wheels/lib/singular/MOD/pyobject.la +41 -0
  150. sage_wheels/lib/singular/MOD/pyobject.so +0 -0
  151. sage_wheels/lib/singular/MOD/singmathic.la +41 -0
  152. sage_wheels/lib/singular/MOD/singmathic.so +0 -0
  153. sage_wheels/lib/singular/MOD/sispasm.la +41 -0
  154. sage_wheels/lib/singular/MOD/sispasm.so +0 -0
  155. sage_wheels/lib/singular/MOD/subsets.la +41 -0
  156. sage_wheels/lib/singular/MOD/subsets.so +0 -0
  157. sage_wheels/lib/singular/MOD/systhreads.la +41 -0
  158. sage_wheels/lib/singular/MOD/systhreads.so +0 -0
  159. sage_wheels/lib/singular/MOD/syzextra.la +41 -0
  160. sage_wheels/lib/singular/MOD/syzextra.so +0 -0
  161. sage_wheels/libexec/singular/MOD/change_cost +0 -0
  162. sage_wheels/libexec/singular/MOD/singularsurf +11 -0
  163. sage_wheels/libexec/singular/MOD/singularsurf_jupyter +9 -0
  164. sage_wheels/libexec/singular/MOD/singularsurf_win +10 -0
  165. sage_wheels/libexec/singular/MOD/solve_IP +0 -0
  166. sage_wheels/libexec/singular/MOD/surfex +16 -0
  167. sage_wheels/libexec/singular/MOD/toric_ideal +0 -0
  168. sage_wheels/share/factory/gftables/10201 +342 -0
  169. sage_wheels/share/factory/gftables/1024 +37 -0
  170. sage_wheels/share/factory/gftables/10609 +356 -0
  171. sage_wheels/share/factory/gftables/11449 +384 -0
  172. sage_wheels/share/factory/gftables/11881 +398 -0
  173. sage_wheels/share/factory/gftables/121 +6 -0
  174. sage_wheels/share/factory/gftables/12167 +408 -0
  175. sage_wheels/share/factory/gftables/125 +7 -0
  176. sage_wheels/share/factory/gftables/12769 +428 -0
  177. sage_wheels/share/factory/gftables/128 +7 -0
  178. sage_wheels/share/factory/gftables/1331 +47 -0
  179. sage_wheels/share/factory/gftables/1369 +48 -0
  180. sage_wheels/share/factory/gftables/14641 +490 -0
  181. sage_wheels/share/factory/gftables/15625 +523 -0
  182. sage_wheels/share/factory/gftables/16 +3 -0
  183. sage_wheels/share/factory/gftables/16129 +540 -0
  184. sage_wheels/share/factory/gftables/16384 +549 -0
  185. sage_wheels/share/factory/gftables/16807 +563 -0
  186. sage_wheels/share/factory/gftables/1681 +58 -0
  187. sage_wheels/share/factory/gftables/169 +8 -0
  188. sage_wheels/share/factory/gftables/17161 +574 -0
  189. sage_wheels/share/factory/gftables/1849 +64 -0
  190. sage_wheels/share/factory/gftables/18769 +628 -0
  191. sage_wheels/share/factory/gftables/19321 +646 -0
  192. sage_wheels/share/factory/gftables/19683 +659 -0
  193. sage_wheels/share/factory/gftables/2048 +71 -0
  194. sage_wheels/share/factory/gftables/2187 +75 -0
  195. sage_wheels/share/factory/gftables/2197 +76 -0
  196. sage_wheels/share/factory/gftables/2209 +76 -0
  197. sage_wheels/share/factory/gftables/22201 +742 -0
  198. sage_wheels/share/factory/gftables/22801 +762 -0
  199. sage_wheels/share/factory/gftables/2401 +82 -0
  200. sage_wheels/share/factory/gftables/243 +11 -0
  201. sage_wheels/share/factory/gftables/24389 +815 -0
  202. sage_wheels/share/factory/gftables/24649 +824 -0
  203. sage_wheels/share/factory/gftables/25 +3 -0
  204. sage_wheels/share/factory/gftables/256 +11 -0
  205. sage_wheels/share/factory/gftables/26569 +888 -0
  206. sage_wheels/share/factory/gftables/27 +3 -0
  207. sage_wheels/share/factory/gftables/27889 +932 -0
  208. sage_wheels/share/factory/gftables/2809 +96 -0
  209. sage_wheels/share/factory/gftables/28561 +954 -0
  210. sage_wheels/share/factory/gftables/289 +12 -0
  211. sage_wheels/share/factory/gftables/29791 +995 -0
  212. sage_wheels/share/factory/gftables/29929 +1000 -0
  213. sage_wheels/share/factory/gftables/3125 +107 -0
  214. sage_wheels/share/factory/gftables/32 +4 -0
  215. sage_wheels/share/factory/gftables/32041 +1070 -0
  216. sage_wheels/share/factory/gftables/32761 +1094 -0
  217. sage_wheels/share/factory/gftables/32768 +1095 -0
  218. sage_wheels/share/factory/gftables/343 +14 -0
  219. sage_wheels/share/factory/gftables/3481 +118 -0
  220. sage_wheels/share/factory/gftables/361 +14 -0
  221. sage_wheels/share/factory/gftables/36481 +1218 -0
  222. sage_wheels/share/factory/gftables/3721 +126 -0
  223. sage_wheels/share/factory/gftables/37249 +1244 -0
  224. sage_wheels/share/factory/gftables/38809 +1296 -0
  225. sage_wheels/share/factory/gftables/39601 +1322 -0
  226. sage_wheels/share/factory/gftables/4 +3 -0
  227. sage_wheels/share/factory/gftables/4096 +139 -0
  228. sage_wheels/share/factory/gftables/44521 +1486 -0
  229. sage_wheels/share/factory/gftables/4489 +152 -0
  230. sage_wheels/share/factory/gftables/49 +4 -0
  231. sage_wheels/share/factory/gftables/4913 +166 -0
  232. sage_wheels/share/factory/gftables/49729 +1660 -0
  233. sage_wheels/share/factory/gftables/5041 +170 -0
  234. sage_wheels/share/factory/gftables/50653 +1691 -0
  235. sage_wheels/share/factory/gftables/512 +20 -0
  236. sage_wheels/share/factory/gftables/51529 +1720 -0
  237. sage_wheels/share/factory/gftables/52441 +1750 -0
  238. sage_wheels/share/factory/gftables/529 +20 -0
  239. sage_wheels/share/factory/gftables/5329 +180 -0
  240. sage_wheels/share/factory/gftables/54289 +1812 -0
  241. sage_wheels/share/factory/gftables/57121 +1906 -0
  242. sage_wheels/share/factory/gftables/58081 +1938 -0
  243. sage_wheels/share/factory/gftables/59049 +1971 -0
  244. sage_wheels/share/factory/gftables/6241 +210 -0
  245. sage_wheels/share/factory/gftables/625 +23 -0
  246. sage_wheels/share/factory/gftables/63001 +2102 -0
  247. sage_wheels/share/factory/gftables/64 +5 -0
  248. sage_wheels/share/factory/gftables/6561 +221 -0
  249. sage_wheels/share/factory/gftables/6859 +231 -0
  250. sage_wheels/share/factory/gftables/6889 +232 -0
  251. sage_wheels/share/factory/gftables/729 +27 -0
  252. sage_wheels/share/factory/gftables/7921 +266 -0
  253. sage_wheels/share/factory/gftables/8 +3 -0
  254. sage_wheels/share/factory/gftables/81 +5 -0
  255. sage_wheels/share/factory/gftables/8192 +276 -0
  256. sage_wheels/share/factory/gftables/841 +30 -0
  257. sage_wheels/share/factory/gftables/9 +3 -0
  258. sage_wheels/share/factory/gftables/9409 +316 -0
  259. sage_wheels/share/factory/gftables/961 +34 -0
  260. sage_wheels/share/info/singular.info +191898 -0
  261. sage_wheels/share/singular/LIB/GND.lib +1359 -0
  262. sage_wheels/share/singular/LIB/JMBTest.lib +976 -0
  263. sage_wheels/share/singular/LIB/JMSConst.lib +1363 -0
  264. sage_wheels/share/singular/LIB/KVequiv.lib +699 -0
  265. sage_wheels/share/singular/LIB/SingularityDBM.lib +491 -0
  266. sage_wheels/share/singular/LIB/VecField.lib +1542 -0
  267. sage_wheels/share/singular/LIB/absfact.lib +959 -0
  268. sage_wheels/share/singular/LIB/ainvar.lib +730 -0
  269. sage_wheels/share/singular/LIB/aksaka.lib +419 -0
  270. sage_wheels/share/singular/LIB/alexpoly.lib +2542 -0
  271. sage_wheels/share/singular/LIB/algebra.lib +1193 -0
  272. sage_wheels/share/singular/LIB/all.lib +136 -0
  273. sage_wheels/share/singular/LIB/arcpoint.lib +514 -0
  274. sage_wheels/share/singular/LIB/arnold.lib +4553 -0
  275. sage_wheels/share/singular/LIB/arnoldclassify.lib +2058 -0
  276. sage_wheels/share/singular/LIB/arr.lib +3486 -0
  277. sage_wheels/share/singular/LIB/assprimeszerodim.lib +755 -0
  278. sage_wheels/share/singular/LIB/autgradalg.lib +3361 -0
  279. sage_wheels/share/singular/LIB/bfun.lib +1964 -0
  280. sage_wheels/share/singular/LIB/bimodules.lib +774 -0
  281. sage_wheels/share/singular/LIB/brillnoether.lib +226 -0
  282. sage_wheels/share/singular/LIB/brnoeth.lib +5017 -0
  283. sage_wheels/share/singular/LIB/central.lib +2169 -0
  284. sage_wheels/share/singular/LIB/chern.lib +4162 -0
  285. sage_wheels/share/singular/LIB/cimonom.lib +571 -0
  286. sage_wheels/share/singular/LIB/cisimplicial.lib +1835 -0
  287. sage_wheels/share/singular/LIB/classify.lib +3239 -0
  288. sage_wheels/share/singular/LIB/classify2.lib +1462 -0
  289. sage_wheels/share/singular/LIB/classifyMapGerms.lib +1515 -0
  290. sage_wheels/share/singular/LIB/classify_aeq.lib +3253 -0
  291. sage_wheels/share/singular/LIB/classifyceq.lib +2092 -0
  292. sage_wheels/share/singular/LIB/classifyci.lib +1133 -0
  293. sage_wheels/share/singular/LIB/combinat.lib +91 -0
  294. sage_wheels/share/singular/LIB/compregb.lib +276 -0
  295. sage_wheels/share/singular/LIB/control.lib +1636 -0
  296. sage_wheels/share/singular/LIB/crypto.lib +3795 -0
  297. sage_wheels/share/singular/LIB/curveInv.lib +667 -0
  298. sage_wheels/share/singular/LIB/curvepar.lib +1817 -0
  299. sage_wheels/share/singular/LIB/customstd.lib +100 -0
  300. sage_wheels/share/singular/LIB/deRham.lib +5979 -0
  301. sage_wheels/share/singular/LIB/decodegb.lib +2134 -0
  302. sage_wheels/share/singular/LIB/decomp.lib +1655 -0
  303. sage_wheels/share/singular/LIB/deflation.lib +872 -0
  304. sage_wheels/share/singular/LIB/deform.lib +925 -0
  305. sage_wheels/share/singular/LIB/difform.lib +3055 -0
  306. sage_wheels/share/singular/LIB/divisors.lib +750 -0
  307. sage_wheels/share/singular/LIB/dmod.lib +5817 -0
  308. sage_wheels/share/singular/LIB/dmodapp.lib +3269 -0
  309. sage_wheels/share/singular/LIB/dmodideal.lib +1211 -0
  310. sage_wheels/share/singular/LIB/dmodloc.lib +2645 -0
  311. sage_wheels/share/singular/LIB/dmodvar.lib +818 -0
  312. sage_wheels/share/singular/LIB/dummy.lib +17 -0
  313. sage_wheels/share/singular/LIB/elim.lib +1009 -0
  314. sage_wheels/share/singular/LIB/ellipticcovers.lib +548 -0
  315. sage_wheels/share/singular/LIB/enumpoints.lib +146 -0
  316. sage_wheels/share/singular/LIB/equising.lib +2127 -0
  317. sage_wheels/share/singular/LIB/ffmodstd.lib +2384 -0
  318. sage_wheels/share/singular/LIB/ffsolve.lib +1289 -0
  319. sage_wheels/share/singular/LIB/findifs.lib +778 -0
  320. sage_wheels/share/singular/LIB/finitediff.lib +1768 -0
  321. sage_wheels/share/singular/LIB/finvar.lib +7989 -0
  322. sage_wheels/share/singular/LIB/fpadim.lib +2429 -0
  323. sage_wheels/share/singular/LIB/fpalgebras.lib +1666 -0
  324. sage_wheels/share/singular/LIB/fpaprops.lib +1462 -0
  325. sage_wheels/share/singular/LIB/freegb.lib +3853 -0
  326. sage_wheels/share/singular/LIB/general.lib +1350 -0
  327. sage_wheels/share/singular/LIB/gfan.lib +1768 -0
  328. sage_wheels/share/singular/LIB/gitfan.lib +3130 -0
  329. sage_wheels/share/singular/LIB/gkdim.lib +99 -0
  330. sage_wheels/share/singular/LIB/gmspoly.lib +589 -0
  331. sage_wheels/share/singular/LIB/gmssing.lib +1739 -0
  332. sage_wheels/share/singular/LIB/goettsche.lib +909 -0
  333. sage_wheels/share/singular/LIB/graal.lib +1366 -0
  334. sage_wheels/share/singular/LIB/gradedModules.lib +2541 -0
  335. sage_wheels/share/singular/LIB/graphics.lib +360 -0
  336. sage_wheels/share/singular/LIB/grobcov.lib +7706 -0
  337. sage_wheels/share/singular/LIB/groups.lib +1123 -0
  338. sage_wheels/share/singular/LIB/grwalk.lib +507 -0
  339. sage_wheels/share/singular/LIB/hdepth.lib +194 -0
  340. sage_wheels/share/singular/LIB/help.cnf +57 -0
  341. sage_wheels/share/singular/LIB/hess.lib +1946 -0
  342. sage_wheels/share/singular/LIB/hnoether.lib +4292 -0
  343. sage_wheels/share/singular/LIB/hodge.lib +400 -0
  344. sage_wheels/share/singular/LIB/homolog.lib +1965 -0
  345. sage_wheels/share/singular/LIB/hyperel.lib +975 -0
  346. sage_wheels/share/singular/LIB/inout.lib +679 -0
  347. sage_wheels/share/singular/LIB/integralbasis.lib +6224 -0
  348. sage_wheels/share/singular/LIB/interval.lib +1418 -0
  349. sage_wheels/share/singular/LIB/intprog.lib +778 -0
  350. sage_wheels/share/singular/LIB/invar.lib +443 -0
  351. sage_wheels/share/singular/LIB/involut.lib +980 -0
  352. sage_wheels/share/singular/LIB/jacobson.lib +1215 -0
  353. sage_wheels/share/singular/LIB/kskernel.lib +534 -0
  354. sage_wheels/share/singular/LIB/latex.lib +3146 -0
  355. sage_wheels/share/singular/LIB/lejeune.lib +651 -0
  356. sage_wheels/share/singular/LIB/linalg.lib +2040 -0
  357. sage_wheels/share/singular/LIB/locnormal.lib +212 -0
  358. sage_wheels/share/singular/LIB/lrcalc.lib +526 -0
  359. sage_wheels/share/singular/LIB/makedbm.lib +294 -0
  360. sage_wheels/share/singular/LIB/mathml.lib +813 -0
  361. sage_wheels/share/singular/LIB/matrix.lib +1372 -0
  362. sage_wheels/share/singular/LIB/maxlike.lib +1132 -0
  363. sage_wheels/share/singular/LIB/methods.lib +212 -0
  364. sage_wheels/share/singular/LIB/moddiq.lib +322 -0
  365. sage_wheels/share/singular/LIB/modfinduni.lib +181 -0
  366. sage_wheels/share/singular/LIB/modnormal.lib +218 -0
  367. sage_wheels/share/singular/LIB/modprimdec.lib +1278 -0
  368. sage_wheels/share/singular/LIB/modquotient.lib +269 -0
  369. sage_wheels/share/singular/LIB/modstd.lib +1024 -0
  370. sage_wheels/share/singular/LIB/modular.lib +545 -0
  371. sage_wheels/share/singular/LIB/modules.lib +2561 -0
  372. sage_wheels/share/singular/LIB/modwalk.lib +609 -0
  373. sage_wheels/share/singular/LIB/mondromy.lib +1016 -0
  374. sage_wheels/share/singular/LIB/monomialideal.lib +3851 -0
  375. sage_wheels/share/singular/LIB/mprimdec.lib +2353 -0
  376. sage_wheels/share/singular/LIB/mregular.lib +1863 -0
  377. sage_wheels/share/singular/LIB/multigrading.lib +5629 -0
  378. sage_wheels/share/singular/LIB/ncHilb.lib +777 -0
  379. sage_wheels/share/singular/LIB/ncModslimgb.lib +791 -0
  380. sage_wheels/share/singular/LIB/ncalg.lib +16311 -0
  381. sage_wheels/share/singular/LIB/ncall.lib +31 -0
  382. sage_wheels/share/singular/LIB/ncdecomp.lib +468 -0
  383. sage_wheels/share/singular/LIB/ncfactor.lib +13371 -0
  384. sage_wheels/share/singular/LIB/ncfrac.lib +1023 -0
  385. sage_wheels/share/singular/LIB/nchilbert.lib +448 -0
  386. sage_wheels/share/singular/LIB/nchomolog.lib +759 -0
  387. sage_wheels/share/singular/LIB/ncloc.lib +361 -0
  388. sage_wheels/share/singular/LIB/ncpreim.lib +795 -0
  389. sage_wheels/share/singular/LIB/ncrat.lib +2849 -0
  390. sage_wheels/share/singular/LIB/nctools.lib +1887 -0
  391. sage_wheels/share/singular/LIB/nets.lib +1456 -0
  392. sage_wheels/share/singular/LIB/nfmodstd.lib +1000 -0
  393. sage_wheels/share/singular/LIB/nfmodsyz.lib +732 -0
  394. sage_wheels/share/singular/LIB/noether.lib +1106 -0
  395. sage_wheels/share/singular/LIB/normal.lib +8700 -0
  396. sage_wheels/share/singular/LIB/normaliz.lib +2226 -0
  397. sage_wheels/share/singular/LIB/ntsolve.lib +362 -0
  398. sage_wheels/share/singular/LIB/numerAlg.lib +560 -0
  399. sage_wheels/share/singular/LIB/numerDecom.lib +2261 -0
  400. sage_wheels/share/singular/LIB/olga.lib +1933 -0
  401. sage_wheels/share/singular/LIB/orbitparam.lib +351 -0
  402. sage_wheels/share/singular/LIB/parallel.lib +319 -0
  403. sage_wheels/share/singular/LIB/paraplanecurves.lib +3110 -0
  404. sage_wheels/share/singular/LIB/perron.lib +202 -0
  405. sage_wheels/share/singular/LIB/pfd.lib +2223 -0
  406. sage_wheels/share/singular/LIB/phindex.lib +642 -0
  407. sage_wheels/share/singular/LIB/pointid.lib +673 -0
  408. sage_wheels/share/singular/LIB/polybori.lib +1430 -0
  409. sage_wheels/share/singular/LIB/polyclass.lib +525 -0
  410. sage_wheels/share/singular/LIB/polylib.lib +1174 -0
  411. sage_wheels/share/singular/LIB/polymake.lib +1902 -0
  412. sage_wheels/share/singular/LIB/presolve.lib +1533 -0
  413. sage_wheels/share/singular/LIB/primdec.lib +9576 -0
  414. sage_wheels/share/singular/LIB/primdecint.lib +1782 -0
  415. sage_wheels/share/singular/LIB/primitiv.lib +401 -0
  416. sage_wheels/share/singular/LIB/puiseuxexpansions.lib +1631 -0
  417. sage_wheels/share/singular/LIB/purityfiltration.lib +960 -0
  418. sage_wheels/share/singular/LIB/qhmoduli.lib +1561 -0
  419. sage_wheels/share/singular/LIB/qmatrix.lib +293 -0
  420. sage_wheels/share/singular/LIB/random.lib +455 -0
  421. sage_wheels/share/singular/LIB/ratgb.lib +489 -0
  422. sage_wheels/share/singular/LIB/realclassify.lib +5759 -0
  423. sage_wheels/share/singular/LIB/realizationMatroids.lib +772 -0
  424. sage_wheels/share/singular/LIB/realrad.lib +1197 -0
  425. sage_wheels/share/singular/LIB/recover.lib +2628 -0
  426. sage_wheels/share/singular/LIB/redcgs.lib +3984 -0
  427. sage_wheels/share/singular/LIB/reesclos.lib +465 -0
  428. sage_wheels/share/singular/LIB/resbinomial.lib +2802 -0
  429. sage_wheels/share/singular/LIB/resgraph.lib +789 -0
  430. sage_wheels/share/singular/LIB/resjung.lib +820 -0
  431. sage_wheels/share/singular/LIB/resolve.lib +5110 -0
  432. sage_wheels/share/singular/LIB/resources.lib +170 -0
  433. sage_wheels/share/singular/LIB/reszeta.lib +5473 -0
  434. sage_wheels/share/singular/LIB/ring.lib +1328 -0
  435. sage_wheels/share/singular/LIB/ringgb.lib +343 -0
  436. sage_wheels/share/singular/LIB/rinvar.lib +1153 -0
  437. sage_wheels/share/singular/LIB/rootisolation.lib +1481 -0
  438. sage_wheels/share/singular/LIB/rootsmr.lib +709 -0
  439. sage_wheels/share/singular/LIB/rootsur.lib +886 -0
  440. sage_wheels/share/singular/LIB/rstandard.lib +607 -0
  441. sage_wheels/share/singular/LIB/rwalk.lib +336 -0
  442. sage_wheels/share/singular/LIB/sagbi.lib +1353 -0
  443. sage_wheels/share/singular/LIB/sagbiNormaliz.lib +1622 -0
  444. sage_wheels/share/singular/LIB/sagbiNormaliz0.lib +1498 -0
  445. sage_wheels/share/singular/LIB/sagbigrob.lib +449 -0
  446. sage_wheels/share/singular/LIB/schreyer.lib +321 -0
  447. sage_wheels/share/singular/LIB/schubert.lib +2551 -0
  448. sage_wheels/share/singular/LIB/sets.lib +524 -0
  449. sage_wheels/share/singular/LIB/sheafcoh.lib +1663 -0
  450. sage_wheels/share/singular/LIB/signcond.lib +437 -0
  451. sage_wheels/share/singular/LIB/sing.lib +1094 -0
  452. sage_wheels/share/singular/LIB/sing4ti2.lib +419 -0
  453. sage_wheels/share/singular/LIB/solve.lib +2243 -0
  454. sage_wheels/share/singular/LIB/spcurve.lib +1077 -0
  455. sage_wheels/share/singular/LIB/spectrum.lib +62 -0
  456. sage_wheels/share/singular/LIB/sresext.lib +757 -0
  457. sage_wheels/share/singular/LIB/ssi.lib +143 -0
  458. sage_wheels/share/singular/LIB/standard.lib +2769 -0
  459. sage_wheels/share/singular/LIB/stanleyreisner.lib +473 -0
  460. sage_wheels/share/singular/LIB/stdmodule.lib +547 -0
  461. sage_wheels/share/singular/LIB/stratify.lib +1070 -0
  462. sage_wheels/share/singular/LIB/surf.lib +506 -0
  463. sage_wheels/share/singular/LIB/surf_jupyter.lib +223 -0
  464. sage_wheels/share/singular/LIB/surfacesignature.lib +522 -0
  465. sage_wheels/share/singular/LIB/surfex.lib +1462 -0
  466. sage_wheels/share/singular/LIB/swalk.lib +877 -0
  467. sage_wheels/share/singular/LIB/symodstd.lib +1570 -0
  468. sage_wheels/share/singular/LIB/systhreads.lib +74 -0
  469. sage_wheels/share/singular/LIB/tasks.lib +1324 -0
  470. sage_wheels/share/singular/LIB/tateProdCplxNegGrad.lib +2412 -0
  471. sage_wheels/share/singular/LIB/teachstd.lib +858 -0
  472. sage_wheels/share/singular/LIB/template.lib +116 -0
  473. sage_wheels/share/singular/LIB/toric.lib +1119 -0
  474. sage_wheels/share/singular/LIB/transformation.lib +116 -0
  475. sage_wheels/share/singular/LIB/triang.lib +1197 -0
  476. sage_wheels/share/singular/LIB/tropical.lib +8741 -0
  477. sage_wheels/share/singular/LIB/tropicalEllipticCovers.lib +2922 -0
  478. sage_wheels/share/singular/LIB/tropicalNewton.lib +1128 -0
  479. sage_wheels/share/singular/LIB/tst.lib +1108 -0
  480. sage_wheels/share/singular/LIB/weierstr.lib +241 -0
  481. sage_wheels/share/singular/LIB/zeroset.lib +1478 -0
  482. sage_wheels/share/singular/emacs/.emacs-general +184 -0
  483. sage_wheels/share/singular/emacs/.emacs-singular +234 -0
  484. sage_wheels/share/singular/emacs/COPYING +44 -0
  485. sage_wheels/share/singular/emacs/cmd-cmpl.el +241 -0
  486. sage_wheels/share/singular/emacs/ex-cmpl.el +1681 -0
  487. sage_wheels/share/singular/emacs/hlp-cmpl.el +4318 -0
  488. sage_wheels/share/singular/emacs/lib-cmpl.el +179 -0
  489. sage_wheels/share/singular/emacs/singular.el +4273 -0
  490. sage_wheels/share/singular/emacs/singular.xpm +39 -0
  491. sage_wheels/share/singular/singular.idx +5002 -0
@@ -0,0 +1,1622 @@
1
+ //// Singular library normaliz.lib
2
+ version="version sagbiNormaliz.lib 4.4.1.2 July_2025 "; // $Id: cda254052dc8f441ea599ecd6e6179207fe2b1a2 $
3
+ category="Commutative Algebra";
4
+ info="
5
+ LIBRARY: sagbiNormaliz.lib Provides an interface for the computation of Sagbi bases.
6
+ It uses normaliz (version 3.10.5 or higher) for combinatorial computations.
7
+
8
+ AUTHORS: Winfried Bruns, wbruns@uos.de
9
+
10
+ OVERVIEW:
11
+
12
+ The library sagbiNormaliz.lib provides functions for the computations of Sagbi bases of
13
+ subalgebras A of polynomial rings over a field. It is based on normaliz.lib. Its
14
+ functions compute Sagbi bases with or without the control by Hilbert functions and/or
15
+ degrees. Hilbert functions and degrees require that bthe ambient polynomial ring is
16
+ standard graded. (An extension to general positive gradings would not be difficult.)
17
+
18
+ In addition to the Sagbi bases it can compute a defining ideal for the algebra A with
19
+ respect to the given system of generators. (The computation of defining ideals cannot be
20
+ controlled by Hilbert series.)
21
+
22
+ See the papers
23
+
24
+ (1) W.Bruns and A. Conca, Sagbi combinatorics of maximal minors and a Sagbi algorithm.
25
+ J. Symb. Comput. 120 (2024), Article ID 102237, 14 p. (arXiv:2302.14345)
26
+
27
+ (2) W. Bruns, A. Conca and F.Lembo, Sagbi bases, defining ideals and algebras of minors.
28
+
29
+ Use of this library requires the program Normaliz, version n 3.10.5 or newer, to be
30
+ installed and the availability of normaliz.lib. You can download both from
31
+ @uref{https://github.com/Normaliz/Normaliz/releases}.
32
+ Please make sure that the executable is in the search path or use setNmzExecPath (defined
33
+ in normaliz.lib).
34
+
35
+ The computations of this library require reading Normaliz output files and therefore a file name
36
+ must be set. The standard file name chosen by the library is NmzSagbiExchange in the current
37
+ directory. The user can change the name.
38
+
39
+ KEYWORDS: Sagbi basis, initial algebra, defining ideal.
40
+
41
+ PROCEDURES:
42
+ sagbiGeneral(ideal Q [, int sagbiMaxRounds, int sorting, int verb]) computes the Sagbi basis of the subalgebra of
43
+ the current polynomial ring that is generated by the elements of Q. The computation is stopped after at most sagbiMaxRounds rounds if trhe parameter is set. If sorting is set, the computed elements are degrevlex sorted before a round of the algorithm.
44
+ The optional parameter verb sets the terminal output. Default is 1 = on..
45
+
46
+ sagbiByDegree(ideal Q, int Sagbi_degree_bound,[,int sorting, int verb]) computes the Sagbi basis degree by degree
47
+ until thwe degree bound is reached or the Sagbi basis has been computed compltely.
48
+
49
+ sagbiHilbControlled(ideal Q, intvec HS_num_algebra, intvec HS_denom_algebra, int Sagbi_degree_bound[, int finalCheck, int sorting, int verb])
50
+ computes the Sagbi basis up to the degree bound. The Hilbert series of the subalgebra
51
+ generated by the elements of Q is given by its numerator and denominator as a rational
52
+ function. HS_denom_algebra lists the exponents g_i in the factors 1 -t^g_i of the denominator.
53
+ If the degree bound is reached and the optional argument inalCheck is set, the Hilbert series
54
+ is checked again for completion.
55
+
56
+ sagbiDefIdealGeneral(ideal Q [, int sagbiMaxRounds, int sorting, int verb]) does the same as sagbiGeneral, but additionally
57
+ computes as much of a system of generators of the defining idael as it can get before being stopped. Addutionally it returns the list of expressions of the Sagbi elements in terms of the original generators of the aubalgebra, calles the retract.
58
+
59
+ sagbiDefIdealByDegree(ideal Q, int Sagbi_degree_bound,[,int sorting, int verb]) does the same as sagbiByDegree,
60
+ but additionally computes the defining ideal up to the degree set by Sagbi_degree_bound.
61
+ Addutionally it returns the list of expressions of the Sagbi elements in terms of the original generators of the aubalgebra, calles the retract.
62
+
63
+
64
+ ";
65
+
66
+ LIB "finvar.lib";
67
+
68
+ // ------------------------------------------------
69
+ // Helpers for ideal management
70
+ // -----------------------------------------------
71
+
72
+ static proc leadcoafIdeal(ideal Q){
73
+ ideal LC;
74
+ for(int i = 1; i <= ncols(Q); i++){
75
+ if(i == 1){
76
+ LC[1] = leadcoef(Q[1]);
77
+ }
78
+ else{
79
+ LC = LC, leadcoef(Q[i]);
80
+ }
81
+ }
82
+ return(LC);
83
+ }
84
+
85
+ static proc degIdeal(ideal Q){
86
+ int p = ncols(Q);
87
+ intvec D = 1..p; // to give it size p
88
+ for(int i = 1; i <= p; i++){
89
+ D[i] = deg(Q[i]); // no GradingDenom: only interested in <0, 0 , >0
90
+ }
91
+ return(D);
92
+ }
93
+
94
+ static proc checkPposDegree(ideal Q){
95
+ for(int i = 1; i <= ncols(Q); i++){
96
+ if(deg(Q[i]) <= 0){
97
+ ERROR("Polynomials in input must have positive degree");
98
+ }
99
+ }
100
+ }
101
+
102
+
103
+ static proc aapplyLaedIdeal(ideal LC){
104
+
105
+ for(int i = 1; i <= ncols(LC); i++){
106
+ if(LC[i] == 0){
107
+ @DefIdeal = @DefIdeal, @Retract[i];
108
+ @Retract[i] = 0;
109
+ }
110
+ else{
111
+ @Retract[i] = @Retract[i]/LC[i];
112
+ }
113
+ }
114
+ @DefIdeal = simplify(@DefIdeal, 3);
115
+ @Retract = simplify(@Retract, 2);
116
+ }
117
+
118
+
119
+ static proc checkDefIdeal(ideal Q){
120
+ map h = @S, Q;
121
+ ideal test_def_Id = h(@DefIdeal);
122
+ test_def_Id = simplify(test_def_Id,2);
123
+ if(size(test_def_Id) != 0){
124
+ ERROR("Defining ideal doesn't map to 0. Inform the authors!");
125
+ }
126
+ }
127
+
128
+ static proc removeConstants(ideal Q){
129
+ for(int i = 1; i<=ncols(Q); i++){
130
+ if(deg(Q[i]) == 0){
131
+ Q[i] = 0;
132
+ }
133
+ }
134
+ Q = simplify(Q, 2);
135
+ return(Q);
136
+ }
137
+
138
+ static proc preparePreIm(intvec D, ideal LC){
139
+
140
+ for(int i = 1; i <= size(D); i++){
141
+ if(D[i] <= 0){ // constant
142
+ @DefIdeal = @DefIdeal, @Retract[i] - LC[i];
143
+ @Retract[i] = 0;
144
+ }
145
+ else{
146
+ @Retract[i] = @Retract[i]/LC[i];
147
+ }
148
+ }
149
+ @Retract = simplify(@Retract, 2);
150
+ }
151
+
152
+ // ------------------------------------------------
153
+ // Helpers related to grading
154
+ // -----------------------------------------------
155
+
156
+
157
+ static proc gradingDenominator(ideal P){
158
+ int GradingDenom = deg(P[1]);
159
+ for(int i = 2; i <= size(P); i++){
160
+ GradingDenom = gcd(GradingDenom, deg(P[i]));
161
+ }
162
+ return(GradingDenom);
163
+ }
164
+
165
+ static proc gradVector(ideal Q, int GradingDenom){
166
+ intvec SGrad;
167
+ SGrad = deg(Q[1]) div GradingDenom;
168
+ for(int i = 2; i <= size(Q); i++){
169
+ SGrad = SGrad, deg(Q[i]) div GradingDenom;
170
+ }
171
+ return(SGrad);
172
+ }
173
+
174
+ static proc scalarProduct(intvec u, intvec v){
175
+ int p = 0;
176
+ for(int i = 1; i <= size(u); i++){
177
+ p = p + u[i]*v[i];
178
+ }
179
+ return(p);
180
+ }
181
+
182
+ static proc posScalarProductMat(intmat U, int row, intvec v){
183
+ int p = 0;
184
+ for(int i = 1; i <= ncols(U); i++){
185
+ if(U[row,i] > 0){
186
+ p = p + U[row,i]*v[i];
187
+ }
188
+ }
189
+ return(p);
190
+ }
191
+
192
+ static proc selectNextDegree(intmat saveTete_a_tete, int startTete_tete, intvec SGrad){
193
+
194
+ for(int k = 1; k <= nrows(saveTete_a_tete); k++){
195
+ // posScalarProductMat(saveTete_a_tete, k, SGrad);
196
+ }
197
+
198
+ int endTete_atete = nrows(saveTete_a_tete);
199
+ if(startTete_tete > nrows(saveTete_a_tete))
200
+ {
201
+ intmat empty[0][ncols(saveTete_a_tete)];
202
+ return (empty, startTete_tete);
203
+ }
204
+
205
+ int startDeg = posScalarProductMat(saveTete_a_tete, startTete_tete, SGrad);
206
+ int i,j;
207
+
208
+ for(i = startTete_tete; i <= nrows(saveTete_a_tete); i++){
209
+ if(posScalarProductMat(saveTete_a_tete, i, SGrad) > startDeg)
210
+ {
211
+ endTete_atete = i -1;
212
+ break;
213
+ }
214
+ }
215
+ intmat selection[endTete_atete - startTete_tete +1][ncols(saveTete_a_tete)];
216
+ for(i = startTete_tete; i <= endTete_atete; i++){
217
+ for(j = 1; j <= ncols(saveTete_a_tete); j++){
218
+ selection[i - startTete_tete +1, j] = saveTete_a_tete[i, j];
219
+ }
220
+ }
221
+ return(selection, endTete_atete + 1);
222
+ }
223
+
224
+ static proc selectionByDegree(ideal P, intvec grading, int our_deg){
225
+ ideal Q;
226
+ for(int i = 1; i <= size(P); i++){
227
+ if(scalarProduct(leadexp(P[i]), grading) == our_deg){
228
+ Q = Q + P[i];
229
+ }
230
+ }
231
+ return(Q);
232
+ }
233
+
234
+ // ------------------------------------------------
235
+ // Helpers for Hilbert series
236
+ // -----------------------------------------------
237
+
238
+
239
+ static proc polyProd(intvec F, bigintmat G, int max_degree){
240
+ // F and G represent polynomials in one variable
241
+ // We compute their product up to maxdegree
242
+ int deg_F = size(F) - 1;
243
+ int deg_G = ncols(G) - 1;
244
+ int deg_prod = deg_F + deg_G;
245
+ int eff_deg = max_degree;
246
+ if(eff_deg > deg_prod || eff_deg == -1){
247
+ eff_deg = deg_prod;
248
+ }
249
+ bigintmat Prod[1][eff_deg +1];
250
+ int d, j;
251
+ bigint S;
252
+ for(d = 0; d <= eff_deg; d++){
253
+ S = 0;
254
+ for(j = 0; j <= d; j++){
255
+ if(j <= deg_F && d - j <= deg_G){
256
+ S = S + F[j + 1]*G[1, d - j +1];
257
+ }
258
+ }
259
+ Prod[1,d + 1] = S;
260
+ }
261
+ return(Prod);
262
+ }
263
+
264
+ static proc cycloRatFunctionExpansion(EnumData HS, int exp_degree){
265
+ // Computes the expansion of a rational function with numerator represented by HS.HilbertSeriesNum
266
+ // and denominator a product of terms 1 - t^g_i where zjhe g_i are the entries of den_vec
267
+
268
+ bigintmat E[1][exp_degree + 1];
269
+ int to_copy = ncols(HS.HilbertSeriesNum);
270
+ if(to_copy > exp_degree + 1){
271
+ to_copy = exp_degree + 1;
272
+ }
273
+ int i, j, k;
274
+ for(i = 1; i <= to_copy; i++){
275
+ E[1, i] = HS.HilbertSeriesNum[1,i];
276
+ }
277
+ intvec fac;
278
+ for(i = 1; i <= exp_degree; i++){
279
+ fac = fac, 0;
280
+ }
281
+ intvec den_vec = HS.HilbertSeriesDenom;
282
+ for( k = 1; k<= size(den_vec); k++){
283
+ for(i = 1; i <= size(fac); i++){
284
+ fac[i] = 0;
285
+ }
286
+ for(i = 0; i * den_vec[k] <= exp_degree; i++){
287
+ fac[1 + i * den_vec[k] ] = 1;
288
+ }
289
+ E = polyProd(fac, E, exp_degree);
290
+ }
291
+ return(E);
292
+ }
293
+
294
+
295
+ static proc intvec2poly(bigintmat vec){
296
+ poly f = 0;
297
+ poly t = var(1);
298
+ for(int i = 1; i <= ncols(vec); i++){
299
+ f = f + vec[1,i]*t^(i-1);
300
+ }
301
+ return(f);
302
+ }
303
+
304
+ static proc expandDenom(intvec den){
305
+ poly g = 1;
306
+ poly t = var(1);
307
+ for(int i = 1; i <= size(den); i++){
308
+ g = g*(1-t^den[i]);
309
+ }
310
+ return(g);
311
+ }
312
+
313
+ static proc unifiedRepresentations(EnumData HS_1, EnumData HS_2){
314
+
315
+ ring T = 0,t,dp;
316
+ poly num_1, den_1, num_2, den_2;
317
+ num_1 = intvec2poly(HS_1.HilbertSeriesNum);
318
+ num_2 = intvec2poly(HS_2.HilbertSeriesNum);
319
+ den_1 = expandDenom(HS_1.HilbertSeriesDenom);
320
+ den_2 = expandDenom(HS_2.HilbertSeriesDenom);
321
+ if(num_1*den_2 == num_2*den_1){
322
+ return(1);
323
+ }
324
+ return(0);
325
+ }
326
+
327
+ static proc fullDenomCCycloRatFunction(EnumData HS){
328
+ // transfer HS from denominator of cyclotomic polynomials p(e)
329
+ // to denominator with denominator of factors (1-t^e)
330
+
331
+ ring T = 0,t,dp;
332
+ poly factor;
333
+ int expo;
334
+ poly num_poly = intvec2poly(HS.HilbertSeriesNum);
335
+ for(int i = 1; i <= size(HS.HilbertSeriesDenom); i++){
336
+ expo = HS.HilbertSeriesDenom[i];
337
+ factor = (1 -t^expo)/cyclotomic(expo);
338
+ num_poly = num_poly * factor;
339
+ }
340
+ matrix C = coeffs(num_poly,t);
341
+ bigintmat D[1][nrows(C)];
342
+ for(i = 1; i<= nrows(C); i++){
343
+ D[1,i] = bigint(C[i,1]);
344
+ }
345
+ HS.HilbertSeriesNum = D;
346
+ return(HS);
347
+ }
348
+
349
+ static proc compareCCycloRatFunctions(EnumData HS_1, EnumData HS_2){
350
+ // Compares the expansions of rational functions as in cycloRatFunctionExpansion
351
+ // It must be made sure that the rational functions agree if and only they agree in
352
+ // numerator and denominator
353
+
354
+ // if(HS_1.HilbertSeriesNum == HS_2.HilbertSeriesNum && HS_1.HilbertSeriesDenom == HS_2.HilbertSeriesDenom){
355
+ // return(-1,0);
356
+ // }
357
+
358
+ if(unifiedRepresentations(HS_1, HS_2) ){
359
+ return(-1,0);
360
+ }
361
+
362
+ int expansion_deg = ncols(HS_1.HilbertSeriesNum);
363
+ bigintmat expansion_1, expansion_2;
364
+ int u;
365
+ while(1)
366
+ {
367
+ expansion_1 = cycloRatFunctionExpansion(HS_1, expansion_deg);
368
+ expansion_2 = cycloRatFunctionExpansion(HS_2, expansion_deg);
369
+ if(expansion_1 == expansion_2){
370
+ expansion_deg = 2*expansion_deg;
371
+ continue;
372
+ }
373
+ for(u = 1; u <= expansion_deg+1; u++){
374
+ if(expansion_1[1, u] != expansion_2[1, u]){
375
+ return(u -1, expansion_1[1, u] - expansion_2[1, u])
376
+ }
377
+ }
378
+ }
379
+ }
380
+
381
+ // ------------------------------------------------
382
+ // Computation of Hilbert series
383
+ // -----------------------------------------------
384
+
385
+ // The return value is_normal registers whether monoid is normal
386
+ // in the nonnormal case the Markov basis is kept
387
+ // for use in tete-a-tete
388
+ static proc HilbertSeriesMonoid(intmat U, int min_degree){
389
+ // min_degree for output of Markovbasis
390
+ intmat V;
391
+ int swallow = setNmzOption("intclosed",1);
392
+ V = normaliz(U, "monoid");
393
+ exportNuminvs();
394
+ // showNuminvs();
395
+ swallow = setNmzOption("intclosed",0);
396
+ int is_normal = nmz_integrally_closed;
397
+ if(!is_normal){
398
+ dbprint(our_printlevel,"Not normal");
399
+ swallow = setNmzOption("MRK",1);
400
+ }
401
+ int saveBigNumInvs = BigNumInvs;
402
+ BigNumInvs = 1;
403
+ swallow = setNmzOption("only_hvect",1);
404
+ if(Cyclotomic){
405
+ swallow = setNmzOption("cyclo", 1);
406
+ }
407
+ else{
408
+ swallow = setNmzOption("noquasi", 1);
409
+ }
410
+ // swallow = setNmzOption("verbose", 1);
411
+ V = normaliz(U, "monoid", min_degree, "gb_min_degree");
412
+ swallow = setNmzOption("only_hvect",0);
413
+ swallow = setNmzOption("MRK",0);
414
+ if(Cyclotomic){
415
+ swallow = setNmzOption("cyclo", 0);
416
+ }
417
+ else{
418
+ swallow = setNmzOption("noquasi", 0);
419
+ }
420
+ // swallow = setNmzOption("verbose", 0);
421
+ exportNuminvs();
422
+ BigNumInvs = saveBigNumInvs;
423
+ EnumData HSeries;
424
+ bigintmat Transfer;
425
+ if(Cyclotomic){
426
+ HSeries.HilbertSeriesDenom = nmz_hilbert_series_cyclo_denom;
427
+ Transfer = nmz_hilbert_series_cyclo_num;
428
+ }
429
+ else{
430
+ HSeries.HilbertSeriesDenom = nmz_hilbert_series_denom;
431
+ Transfer = nmz_hilbert_series_num;
432
+ }
433
+ HSeries.HilbertSeriesNum = Transfer;
434
+ if(Cyclotomic){
435
+ HSeries = fullDenomCCycloRatFunction(HSeries);
436
+ }
437
+
438
+ return(HSeries, is_normal);
439
+ }
440
+
441
+ static proc HilbertSeriesMonAlgebra(ideal P, int min_degree)
442
+ {
443
+ intmat U = mons2intmat(P);
444
+ return (HilbertSeriesMonoid(U, min_degree));
445
+ }
446
+
447
+ // ------------------------------------------------
448
+ // Computation of Hilbert bases
449
+ // -----------------------------------------------
450
+
451
+ static proc HilbertBasisMonoid(intmat U){
452
+ intmat V;
453
+ int swallow = setNmzOption("hilbbas",1);
454
+ V = normaliz(U, "monoid");
455
+ swallow = setNmzOption("hilbbas",0);
456
+ return(V);
457
+ }
458
+
459
+ static proc HilbertBasisMonAlgebra(ideal P){
460
+ intmat U = mons2intmat(P);
461
+ return (intmat2mons(HilbertBasisMonoid(U)));
462
+ }
463
+
464
+ // ------------------------------------------------
465
+ // Subduction
466
+ // -----------------------------------------------
467
+
468
+ static proc Subduction(ideal P, bigint nr_generators_needed){
469
+ // nr_generators = -1: complete subduction
470
+ // szbduction in the sense of Robbiano-Sweedler.
471
+ // It is applied once to every polynomial whose
472
+ // initial is not in the minimal system of generators of the algebra
473
+ // generated by the initial monomials
474
+ // ideal P = Pgiven;
475
+ intvec test_num, test_den;
476
+ int i,j;
477
+ int swallow = setNmzOption("REP",1);
478
+ intmat U = mons2intmat(P);
479
+ intmat V = normaliz(U, "monoid"); // V only to swallow return value
480
+ V = readNmzData("rep");
481
+ swallow = setNmzOption("REP",0);
482
+ exportNuminvs();
483
+
484
+ bigint nr_generators = bigint(size(P) - nrows(V));
485
+ string output = "polynomials " + string(size(P)) + " minimal so far " + string( nr_generators);
486
+ dbprint(our_printlevel,output);
487
+
488
+ if(nr_generators_needed != -1 && nr_generators_needed == nr_generators){
489
+ return(P, 0, nmz_hilbert_basis_key); // important here: no change in P anymore
490
+ } // can use nmz_hilbert_basis_key
491
+ if(nr_generators_needed == -1 && size(P) == nmz_hilbert_basis_elements){
492
+ return(P, 0, nmz_hilbert_basis_key);
493
+ }
494
+ if(nr_generators_needed != -1 && size(P) == nmz_hilbert_basis_elements){
495
+ ERROR("Error in Subduction. Inform the authors!");
496
+ }
497
+ // relative to Pgiven
498
+ def our_ring = basering;
499
+ int p = size(P);
500
+ list baseringlist = ringlist(basering);
501
+ ring S = (baseringlist[1]),(y(1.. p)),dp;
502
+ ideal Bl = intmat2binomials(V);
503
+ setring our_ring;
504
+ map f = S, P;
505
+ ideal P_modify = f(Bl);
506
+ for(i = 1; i <= nrows(V); i++){
507
+ for(j= 1; j <= ncols(V); j++){
508
+ if(V[i,j] == 1){
509
+ break;
510
+ }
511
+ }
512
+ P[j] = P_modify[i];
513
+ }
514
+ ideal LC = leadcoafIdeal(P);
515
+ intvec D = degIdeal(P);
516
+ our_ring = basering;
517
+ setring our_ring;
518
+ P = removeConstants(P);
519
+ P = simplify(P,1); // nakes monic
520
+ int check = ncols(P);
521
+
522
+ if(@do_def_ideal){
523
+ setring @S;
524
+ map g = S,@Retract;
525
+ ideal Pre_modify = g(Bl);
526
+ ideal LCC = fetch(our_ring, LC);
527
+ for(i = 1; i <= nrows(V); i++){
528
+ for(j= 1; j <= ncols(V); j++){
529
+ if(V[i,j] == 1){
530
+ break;
531
+ }
532
+ }
533
+ @Retract[j] = Pre_modify[i];
534
+ if(D[j] <= 0){
535
+ @DefIdeal = @DefIdeal, @Retract[j] - LCC[j];
536
+ @Retract[j] = 0;
537
+ }
538
+ else{
539
+ @Retract[j] = @Retract[j]/LCC[j];
540
+ }
541
+ }
542
+ @Retract = simplify(@Retract, 2); // removes 0, DON'T MAKE MONIC
543
+ if(check != ncols(@Retract)){
544
+ "P ncols", check, " PreIm ncols ", ncols(@Retract);
545
+ ERROR("Preimage doesn' fit. Inform the authors!");
546
+ }
547
+ }
548
+
549
+ setring our_ring;
550
+ return(P,1, nmz_hilbert_basis_key);
551
+ }
552
+
553
+ static proc HilbbasSubduction(ideal P, int old_nr_hilbbas, bigint HF_difference){
554
+ // Applies subduction as many times as necessary to frill HF_difference
555
+ ideal Q = simplify(P, 3);
556
+ int change;
557
+ intvec HilbertBasisKey;
558
+
559
+ bigint nr_generators_needed = bigint(old_nr_hilbbas) + HF_difference;
560
+ string output = "Have " + string( old_nr_hilbbas) + " need " + string(nr_generators_needed);
561
+ dbprint(our_printlevel,output);
562
+
563
+ while(1){
564
+ (Q, change, HilbertBasisKey) = Subduction(Q, nr_generators_needed);
565
+ if(change == 0){
566
+ list L = sort(HilbertBasisKey);
567
+ HilbertBasisKey = L[1];
568
+ return(Q, HilbertBasisKey); // HilbertBasisKey only used in this case
569
+ }
570
+ }
571
+ }
572
+
573
+ static proc completeSubduction(ideal Q){
574
+ // applies subduction repeatedly until statbility is reached.
575
+ int change;
576
+ intvec HilbertBasisKey; // for syntactical reasons
577
+
578
+ string output = "complete subduction applied to size "+ string(size(Q));
579
+ dbprint(our_printlevel,output);
580
+ while(1){
581
+ (Q, change,HilbertBasisKey) = Subduction(Q, -1);
582
+ if(change == 0){
583
+ output = "subduced size " + string(size(Q));
584
+ dbprint(our_printlevel,output);
585
+ def our_ring = basering;
586
+ if(@do_def_ideal){
587
+ setring @S;
588
+ output = "Size defining ideal so far (not minimized) " + string(size(@DefIdeal));
589
+ dbprint(our_printlevel,output);
590
+ setring our_ring;
591
+ }
592
+ return(Q);
593
+ }
594
+ }
595
+ }
596
+
597
+ // ------------------------------------------------
598
+ // Tete-a-tete
599
+ // -----------------------------------------------
600
+
601
+ static proc Tete_A_TeteHilbControlled(ideal Q, int crit_degree, int is_normal)
602
+ // Computes the terte-a-tete of a system of polynomials (termonology of
603
+ // Robbiano-Sweedler). Control by Hilbert series: only the crit degree is
604
+ // evaluated and normalioty is exploited. General version below.
605
+ {
606
+ dbprint(our_printlevel,"Start Tete-a-tete ");
607
+ string output;
608
+
609
+ // system("--ticks-per-sec",1000);
610
+ // timer=0;
611
+ // int t = timer;
612
+
613
+ int i;
614
+ // ideal Q = P;
615
+ Q = simplify(Q,3);
616
+
617
+ // First we reconstruct the grading of the binomials
618
+ // Only needed in the nonnormal case
619
+ int GradingDenom = gradingDenominator(Q);
620
+ intvec SGrad = gradVector(Q, GradingDenom);
621
+ intmat U = mons2intmat(Q);
622
+
623
+ // ideal Bla = lead(Q);
624
+ // Bla;
625
+ // mons2intmat(Bla);
626
+
627
+ def our_ring = basering;
628
+ int p = size(Q);
629
+ list baseringlist = ringlist(basering);
630
+ ring S = (baseringlist[1]),(y(1..p)), dp;
631
+ // U;
632
+ intmat V;
633
+ ideal B, Bfull;
634
+ if(is_normal){ // in the normal case we don't have the Markov basis yet
635
+ int swallow = setNmzOption("MRK",1);
636
+ // swallow = setNmzOption("verbose",1);
637
+ intmat Bl = normaliz(U, "monoid", crit_degree, "gb_min_degree", crit_degree, "gb_degree_bound");
638
+ exportNuminvs();
639
+ swallow = setNmzOption("MRK",0);
640
+ // swallow = setNmzOption("verbose",0);
641
+ V = readNmzData("mrk");
642
+ dbprint(our_printlevel,"Evaluating tete-a-tete");
643
+ output = "Computing " + string(nrows(V)) + " binomials";
644
+ dbprint(our_printlevel,output);
645
+ B = intmat2binomials(V);
646
+ }
647
+ else{ // we have the full Markov basis already from the Hilbert series computation.
648
+ // However we have the full Markov basis, and not a single degree only.
649
+ // IMPORTANT::: we use the data of the Hilbert series computation
650
+ // in this case.
651
+ //
652
+
653
+ int our_deg, u;
654
+ V = readNmzData("mrk");
655
+ dbprint(our_printlevel,"Evaluating tete-a-tete");
656
+ // V;
657
+ output = "Selecting from " + string(nrows(V)) + " binomials";
658
+ dbprint(our_printlevel,output);
659
+ Bfull = intmat2binomials(V);
660
+ // "SSSSSSS ", size(leadexp(Bfull[1])), " ", size(SGrad);
661
+ B = selectionByDegree(Bfull, SGrad, crit_degree);
662
+ }
663
+
664
+ B = simplify(B,3);
665
+ dbprint(our_printlevel,"Binomials computed");
666
+
667
+ setring our_ring;
668
+ map f =S, Q;
669
+ Q = Q, f(B);
670
+ dbprint(our_printlevel,"Generators extended");
671
+ Q =simplify(Q,3);
672
+ // "Time in milliseconds ", timer-t;
673
+ return(Q);
674
+ }
675
+
676
+ static proc Tete_A_TeteGeneral(ideal Q, int current_degree, int Sagbi_degree_bound, int degreeByDegree, int makeNewTete_a_tete)
677
+ {
678
+
679
+ int degree_tete_a_tete = -1;
680
+ string output;
681
+ if(makeNewTete_a_tete){
682
+ dbprint(our_printlevel,"Making new tete-a-tete");
683
+ }
684
+ else{
685
+ dbprint(our_printlevel,"Exploiting existing tete-a-tete");
686
+ }
687
+ // ideal Q = P;
688
+ intvec SGrad;
689
+ if(degreeByDegree){
690
+ int GradingDenom = gradingDenominator(Q);
691
+ SGrad = gradVector(Q, GradingDenom);
692
+ }
693
+
694
+ intmat U = mons2intmat(Q);
695
+
696
+ // ideal Bla = lead(Q);
697
+ // Bla;
698
+
699
+ def our_ring = basering;
700
+ int p = size(Q);
701
+ list baseringlist = ringlist(basering);
702
+ ring S = (baseringlist[1]),(y(1..p)), dp;
703
+ // U;
704
+ ideal B;
705
+
706
+ int swallow = setNmzOption("MRK",1);
707
+ intmat Dummy;
708
+ if(current_degree != -1){
709
+ if(degreeByDegree == 2){ // no jumping over empty degrees
710
+ Dummy = normaliz(U, "monoid", current_degree, "gb_min_degree", current_degree, "gb_degree_bound");
711
+ exportNuminvs();
712
+ }
713
+ else{
714
+ if(makeNewTete_a_tete){
715
+ Dummy = normaliz(U, "monoid", current_degree, "gb_min_degree");
716
+ // exportNuminvs();
717
+ // showNuminvs();
718
+ }
719
+ // gb_degree_bound = -2 implies: print component d such that d >= gb_min_degree
720
+ // and component is nonzero
721
+ // Bl = normaliz(U, "monoid", current_degree, "gb_min_degree", -2, "gb_degree_bound");
722
+ }
723
+ }
724
+ else{
725
+ Dummy = normaliz(U, "monoid");
726
+ }
727
+ swallow = setNmzOption("MRK",0);
728
+
729
+ intmat V;
730
+ if(current_degree != -1){
731
+ if(makeNewTete_a_tete){
732
+ saveTete_a_tete = readNmzData("mrk");
733
+ startTete_tete = 1;
734
+ }
735
+ (V, startTete_tete) = selectNextDegree(saveTete_a_tete, startTete_tete, SGrad);
736
+ }
737
+ else{
738
+ V = readNmzData("mrk");
739
+ }
740
+
741
+ int tete_a_tete_empty = 0;
742
+ if(nrows(V) == 0){
743
+ dbprint(our_printlevel,"Tete-a-tete empty");
744
+ tete_a_tete_empty = 1;
745
+ }
746
+ dbprint(our_printlevel,"Evaluating tete-a-tete");
747
+ output = "Computing " + string(nrows(V)) + " binomials";
748
+ dbprint(our_printlevel,output);
749
+ B = intmat2binomials(V);
750
+ dbprint(our_printlevel,"Binomials computed");
751
+ int degree_too_large;
752
+ degree_too_large = 0;
753
+ if(degreeByDegree==1){
754
+ degree_tete_a_tete = scalarProduct(leadexp(B[1]), SGrad);
755
+ if(degree_tete_a_tete > Sagbi_degree_bound)
756
+ {
757
+ degree_too_large = 1;
758
+ }
759
+ }
760
+ if(degreeByDegree==2){
761
+ degree_tete_a_tete = current_degree;
762
+ }
763
+ B = simplify(B,3);
764
+ setring our_ring;
765
+ if(tete_a_tete_empty && degreeByDegree != 2){
766
+ return(Q, -1);
767
+ }
768
+ if(degree_too_large){
769
+ return(Q, degree_tete_a_tete);
770
+ }
771
+ map f =S, Q;
772
+ Q = Q, f(B);
773
+ dbprint(our_printlevel,"Generators extended");
774
+ ideal LC = leadcoafIdeal(Q); // data needed for PreIm
775
+ intvec D = degIdeal(Q);
776
+ Q = removeConstants(Q);
777
+ Q =simplify(Q,1);// makes monic
778
+ int check = ncols(Q);
779
+
780
+ if(@do_def_ideal){
781
+ setring @S;
782
+ map g = S,@Retract;
783
+ @Retract = @Retract, g(B);
784
+ ideal LCC = fetch(our_ring, LC);
785
+ // aapplyLaedIdeal(LCC);
786
+ preparePreIm(D, LCC);
787
+ if(check != ncols(@Retract)){
788
+ "Q ncols", check, " PreIm ncols ", ncols(@Retract);
789
+ ERROR("Preimage doesn'tfit. Inform the authors!");
790
+ }
791
+ }
792
+ setring our_ring;
793
+ return(Q, degree_tete_a_tete);
794
+ }
795
+
796
+ // ------------------------------------------------
797
+ // Sagbi computation
798
+ // -----------------------------------------------
799
+
800
+ static proc dosagbiHilbControlled(ideal Q, intvec HS_num_algebra, intvec HS_denom_algebra,
801
+ int Sagbi_degree_bound, int finalCheck, int sorting){
802
+ // The code would allow Sagbi_degree_bound = -, meaning no bound
803
+
804
+ if(HS_denom_algebra[1] < 0){
805
+ Cyclotomic = 1;
806
+ HS_denom_algebra[1] = -HS_denom_algebra[1];
807
+ }
808
+ EnumData AlgebraHilbData;
809
+ AlgebraHilbData.HilbertSeriesDenom = HS_denom_algebra;
810
+ bigintmat Transfer[1][size(HS_num_algebra)];
811
+ for(int i = 1; i <= size(HS_num_algebra); i++){
812
+ Transfer[1,i] = HS_num_algebra[i];
813
+ }
814
+ AlgebraHilbData.HilbertSeriesNum = Transfer;
815
+ if(Cyclotomic){
816
+ AlgebraHilbData = fullDenomCCycloRatFunction(AlgebraHilbData);
817
+ }
818
+
819
+ int has_positive_degree = 0;
820
+ for( i = 1; i <= ncols(Q); i++){
821
+ if(deg(Q[i]) >= 1){
822
+ has_positive_degree = 1;
823
+ break;
824
+ }
825
+ }
826
+ if(!has_positive_degree){
827
+ ERROR("At least one generator must have positive degree");
828
+ }
829
+ string output;
830
+
831
+ int crit_degree, nr_hilbbas_1, nr_hilbbas_2;
832
+ bigint HF_difference;
833
+ ideal Plow, Phigh, K, Dummy;
834
+ intvec HS_denom_cand, HS_num_cand;
835
+ int GradingDenom, standard_crit_degree;
836
+ intvec HilbertBasisKey;
837
+
838
+ ideal P = simplify(Q,15); // make inititial coeff 1, erase 0, duplicates and scalar multiples
839
+ P = completeSubduction(P);
840
+ dbprint(our_printlevel,"Initial subduction dione");
841
+
842
+ GradingDenom = gradingDenominator(P);
843
+ int round = 0;
844
+ int count;
845
+ intmat U,V;
846
+ int swallow;
847
+ int is_normal;
848
+
849
+ list L;
850
+
851
+ crit_degree = 0;
852
+
853
+ EnumData CandData;
854
+
855
+
856
+ while(1){
857
+ if(round > 0){
858
+ output = "New Hilbert series " + string(round);
859
+ dbprint(our_printlevel,output);
860
+ }
861
+
862
+ if(sorting){
863
+ L = sort(P,"dp");
864
+ P = L[1];
865
+ }
866
+ (CandData, is_normal) = HilbertSeriesMonAlgebra(P, crit_degree+1);
867
+
868
+ // (HS_num_cand, HS_denom_cand, is_normal) = HilbertSeriesMonAlgebra(P, crit_degree+1);
869
+
870
+ (crit_degree, HF_difference) = compareCCycloRatFunctions(AlgebraHilbData, CandData);
871
+
872
+
873
+ //(crit_degree, HF_difference) = compareCCycloRatFunctions(HS_num_algebra, HS_denom_algebra,
874
+ // HS_num_cand, HS_denom_cand);
875
+
876
+ // quit;
877
+
878
+ if(crit_degree > Sagbi_degree_bound && Sagbi_degree_bound != -1){
879
+ output = "critical degree = " + string(crit_degree) + " > Sagbi_degree_bound = " + string(Sagbi_degree_bound);
880
+ dbprint(our_printlevel,"--------------------------------------------------------------");
881
+ return(P,0):
882
+ }
883
+
884
+ if(crit_degree == -1){
885
+ if(round > 0){
886
+ dbprint(our_printlevel,"Sagbi basis computed");
887
+ dbprint(our_printlevel,"--------------------------------------------------------------");
888
+ }
889
+ return(P,2);
890
+ }
891
+ if(round == 0){
892
+ dbprint(our_printlevel,"--------------------------------------------------------------");
893
+ }
894
+ else{
895
+ dbprint(our_printlevel,"*********************");
896
+ }
897
+ round++;
898
+
899
+ // "got Hilbert series ", HS_num_cand, " ", HS_denom_cand;
900
+ if(round == 1){
901
+ output = "expected Hilbert series with representation " + string(HS_num_algebra) + " " + string( HS_denom_algebra);
902
+ dbprint(our_printlevel,output);
903
+ }
904
+ output = "crit_degree " + string(crit_degree) + ": HF_difference " + string( HF_difference);
905
+ dbprint(our_printlevel,output);
906
+
907
+ // we must split our algebra generators at the critical degree
908
+ Plow = 0;
909
+ Phigh = 0;
910
+ standard_crit_degree = crit_degree * GradingDenom;
911
+ for(i = 1; i <=size(P); i++){
912
+ if(deg(P[i]) <= standard_crit_degree){
913
+ Plow = Plow + P[i];
914
+ }
915
+ else{
916
+ Phigh = Phigh + P[i];
917
+ }
918
+ }
919
+ Dummy = HilbertBasisMonAlgebra(Plow);
920
+ nr_hilbbas_1 = size(Dummy);
921
+
922
+ K= Tete_A_TeteHilbControlled(Plow, crit_degree,is_normal);
923
+ dbprint(our_printlevel,"Tete-a-tete done");
924
+ (K, HilbertBasisKey) = HilbbasSubduction(K, nr_hilbbas_1, HF_difference);
925
+ dbprint(our_printlevel,"Subduction done");
926
+
927
+ P = 0;
928
+ for(i = 1; i <= size( HilbertBasisKey); i++){
929
+ P = P + K[ HilbertBasisKey[i]];
930
+ }
931
+
932
+ if(crit_degree >= Sagbi_degree_bound && Sagbi_degree_bound != -1 && !finalCheck){
933
+ output = "Sagbi basis computed up tp degree " + string(Sagbi_degree_bound);
934
+ dbprint(our_printlevel,output);
935
+ dbprint(our_printlevel,"No final check");
936
+ return(P,1);
937
+ }
938
+
939
+ if(size(Phigh) > 0){
940
+ P = P + Phigh;
941
+ P = completeSubduction(P);
942
+ }
943
+
944
+ // lead(P);
945
+ }
946
+ }
947
+ // ---------------------------------------------------------------
948
+
949
+ static proc doSagbiGeneral(ideal Q, int defining_ideal, int Sagbi_degree_bound, int Sagbi_max_rounds, int sorting)
950
+ {
951
+ int i;
952
+ int has_positive_degree = 0;
953
+ for(i = 1; i <= ncols(Q); i++){
954
+ if(deg(Q[i]) >= 1){
955
+ has_positive_degree = 1;
956
+ break;
957
+ }
958
+ }
959
+ if(!has_positive_degree){
960
+ ERROR("At least one generator must have positive degree");
961
+ }
962
+
963
+
964
+ string output;
965
+
966
+ int degreeByDegree = 0;
967
+ if(Sagbi_degree_bound != -1){
968
+ degreeByDegree = 1;
969
+ }
970
+
971
+ // if(degreeByDegree == 0 && defining_ideal == 1){
972
+ // ERROR("Defining ideal only computed gegree by degree");
973
+ // }
974
+
975
+ @do_def_ideal = defining_ideal;
976
+
977
+ ideal P;
978
+ int GradingDenom;
979
+ intvec D;
980
+
981
+ def our_ring = basering;
982
+
983
+ if(!@do_def_ideal){
984
+ Q = removeConstants(Q); // erases constants including 0
985
+ P = simplify(Q,13); // make inititial coeff 1, remove duplicates and scalar multiples
986
+ }
987
+ else{
988
+ // setup preimages of generators, take care of constants in the generators (not forbidden)
989
+ // constants give elements in the defining ideal
990
+ P = Q;
991
+ ideal LC = leadcoafIdeal(P); // must be done before any change of P
992
+ D = degIdeal(P); // ditto. We need hese data for PreIm
993
+ for(i = 1; i <=size(D); i++){
994
+ if(D[i] <= 0){
995
+ ERROR("constants not allowed in algebra generators");
996
+ }
997
+ }
998
+ // "Degrees ", D, " LC ", LC;
999
+ list baseringlist = ringlist(basering);
1000
+ int p = ncols(P);
1001
+ P = removeConstants(P); // PreIm will be gtaken care below
1002
+ P = simplify(P,1); // make monic
1003
+ ring @S = (baseringlist[1]),(y(1.. p)),wp(D);
1004
+ ideal @Retract =(y(1..p));
1005
+ ideal @DefIdeal;
1006
+ ideal @Retract_low;
1007
+ ideal @Retract_high;
1008
+ export(@S);
1009
+ export(@Retract);
1010
+ export(@DefIdeal);
1011
+ export(@Retract_low);
1012
+ export(@Retract_high);
1013
+ ideal LCC = fetch(our_ring, LC);
1014
+ preparePreIm(D, LCC); // takes care of constants in P, makes moic
1015
+ // for(i = 1; i <= ncols(LCC); i++){
1016
+ // @Retract[i] = @Retract[i]/LCC[i];
1017
+ // }
1018
+ setring our_ring;
1019
+ }
1020
+
1021
+ GradingDenom = gradingDenominator(P);
1022
+
1023
+ P = completeSubduction(P);
1024
+ dbprint(our_printlevel,"Initial subduction dione");
1025
+
1026
+ int maxDegreeGens = deg(P[1]);
1027
+ int minDegreeGens = maxDegreeGens;
1028
+ for(i = 2; i <= size(P); i++){
1029
+ if(deg(P[i]) > maxDegreeGens){
1030
+ maxDegreeGens = deg(P[i]);
1031
+ }
1032
+ if(deg(P[i]) < minDegreeGens){
1033
+ minDegreeGens = deg(P[i]);
1034
+ }
1035
+ }
1036
+ maxDegreeGens = maxDegreeGens div GradingDenom;
1037
+ minDegreeGens = minDegreeGens div GradingDenom;
1038
+
1039
+
1040
+ ideal P_1;
1041
+ int done;
1042
+ int checked;
1043
+ int makeNewTete_a_tete = 1;
1044
+ int first_after_maxDegGens = 1;
1045
+
1046
+ int uu = minDegreeGens;
1047
+ int degreeBoundReached;
1048
+ list L;
1049
+
1050
+ int degree_tete_a_tete;
1051
+
1052
+ ideal Plow, Phigh;
1053
+ int round = 1;
1054
+ int check_high,check_low;
1055
+
1056
+ while(1){
1057
+ P = simplify(P,3);
1058
+ if(sorting){
1059
+ L = sort(P, "dp");
1060
+ P = L[1];
1061
+ }
1062
+
1063
+ Plow = 0;
1064
+ Phigh = 0;
1065
+ our_ring = basering;
1066
+
1067
+ if(@do_def_ideal){
1068
+ setring @S;
1069
+ @Retract_high = 0;
1070
+ @Retract_low = 0;
1071
+ }
1072
+
1073
+ setring our_ring;
1074
+
1075
+ if(!degreeByDegree){
1076
+ (P_1, degree_tete_a_tete) = Tete_A_TeteGeneral(P, -1, -1, 0,1);
1077
+ P_1 = completeSubduction(P_1);
1078
+ }
1079
+ else{
1080
+ if(uu < maxDegreeGens){
1081
+ our_ring = basering;
1082
+ D = degIdeal(P);
1083
+ for(i = 1; i <=size(P); i++){
1084
+ if(D[i] <= uu * GradingDenom){
1085
+ Plow = Plow + P[i];
1086
+ }
1087
+ else{
1088
+ Phigh = Phigh + P[i];
1089
+ }
1090
+ }
1091
+ check_low = size(Plow);
1092
+ check_high = size(Phigh);
1093
+ if(@do_def_ideal){
1094
+ setring @S;
1095
+ for(i = 1; i <=size(D); i++){
1096
+ if(D[i] <= uu * GradingDenom){
1097
+ @Retract_low = @Retract_low + @Retract[i];
1098
+ }
1099
+ else{
1100
+ @Retract_high = @Retract_high + @Retract[i];
1101
+ }
1102
+ }
1103
+ if(size(@Retract_low) != check_low || size(@Retract_high) != check_high){
1104
+ "Problem ", size(@Retract_low), check_low, size(@Retract_high), check_high;
1105
+ }
1106
+ @Retract = @Retract_low;
1107
+ }
1108
+ setring our_ring;
1109
+ // 2 = strictly degree by degree
1110
+ (P_1, degree_tete_a_tete) = Tete_A_TeteGeneral(Plow,uu, Sagbi_degree_bound, 2, 1);
1111
+ }
1112
+ else{
1113
+ (P_1, degree_tete_a_tete) = Tete_A_TeteGeneral(P,uu, Sagbi_degree_bound, 1, makeNewTete_a_tete);
1114
+ }
1115
+ if(degree_tete_a_tete == -1){
1116
+ our_ring = basering;
1117
+ dbprint(our_printlevel,"Sagbi basis computed");
1118
+ if(@do_def_ideal){
1119
+ setring @S;
1120
+ @DefIdeal = simplify(@DefIdeal, 3);
1121
+ }
1122
+ setring our_ring;
1123
+ if(@do_def_ideal){
1124
+ checkDefIdeal(Q);
1125
+ }
1126
+ return(P_1,2);
1127
+ }
1128
+ if(uu != degree_tete_a_tete){
1129
+ if(uu > degree_tete_a_tete){
1130
+ ERROR("Degree in tete-a-tete too small. Inform the authors!");
1131
+ }
1132
+ uu = degree_tete_a_tete;
1133
+ if(uu > Sagbi_degree_bound){
1134
+ dbprint(our_printlevel,"Degree bound reached");
1135
+ if(@do_def_ideal){
1136
+ setring @S;
1137
+ @DefIdeal = simplify(@DefIdeal, 3);
1138
+ }
1139
+ setring our_ring;
1140
+ if(@do_def_ideal){
1141
+ checkDefIdeal(Q);
1142
+ }
1143
+ return(P_1, 1);
1144
+ }
1145
+ output = "Degree increased to " + string( uu);
1146
+ dbprint(our_printlevel,output);
1147
+ }
1148
+ P_1 = completeSubduction(P_1);
1149
+ }
1150
+
1151
+ degreeBoundReached = 0;
1152
+ if(Sagbi_degree_bound == uu){
1153
+ degreeBoundReached = 1;
1154
+ }
1155
+
1156
+ if(degreeBoundReached){
1157
+ dbprint(our_printlevel,"Degree bound reached");
1158
+ if(@do_def_ideal){
1159
+ setring @S;
1160
+ @DefIdeal = simplify(@DefIdeal, 3);
1161
+ }
1162
+ setring our_ring;
1163
+ if(@do_def_ideal){
1164
+ checkDefIdeal(Q);
1165
+ }
1166
+ return(P_1,1);
1167
+ }
1168
+
1169
+ done = 0;
1170
+ checked = 0;
1171
+ if(size(P) == size(P_1) && !degreeByDegree){
1172
+ done = 1;
1173
+ checked = 1;
1174
+ for(i = 1; i <= size(P); i++){
1175
+ if(P[i] != P_1[i]){
1176
+ done = 0;
1177
+ break;
1178
+ }
1179
+ }
1180
+ }
1181
+
1182
+ if(done){
1183
+ dbprint(our_printlevel,"Sagbi basis computed");
1184
+ if(@do_def_ideal){
1185
+ our_ring = basering;
1186
+ setring @S;
1187
+ @DefIdeal = simplify(@DefIdeal, 3);
1188
+ setring our_ring;
1189
+ checkDefIdeal(Q);
1190
+ }
1191
+ return(P_1, 2);
1192
+ }
1193
+
1194
+ round++;
1195
+ if(Sagbi_max_rounds != -1 && round > Sagbi_max_rounds){
1196
+ dbprint(our_printlevel,"Maximal number of rounds reached");
1197
+ return(P_1,1);
1198
+ }
1199
+
1200
+ uu++;
1201
+ dbprint(our_printlevel,"*********************");
1202
+ output = "Round " + string( round) + " with " + string(size(P_1)) + " generators";
1203
+ dbprint(our_printlevel,output);
1204
+ if(degreeByDegree){
1205
+ output = "Degree >= " + string(uu);
1206
+ dbprint(our_printlevel, output);
1207
+ }
1208
+
1209
+ if(degreeByDegree){
1210
+ makeNewTete_a_tete = 0;
1211
+ if(size(P) != size(P_1)){
1212
+ makeNewTete_a_tete = 1;
1213
+ }
1214
+ else{
1215
+ if(minDegreeGens < maxDegreeGens){ // in this case we may have P != P_1 despite of equal size
1216
+ for(i = size(P); i >= 1; i--){
1217
+ if(P[i] != P_1[i]){
1218
+ makeNewTete_a_tete = 1;
1219
+ break;
1220
+ }
1221
+ }
1222
+ }
1223
+ }
1224
+ }
1225
+
1226
+ P = P_1 + Phigh;
1227
+ our_ring = basering;
1228
+ if(@do_def_ideal){
1229
+ setring @S;
1230
+ @Retract = @Retract + @Retract_high;
1231
+ }
1232
+
1233
+ setring our_ring;
1234
+
1235
+ } // main while loop
1236
+
1237
+ }
1238
+
1239
+ // ------------------------------------------------
1240
+ // User interface
1241
+ // -----------------------------------------------
1242
+
1243
+ proc sagbiHilbControlled(ideal Q, intvec HS_num_algebra, intvec HS_denom_algebra, int Sagbi_degree_bound, list #)
1244
+ "USAGE: agbiHilbControlled(ideal Q, intvec HS_num_algebra, intvec HS_denom_algebra, int Sagbi_degree_bound [,int finalChweck, int sorting, int verb]);
1245
+ RETURN: An ideal whose generators form the Sagbi basis of the algebra generated
1246
+ by the polynomials inin degrwees <= Sagbi_degree_bound. The computation is controlled by the Hilbert series
1247
+ given by the numerator and the denominator.
1248
+
1249
+ If sorting is set, the computed elements are degrevlex sorted before a round of the algorithm.
1250
+ The optional parameter verb sets the terminal output. Default is 1 = on.
1251
+
1252
+ The return value has a second integer component. Its possible values are: 0, if the full Sagbi basis has
1253
+ not been reached, 1 if this is unknown, and 2 if the full Sagbi basis has been computed.
1254
+
1255
+ In the non-standard graded situation it may be useful to restrict the exchange of data between Singular
1256
+ and normaliz to the Hilbert series as a rational function with cyclotomic polynomials in the
1257
+ denominator. Of course, HS_num_algebra and HS_denom_algebra must have been computed for this
1258
+ representation of the Hilbert series. This choice is communicated to the function by replacing the first
1259
+ component of HS_denom_algebra by its negative.
1260
+ EXAMPLE: example sagbiHilbControlled; shows an example
1261
+ "
1262
+ {
1263
+
1264
+ int finalCheck = 0;
1265
+ int sorting = 0;
1266
+
1267
+ if(size(#) > 0){
1268
+ finalCheck = #[1];
1269
+ }
1270
+ if(size(#) > 1){
1271
+ sorting = #[2];
1272
+ }
1273
+ if(size(#) > 2){
1274
+ our_printlevel = #[3];
1275
+ }
1276
+
1277
+ if(Sagbi_degree_bound <= 0){
1278
+ ERROR("Degree bound must be positive");
1279
+ }
1280
+
1281
+ if(!homog(Q)){
1282
+ ERROR("sagbiHilbControlled expects homogeneous input");
1283
+ }
1284
+ list baseringlist = ringlist(basering);
1285
+ intvec w = baseringlist[3][1][2];
1286
+ for(int i = 1; i <=size(w); i++){
1287
+ if(w[i] != 1){
1288
+ ERROR("Basering not standard graded");
1289
+ }
1290
+ }
1291
+
1292
+ ideal P;
1293
+ int success;
1294
+ (P, success) = dosagbiHilbControlled(Q, HS_num_algebra, HS_denom_algebra, Sagbi_degree_bound, finalCheck, sorting);
1295
+ return(P,success);
1296
+ }
1297
+ example
1298
+ { "EXAMPLE:"; echo=2;
1299
+ ring R = 0, (x,y,z),dp;
1300
+ ideal P = x^6+y^6+z^6, x^7+y^7+z^7, x^8+y^8+z^8;
1301
+ ideal Q;
1302
+ intvec HS_num = 1;
1303
+ intvec HS_denom = 6,7,8;
1304
+ int success;
1305
+ // degree bound 40, final check, ,no sorting, no terminal output
1306
+ (Q,success) = sagbiHilbControlled(P,HS_num, HS_denom,40, 1,0,0);
1307
+ lead(Q);
1308
+ "Note: success = 0 <==> Sagbi basis incomplete";
1309
+ "success",success;
1310
+ }
1311
+
1312
+
1313
+ proc sagbiByDegree(ideal Q, int Sagbi_degree_bound, list #)
1314
+ "USAGE: sagbiByDegree(ideal Q, int sagbiDegreeBound [,int sorting, int verb]);
1315
+ RETURN: RETURN: An ideal whose generators form the Sagbi basis of the algebra generated
1316
+ by the polynomials inin degrwees <= Sagbi_degree_bound.
1317
+
1318
+ If sorting is set, the computed elements are degrevlex sorted before a round of the algorithm.
1319
+ The optional parameter verb sets the terminal output. Default is 1 = on.
1320
+
1321
+ The return value has a second integer component. Its possible values are: 0, if the full Sagbi basis has
1322
+ not been reached, 1 if this is unknown, and 2 if the full Sagbi basis has been computed.
1323
+
1324
+ EXAMPLE: example sagbiByDegree; shows an example
1325
+ "
1326
+ {
1327
+ int sorting = 0;
1328
+ if(size(#) > 0)
1329
+ {
1330
+ sorting = #[1];
1331
+ }
1332
+ if(size(#) > 1){
1333
+ our_printlevel = #[2];
1334
+ }
1335
+
1336
+
1337
+ if(Sagbi_degree_bound <= 0){
1338
+ ERROR("Degree bound must be positive");
1339
+ }
1340
+ if(!homog(Q)){
1341
+ ERROR("sagbiByDegree expects homogeneous input");
1342
+ }
1343
+
1344
+ list baseringlist = ringlist(basering);
1345
+ intvec w = baseringlist[3][1][2];
1346
+ for(int i = 1; i <=size(w); i++){
1347
+ if(w[i] != 1){
1348
+ ERROR("Basering not standard graded");
1349
+ }
1350
+ }
1351
+
1352
+ ideal P;
1353
+ int success;
1354
+ (P, success) = doSagbiGeneral(Q, 0, Sagbi_degree_bound, -1, sorting);
1355
+
1356
+ int NrTerms = 0;
1357
+ for(int k = 1; k <= size(P); k++){
1358
+ NrTerms = NrTerms + size(P[k]);
1359
+ }
1360
+ // "Number Terms", NrTerms;
1361
+
1362
+
1363
+ return(P,success);
1364
+ }
1365
+ example
1366
+ { "EXAMPLE:"; echo=2;
1367
+ ring R = 0, (x,y,z),dp;
1368
+ ideal P = x^6+y^6+z^6, x^7+y^7+z^7, x^8+y^8+z^8;
1369
+ ideal Q;
1370
+ int success;
1371
+ // degree bound 40, no sorting, no terminal output
1372
+ (Q,success) = sagbiByDegree(P,40,0,0);
1373
+ lead(Q);
1374
+ "Note: success = 1 <==> Unknown whether complete";
1375
+ "success",success;
1376
+ }
1377
+
1378
+
1379
+ proc sagbiGeneral(ideal Q, list #)
1380
+ "USAGE: sagbiGeneral(ideal Q [, int sagbiMaxRounds, int sorting, int verb]));
1381
+ RETURN: An ideal whose generators form the Sagbi basis of the algebra generated
1382
+ by the polynomials in Q as far as computwed in at most sagbiMaxRounds.
1383
+
1384
+ If sorting is set, the computed elements are degrevlex sorted before a round of the algorithm.
1385
+ The optional parameter verb sets the terminal output. Default is 1 = on.
1386
+
1387
+ The return value has a second integer component. Its possible values are: 0, if the full Sagbi basis has
1388
+ not been reached, 1 if this is unknown, and 2 if the full Sagbi basis has been computed.
1389
+
1390
+ EXAMPLE: example agbiGeneral; shows an example
1391
+ "
1392
+ {
1393
+ int sorting = 0;
1394
+ int Sagbi_max_rounds = -1;
1395
+ if(size(#) > 0){
1396
+ Sagbi_max_rounds = #[1];
1397
+ }
1398
+ if(size(#) > 1){
1399
+ sorting = #[2];
1400
+ }
1401
+ if(size(#) > 2){
1402
+ our_printlevel = #[3];
1403
+ }
1404
+ ideal P;
1405
+ int success;
1406
+ (P, success) = doSagbiGeneral(Q, 0, -1, Sagbi_max_rounds, sorting);
1407
+ return(P,success);
1408
+ }
1409
+ example
1410
+ { "EXAMPLE:"; echo=2;
1411
+ ring R = 0, (x,y,z),dp;
1412
+ ideal P = x^6+y^6+z^6, x^7+y^7+z^7;
1413
+ ideal Q;
1414
+ int success;
1415
+ // at most 3 rounds, no sorting, no terminal output
1416
+ (Q,success) = sagbiGeneral(P,3,0,0);
1417
+ Q;
1418
+ "Note: success = 2 <==> Sagbi basis complete";
1419
+ "success",success;
1420
+ }
1421
+
1422
+ proc sagbiDefIdealByDegree(ideal Q, int Sagbi_degree_bound, list #)
1423
+ "USAGE: defIdealByDegree(ideal Q, int sagbiDegreeBound [,int sorting, int verb]);
1424
+ RETURN: An instance of
1425
+
1426
+ newstruct("sagbiResult","int success, ideal sagbiBasis, ideal defIdeal,, ideal retract");
1427
+
1428
+ success has the value 0, if the full Sagbi basis has not been reached,
1429
+ 1 if this is unknown, and 2 if the full Sagbi basis has been computed.
1430
+
1431
+ sagbiBasis is the Sagbi basis encodeed as an ideal in the polynomial ring that was
1432
+ active when sagbiDefIdealByDegree was called.
1433
+
1434
+ defIdeal contains the defining ideal and the retract (as far as computed). They live in the ring
1435
+ (name of the result).r_defIdeal; See example for the activation of this ring.
1436
+ The defining ideal has been minimized.
1437
+
1438
+ Note: sorting, if set at all, must be 0.
1439
+
1440
+ EXAMPLE: example sagbiDefIdealByDegree; shows an example
1441
+ "
1442
+ {
1443
+ // checkPposDegree(Q);
1444
+
1445
+ int sorting = 0;
1446
+ if(size(#) > 1){
1447
+ sorting = #[2];
1448
+ }
1449
+ if(sorting){
1450
+ "Sorting not allowed for defining ideal and swiched off";
1451
+ sorting = 0;
1452
+ }
1453
+
1454
+ if(size(#) > 1){
1455
+ our_printlevel = #[2];
1456
+ }
1457
+
1458
+ if(Sagbi_degree_bound <= 0){
1459
+ ERROR("Degree bound must be positive");
1460
+ }
1461
+ if(!homog(Q)){
1462
+ ERROR("defIdealByDegree expects homogeneous input");
1463
+ }
1464
+
1465
+ list baseringlist = ringlist(basering);
1466
+ intvec w = baseringlist[3][1][2];
1467
+ for(int i = 1; i <=size(w); i++){
1468
+ if(w[i] != 1){
1469
+ ERROR("Basering not standard graded");
1470
+ }
1471
+ }
1472
+
1473
+ ideal P;
1474
+ int success;
1475
+ (P, success) = doSagbiGeneral(Q, 1, Sagbi_degree_bound, -1, sorting); // 1 = defining ideal
1476
+
1477
+ // int NrTerms = 0;
1478
+ // for(int k = 1; k <= size(P); k++){
1479
+ // NrTerms = NrTerms + size(P[k]);
1480
+ // }
1481
+ // "Number Terms", NrTerms;
1482
+
1483
+ sagbiResult res;
1484
+ res.success = success;
1485
+ res.sagbiBasis = P;
1486
+ def our_ring = basering;
1487
+ setring @S;
1488
+ res.defIdeal = minbase(@DefIdeal);
1489
+ res.retract = @Retract;
1490
+ setring our_ring;
1491
+ return(res);
1492
+ }
1493
+ example
1494
+ { "EXAMPLE:"; echo=2;
1495
+ ring R = 0,(x(1..2)(1..5)), dp;
1496
+ matrix M[2][5] = x(1..2)(1..5);
1497
+ ideal P = minor(M,2);
1498
+ int degree_bound = 15;
1499
+ def Result = sagbiDefIdealByDegree(P, degree_bound, 0, 1);
1500
+ "Note: success = 2 <==> Sagbi basis and defining ideal completee";
1501
+ "success", Result.success;
1502
+ "Sagbi basis";
1503
+ Result.sagbiBasis;
1504
+ def motherRing = Result.r_defIdeal;
1505
+ setring motherRing;
1506
+ "defining ideal";
1507
+ Result.defIdeal;
1508
+ "retract";
1509
+ if(defined(Result.r_retract)){ def s=Result.r_retract;setring s;}
1510
+ Result.retract;
1511
+ }
1512
+
1513
+ proc sagbiDefIdealGeneral(ideal Q, list #)
1514
+ "USAGE: defIdealGeneral(ideal Q [, int sagbiMaxRounds, int sorting, int verb]));
1515
+ RETURN: An instance of
1516
+
1517
+ newstruct("sagbiResult","int success, ideal sagbiBasis, ideal defIdeal, ideal retract");
1518
+
1519
+ success has the value 0, if the full Sagbi basis has not been reached,
1520
+ 1 if this is unknown, and 2 if the full Sagbi basis has been computed.
1521
+
1522
+ sagbiBasis is the Sagbi basis encodeed as an ideal in the polynomial ring that was
1523
+ active when sagbiDefIdealByDegree was called.
1524
+
1525
+ defIdeal contains the defining ideal and the retract (as far as computed). They live in the ring
1526
+ (name of the result).r_defIdeal; See example for the activation of this ring.
1527
+ The defining ideal has been minimized.
1528
+
1529
+ Note: sorting, if set at all, must be 0.
1530
+
1531
+ EXAMPLE: example sagbiDefIdealGeneral; shows an example
1532
+ "
1533
+ {
1534
+ int sorting = 0;
1535
+ int Sagbi_max_rounds = -1;
1536
+ if(size(#) > 0){
1537
+ Sagbi_max_rounds = #[1];
1538
+ }
1539
+ if(size(#) > 1){
1540
+ sorting = #[2];
1541
+ }
1542
+ if(sorting){
1543
+ "Sorting not allowed for defining ideal and swiched off";
1544
+ sorting = 0;
1545
+ }
1546
+ if(size(#) > 2){
1547
+ our_printlevel = #[3];
1548
+ }
1549
+ ideal P;
1550
+ int success;
1551
+ (P, success) = doSagbiGeneral(Q, 1, -1, Sagbi_max_rounds, sorting); // 1 = defining ideal, -1 = no degrees.
1552
+
1553
+ sagbiResult res;
1554
+ res.success = success;
1555
+ res.sagbiBasis = P;
1556
+ def our_ring = basering;
1557
+ setring @S;
1558
+ res.defIdeal = @DefIdeal;
1559
+ res.retract = @Retract;
1560
+ setring our_ring;
1561
+ return(res);
1562
+ }
1563
+ example
1564
+ { "EXAMPLE:";echo=2;
1565
+ ring R = 0,(x,w),dp;
1566
+ ideal A = x^2-w+1, x + w^3, x -w;
1567
+ def Result = sagbiDefIdealGeneral(A,-1); "Note: success = 2 <==> Sagbi basis and defining ideal completee";
1568
+ "success", Result.success;
1569
+ "Sagbi basis";
1570
+ Result.sagbiBasis;
1571
+ def motherRing = Result.r_defIdeal;
1572
+ setring motherRing;
1573
+ "defining ideal";
1574
+ Result.defIdeal;
1575
+ "retract";
1576
+ if(defined(Result.r_retract)) {def s=Result.r_retract;setring s;}
1577
+ Result.retract;
1578
+ }
1579
+ // ------------------------------------------------
1580
+ // Initialization
1581
+ // -----------------------------------------------
1582
+
1583
+ static proc mod_init()
1584
+ {
1585
+ if(size(system("executable","normaliz"))>0)
1586
+ {string @ver=read("|: normaliz --version");}
1587
+ if(!defined(Normaliz)) { LIB "normaliz.lib";}
1588
+ int swallow;
1589
+ addNmzOption("MRK","MarkovBasis");
1590
+ addNmzOption("REP","Representations");
1591
+ addNmzOption("BPK","BinomialsPacked");
1592
+ addNmzOption("cyclo","OnlyCyclotomicHilbSer");
1593
+ addNmzOption("noquasi","NoQuasiPolynomial");
1594
+ swallow = setNmzOption("BPK", 1);
1595
+ swallow = setNmzOption("MRK",0);
1596
+ swallow =setNmzOption("REP",0);
1597
+ swallow =setNmzOption("cyclo",0);
1598
+ swallow =setNmzOption("noquasi",0);
1599
+ setNmzFilename("NmzSagbiExchange");
1600
+ intmat saveTete_a_tete;
1601
+ int startTete_tete;
1602
+ export(saveTete_a_tete);
1603
+ export(startTete_tete);
1604
+ int our_printlevel = 1;
1605
+ export(our_printlevel);
1606
+ int @do_def_ideal = 0;
1607
+ export(@do_def_ideal);
1608
+ newstruct("EnumData", "bigintmat HilbertSeriesNum, intvec HilbertSeriesDenom, bigint MultiplicityNum, bigint NultiplicityDenom");
1609
+ newstruct("GradingData", "int GradingDenom, intvec GradingVec");
1610
+ newstruct("sagbiResult","int success, ideal sagbiBasis, ideal defIdeal, ideal retract");
1611
+ int Cyclotomic = 0;
1612
+ export(Cyclotomic);
1613
+ if(defined(@ver))
1614
+ {
1615
+ if (@ver<"Normaliz 3.10.5")
1616
+ { option(noredefine);LIB"sagbiNormaliz0.lib";option(redefine);
1617
+ "***** normaliz 3.10.5 or newer required";
1618
+ "***** loading sagbiNormaliz0.lib instead";
1619
+ }
1620
+ }
1621
+ }
1622
+