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,2769 @@
1
+ ///////////////////////////////////////////////////////////////////////////
2
+ version="version standard.lib 4.4.0.6 Oct_2024 "; // $Id: d0ba31df498b041078e8c5c82eab9b9ed0dd668f $
3
+ category="Miscellaneous";
4
+ info="
5
+ LIBRARY: standard.lib Procedures which are always loaded at Start-up
6
+
7
+ PROCEDURES:
8
+ stdfglm(ideal[,ord]) standard basis of ideal via fglm [and ordering ord]
9
+ stdhilb(ideal[,h]) Hilbert driven Groebner basis of ideal
10
+ groebner(ideal,...) standard basis using a heuristically chosen method
11
+ res(ideal/module,[i]) free resolution of ideal or module
12
+ sprintf(fmt,...) returns formatted string
13
+ fprintf(link,fmt,..) writes formatted string to link
14
+ printf(fmt,...) displays formatted string
15
+ weightKB(stc,dd,vl) degree dd part of a kbase w.r.t. some weights
16
+ qslimgb(i) computes a standard basis with slimgb in a qring
17
+ par2varRing([i]) create a ring making pars to vars, together with i
18
+ datetime() return date and time as a string
19
+ max(i_1,...,i_k) maximum of i_1, ..., i_k
20
+ min(i_1,...,i_k) minimum of i_1, ..., i_k
21
+ create_ring(l1,l2,l3,l4) return ring(list(l1, l2, l3, l4))
22
+
23
+ ";
24
+ //AUXILIARY PROCEDURES:
25
+ // hilbRing([i]) ring for computing the (weighted) hilbert series
26
+ // quotientList(L,...) ringlist for creating a correct quotient ring
27
+
28
+ //////////////////////////////////////////////////////////////////////////////
29
+
30
+ proc stdfglm (ideal i, list #)
31
+ "SYNTAX: @code{stdfglm (} ideal_expression @code{)} @*
32
+ @code{stdfglm (} ideal_expression@code{,} string_expression @code{)}
33
+ TYPE: ideal
34
+ PURPOSE: computes the standard basis of the ideal in the basering
35
+ via @code{fglm} from the ordering given as the second argument
36
+ to the ordering of the basering. If no second argument is given,
37
+ \"dp\" is used. The standard basis for the given ordering (resp. for
38
+ \"dp\") is computed via the command groebner except if a further
39
+ argument \"std\" or \"slimgb\" is given in which case std resp.
40
+ slimgb is used.
41
+ SEE ALSO: fglm, groebner, std, slimgb, stdhilb
42
+ KEYWORDS: fglm
43
+ EXAMPLE: example stdfglm; shows an example"
44
+ {
45
+ string os;
46
+ int s = size(#);
47
+ def P= basering;
48
+ string algorithm;
49
+ int ii;
50
+ for( ii=1; ii<=s; ii++)
51
+ {
52
+ if ( typeof(#[ii])== "string" )
53
+ {
54
+ if ( #[ii]=="std" || #[ii]=="slimgb" )
55
+ {
56
+ algorithm = #[ii];
57
+ # = delete(#,ii);
58
+ s--;
59
+ ii--;
60
+ }
61
+ }
62
+ }
63
+
64
+ intvec opt = option(get); //save options
65
+ option(pure_gb);
66
+ if((s > 0) && (typeof(#[1]) == "string"))
67
+ {
68
+ os = #[1];
69
+ ideal Qideal = ideal(P);
70
+ int sQ = size(Qideal);
71
+ if (sQ!=0 )
72
+ {
73
+ ring Rfglm = create_ring(ring_list(P)[1], "("+varstr(P)+")", os);
74
+ ideal Qideal = fetch(P,Qideal);
75
+ qring Pfglm = groebner(Qideal,"std","slimgb");
76
+ }
77
+ else
78
+ {
79
+ ring Pfglm = create_ring(ring_list(P)[1], "("+varstr(P)+")", os);
80
+ }
81
+ }
82
+ else
83
+ {
84
+ list BRlist = ring_list(P);
85
+ int nvarP = nvars(P);
86
+ intvec w; //for ringweights of basering P
87
+ int k;
88
+ for(k=1; k <= nvarP; k++)
89
+ {
90
+ w[k]=deg(var(k));
91
+ }
92
+
93
+ BRlist[3] = list();
94
+ if( s==0 or (typeof(#[1]) != "string") )
95
+ {
96
+ if( w==1 )
97
+ {
98
+ BRlist[3][1]=list("dp",w);
99
+ }
100
+ else
101
+ {
102
+ BRlist[3][1]=list("wp",w);
103
+ }
104
+ BRlist[3][2]=list("C",intvec(0));
105
+ def Pfglm = ring(quotientList(BRlist));
106
+ setring Pfglm;
107
+ }
108
+ }
109
+ ideal i = fetch(P,i);
110
+
111
+ option(redSB);
112
+ if (size(algorithm) > 0)
113
+ {
114
+ i = groebner(i,algorithm);
115
+ }
116
+ else
117
+ {
118
+ i = groebner(i);
119
+ }
120
+ option(set,opt);
121
+ setring P;
122
+ return (fglm(Pfglm,i));
123
+ }
124
+ example
125
+ { "EXAMPLE:"; echo = 2;
126
+ ring r = 0,(x,y,z),lp;
127
+ ideal i = y3+x2,x2y+x2,x3-x2,z4-x2-y;
128
+ stdfglm(i); //uses fglm from "dp" (with groebner) to "lp"
129
+ stdfglm(i,"std"); //uses fglm from "dp" (with std) to "lp"
130
+
131
+ ring s = (0,x),(y,z,u,v),lp;
132
+ minpoly = x2+1;
133
+ ideal i = u5-v4,zv-u2,zu3-v3,z2u-v2,z3-uv,yv-zu,yu-z2,yz-v,y2-u,u-xy2;
134
+ weight(i);
135
+ stdfglm(i,"(a(2,3,4,5),dp)"); //uses fglm from "(a(2,3,4,5),dp)" to "lp"
136
+ }
137
+
138
+ /////////////////////////////////////////////////////////////////////////////
139
+
140
+ proc stdhilb(def i,list #)
141
+ "SYNTAX: @code{stdhilb (} ideal_expression @code{)} @*
142
+ @code{stdhilb (} module_expression @code{)} @*
143
+ @code{stdhilb (} ideal_expression, intvec_expression @code{)}@*
144
+ @code{stdhilb (} module_expression, intvec_expression @code{)}@*
145
+ @code{stdhilb (} ideal_expression@code{,} list of string_expressions,
146
+ and intvec_expression @code{)} @*
147
+ TYPE: type of the first argument
148
+ PURPOSE: Compute a Groebner basis of the ideal/module in the basering by
149
+ using the Hilbert driven Groebner basis algorithm.
150
+ If an argument of type string, stating @code{\"std\"} resp. @code{\"slimgb\"},
151
+ is given, the standard basis computation uses @code{std} or
152
+ @code{slimgb}, otherwise a heuristically chosen method (default)@*
153
+ If an optional second argument w of type intvec is given, w is used
154
+ as variable weights. If w is not given, it is computed as w[i] =
155
+ deg(var(i)). If the ideal is homogeneous w.r.t. w then the
156
+ Hilbert series is computed w.r.t. to these weights.
157
+ THEORY: If the ideal is not homogeneous compute first a Groebner basis
158
+ of the homogenization [w.r.t. the weights w] of the ideal/module,
159
+ then the Hilbert function and, finally, a Groebner basis in the
160
+ original ring by using the computed Hilbert function. If the given
161
+ w does not coincide with the variable weights of the basering, the
162
+ result may not be a groebner basis in the original ring.
163
+ NOTE: 'Homogeneous' means weighted homogeneous with respect to the weights
164
+ w[i] of the variables var(i) of the basering. Parameters are not
165
+ converted to variables.
166
+ SEE ALSO: stdfglm, std, slimgb, groebner
167
+ KEYWORDS: Hilbert function
168
+ EXAMPLE: example stdhilb; shows an example"
169
+ {
170
+
171
+ //--------------------- save data from basering --------------------------
172
+ def P=basering;
173
+ int nr;
174
+ if (typeof(i)=="ideal") { nr=1;}
175
+ else { nr= nrows(i); } //nr=1 if i is an ideal
176
+ ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring
177
+ int was_qring; //remembers if basering was a qring
178
+ int is_homog =homog(i); //check for homogeneity of i and Qideal
179
+ if (size(Qideal) > 0)
180
+ {
181
+ was_qring = 1;
182
+ }
183
+
184
+ // save ordering of basering P for later use
185
+ list ord_P = ring_list(P)[3]; //ordering of basering in ringlist
186
+ string ordstr_P = ordstr(P); //ordering of basering as string
187
+ int nvarP = nvars(P);
188
+
189
+ //save options:
190
+ intvec gopt = option(get);
191
+ option(pure_gb);
192
+ int p_opt;
193
+ string s_opt = option();
194
+ if (find(s_opt, "prot")) { p_opt = 1; }
195
+
196
+ //-------------------- check the given method and weights ---------------------
197
+ //Note: stdhilb is used in elim where it is applied to an elimination ordering
198
+ //a(1..1,0..0),wp(w). In such a ring deg(var(k)=0 for all vars corresponding to
199
+ //0 in a(1..1,0..0), hence we cannot identify w via w[k] = deg(var(k));
200
+ //Therefore hilbstd has the option to give ringweights.
201
+
202
+ int k;
203
+ string method;
204
+ for (k=1; k<=size(#); k++)
205
+ {
206
+ if (typeof(#[k]) == "intvec")
207
+ {
208
+ intvec w = #[k]; //given ringweights of basering P
209
+ }
210
+ if (typeof(#[k]) == "string")
211
+ {
212
+ method = method + "," + #[k];
213
+ }
214
+ }
215
+
216
+ if ( defined(w)!=voice )
217
+ {
218
+ intvec w;
219
+ for(k=nvarP; k>=1; k--)
220
+ {
221
+ w[k] = deg(var(k)); //compute ring weights
222
+ }
223
+ }
224
+
225
+ if (npars(P) > 0) //clear denominators of parameters
226
+ {
227
+ for( k=ncols(i); k>0; k-- )
228
+ {
229
+ i[k]=cleardenom(i[k]);
230
+ }
231
+ }
232
+
233
+ //---------- exclude cases to which stdhilb should no be applied ----------
234
+ //Note that quotient ideal of qring must be homogeneous too
235
+
236
+ int neg=1-attrib (P,"global");
237
+
238
+ if( //find(ordstr_P,"s") ||// covered by neg
239
+ find(ordstr_P,"M") || neg )
240
+ {
241
+ // if( defined(hi) && is_homog )
242
+ // {
243
+ // if (p_opt){"std with given Hilbert function in basering";}
244
+ // return( std(i,hi,w) );
245
+ //### here we would need Hibert-Samuel function
246
+ // }
247
+
248
+ if (p_opt)
249
+ {"//-- stdhilb not implemented, we use std in ring:"; string(P);}
250
+ return( std(i) );
251
+ }
252
+
253
+ //------------------------ change to hilbRing ----------------------------
254
+ //The ground field of P and Philb coincide, Philb has an extra variable
255
+ //@ or @(k). Philb is no qring and the predefined ideal/module Id[1] in
256
+ //Philb is homogeneous (it is the homogenized i w.r.t. @ or @(k))
257
+ //Parameters of P are not converted in Philb
258
+ //Philb has only 1 block dp or wp(w)
259
+
260
+ list hiRi = hilbRing(i,w);
261
+ intvec W = hiRi[2];
262
+ def Philb = hiRi[1];
263
+ setring Philb;
264
+
265
+ //-------- compute Hilbert series of homogenized ideal in Philb ---------
266
+ //There are three cases
267
+
268
+ string algorithm; //possibilities: std, slimgb, stdorslimgb
269
+ //define algorithm:
270
+ if( find(method,"std") && !find(method,"slimgb") )
271
+ {
272
+ algorithm = "std";
273
+ }
274
+ if( find(method,"slimgb") && !find(method,"std") )
275
+ {
276
+ algorithm = "slimgb";
277
+ }
278
+ if( find(method,"std") && find(method,"slimgb") ||
279
+ (!find(method,"std") && !find(method,"slimgb")) )
280
+ {
281
+ algorithm = "stdorslimgb";
282
+ }
283
+
284
+ //### geaendert Dez08: es wird std(Id[1]) statt Id[1] aus Philb nach Phelp
285
+ // weitergegeben fuer hilbertgetriebenen std
286
+
287
+ if (( algorithm=="std" || ( algorithm=="stdorslimgb" && char(P)>0 ) )
288
+ && (defined(hi)!=voice))
289
+ {
290
+ if (p_opt) {"compute hilbert series with std in ring " + string(Philb);
291
+ "weights used for hilbert series:",W;}
292
+ Id[1] = std(Id[1]);
293
+ bigintvec hi = hilb( Id[1],1,W );
294
+ }
295
+ if (( algorithm=="slimgb" || ( algorithm=="stdorslimgb" && char(P)==0 ) )
296
+ && (defined(hi)!=voice))
297
+ {
298
+ if (p_opt) {"compute hilbert series with slimgb in ring " + string(Philb);
299
+ "weights used for hilbert series:",W;}
300
+ Id[1] = qslimgb(Id[1]);
301
+ bigintvec hi = hilb( Id[1],1,W );
302
+ }
303
+
304
+ //-------------- we need another intermediate ring Phelp ----------------
305
+ //In Phelp we change only the ordering from Philb (otherwise it coincides
306
+ //with Philb). Phelp has in addition to P an extra homogenizing variable
307
+ //with name @ (resp. @(i) if @ and @(1), ..., @(i-1) are defined) with
308
+ //ordering an extra last block dp(1).
309
+ //Phelp has the same ordering as P on common variables. In Phelp
310
+ //a quotient ideal from P is added to the input
311
+
312
+ list BRlist = ring_list(Philb);
313
+ BRlist[3] = list();
314
+ int so = size(ord_P);
315
+ if( ord_P[so][1] =="c" || ord_P[so][1] =="C" )
316
+ {
317
+ list moduleord = ord_P[so];
318
+ so = so-1;
319
+ }
320
+ for (k=1; k<=so; k++)
321
+ {
322
+ BRlist[3][k] = ord_P[k];
323
+ }
324
+
325
+ BRlist[3][so+1] = list("dp",1);
326
+ w = w,1;
327
+
328
+ if( defined(moduleord)==voice )
329
+ {
330
+ BRlist[3][so+2] = moduleord;
331
+ }
332
+
333
+ //--- change to extended ring Phelp and compute std with hilbert series ----
334
+ def Phelp = ring(quotientList(BRlist));
335
+ setring Phelp;
336
+ list Id= imap(Philb, Id); def i=Id[1];
337
+ kill Philb;
338
+
339
+ // compute std with Hilbert series
340
+ option(redThrough);
341
+ if (w == 1)
342
+ {
343
+ if (p_opt){ "std with hilb in " + string(Phelp);}
344
+ i = std(i, hi);
345
+ }
346
+ else
347
+ {
348
+ if(p_opt){"std with weighted hilb in "+string(Phelp);}
349
+ i = std(i, hi, w);
350
+ }
351
+
352
+ //-------------------- go back to original ring ---------------------------
353
+ //The main computation is done. Do not forget to simplify before mapping.
354
+
355
+ // subst 1 for homogenizing var
356
+ if ( p_opt ) { "dehomogenization"; }
357
+ i = subst(i, var(nvars(basering)), 1);
358
+
359
+ if (p_opt) { "simplification"; }
360
+ i= simplify(i,34);
361
+
362
+ setring P;
363
+ if (p_opt) { "imap to ring "+string(P); }
364
+ i = imap(Phelp,i);
365
+ kill Phelp;
366
+ if( was_qring )
367
+ {
368
+ i = NF(i,std(0));
369
+ }
370
+ i = simplify(i,34);
371
+ // compute reduced SB
372
+ if (find(s_opt, "redSB") > 0)
373
+ {
374
+ if (p_opt) { "//interreduction"; }
375
+ i=interred(i);
376
+ }
377
+ attrib(i, "isSB", 1);
378
+ option(set,gopt);
379
+ return (i);
380
+ }
381
+ example
382
+ { "EXAMPLE:"; echo = 2;
383
+ ring r = 0,(x,y,z),lp;
384
+ ideal i = y3+x2,x2y+x2z2,x3-z9,z4-y2-xz;
385
+ ideal j = stdhilb(i); j;
386
+
387
+ ring r1 = 0,(x,y,z),wp(3,2,1);
388
+ ideal i = y3+x2,x2y+x2z2,x3-z9,z4-y2-xz; //ideal is homogeneous
389
+ ideal j = stdhilb(i,"std"); j;
390
+ //this is equivalent to:
391
+ bigintvec v = hilb(std(i),1);
392
+ ideal j1 = std(i,v,intvec(3,2,1)); j1;
393
+
394
+ size(NF(j,j1))+size(NF(j1,j)); //j and j1 define the same ideal
395
+ }
396
+
397
+ ///////////////////////////////////////////////////////////////////////////////
398
+ proc quotientList (list RL, list #)
399
+ "SYNTAX: @code{quotientList (} list_expression @code{)} @*
400
+ @code{quotientList (} list_expression @code{,} string_expression@code{)}
401
+ TYPE: list
402
+ PURPOSE: define a ringlist, say QL, of the first argument, say RL, which is
403
+ assumed to be the ringlist of a qring, but where the quotient ideal
404
+ RL[4] is not a standard basis with respect to the given monomial
405
+ order in RL[3]. Then QL will be obtained from RL just by replacing
406
+ RL[4] by a standard of it with respect to this order. RL itself
407
+ will be returned if size(RL[4]) <= 1 (in which case it is known to be
408
+ a standard basis w.r.t. any ordering) or if a second argument
409
+ \"isSB\" of type string is given.
410
+ NOTE: the command ring(quotientList(RL)) defines a quotient ring correctly
411
+ and should be used instead of ring(RL) if the quotient ideal RL[4]
412
+ is not (or not known to be) a standard basis with respect to the
413
+ monomial ordering specified in RL[3].
414
+ SEE ALSO: ringlist, ring
415
+ EXAMPLE: example quotientList; shows an example"
416
+ {
417
+ def P = basering;
418
+ if( size(#) > 0 )
419
+ {
420
+ if ( #[1] == "isSB")
421
+ {
422
+ return (RL);
423
+ }
424
+ }
425
+ ideal Qideal = RL[4]; //##Achtung: falls basering Nullteiler hat, kann
426
+ //die SB eines Elements mehrere Elemente enthalten
427
+ if( size(Qideal) <= 0)
428
+ {
429
+ return (RL);
430
+ }
431
+
432
+ RL[4] = ideal(0);
433
+ def Phelp = ring(RL);
434
+ setring Phelp;
435
+ ideal Qideal = groebner(fetch(P,Qideal));
436
+ setring P;
437
+ RL[4]=fetch(Phelp,Qideal);
438
+ return (RL);
439
+ }
440
+ example
441
+ { "EXAMPLE:"; echo = 2;
442
+ ring P = 0,(y,z,u,v),lp;
443
+ ideal i = y+u2+uv3, z+uv3; //i is an lp-SB but not a dp_SB
444
+ qring Q = std(i);
445
+ list LQ = ring_list(Q);
446
+ LQ[3][1][1]="dp";
447
+ def Q1 = ring(quotientList(LQ));
448
+ setring Q1;
449
+ Q1;
450
+
451
+ setring Q;
452
+ ideal q1 = uv3+z, u2+y-z, yv3-zv3-zu; //q1 is a dp-standard basis
453
+ LQ[4] = q1;
454
+ def Q2 = ring(quotientList(LQ,"isSB"));
455
+ setring Q2;
456
+ Q2;
457
+ }
458
+
459
+ ///////////////////////////////////////////////////////////////////////////////
460
+ proc par2varRing (list #)
461
+ "USAGE: par2varRing([l]); l list of ideals/modules [default:l=empty list]
462
+ RETURN: list, say L, with L[1] a ring where the parameters of the
463
+ basering have been converted to an additional last block of
464
+ variables, all of weight 1, and ordering dp.
465
+ If a list l with l[i] an ideal/module is given, then
466
+ l[i] + minpoly*freemodule(nrows(l[i])) is mapped to an ideal/module
467
+ in L[1] with name Id[i].
468
+ If the basering has no parameters then L[1] is the basering.
469
+ EXAMPLE: example par2varRing; shows an example"
470
+ {
471
+ def P = basering;
472
+ int npar = npars(P); //number of parameters
473
+ int s = size(#);
474
+ int ii;
475
+ if ( npar == 0)
476
+ {
477
+ dbprint(printlevel-voice+3,"// ** no parameters, ring was not changed");
478
+ list Id=#;
479
+ export Id;
480
+ return(list(P));
481
+ }
482
+
483
+ list rlist = ringlist(P);
484
+ list parlist = rlist[1];
485
+ rlist[1] = parlist[1];
486
+
487
+ string @Minpoly = string(minpoly); //check for minpoly:
488
+ int sm = size(minpoly);
489
+ //now create new ring
490
+ list Id=#;
491
+ int nvar = size(rlist[2]);
492
+ int nblock = size(rlist[3]);
493
+ int k;
494
+ for (k=1; k<=npar; k++)
495
+ {
496
+ rlist[2][nvar+k] = parlist[2][k]; //change variable list
497
+ }
498
+
499
+ //converted parameters get one block dp. If module ordering was in front
500
+ //it stays in front, otherwise it will be moved to the end
501
+ intvec OW = 1:npar;
502
+ if( rlist[3][nblock][1] =="c" || rlist[3][nblock][1] =="C" )
503
+ {
504
+ rlist[3][nblock+1] = rlist[3][nblock];
505
+ rlist[3][nblock] = list("dp",OW);
506
+ }
507
+ else
508
+ {
509
+ rlist[3][nblock+1] = list("dp",OW);
510
+ }
511
+
512
+ def Ppar2var = ring(quotientList(rlist));
513
+ setring Ppar2var;
514
+ if ( sm == 0 )
515
+ {
516
+ list Id=imap(P,Id);
517
+ export (Id);
518
+ }
519
+ else
520
+ {
521
+ if( find(option(),"prot") ){"//add minpoly to input";}
522
+ execute("poly Minpoly = " + @Minpoly + " ;");
523
+ list Id=imap(P,Id);
524
+ for( ii = 1; ii <= s; ii++)
525
+ {
526
+ if (typeof(Id[ii])=="module")
527
+ {
528
+ Id[ii] = Id[ii],Minpoly*freemodule(nrows(Id[ii]));
529
+ }
530
+ else
531
+ {
532
+ Id[ii] = Id[ii],Minpoly;
533
+ }
534
+ }
535
+ export (Id);
536
+ }
537
+ list Lpar2var = Ppar2var;
538
+ return(Lpar2var);
539
+ }
540
+ example
541
+ { "EXAMPLE:"; echo = 2;
542
+ ring R = (0,x),(y,z,u,v),lp;
543
+ minpoly = x2+1;
544
+ ideal i = x3,x2+y+z+u+v,xyzuv-1; i;
545
+ def P = par2varRing(i)[1]; P;
546
+ setring(P);
547
+ Id[1];
548
+
549
+ setring R;
550
+ module m = x3*[1,1,1], (xyzuv-1)*[1,0,1];
551
+ def Q = par2varRing(m)[1]; Q;
552
+ setring(Q);
553
+ print(Id[1]);
554
+ }
555
+
556
+ //////////////////////////////////////////////////////////////////////////////
557
+ proc hilbRing ( list # )
558
+ "USAGE: hilbRing([w,l]); w = intvec, l = list of ideals/modules
559
+ RETURN: list, say L: L[1] is a ring and L[2] an intvec
560
+ L[1] is a ring with an extra homogenizing variable with name @,
561
+ resp. @(i) if @ and @(1), ..., @(i-1) are defined.
562
+ The monomial ordering of L[1] is consists of 1 block: dp if the
563
+ weights of the variables of the basering, say R, are all 1, resp.
564
+ wp(w,1) where w is either given or the intvec of weights of the
565
+ variables of R, i.e. w[k]=deg(var(k)).
566
+ If R is a quotient ring P/Q, then L[1] is not a quotient ring but
567
+ contains the ideal @Qidealhilb@, the homogenized ideal Q of P.
568
+ (Parameters of R are not touched).
569
+ If a list l is given with l[i] an ideal/module, then l[i] is mapped
570
+ to Id[i], the homogenized l[i]+Q*freemodule(nrows(l[i]) in L[1]
571
+ (Id[i] = l[i] if l[i] is already homogeneous).
572
+ L[2] is the intvec (w,1).
573
+ PURPOSE: Prepare a ring for computing the (weighted) hilbert series of
574
+ an ideal/module with an easy monomial ordering.
575
+ NOTE: For this purpose we need w[k]=deg(var(k)). However, if the ordering
576
+ contains an extra weight vector a(v,0..0)) deg(var(k)) returns 0 for
577
+ k being an index which is 0 in a. Therefore we must compute w
578
+ beforehand and give it to hilbRing.
579
+ EXAMPLE: example hilbRing; shows an example
580
+ "
581
+ {
582
+ def P = basering;
583
+ ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring
584
+ if( size(Qideal) != 0 )
585
+ {
586
+ int is_qring =1;
587
+ }
588
+ list BRlist = ring_list(P);
589
+ BRlist[4] = ideal(0); //kill quotient ideal in BRlist
590
+
591
+ int nvarP = nvars(P);
592
+ int s = size(#);
593
+ int k;
594
+
595
+ for(k = 1; k <= s; k++)
596
+ {
597
+ if ( typeof(#[k]) == "intvec" )
598
+ {
599
+ intvec w = #[k]; //given weights for the variables
600
+ # = delete (#,k);
601
+ }
602
+ }
603
+
604
+ s = size(#);
605
+ list nr,Id;
606
+ Id=#;
607
+ for(k = 1; k <= s; k++)
608
+ {
609
+ if (typeof(#[k])=="module") { nr[k]=nrows(Id[k]); }
610
+ else { nr[k]=1; }
611
+ }
612
+
613
+ if ( defined(w)!=voice )
614
+ {
615
+ intvec w; //for ringweights of basering P
616
+ for(k=1; k<=nvarP; k++)
617
+ {
618
+ w[k]=deg(var(k)); //degree of kth variable
619
+ }
620
+ }
621
+ //--------------------- a homogenizing variable is added ------------------
622
+ // call it @, resp. @(k) if @(1),...,@(k-1) are defined
623
+ string homvar;
624
+ if ( defined(@)==0 )
625
+ {
626
+ homvar = "@";
627
+ }
628
+ else
629
+ {
630
+ k=1;
631
+ while( defined(@(k)) != 0 )
632
+ {
633
+ k++;
634
+ }
635
+ homvar = "@("+string(k)+")";
636
+ }
637
+ BRlist[2][nvarP+1] = homvar;
638
+ w[nvarP +1]=1;
639
+
640
+ //ordering is set to (dp,C) if weights of all variables are 1
641
+ //resp. to (wp(w,1),C) where w are the ringweights of basering P
642
+ //homogenizing var gets weight 1:
643
+
644
+ BRlist[3] = list();
645
+ BRlist[3][2]=list("C",intvec(0)); //put module ordering always last
646
+ if(w==1)
647
+ {
648
+ BRlist[3][1]=list("dp",w);
649
+ }
650
+ else
651
+ {
652
+ BRlist[3][1]=list("wp",w);
653
+ }
654
+
655
+ //-------------- change ring and get ideal from previous ring ---------------
656
+ def Philb = ring(quotientList(BRlist));
657
+ kill BRlist;
658
+ setring Philb;
659
+ if( defined(is_qring)==voice )
660
+ {
661
+ ideal @Qidealhilb@ = imap(P,Qideal);
662
+ if ( ! homog(@Qidealhilb@) )
663
+ {
664
+ @Qidealhilb@ = homog( @Qidealhilb@, `homvar` );
665
+ }
666
+ export(@Qidealhilb@);
667
+
668
+ if( find(option(),"prot") ){"add quotient ideal to input";}
669
+
670
+ list Id=imap(P,Id);
671
+ for(k = 1; k <= s; k++)
672
+ { //homogenize if necessary
673
+ if ( ! homog(Id[k]) )
674
+ {
675
+ Id[k] = homog( Id[k], `homvar` );
676
+ }
677
+ if (typeof(Id[k])=="module")
678
+ {
679
+ Id[k] = Id[k],@Qidealhilb@*freemodule(nr[k]) ;
680
+ }
681
+ else
682
+ {
683
+ Id[k] = Id[k],@Qidealhilb@ ;
684
+ }
685
+ }
686
+ }
687
+ else
688
+ {
689
+ list Id=imap(P,Id);
690
+ for(k = 1; k <= s; k++)
691
+ { //homogenize if necessary
692
+ if ( ! homog(Id[k]) )
693
+ {
694
+ Id[k] = homog( Id[k], `homvar` );
695
+ }
696
+ }
697
+ }
698
+ export(Id);
699
+ list Lhilb = Philb,w;
700
+ setring(P); return(Lhilb);
701
+ }
702
+ example
703
+ { "EXAMPLE:"; echo = 2;
704
+ ring R = 0,(x,y,z,u,v),lp;
705
+ ideal i = x+y2+z3,xy+xv+yz+zu+uv,xyzuv-1;
706
+ intvec w = 6,3,2,1,1;
707
+ hilbRing(i,w);
708
+ def P = hilbRing(w,i)[1];
709
+ setring P;
710
+ Id[1];
711
+ hilb(std(Id[1]),1);
712
+
713
+ ring S = 0,(x,y,z,u,v),lp;
714
+ qring T = std(x+y2+z3);
715
+ ideal i = xy+xv+yz+zu+uv,xyzuv-v5;
716
+ module m = i*[0,1,1] + (xyzuv-v5)*[1,1,0];
717
+ def Q = hilbRing(m)[1]; Q;
718
+ setring Q;
719
+ print(Id[1]);
720
+ }
721
+
722
+ //////////////////////////////////////////////////////////////////////////////
723
+ proc qslimgb (def i)
724
+ "USAGE: qslimgb(i); i ideal or module
725
+ RETURN: same type as input, a standard basis of i computed with slimgb
726
+ NOTE: Only as long as slimgb does not know qrings qslimgb should be used
727
+ in case the basering is (possibly) a quotient ring.
728
+ The quotient ideal is added to the input and slimgb is applied.
729
+ EXAMPLE: example qslimgb; shows an example"
730
+ {
731
+ def P = basering;
732
+ ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring
733
+ int p_opt;
734
+ if( find(option(),"prot") )
735
+ {
736
+ p_opt=1;
737
+ }
738
+ if (size(Qideal) == 0)
739
+ {
740
+ if (p_opt) { "slimgb in ring " + string(P); }
741
+ return(slimgb(i));
742
+ }
743
+
744
+ //case of a qring; since slimgb does not know qrings we
745
+ //delete the quotient ideal and add it to i
746
+
747
+ list BRlist = ring_list(P);
748
+ BRlist[4] = ideal(0);
749
+ def Phelp = ring(BRlist);
750
+ kill BRlist;
751
+ setring Phelp;
752
+ // module case:
753
+ def iq = imap(P,i);
754
+ if (typeof(iq)=="module")
755
+ {
756
+ iq = iq, imap(P,Qideal)*freemodule(nrows(iq));
757
+ }
758
+ else
759
+ {
760
+ iq = iq, imap(P,Qideal);
761
+ }
762
+ if (p_opt)
763
+ {
764
+ "slimgb in ring " + string(Phelp);
765
+ "(with quotient ideal added to input)";
766
+ }
767
+ iq = slimgb(iq);
768
+
769
+ setring P;
770
+ if (p_opt) { "//imap to original ring"; }
771
+ i = imap(Phelp,iq);
772
+ kill Phelp;
773
+
774
+ if (find(option(),"redSB") > 0)
775
+ {
776
+ if (p_opt) { "//interreduction"; }
777
+ i=reduce(i,std(0));
778
+ i=interred(i);
779
+ }
780
+ attrib(i, "isSB", 1);
781
+ return (i);
782
+ }
783
+ example
784
+ { "EXAMPLE:"; echo = 2;
785
+ ring R = (0,v),(x,y,z,u),dp;
786
+ qring Q = std(x2-y3);
787
+ ideal i = x+y2,xy+yz+zu+u*v,xyzu*v-1;
788
+ ideal j = qslimgb(i); j;
789
+
790
+ module m = [x+y2,1,0], [1,1,x2+y2+xyz];
791
+ print(qslimgb(m));
792
+ }
793
+
794
+ //////////////////////////////////////////////////////////////////////////////
795
+ proc groebner(def i_par, list #)
796
+ "SYNTAX: @code{groebner (} ideal_expression @code{)} @*
797
+ @code{groebner (} module_expression @code{)} @*
798
+ @code{groebner (} ideal_expression@code{,} list of string_expressions
799
+ @code{)} @*
800
+ @code{groebner (} ideal_expression@code{,} list of string_expressions
801
+ and int_expression @code{)}
802
+ TYPE: type of the first argument
803
+ PURPOSE: computes a standard basis of the first argument @code{I}
804
+ (ideal or module) by a heuristically chosen method (default)
805
+ or by a method specified by further arguments of type string.
806
+ Possible methods are: @*
807
+ - the direct methods @code{\"std\"} or @code{\"slimgb\"} without
808
+ conversion, @*
809
+ - conversion methods @code{\"hilb\"} or @code{\"fglm\"} where
810
+ a Groebner basis is first computed with an \"easy\" ordering
811
+ and then converted to the ordering of the basering by the
812
+ Hilbert driven Groebner basis computation or by linear algebra.
813
+ The actual computation of the Groebner basis can be
814
+ specified by @code{\"std\"} or by @code{\"slimgb\"}
815
+ (not for all orderings implemented). @*
816
+ A further string @code{\"par2var\"} converts parameters to an extra
817
+ block of variables before a Groebner basis computation (and
818
+ afterwards back).
819
+ @code{option(prot)} informs about the chosen method.
820
+ HINT: Since there exists no uniform best method for computing standard
821
+ bases, and since the difference in performance of a method on
822
+ different examples can be huge, it is recommended to test, for hard
823
+ examples, first various methods on a simplified example (e.g. use
824
+ characteristic 32003 instead of 0 or substitute a subset of
825
+ parameters/variables by integers, etc.). @*
826
+ SEE ALSO: stdhilb, stdfglm, std, slimgb, modstd_lib, ffmodstd_lib, nfmodstd_lib
827
+ KEYWORDS: groebner basis computations; high corner method; highcorner
828
+ EXAMPLE: example groebner; shows an example"
829
+
830
+ {
831
+ //Vorgabe einer Teilmenge aus {hilb,fglm,par2var,std,slimgb}
832
+ //V1: Erste Einstellungen (Jan 2007)
833
+ //V2: Aktuelle Aenderungen (Juni 2008)
834
+ //---------------------------------
835
+ //0. Immer Aufruf von std unabhaengig von der Vorgabe:
836
+ // gemischte Ordnungen, extra Gewichtsvektor, Matrix Ordnungen
837
+ // ### Todo: extra Gewichtsvektor sollte nicht immer mit std wirken,
838
+ // sondern z.B. mit "hilb" arbeiten koennen
839
+ // ### Todo: es sollte ein Gewichtsvektor mitgegeben werden koennen (oder
840
+ // berechnet werden), z.B. groebner(I,"hilb",w) oder groebner(I,"withWeights")
841
+ // wie bei elim in elim.lib
842
+
843
+ //1. Keine Vorgabe: es wirkt die aktuelle Heuristk:
844
+ // - Char = p: std
845
+ //V1 - Char = 0: slimgb (im qring wird Quotientenideal zum Input addiert)
846
+ //V2 - Char = 0: std
847
+ // - 1-Block-Ordnungen/non-commutative: direkt Aufruf von std oder slimgb
848
+ // - Komplizierte Ordnungen (lp oder > 1 Block): hilb
849
+ //V1 - Parameter werden grundsaetzlich nicht in Variable umgewandelt
850
+ //V2 - Mehr als ein Parameter wird zu Variable konvertiert
851
+ // - fglm is keine Heuristik, da sonst vorher dim==0 peprueft werden muss
852
+
853
+ //2. Vorgabe aus {std,slimgb}: es wird wo immer moeglich das Angegebene
854
+ // gewaehlt (da slimgb keine Hilbertfunktion kennt, wird std verwendet).
855
+ // Bei slimgb im qring, wird das Quotientenideal zum Ideal addiert.
856
+ // Bei Angabe von std zusammen mit slimgb (aequivalent zur Angabe von
857
+ // keinem von beidem) wirkt obige Heuristik.
858
+
859
+ //3. Nichtleere Vorgabe aus {hilb,fglm,std,slimgb}:
860
+ // es wird nur das Angegebene und Moegliche sowie das Notwendige verwendet
861
+ // und bei Wahlmoeglickeit je nach Heuristik.
862
+ // Z.B. Vorgabe von {hilb} ist aequivalent zu {hilb,std,slimgb} und es wird
863
+ // hilb und nach Heuristik std oder slimgb verwendet,
864
+ // (V1: aber nicht par2var)
865
+ // bei Vorgabe von {hilb,slimgb} wird hilb und wo moeglich slimgb verwendet.
866
+
867
+ //4. Bei Vorgabe von {par2var} wird par2var immer mit hilb und nach Heuristik
868
+ // std oder slimgb verwendet. Zu Variablen konvertierte Parameter haben
869
+ // extra letzten Block und Gewichte 1.
870
+
871
+ def P=basering;
872
+ if ((typeof(i_par)=="vector")||(typeof(i_par)=="module")||(typeof(i_par)=="matrix")) {module i=i_par;}
873
+ else {ideal i=i_par; } // int, poly, number, ideal
874
+ kill i_par;
875
+ // check for integer etc coefficients
876
+ if (attrib(basering,"ring_cf")==1) // either integer or integer,q
877
+ {
878
+ if (find(option(),"prot")) { "calling std for ideals in ring with ring coefficients"; }
879
+ return (std(i));
880
+ }
881
+
882
+ //----------------------- save the given method ---------------------------
883
+ string method; //all given methods as a coma separated string
884
+ int k;
885
+ for (k=1; k<=size(#); k++)
886
+ {
887
+ if (typeof(#[k]) == "string")
888
+ {
889
+ method = method + "," + #[k];
890
+ }
891
+ }
892
+
893
+ //--------------------- save data from basering ---------------------------
894
+ string @Minpoly = string(minpoly); //minimal polynomial
895
+ int was_minpoly; //remembers if there was a minpoly in P
896
+ if (size(minpoly) > 0)
897
+ {
898
+ was_minpoly = 1;
899
+ }
900
+
901
+ ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring
902
+ int was_qring; //remembers if basering was a qring
903
+ //int is_homog = 1;
904
+ if (size(Qideal) > 0)
905
+ {
906
+ was_qring = 1;
907
+ //is_homog = homog(Qideal); //remembers if Qideal was homog (homog(0)=1)
908
+ }
909
+ list BRlist = ring_list(P); //ringlist of basering
910
+
911
+ // save ordering of basering P for later use
912
+ list ord_P = BRlist[3]; //should be available in all rings
913
+ string ordstr_P = ordstr(P);
914
+ int nvars_P = nvars(P);
915
+ int npars_P = npars(P);
916
+ intvec w; //for ringweights of basering P
917
+ for(k=1; k<=nvars_P; k++)
918
+ {
919
+ w[k]=deg(var(k));
920
+ }
921
+ int neg=1-attrib (P,"global");
922
+
923
+ //save options:
924
+ intvec opt=option(get);
925
+ string s_opt = option();
926
+ int p_opt;
927
+ if (find(s_opt, "prot")) { p_opt = 1; }
928
+
929
+ //------------------ cases where std is always used ------------------------
930
+ //If other methods are not implemented or do not make sense, i.e. for
931
+ //local or mixed orderings, matrix orderings, extra weight vector
932
+ //### Todo: extra weight vector should be allowed for e.g. with "hilb"
933
+
934
+ if( //( find(ordstr_P,"s") > 0 ) || // covered by neg
935
+ ( find(ordstr_P,"M") > 0 ) || ( find(ordstr_P,"a") > 0 ) || neg )
936
+ {
937
+ if (p_opt) { "std in basering"; }
938
+ option(set,opt);
939
+ return(std(i));
940
+ }
941
+
942
+ //now we have:
943
+ //ideal or module, global ordering, no matrix ordering, no extra weight vector
944
+ //The interesting cases start now.
945
+
946
+ //------------------ classify the possible settings ---------------------
947
+ string algorithm; //possibilities: std, slimgb, stdorslimgb, mathicgb
948
+ string conversion; //possibilities: hilb, fglm, hilborfglm, no
949
+ string partovar; //possibilities: yes, no
950
+ string order; //possibilities: simple, !simple
951
+ string direct; //possibilities: yes, no
952
+
953
+ //define algorithm:
954
+ if( (was_minpoly == 0) && (npars_P == 0) && (was_qring == 0) && (attrib (P,"global") == 1) && (char(P) > 0) && (size(BRlist)<=4) )
955
+ {
956
+ if( defined(Singmathic) )
957
+ {
958
+ algorithm = "mathicgb"; // make it default for any appropriate setting... if mathicgb is available...
959
+ } else
960
+ {
961
+ if( p_opt && find(method,"mathicgb") ) { "Sorry Singmathic::mathicgb is not available!"; }
962
+ }
963
+ }
964
+ if( find(method,"std") && !find(method,"slimgb") )
965
+ {
966
+ algorithm = "std";
967
+ }
968
+ if( find(method,"slimgb") && !find(method,"std") )
969
+ {
970
+ algorithm = "slimgb";
971
+ }
972
+ if( find(method,"std") && find(method,"slimgb") ||
973
+ (!find(method,"std") && !find(method,"slimgb")) )
974
+ {
975
+ algorithm = "stdorslimgb";
976
+ }
977
+
978
+ //define conversion:
979
+ if( find(method,"hilb") && !find(method,"fglm") )
980
+ {
981
+ conversion = "hilb";
982
+ }
983
+ if( find(method,"fglm") && !find(method,"hilb") )
984
+ {
985
+ conversion = "fglm";
986
+ }
987
+ if( find(method,"fglm") && find(method,"hilb") )
988
+ {
989
+ conversion = "hilborfglm";
990
+ }
991
+ if( !find(method,"fglm") && !find(method,"hilb") )
992
+ {
993
+ conversion = "no";
994
+ }
995
+
996
+ //define partovar:
997
+ //if( find(method,"par2var") && npars_P > 0 ) //V1
998
+ if( find(method,"par2var") || npars_P > 1 ) //V2
999
+ {
1000
+ partovar = "yes";
1001
+ }
1002
+ else
1003
+ {
1004
+ partovar = "no";
1005
+ }
1006
+
1007
+ //define order:
1008
+ if (system("nblocks") <= 2)
1009
+ {
1010
+ if ( find(ordstr_P,"M")+find(ordstr_P,"lp")+find(ordstr_P,"rp") <= 0 )
1011
+ {
1012
+ order = "simple";
1013
+ }
1014
+ }
1015
+
1016
+ //define direct:
1017
+ if ( (order=="simple" && (size(method)==0)) ||
1018
+ (size(BRlist)>4) ||
1019
+ (order=="simple" && (method==",par2var" && npars_P==0 )) ||
1020
+ (conversion=="no" && partovar=="no" &&
1021
+ (algorithm=="std" || algorithm=="slimgb" || algorithm=="mathicgb" ||
1022
+ (find(method,"std") && find(method,"slimgb"))
1023
+ )
1024
+ )
1025
+ )
1026
+ {
1027
+ direct = "yes";
1028
+ }
1029
+ else
1030
+ {
1031
+ direct = "no";
1032
+ }
1033
+
1034
+ //order=="simple" means that the ordering of the variables consists of one
1035
+ //block which is not a matrix ordering and not a lexicographical ordering.
1036
+ //(Note:Singular counts always least 2 blocks, one is for module component):
1037
+ //Call a method "direct" if conversion=="no" && partovar="no" which means
1038
+ //that we apply std or slimgb direct in the basering (exception
1039
+ //as long as slimgb does not know qrings: in a qring of a ring P
1040
+ //the ideal Qideal is added to the ideal and slimgb is applied in P).
1041
+ //We apply a direct method if we have a simple monomial ordering, if no
1042
+ //conversion (fglm or hilb) is specified and if the parameters shall
1043
+ //not be made to variables
1044
+ //BRlist (=ringlist of basering) > 4 if the basering is non-commutative
1045
+ //---------------------------- direct methods -----------------------------
1046
+ if ( algorithm=="mathicgb" )
1047
+ {
1048
+ if (p_opt) { algorithm + " in " + string(P); }
1049
+ i=mathicgb(i);
1050
+ option(set,opt);
1051
+ return(i);
1052
+ }
1053
+ if ( direct == "yes" )
1054
+ {
1055
+ //if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) //V1
1056
+ if ( algorithm=="std" || (algorithm=="stdorslimgb") ) //V2
1057
+ {
1058
+ if (p_opt) { "std in " + string(P); }
1059
+ i=std(i);
1060
+ option(set,opt);
1061
+ return(i);
1062
+ }
1063
+ //if( algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0)) //V1
1064
+ if ( algorithm=="slimgb" ) //V2
1065
+ {
1066
+ i=qslimgb(i);
1067
+ option(set,opt);
1068
+ return(i);
1069
+ }
1070
+ }
1071
+
1072
+ //--------------------------- indirect methods -----------------------------
1073
+ //indirect methods are methods where a conversion is used with a ring change
1074
+ //We are in the following situation:
1075
+ //direct=="no" (i.e. "hilb" or "fglm" or "par2var" is given)
1076
+ //or no method is given and we have a complicated monomial ordering
1077
+ //V1: "par2var" is not a default strategy, it must be explicitly
1078
+ //given in order to be performed.
1079
+ //V2: "par2var" is a default strategy if there are more than 1 parameters
1080
+
1081
+ //------------ case where no parameters are made to variables -------------
1082
+ if ( partovar == "no" && conversion == "hilb"
1083
+ || (partovar == "no" && conversion == "fglm" )
1084
+ || (partovar == "no" && conversion == "hilborfglm" )
1085
+ || (partovar == "no" && conversion == "no" && direct == "no") )
1086
+ //last case: heuristic
1087
+ {
1088
+ if ( conversion=="fglm" )
1089
+ {
1090
+ //if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) //V1
1091
+ if ( algorithm=="std" || (algorithm=="stdorslimgb") ) //V2
1092
+ {
1093
+ i=stdfglm(i,"std");
1094
+ option(set,opt);
1095
+ return (i);
1096
+ }
1097
+ //if(algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0))//V1
1098
+ if( algorithm=="slimgb" ) //V2
1099
+ {
1100
+ i=stdfglm(i,"slimgb");
1101
+ option(set,opt);
1102
+ return (i);
1103
+ }
1104
+ }
1105
+ else
1106
+ {
1107
+ //if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) )//V1
1108
+ if ( algorithm=="std" || (algorithm=="stdorslimgb" ) ) //V2
1109
+ {
1110
+ i=stdhilb(i,"std");
1111
+ option(set,opt);
1112
+ return (i);
1113
+ }
1114
+ //if(algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0))//V1
1115
+ if ( algorithm=="slimgb" ) //V2
1116
+ {
1117
+ i=stdhilb(i,"slimgb");
1118
+ option(set,opt);
1119
+ return (i);
1120
+ }
1121
+ }
1122
+ }
1123
+
1124
+ //------------ case where parameters are made to variables ----------------
1125
+ //define a ring Phelp via par2varRing in which the parameters are variables
1126
+
1127
+ else
1128
+ {
1129
+ // reset options
1130
+ option(none);
1131
+ // turn on options prot, mem, redSB, intStrategy if previously set
1132
+ if ( find(s_opt, "prot") )
1133
+ { option(prot); }
1134
+ if ( find(s_opt, "mem") )
1135
+ { option(mem); }
1136
+ if ( find(s_opt, "redSB") )
1137
+ { option(redSB); }
1138
+ if ( find(s_opt, "intStrategy") )
1139
+ { option(intStrategy); }
1140
+
1141
+ //first clear denominators of parameters
1142
+ if (npars_P > 0)
1143
+ {
1144
+ for( k=ncols(i); k>0; k-- )
1145
+ { i[k]=cleardenom(i[k]); }
1146
+ }
1147
+
1148
+ def Phelp = par2varRing(i)[1]; //minpoly is mapped with i
1149
+ setring Phelp;
1150
+ def i = Id[1];
1151
+ //is_homog = homog(i);
1152
+
1153
+ //If parameters are converted to ring variables, they appear in an extra
1154
+ //block. Therefore we use always hilb for this block ordering:
1155
+ if ( conversion=="fglm" )
1156
+ {
1157
+ i = stdfglm(i); //only useful for 1 parameter with minpoly
1158
+ }
1159
+ else
1160
+ {
1161
+ //if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) )//V1
1162
+ if ( algorithm=="std" || (algorithm=="stdorslimgb" )) //V2
1163
+ {
1164
+ i = stdhilb(i,"std");
1165
+ }
1166
+ //if(algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0))//V1
1167
+ if ( algorithm=="slimgb" ) //V2
1168
+ {
1169
+ i = stdhilb(i,"slimgb");
1170
+ }
1171
+ }
1172
+ }
1173
+
1174
+ //-------------------- go back to original ring ---------------------------
1175
+ //The main computation is done. However, the SB coming from a ring with
1176
+ //extra variables is in general too big. We simplify it before mapping it
1177
+ //to the basering.
1178
+
1179
+ if (p_opt) { "//simplification"; }
1180
+
1181
+ if (was_minpoly)
1182
+ {
1183
+ execute("ideal Minpoly = " + @Minpoly + ";");
1184
+ attrib(Minpoly,"isSB",1);
1185
+ i = simplify(NF(i,Minpoly),2);
1186
+ }
1187
+
1188
+ def Li = lead(i);
1189
+ setring P;
1190
+ def Li = imap(Phelp,Li);
1191
+ Li = simplify(Li,32);
1192
+ intvec vi;
1193
+ for (k=1; k<=ncols(Li); k++)
1194
+ {
1195
+ vi[k] = Li[k]==0;
1196
+ }
1197
+
1198
+ setring Phelp;
1199
+ for (k=1; k<=size(i) ;k++)
1200
+ {
1201
+ if(vi[k]==1)
1202
+ {
1203
+ i[k]=0;
1204
+ }
1205
+ }
1206
+ i = simplify(i,2);
1207
+
1208
+ setring P;
1209
+ if (p_opt) { "//imap to original ring"; }
1210
+ i = imap(Phelp,i);
1211
+ kill Phelp;
1212
+ i = simplify(i,34);
1213
+
1214
+ // clean-up time
1215
+ option(set, opt);
1216
+ if (find(s_opt, "redSB") > 0)
1217
+ {
1218
+ if (p_opt) { "//interreduction"; }
1219
+ i=interred(i);
1220
+ }
1221
+ attrib(i, "isSB", 1);
1222
+ return (i);
1223
+ }
1224
+ example
1225
+ { "EXAMPLE: "; echo=2;
1226
+ intvec opt = option(get);
1227
+ option(prot);
1228
+ ring r = 0,(a,b,c,d),dp;
1229
+ ideal i = a+b+c+d,ab+ad+bc+cd,abc+abd+acd+bcd,abcd-1;
1230
+ groebner(i);
1231
+
1232
+ ring s = 0,(a,b,c,d),lp;
1233
+ ideal i = imap(r,i);
1234
+ groebner(i,"hilb");
1235
+
1236
+ ring R = (0,a),(b,c,d),lp;
1237
+ minpoly = a2+1;
1238
+ ideal i = a+b+c+d,ab+ad+bc+cd,abc+abd+acd+bcd,d2-c2b2;
1239
+ groebner(i,"par2var","slimgb");
1240
+
1241
+ groebner(i,"fglm"); //computes a reduced standard basis
1242
+
1243
+ option(set,opt);
1244
+ }
1245
+
1246
+ //////////////////////////////////////////////////////////////////////////
1247
+
1248
+ proc res(list #)
1249
+ "@c we do texinfo here:
1250
+ @cindex resolution, computation of
1251
+ @table @code
1252
+ @item @strong{Syntax:}
1253
+ @code{res (} ideal_expression@code{,} int_expression @code{[,} any_expression @code{])}
1254
+ @*@code{res (} module_expression@code{,} int_expression @code{[,} any_expression @code{])}
1255
+ @item @strong{Type:}
1256
+ resolution
1257
+ @item @strong{Purpose:}
1258
+ computes a (possibly minimal) free resolution of an ideal or module using
1259
+ a heuristically chosen method.
1260
+ @* The second (int) argument (say @code{k}) specifies the length of
1261
+ the resolution. If it is not positive then @code{k} is assumed to be the
1262
+ number of variables of the basering.
1263
+ @* If a third argument is given, the returned resolution is minimized.
1264
+
1265
+ Depending on the input, the returned resolution is computed using the
1266
+ following methods:
1267
+ @table @asis
1268
+ @item @strong{quotient rings:}
1269
+ @code{nres} (classical method using syzygies) , see @ref{nres}.
1270
+
1271
+ @item @strong{homogeneous ideals and k=0:}
1272
+ @code{lres} (La'Scala's method), see @ref{lres}.
1273
+
1274
+ @item @strong{not minimized resolution and (homogeneous input with k not 0, or local rings):}
1275
+ @code{sres} (Schreyer's method), see @ref{sres}.
1276
+
1277
+ @item @strong{all other inputs:}
1278
+ @code{mres} (classical method), see @ref{mres}.
1279
+ @end table
1280
+ @item @strong{Note:}
1281
+ Accessing single elements of a resolution may require some partial
1282
+ computations to be finished and may therefore take some time.
1283
+ @end table
1284
+ @c ref
1285
+ See also
1286
+ @ref{betti};
1287
+ @ref{ideal};
1288
+ @ref{minres};
1289
+ @ref{module};
1290
+ @ref{mres};
1291
+ @ref{nres};
1292
+ @ref{lres};
1293
+ @ref{hres};
1294
+ @ref{sres};
1295
+ @ref{fres};
1296
+ @ref{resolution}.
1297
+ @c ref
1298
+ "
1299
+ {
1300
+ def P=basering;
1301
+ if (size(#) < 2)
1302
+ {
1303
+ ERROR("res: need at least two arguments: ideal/module, int");
1304
+ }
1305
+
1306
+ def m=#[1]; //the ideal or module
1307
+ int i=#[2]; //the length of the resolution
1308
+ if (i< 0) { i=0;}
1309
+
1310
+ string varstr_P = varstr(P);
1311
+
1312
+ int p_opt;
1313
+ string s_opt = option();
1314
+ // set p_opt, if option(prot) is set
1315
+ if (find(s_opt, "prot"))
1316
+ {
1317
+ p_opt = 1;
1318
+ }
1319
+
1320
+ if( (size(ideal(basering)) > 0) || (size(ring_list(P)) > 4) )
1321
+ {
1322
+ // the quick hack for qrings - seems to fit most needs
1323
+ // (lres is not implemented for qrings, sres is not so efficient)
1324
+ // || non-commutative, since only n/m-res are implemented for NC rings
1325
+ if (p_opt) { "using nres";}
1326
+ return(nres(m,i));
1327
+ }
1328
+
1329
+ if(homog(m)==1)
1330
+ {
1331
+ resolution re;
1332
+ if (((i==0) or (i>=nvars(basering))) && (typeof(m) != "module") && (nvars(basering)>1))
1333
+ {
1334
+ //LaScala for the homogeneous case and i == 0
1335
+ if (p_opt) { "using lres";}
1336
+ re=lres(m,i);
1337
+ if(size(#)>2)
1338
+ {
1339
+ re=minres(re);
1340
+ }
1341
+ }
1342
+ else
1343
+ {
1344
+ if(size(#)>2)
1345
+ {
1346
+ if (p_opt) { "using mres";}
1347
+ re=mres(m,i);
1348
+ }
1349
+ else
1350
+ {
1351
+ if (p_opt) { "using sres";}
1352
+ re=sres(std(m),i);
1353
+ }
1354
+ }
1355
+ return(re);
1356
+ }
1357
+
1358
+ //mres for the global non homogeneous case
1359
+ if(find(ordstr(P),"s")==0)
1360
+ {
1361
+ ring Phelp = create_ring("+string(char(P))+", "("+varstr_P+")", "(dp,C)", "+string(minpoly)+");
1362
+ def m=imap(P,m);
1363
+ if (p_opt) { "using mres in another ring";}
1364
+ list re=mres(m,i);
1365
+ setring P;
1366
+ resolution result=imap(Phelp,re);
1367
+ if (size(#) > 2) {result = minres(result);}
1368
+ return(result);
1369
+ }
1370
+
1371
+ //sres for the local case and not minimal resolution
1372
+ if(size(#)<=2)
1373
+ {
1374
+ ring Phelp = create_ring("+string(char(P))+", "("+varstr_P+")", "(ls,c)", "+string(minpoly)+");
1375
+ def m=imap(P,m);
1376
+ m=std(m);
1377
+ if (p_opt) { "using sres in another ring";}
1378
+ list re=sres(m,i);
1379
+ setring P;
1380
+ resolution result=imap(Phelp,re);
1381
+ return(result);
1382
+ }
1383
+
1384
+ //mres for the local case and minimal resolution
1385
+ ring Phelp = create_ring("+string(char(P))+", "("+varstr_P+")", "(ls,C)", "+string(minpoly)+");
1386
+ def m=imap(P,m);
1387
+ if (p_opt) { "using mres in another ring";}
1388
+ list re=mres(m,i);
1389
+ setring P;
1390
+ resolution result=imap(Phelp,re);
1391
+ result = minres(result);
1392
+ return(result);
1393
+ }
1394
+ example
1395
+ {"EXAMPLE:"; echo = 2;
1396
+ ring r=0,(x,y,z),dp;
1397
+ ideal i=xz,yz,x3-y3;
1398
+ def l=res(i,0); // homogeneous ideal: uses lres
1399
+ l;
1400
+ print(betti(l), "betti"); // input to betti may be of type resolution
1401
+ l[2]; // element access may take some time
1402
+ i=i,x+1;
1403
+ l=res(i,0); // inhomogeneous ideal: uses mres
1404
+ l;
1405
+ ring rs=0,(x,y,z),ds;
1406
+ ideal i=imap(r,i);
1407
+ def l=res(i,0); // local ring not minimized: uses sres
1408
+ l;
1409
+ res(i,0,0); // local ring and minimized: uses mres
1410
+ }
1411
+ /////////////////////////////////////////////////////////////////////////
1412
+
1413
+ proc quot (def m1,def m2,list #)
1414
+ "SYNTAX: @code{quot (} module_expression@code{,} module_expression @code{)}
1415
+ @*@code{quot (} module_expression@code{,} module_expression@code{,}
1416
+ int_expression @code{)}
1417
+ @*@code{quot (} ideal_expression@code{,} ideal_expression @code{)}
1418
+ @*@code{quot (} ideal_expression@code{,} ideal_expression@code{,}
1419
+ int_expression @code{)}
1420
+ TYPE: ideal
1421
+ SYNTAX: @code{quot (} module_expression@code{,} ideal_expression @code{)}
1422
+ TYPE: module
1423
+ PURPOSE: computes the quotient of the 1st and the 2nd argument.
1424
+ If a 3rd argument @code{n} is given the @code{n}-th method is used
1425
+ (@code{n}=1...5).
1426
+ SEE ALSO: quotient
1427
+ EXAMPLE: example quot; shows an example"
1428
+ {
1429
+ if (((typeof(m1)!="ideal") and (typeof(m1)!="module"))
1430
+ or ((typeof(m2)!="ideal") and (typeof(m2)!="module")))
1431
+ {
1432
+ "USAGE: quot(m1, m2[, n]); m1, m2 two submodules of k^s,";
1433
+ " n (optional) integer (1<= n <=5)";
1434
+ "RETURN: the quotient of m1 and m2";
1435
+ "EXAMPLE: example quot; shows an example";
1436
+ return();
1437
+ }
1438
+ if (typeof(m1)!=typeof(m2))
1439
+ {
1440
+ return(quotient(m1,m2));
1441
+ }
1442
+ if (size(#)>0)
1443
+ {
1444
+ if (typeof(#[1])=="int" )
1445
+ {
1446
+ return(quot1(m1,m2,#[1]));
1447
+ }
1448
+ }
1449
+ else
1450
+ {
1451
+ return(quot1(m1,m2,2));
1452
+ }
1453
+ }
1454
+ example
1455
+ { "EXAMPLE:"; echo = 2;
1456
+ ring r=181,(x,y,z),(c,ls);
1457
+ ideal id1=maxideal(4);
1458
+ ideal id2=x2+xyz,y2-z3y,z3+y5xz;
1459
+ option(prot);
1460
+ ideal id3=quotient(id1,id2);
1461
+ id3;
1462
+ ideal id4=quot(id1,id2,1);
1463
+ id4;
1464
+ ideal id5=quot(id1,id2,2);
1465
+ id5;
1466
+ }
1467
+
1468
+ static proc quot1 (module m1, module m2,int n)
1469
+ "USAGE: quot1(m1, m2, n); m1, m2 two submodules of k^s,
1470
+ n integer (1<= n <=5)
1471
+ RETURN: the quotient of m1 and m2
1472
+ EXAMPLE: example quot1; shows an example"
1473
+ {
1474
+ if (n==1)
1475
+ {
1476
+ return(quotient1(m1,m2));
1477
+ }
1478
+ else
1479
+ {
1480
+ if (n==2)
1481
+ {
1482
+ return(quotient2(m1,m2));
1483
+ }
1484
+ else
1485
+ {
1486
+ if (n==3)
1487
+ {
1488
+ return(quotient3(m1,m2));
1489
+ }
1490
+ else
1491
+ {
1492
+ if (n==4)
1493
+ {
1494
+ return(quotient4(m1,m2));
1495
+ }
1496
+ else
1497
+ {
1498
+ if (n==5)
1499
+ {
1500
+ return(quotient5(m1,m2));
1501
+ }
1502
+ else
1503
+ {
1504
+ return(quotient(m1,m2));
1505
+ }
1506
+ }
1507
+ }
1508
+ }
1509
+ }
1510
+ }
1511
+ example
1512
+ { "EXAMPLE:"; echo = 2;
1513
+ ring r=181,(x,y,z),(c,ls);
1514
+ ideal id1=maxideal(4);
1515
+ ideal id2=x2+xyz,y2-z3y,z3+y5xz;
1516
+ option(prot);
1517
+ ideal id6=quotient(id1,id2);
1518
+ id6;
1519
+ ideal id7=quot1(id1,id2,1);
1520
+ id7;
1521
+ ideal id8=quot1(id1,id2,2);
1522
+ id8;
1523
+ }
1524
+
1525
+ static proc quotient0(module a,module b)
1526
+ {
1527
+ module mm=b+a;
1528
+ resolution rs=lres(mm,0);
1529
+ list I=list(rs);
1530
+ matrix M=I[2];
1531
+ matrix A[1][nrows(M)]=M[1..nrows(M),1];
1532
+ ideal i=A;
1533
+ return (i);
1534
+ }
1535
+ proc quotient1(module a,module b) //17sec
1536
+ "USAGE: quotient1(m1, m2); m1, m2 two submodules of k^s,
1537
+ RETURN: the quotient of m1 and m2"
1538
+ {
1539
+ int i;
1540
+ a=std(a);
1541
+ module dummy;
1542
+ module B=NF(b,a)+dummy;
1543
+ ideal re=quotient(a,module(B[1]));
1544
+ for(i=2;i<=ncols(B);i++)
1545
+ {
1546
+ re=intersect1(re,quotient(a,module(B[i])));
1547
+ }
1548
+ return(re);
1549
+ }
1550
+ proc quotient2(module a,module b) //13sec
1551
+ "USAGE: quotient2(m1, m2); m1, m2 two submodules of k^s,
1552
+ RETURN: the quotient of m1 and m2"
1553
+ {
1554
+ a=std(a);
1555
+ module dummy;
1556
+ module bb=NF(b,a)+dummy;
1557
+ int i=ncols(bb);
1558
+ ideal re=quotient(a,module(bb[i]));
1559
+ bb[i]=0;
1560
+ module temp;
1561
+ module temp1;
1562
+ module bbb;
1563
+ int mx;
1564
+ i=i-1;
1565
+ while (1)
1566
+ {
1567
+ if (i==0) break;
1568
+ temp = a+bb*re;
1569
+ temp1 = lead(interred(temp));
1570
+ mx=ncols(a);
1571
+ if (ncols(temp1)>ncols(a))
1572
+ {
1573
+ mx=ncols(temp1);
1574
+ }
1575
+ temp1 = matrix(temp1,1,mx)-matrix(lead(a),1,mx);
1576
+ temp1 = dummy+temp1;
1577
+ if (deg(temp1[1])<0) break;
1578
+ re=intersect1(re,quotient(a,module(bb[i])));
1579
+ bb[i]=0;
1580
+ i = i-1;
1581
+ }
1582
+ return(re);
1583
+ }
1584
+ proc quotient3(module a,module b) //89sec
1585
+ "USAGE: quotient3(m1, m2); m1, m2 two submodules of k^s,
1586
+ only for global rings
1587
+ RETURN: the quotient of m1 and m2"
1588
+ {
1589
+ def @newP=basering;
1590
+ ring @newr = create_ring(ring_list(basering)[1], "("+varstr(basering)+", @t, @w)", "dp", "no_minpoly");
1591
+ module b=imap(@newP,b);
1592
+ module a=imap(@newP,a);
1593
+ int i;
1594
+ int j=ncols(b);
1595
+ vector @b;
1596
+ for(i=1;i<=j;i++)
1597
+ {
1598
+ @b=@b+@t^(i-1)*@w^(j-i+1)*b[i];
1599
+ }
1600
+ ideal re=quotient(a,module(@b));
1601
+ setring @newP;
1602
+ ideal re=imap(@newr,re);
1603
+ return(re);
1604
+ }
1605
+ proc quotient5(module a,module b) //89sec
1606
+ "USAGE: quotient5(m1, m2); m1, m2 two submodules of k^s,
1607
+ only for global rings
1608
+ RETURN: the quotient of m1 and m2"
1609
+ {
1610
+ def @newP=basering;
1611
+ ring @newr = create_ring(ring_list(basering)[1], "("+varstr(basering)+", @t)", "dp", "no_minpoly");
1612
+ module b=imap(@newP,b);
1613
+ module a=imap(@newP,a);
1614
+ int i;
1615
+ int j=ncols(b);
1616
+ vector @b;
1617
+ for(i=1;i<=j;i++)
1618
+ {
1619
+ @b=@b+@t^(i-1)*b[i];
1620
+ }
1621
+ @b=homog(@b,@w);
1622
+ ideal re=quotient(a,module(@b));
1623
+ setring @newP;
1624
+ ideal re=imap(@newr,re);
1625
+ return(re);
1626
+ }
1627
+ proc quotient4(module a,module b) //95sec
1628
+ "USAGE: quotient4(m1, m2); m1, m2 two submodules of k^s,
1629
+ only for global rings
1630
+ RETURN: the quotient of m1 and m2"
1631
+ {
1632
+ def @newP=basering;
1633
+ ring @newr = create_ring(ring_list(basering)[1], "("+varstr(basering)+", @t)", "dp", "no_minpoly");
1634
+ module b=imap(@newP,b);
1635
+ module a=imap(@newP,a);
1636
+ int i;
1637
+ vector @b=b[1];
1638
+ for(i=2;i<=ncols(b);i++)
1639
+ {
1640
+ @b=@b+@t^(i-1)*b[i];
1641
+ }
1642
+ matrix sy=modulo(@b,a);
1643
+ ideal re=sy;
1644
+ setring @newP;
1645
+ ideal re=imap(@newr,re);
1646
+ return(re);
1647
+ }
1648
+ static proc intersect1(ideal i,ideal j)
1649
+ {
1650
+ def R=basering;
1651
+ ring gnir = create_ring(ring_list(basering)[1], "("+varstr(basering)+",@t)", "(C,dp)", "no_minpoly");
1652
+ ideal i=var(nvars(basering))*imap(R,i)+(var(nvars(basering))-1)*imap(R,j);
1653
+ ideal j=eliminate(i,var(nvars(basering)));
1654
+ setring R;
1655
+ map phi=gnir,maxideal(1);
1656
+ return(phi(j));
1657
+ }
1658
+
1659
+ //////////////////////////////////////////////////////////////////
1660
+ ///
1661
+ /// sprintf, fprintf printf
1662
+ ///
1663
+ proc sprintf(string fmt, list #)
1664
+ "SYNTAX: @code{sprintf (} string_expression @code{[,} any_expressions
1665
+ @code{] )}
1666
+ RETURN: string
1667
+ PURPOSE: @code{sprintf(fmt,...);} performs output formatting. The first
1668
+ argument is a format control string. Additional arguments may be
1669
+ required, depending on the content of the control string. A series
1670
+ of output characters is generated as directed by the control string;
1671
+ these characters are returned as a string. @*
1672
+ The control string @code{fmt} is simply text to be copied,
1673
+ except that the string may contain conversion specifications.@*
1674
+ Type @code{help print;} for a listing of valid conversion
1675
+ specifications. As an addition to the conversions of @code{print},
1676
+ the @code{%n} and @code{%2} conversion specification does not
1677
+ consume an additional argument, but simply generates a newline
1678
+ character.
1679
+ NOTE: If one of the additional arguments is a list, then it should be
1680
+ wrapped in an additional @code{list()} command, since passing a list
1681
+ as an argument flattens the list by one level.
1682
+ SEE ALSO: fprintf, printf, print, string
1683
+ EXAMPLE : example sprintf; shows an example
1684
+ "
1685
+ {
1686
+ int sfmt = size(fmt);
1687
+ if (sfmt <= 1)
1688
+ {
1689
+ return (fmt);
1690
+ }
1691
+ int next, l, nnext;
1692
+ string ret;
1693
+ list formats = "%l", "%s", "%2l", "%2s", "%t", "%;", "%p", "%b", "%n", "%2";
1694
+ while (1)
1695
+ {
1696
+ if (size(#) <= 0)
1697
+ {
1698
+ return (ret + fmt);
1699
+ }
1700
+ nnext = 0;
1701
+ while (nnext < sfmt)
1702
+ {
1703
+ nnext = find(fmt, "%", nnext + 1);
1704
+ if (nnext == 0)
1705
+ {
1706
+ next = 0;
1707
+ break;
1708
+ }
1709
+ l = 1;
1710
+ while (l <= size(formats))
1711
+ {
1712
+ next = find(fmt, formats[l], nnext);
1713
+ if (next == nnext) break;
1714
+ l++;
1715
+ }
1716
+ if (next == nnext) break;
1717
+ }
1718
+ if (next == 0)
1719
+ {
1720
+ return (ret + fmt);
1721
+ }
1722
+ if (formats[l] != "%2" && formats[l] != "%n")
1723
+ {
1724
+ ret = ret + fmt[1, next - 1] + print(#[1], formats[l]);
1725
+ # = delete(#, 1);
1726
+ }
1727
+ else
1728
+ {
1729
+ ret = ret + fmt[1, next - 1] + print("", "%2s");
1730
+ }
1731
+ if (size(fmt) <= (next + size(formats[l]) - 1))
1732
+ {
1733
+ return (ret);
1734
+ }
1735
+ fmt = fmt[next + size(formats[l]), size(fmt)-next-size(formats[l]) + 1];
1736
+ }
1737
+ }
1738
+ example
1739
+ { "EXAMPLE:"; echo=2;
1740
+ ring r=0,(x,y,z),dp;
1741
+ module m=[1,y],[0,x+z];
1742
+ intmat M=betti(mres(m,0));
1743
+ list l = r, m, M;
1744
+ string s = sprintf("s:%s,%n l:%l", 1, 2); s;
1745
+ s = sprintf("s:%n%s", l); s;
1746
+ s = sprintf("s:%2%s", list(l)); s;
1747
+ s = sprintf("2l:%n%2l", list(l)); s;
1748
+ s = sprintf("%p", list(l)); s;
1749
+ s = sprintf("%;", list(l)); s;
1750
+ s = sprintf("%b", M); s;
1751
+ }
1752
+
1753
+ proc printf(string fmt, list #)
1754
+ "SYNTAX: @code{printf (} string_expression @code{[,} any_expressions@code{] )}
1755
+ RETURN: none
1756
+ PURPOSE: @code{printf(fmt,...);} performs output formatting. The first
1757
+ argument is a format control string. Additional arguments may be
1758
+ required, depending on the content of the control string. A series
1759
+ of output characters is generated as directed by the control string;
1760
+ these characters are displayed (i.e., printed to standard out). @*
1761
+ The control string @code{fmt} is simply text to be copied, except
1762
+ that the string may contain conversion specifications. @*
1763
+ Type @code{help print;} for a listing of valid conversion
1764
+ specifications. As an addition to the conversions of @code{print},
1765
+ the @code{%n} and @code{%2} conversion specification does not
1766
+ consume an additional argument, but simply generates a newline
1767
+ character.
1768
+ NOTE: If one of the additional arguments is a list, then it should be
1769
+ enclosed once more into a @code{list()} command, since passing a
1770
+ list as an argument flattens the list by one level.
1771
+ SEE ALSO: sprintf, fprintf, print, string
1772
+ EXAMPLE : example printf; shows an example
1773
+ "
1774
+ {
1775
+ write("", sprintf(fmt, #));
1776
+ }
1777
+ example
1778
+ { "EXAMPLE:"; echo=2;
1779
+ ring r=0,(x,y,z),dp;
1780
+ module m=[1,y],[0,x+z];
1781
+ intmat M=betti(mres(m,0));
1782
+ list l=r,m,matrix(M);
1783
+ printf("s:%s,l:%l",1,2);
1784
+ printf("s:%s",l);
1785
+ printf("s:%s",list(l));
1786
+ printf("2l:%2l",list(l));
1787
+ printf("%p",matrix(M));
1788
+ printf("%;",matrix(M));
1789
+ printf("%b",M);
1790
+ }
1791
+
1792
+
1793
+ proc fprintf(link l, string fmt, list #)
1794
+ "SYNTAX: @code{fprintf (} link_expression@code{,} string_expression @code{[,}
1795
+ any_expressions@code{] )}
1796
+ RETURN: none
1797
+ PURPOSE: @code{fprintf(l,fmt,...);} performs output formatting.
1798
+ The second argument is a format control string. Additional
1799
+ arguments may be required, depending on the content of the
1800
+ control string. A series of output characters is generated as
1801
+ directed by the control string; these characters are
1802
+ written to the link l.
1803
+ The control string @code{fmt} is simply text to be copied, except
1804
+ that the string may contain conversion specifications.@*
1805
+ Type @code{help print;} for a listing of valid conversion
1806
+ specifications. As an addition to the conversions of @code{print},
1807
+ the @code{%n} and @code{%2} conversion specification does not
1808
+ consume an additional argument, but simply generates a newline
1809
+ character.
1810
+ NOTE: If one of the additional arguments is a list, then it should be
1811
+ enclosed once more into a @code{list()} command, since passing
1812
+ a list as an argument flattens the list by one level.
1813
+ SEE ALSO: sprintf, printf, print, string
1814
+ EXAMPLE : example fprintf; shows an example
1815
+ "
1816
+ {
1817
+ write(l, sprintf(fmt, #));
1818
+ }
1819
+ example
1820
+ { "EXAMPLE:"; echo=2;
1821
+ ring r=0,(x,y,z),dp;
1822
+ module m=[1,y],[0,x+z];
1823
+ intmat M=betti(mres(m,0));
1824
+ list l=r,m,M;
1825
+ link li=""; // link to stdout
1826
+ fprintf(li,"s:%s,l:%l",1,2);
1827
+ fprintf(li,"s:%s",l);
1828
+ fprintf(li,"s:%s",list(l));
1829
+ fprintf(li,"2l:%2l",list(l));
1830
+ fprintf(li,"%p",list(l));
1831
+ fprintf(li,"%;",list(l));
1832
+ fprintf(li,"%b",M);
1833
+ }
1834
+
1835
+ //////////////////////////////////////////////////////////////////////////
1836
+
1837
+ /*
1838
+ proc minres(list #)
1839
+ {
1840
+ if (size(#) == 2)
1841
+ {
1842
+ if (typeof(#[1]) == "ideal" || typeof(#[1]) == "module")
1843
+ {
1844
+ if (typeof(#[2] == "int"))
1845
+ {
1846
+ return (res(#[1],#[2],1));
1847
+ }
1848
+ }
1849
+ }
1850
+
1851
+ if (typeof(#[1]) == "resolution")
1852
+ {
1853
+ return minimizeres(#[1]);
1854
+ }
1855
+ else
1856
+ {
1857
+ return minimizeres(#);
1858
+ }
1859
+
1860
+ }
1861
+ */
1862
+ ///////////////////////////////////////////////////////////////////////////////
1863
+
1864
+ proc weightKB(def stc, int dd, list wim)
1865
+ "SYNTAX: @code{weightKB (} module_expression@code{,} int_expression @code{,}
1866
+ list_expression @code{)}@*
1867
+ @code{weightKB (} ideal_expression@code{,} int_expression@code{,}
1868
+ list_expression @code{)}
1869
+ RETURN: the same as the input type of the first argument
1870
+ PURPOSE: If @code{I,d,wim} denotes the three arguments then weightKB
1871
+ computes the weighted degree- @code{d} part of a vector space basis
1872
+ (consisting of monomials) of the quotient ring, resp. of the
1873
+ quotient module, modulo @code{I} w.r.t. weights given by @code{wim}
1874
+ The information about the weights is given as a list of two intvec:
1875
+ @code{wim[1]} weights for all variables (positive),
1876
+ @code{wim[2]} weights for the module generators.
1877
+ NOTE: This is a generalization of the command @code{kbase} with the same
1878
+ first two arguments.
1879
+ SEE ALSO: kbase
1880
+ EXAMPLE: example weightKB; shows an example
1881
+ "
1882
+ {
1883
+ if(checkww(wim)){ERROR("wrong weights");}
1884
+ kbclass();
1885
+ wwtop=wim[1];
1886
+ stc=interred(lead(stc));
1887
+ if(typeof(stc)=="ideal")
1888
+ {
1889
+ stdtop=stc;
1890
+ ideal out=widkbase(dd);
1891
+ delkbclass();
1892
+ out=simplify(out,2); // delete 0
1893
+ return(out);
1894
+ }
1895
+ list mbase=kbprepare(stc);
1896
+ module mout;
1897
+ int im,ii;
1898
+ if(size(wim)>1){mmtop=wim[2];}
1899
+ else{mmtop=0;}
1900
+ for(im=size(mbase);im>0;im--)
1901
+ {
1902
+ stdtop=mbase[im];
1903
+ if(im>size(mmtop)){ii=dd;}
1904
+ else{ii=dd-mmtop[im];}
1905
+ mout=mout+widkbase(ii)*gen(im);
1906
+ }
1907
+ delkbclass();
1908
+ mout=simplify(mout,2); // delete 0
1909
+ return(mout);
1910
+ }
1911
+ example
1912
+ { "EXAMPLE:"; echo=2;
1913
+ ring R=0, (x,y), wp(1,2);
1914
+ weightKB(ideal(0),3,intvec(1,2));
1915
+ }
1916
+
1917
+ ///////////////////////////////////////////////////////////////////////////////
1918
+
1919
+ proc datetime()
1920
+ "SYNTAX: @code{datetime ()}
1921
+ RETURN: string
1922
+ PURPOSE: return the current date and time as a string
1923
+ EXAMPLE: example datetime; shows an example
1924
+ "
1925
+ {
1926
+ return(read("|: date"));
1927
+ }
1928
+ example
1929
+ { "EXAMPLE:"; echo=2;
1930
+ datetime();
1931
+ }
1932
+
1933
+ ///////////////////////////////////////////////////////////////////////////////
1934
+ // construct global values
1935
+ static proc kbclass()
1936
+ {
1937
+ intvec wwtop,mmtop;
1938
+ export (wwtop,mmtop);
1939
+ ideal stdtop,kbtop;
1940
+ export (stdtop,kbtop);
1941
+ }
1942
+ // delete global values
1943
+ static proc delkbclass()
1944
+ {
1945
+ kill wwtop,mmtop;
1946
+ kill stdtop,kbtop;
1947
+ }
1948
+ // select parts of the modul
1949
+ static proc kbprepare(module mstc)
1950
+ {
1951
+ list rr;
1952
+ ideal kk;
1953
+ int i1,i2;
1954
+ mstc=transpose(mstc);
1955
+ for(i1=ncols(mstc);i1>0;i1--)
1956
+ {
1957
+ kk=0;
1958
+ for(i2=nrows(mstc[i1]);i2>0;i2--)
1959
+ {
1960
+ kk=kk+mstc[i1][i2];
1961
+ }
1962
+ rr[i1]=kk;
1963
+ }
1964
+ return(rr);
1965
+ }
1966
+ // check for weights
1967
+ static proc checkww(list vv)
1968
+ {
1969
+ if(typeof(vv[1])!="intvec"){return(1);}
1970
+ intvec ww=vv[1];
1971
+ int mv=nvars(basering);
1972
+ if(size(ww)<mv){return(1);}
1973
+ while(mv>0)
1974
+ {
1975
+ if(ww[mv]<=0){return(1);}
1976
+ mv--;
1977
+ }
1978
+ if(size(vv)>1)
1979
+ {
1980
+ if(typeof(vv[2])!="intvec"){return(1);}
1981
+ }
1982
+ return(0);
1983
+ }
1984
+ ///////////////////////////////////////////////////////
1985
+ // The "Caller" for ideals
1986
+ // dd - the degree of the result
1987
+ static proc widkbase(int dd)
1988
+ {
1989
+ if((size(stdtop)==1)&&(deg(stdtop[1])==0)){return(0);}
1990
+ if(dd<=0)
1991
+ {
1992
+ if(dd<0){return(0);}
1993
+ else{return(1);}
1994
+ }
1995
+ int m1,m2;
1996
+ m1=nvars(basering);
1997
+ while(wwtop[m1]>dd)
1998
+ {
1999
+ m1--;
2000
+ if(m1==0){return(0);}
2001
+ }
2002
+ attrib(stdtop,"isSB",1);
2003
+ poly mo=1;
2004
+ if(m1==1)
2005
+ {
2006
+ m2=dd div wwtop[1];
2007
+ if((m2*wwtop[1])==dd)
2008
+ {
2009
+ mo=var(1)^m2;
2010
+ if(reduce(mo,stdtop)==mo){return(mo);}
2011
+ else{return(0);}
2012
+ }
2013
+ }
2014
+ kbtop=0;
2015
+ m2=dd;
2016
+ weightmon(m1-1,m2,mo);
2017
+ while(m2>=wwtop[m1])
2018
+ {
2019
+ m2=m2-wwtop[m1];
2020
+ mo=var(m1)*mo;
2021
+ if(m2==0)
2022
+ {
2023
+ if((mo!=0) and (reduce(mo,stdtop)==mo))
2024
+ {
2025
+ kbtop[ncols(kbtop)+1]=mo;
2026
+ return(kbtop);
2027
+ }
2028
+ }
2029
+ weightmon(m1-1,m2,mo);
2030
+ }
2031
+ return(kbtop);
2032
+ }
2033
+ /////////////////////////////////////////////////////////
2034
+ // the recursive procedure
2035
+ // va - number of the variable
2036
+ // drest - rest of the degree
2037
+ // mm - the candidate
2038
+ static proc weightmon(int va, int drest, poly mm)
2039
+ {
2040
+ if(va==0){return();}
2041
+ while(wwtop[va]>drest)
2042
+ {
2043
+ va--;
2044
+ if(va==0){return();}
2045
+ }
2046
+ int m2;
2047
+ if(va==1)
2048
+ {
2049
+ m2=drest div wwtop[1];
2050
+ if((m2*wwtop[1])==drest)
2051
+ {
2052
+ mm=var(1)^m2*mm;
2053
+ if ((mm!=0) and (reduce(mm,stdtop)==mm))
2054
+ {
2055
+ kbtop[ncols(kbtop)+1]=mm;
2056
+ }
2057
+ }
2058
+ return();
2059
+ }
2060
+ m2=drest;
2061
+ if ((mm!=0) and (reduce(mm,stdtop)==mm))
2062
+ {
2063
+ weightmon(va-1,m2,mm);
2064
+ }
2065
+ while(m2>=wwtop[va])
2066
+ {
2067
+ m2=m2-wwtop[va];
2068
+ mm=var(va)*mm;
2069
+ if(m2==0)
2070
+ {
2071
+ if ((mm!=0) and (reduce(mm,stdtop)==mm))
2072
+ {
2073
+ kbtop[ncols(kbtop)+1]=mm;
2074
+ return();
2075
+ }
2076
+ }
2077
+ if ((mm!=0) and (reduce(mm,stdtop)==mm))
2078
+ {
2079
+ weightmon(va-1,m2,mm);
2080
+ }
2081
+ }
2082
+ return();
2083
+ }
2084
+ example
2085
+ { "EXAMPLE:"; echo=2;
2086
+ ring r=0,(x,y,z),dp;
2087
+ ideal i = x6,y4,xyz;
2088
+ intvec w = 2,3,6;
2089
+ weightKB(i, 12, list(w));
2090
+ }
2091
+
2092
+ ///////////////////////////////////////////////////////////////////////////////
2093
+ proc max(def i,list #)
2094
+ "SYNTAX: max (i_1, ..., i_k)
2095
+ TYPE: same as type of i_1, ..., i_k resp.
2096
+ PURPOSE: returns the maximum for any arguments of a type
2097
+ for which '>' is defined
2098
+ SEE ALSO: min
2099
+ EXAMPLE: example max; shows an example"
2100
+ {
2101
+ def maximum = i;
2102
+ for (int j=1; j<=size(#); j++)
2103
+ {
2104
+ if(#[j]>maximum)
2105
+ {
2106
+ maximum = #[j];
2107
+ }
2108
+ }
2109
+ return(maximum);
2110
+ }
2111
+ example
2112
+ { "EXAMPLE:"; echo=2;
2113
+ // biggest int
2114
+ max(2,3);
2115
+ max(1,4,3);
2116
+ // lexicographically biggest intvec
2117
+ max(intvec(1,2),intvec(0,1),intvec(1,1));
2118
+ // polynopmial with biggest leading monomial
2119
+ ring r = 0,x,dp;
2120
+ max(x+1,x2+x);
2121
+ }
2122
+ ///////////////////////////////////////////////////////////////////////////////
2123
+ proc min(def i,list #)
2124
+ "SYNTAX: min (i_1, ..., i_k)
2125
+ TYPE: same as type of i_1, ..., i_k resp.
2126
+ PURPOSE: returns the minimum for any arguments of a type
2127
+ for which '>' is defined
2128
+ SEE ALSO: max
2129
+ EXAMPLE: example min; shows an example"
2130
+ {
2131
+ def minimum = i;
2132
+ for (int j=1; j<=size(#); j++)
2133
+ {
2134
+ if(#[j]<minimum)
2135
+ {
2136
+ minimum = #[j];
2137
+ }
2138
+ }
2139
+ return(minimum);
2140
+ }
2141
+ example
2142
+ { "EXAMPLE:"; echo=2;
2143
+ // smallest int
2144
+ min(2,3);
2145
+ min(1,4,3);
2146
+ // lexicographically smallest intvec
2147
+ min(intvec(1,2),intvec(0,1),intvec(1,1));
2148
+ // polynopmial with smallest leading monomial
2149
+ ring r = 0,x,dp;
2150
+ min(x+1,x2+x);
2151
+ }
2152
+
2153
+
2154
+ ///////////////////////////////////////////////////////////////////////////////
2155
+ /*
2156
+ Versuche:
2157
+ ///////////////////////////////////////////////////////////////////////////////
2158
+ proc downsizeSB (def I, list #)
2159
+ "USAGE: downsizeSB(I [,l]); I ideal, l list of integers [default: l=0]
2160
+ RETURN: intvec, say v, with v[j] either 1 or 0. We have v[j]=1 if
2161
+ leadmonom(I[j]) is divisible by some leadmonom(I[k]) or if
2162
+ leadmonom(i[j]) == leadmonom(i[k]) and l[j] >= l[k], with k!=j.
2163
+ PURPOSE: The procedure is applied in a situation where the standard basis
2164
+ computation in the basering R is done via a conversion through an
2165
+ overring Phelp with additional variables and where a direct
2166
+ imap from Phelp to R is too expensive.
2167
+ Assume Phelp is created by the procedure @code{par2varRing} or
2168
+ @code{hilbRing} and IPhelp is a SB in Phelp [ with l[j]=
2169
+ length(IPhelp(j)) or any other integer reflecting the complexity
2170
+ of a IPhelp[j] ]. Let I = lead(IPhelp) mapped to R and compute
2171
+ v = downsizeSB(imap(Phelp,I),l) in R. Then, if Ihelp[j] is deleted
2172
+ for all j with v[j]=1, we can apply imap to the remaining generators
2173
+ of Ihelp and still get SB in R (in general not minimal).
2174
+ EXAMPLE: example downsizeSB; shows an example"
2175
+ {
2176
+ int k,j;
2177
+ intvec v,l;
2178
+ poly M,N,W;
2179
+ int c=size(I);
2180
+ if( size(#) != 0 )
2181
+ {
2182
+ if ( typeof(#[1]) == "intvec" )
2183
+ {
2184
+ l = #[1];
2185
+ }
2186
+ else
2187
+ {
2188
+ ERROR("// 2nd argument must be an intvec");
2189
+ }
2190
+ }
2191
+
2192
+ l[c+1]=0;
2193
+ v[c]=0;
2194
+
2195
+ j=0;
2196
+ while(j<c-1)
2197
+ {
2198
+ j++;
2199
+ M = leadmonom(I[j]);
2200
+ if( M != 0 )
2201
+ {
2202
+ for( k=j+1; k<=c; k++ )
2203
+ {
2204
+ N = leadmonom(I[k]);
2205
+ if( N != 0 )
2206
+ {
2207
+ if( (M==N) && (l[j]>l[k]) )
2208
+ {
2209
+ I[j]=0;
2210
+ v[j]=1;
2211
+ break;
2212
+ }
2213
+ if( (M==N) && (l[j]<=l[k]) || N/M != 0 )
2214
+ {
2215
+ I[k]=0;
2216
+ v[k]=1;
2217
+ }
2218
+ }
2219
+ }
2220
+ }
2221
+ }
2222
+ return(v);
2223
+ }
2224
+ example
2225
+ { "EXAMPLE:"; echo = 2;
2226
+ ring r = 0,(x,y,z,t),(dp(3),dp);
2227
+ ideal i = x+y+z+t,xy+yz+xt+zt,xyz+xyt+xzt+yzt,xyzt-t4;
2228
+ ideal Id = std(i);
2229
+ ideal I = lead(Id); I;
2230
+ ring S = (0,t),(x,y,z),dp;
2231
+ downsizeSB(imap(r,I));
2232
+ //Id[5] can be deleted, we still have a SB of i in the ring S
2233
+
2234
+ ring R = (0,x),(y,z,u),lp;
2235
+ ideal i = x+y+z+u,xy+xu+yz+zu,xyz+xyu+xzu+yzu,xyzu-1;
2236
+ def Phelp = par2varRing()[1];
2237
+ setring Phelp;
2238
+ ideal IPhelp = std(imap(R,i));
2239
+ ideal I = lead(IPhelp);
2240
+ setring R;
2241
+ ideal I = imap(Phelp,I); I;
2242
+ intvec v = downsizeSB(I); v;
2243
+ }
2244
+ ///////////////////////////////////////////////////////////////////////////
2245
+ // PROBLEM: Die Prozedur funktioniert nur fuer Ringe die global bekannt
2246
+ // sind, also interaktiv, aber nicht aus einer Prozedur.
2247
+ // Z.B. funktioniert example imapDownsize; nicht
2248
+
2249
+ proc imapDownsize (string R, string I)
2250
+ "SYNTAX: @code{imapDownsize (} string @code{,} string @code{)} *@
2251
+ First string must be the string of the name of a ring, second
2252
+ string must be the string of the name of an object in the ring.
2253
+ TYPE: same type as the object with name the second string
2254
+ PURPOSE: maps the object given by the second string to the basering.
2255
+ If R resp. I are the first resp. second string, then
2256
+ imapDownsize(R,I) is equivalent to simplify(imap(`R`,`I`),34).
2257
+ NOTE: imapDownsize is usually faster than imap if `I` is large and if
2258
+ simplify has a great effect, since the procedure maps only those
2259
+ generators from `I` which are not killed by simplify( - ,34).
2260
+ This is useful if `I` is a standard bases for a block ordering of
2261
+ `R` and if some variables from the last block in `R` are mapped
2262
+ to parameters. Then the returned result is a standard basis in
2263
+ the basering.
2264
+ SEE ALSO: imap, fetch, map
2265
+ EXAMPLE: example imapDownsize; shows an example"
2266
+ {
2267
+ def BR = basering;
2268
+ int k;
2269
+
2270
+ setring `R`;
2271
+ def @leadI@ = lead(`I`);
2272
+ int s = ncols(@leadI@);
2273
+ setring BR;
2274
+ ideal @leadI@ = simplify(imap(`R`,@leadI@),32);
2275
+ intvec vi;
2276
+ for (k=1; k<=s; k++)
2277
+ {
2278
+ vi[k] = @leadI@[k]==0;
2279
+ }
2280
+ kill @leadI@;
2281
+
2282
+ setring `R`;
2283
+ kill @leadI@;
2284
+ for (k=1; k<=s; k++)
2285
+ {
2286
+ if( vi[k]==1 )
2287
+ {
2288
+ `I`[k]=0;
2289
+ }
2290
+ }
2291
+ `I` = simplify(`I`,2);
2292
+
2293
+ setring BR;
2294
+ return(imap(`R`,`I`));
2295
+ }
2296
+ example
2297
+ { "EXAMPLE:"; echo = 2;
2298
+ ring r = 0,(x,y,z,t),(dp(3),dp);
2299
+ ideal i = x+y+z+t,xy+yz+xt+zt,xyz+xyt+xzt+yzt,xyzt-1;
2300
+ i = std(i); i;
2301
+
2302
+ ring s = (0,t),(x,y,z),dp;
2303
+ imapDownsize("r","i"); //i[5] is omitted since lead(i[2]) | lead(i[5])
2304
+ }
2305
+ ///////////////////////////////////////////////////////////////////////////////
2306
+ //die folgende proc war fuer groebner mit fglm vorgesehen, ist aber zu teuer.
2307
+ //Um die projektive Dimension korrekt zu berechnen, muss man aber teuer
2308
+ //voerher ein SB bzgl. einer Gradordnung berechnen und dann homogenisieren.
2309
+ //Sonst koennen hoeherdimensionale Komponenten in Unendlich entstehen
2310
+
2311
+ proc projInvariants(ideal i,list #)
2312
+ "SYNTAX: @code{projInvariants (} ideal_expression @code{)} @*
2313
+ @code{projInvariants (} ideal_expression@code{,} list of string_expres sions@code{)}
2314
+ TYPE: list, say L, with L[1] and L[2] of type int and L[3] of type bigintvec
2315
+ PURPOSE: Computes the (projective) dimension (L[1]), degree (L[2]) and the
2316
+ first Hilbert series (L[3], as bigintvec) of the homogenized ideal
2317
+ in the ring given by the procedure @code{hilbRing} with global
2318
+ ordering dp (resp. wp if the variables have weights >1)
2319
+ If an argument of type string @code{\"std\"} resp. @code{\"slimgb\"}
2320
+ is given, the standard basis computatuion uses @code{std} or
2321
+ @code{slimgb}, otherwise a heuristically chosen method (default)
2322
+ NOTE: Homogenized means weighted homogenized with respect to the weights
2323
+ w[i] of the variables var(i) of the basering. The returned dimension,
2324
+ degree and Hilbertseries are the respective invariants of the
2325
+ projective variety defined by the homogenized ideal. The dimension
2326
+ is equal to the (affine) dimension of the ideal in the basering
2327
+ (degree and Hilbert series make only sense for homogeneous ideals).
2328
+ SEE ALSO: dim, dmult, hilb
2329
+ KEYWORDS: dimension, degree, Hilbert function
2330
+ EXAMPLE: example projInvariants; shows an example"
2331
+ {
2332
+ def P = basering;
2333
+ int p_opt;
2334
+ string s_opt = option();
2335
+ if (find(option(), "prot")) { p_opt = 1; }
2336
+
2337
+ //---------------- check method and clear denomintors --------------------
2338
+ int k;
2339
+ string method;
2340
+ for (k=1; k<=size(#); k++)
2341
+ {
2342
+ if (typeof(#[k]) == "string")
2343
+ {
2344
+ method = method + "," + #[k];
2345
+ }
2346
+ }
2347
+
2348
+ if (npars(P) > 0) //clear denominators of parameters
2349
+ {
2350
+ for( k=ncols(i); k>0; k-- )
2351
+ {
2352
+ i[k]=cleardenom(i[k]);
2353
+ }
2354
+ }
2355
+
2356
+ //------------------------ change to hilbRing ----------------------------
2357
+ list hiRi = hilbRing(i);
2358
+ intvec W = hiRi[2];
2359
+ def Philb = hiRi[1]; //note: Philb is no qring and the predefined
2360
+ setring Philb; //ideal Id[1] in Philb is homogeneous
2361
+ int di, de; //for dimension, degree
2362
+ bigintvec hi; //for hilbert series
2363
+
2364
+ //-------- compute Hilbert function of homogenized ideal in Philb ---------
2365
+ //Philb has only 1 block. There are three cases
2366
+
2367
+ string algorithm; //possibilities: std, slimgb, stdorslimgb
2368
+ //define algorithm:
2369
+ if( find(method,"std") && !find(method,"slimgb") )
2370
+ {
2371
+ algorithm = "std";
2372
+ }
2373
+ if( find(method,"slimgb") && !find(method,"std") )
2374
+ {
2375
+ algorithm = "slimgb";
2376
+ }
2377
+ if( find(method,"std") && find(method,"slimgb") ||
2378
+ (!find(method,"std") && !find(method,"slimgb")) )
2379
+ {
2380
+ algorithm = "stdorslimgb";
2381
+ }
2382
+
2383
+ if ( algorithm=="std" || ( algorithm=="stdorslimgb" && char(P)>0 ) )
2384
+ {
2385
+ if (p_opt) {"std in ring " + string(Philb);}
2386
+ Id[1] = std(Id[1]);
2387
+ di = dim(Id[1])-1;
2388
+ de = mult(Id[1]);
2389
+ hi = hilb( Id[1],1,W );
2390
+ }
2391
+ if ( algorithm=="slimgb" || ( algorithm=="stdorslimgb" && char(P)==0 ) )
2392
+ {
2393
+ if (p_opt) {"slimgb in ring " + string(Philb);}
2394
+ Id[1] = slimgb(Id[1]);
2395
+ di = dim( Id[1] );
2396
+ if (di > -1)
2397
+ {
2398
+ di = di-1;
2399
+ }
2400
+ de = mult( Id[1] );
2401
+ hi = hilb( Id[1],1,W );
2402
+ }
2403
+ kill Philb;
2404
+ list L = di,de,hi;
2405
+ return(L);
2406
+ }
2407
+ example
2408
+ { "EXAMPLE:"; echo = 2;
2409
+ ring r = 32003,(x,y,z),lp;
2410
+ ideal i = y2-xz,x2-z;
2411
+ projInvariants(i);
2412
+
2413
+ ring R = (0),(x,y,z,u,v),lp;
2414
+ //minpoly = x2+1;
2415
+ ideal i = x2+1,x2+y+z+u+v,xyzuv-1;
2416
+ projInvariants(i);
2417
+ qring S =std(x2+1);
2418
+ ideal i = imap(R,i);
2419
+ projInvariants(i);
2420
+ }
2421
+
2422
+ */
2423
+ ///////////////////////////////////////////////////////////////////////////////
2424
+ // EXAMPLES
2425
+ ///////////////////////////////////////////////////////////////////////////////
2426
+ /*
2427
+ example stdfglm;
2428
+ example stdhilb;
2429
+ example groebner;
2430
+ example res;
2431
+ example sprintf;
2432
+ example fprintf;
2433
+ example printf;
2434
+ example weightKB;
2435
+ example qslimgb;
2436
+ example par2varRing;
2437
+ */
2438
+ static proc mod_init()
2439
+ {
2440
+ if(!defined(Singmathic))
2441
+ {
2442
+ load("singmathic.so","try");
2443
+ }
2444
+ //int pagelength=24;
2445
+ //exportto(Top,pagelength);
2446
+ }
2447
+
2448
+ ///////////////////////////////////////////////////////////////////////////////
2449
+ // replacement for ring declarations via execute()
2450
+ ///////////////////////////////////////////////////////////////////////////////
2451
+
2452
+ /*
2453
+ * parses
2454
+ * "(v1,v2,v3,v4,v5)" to list("v1", "v2", "v3", "v4", "v5"),
2455
+ * "(dp(3), a(1,2,3), ds(3))" to list("dp(3)", "a(1,2,3)", "ds(3)"), and
2456
+ * "(1,2,3,4)" to list("1", "2", "3", "4")
2457
+ */
2458
+ static proc tuple_to_tokens(string s)
2459
+ {
2460
+ list L;
2461
+ int index = 1;
2462
+ int curr = 2;
2463
+ while (s[curr] == " ")
2464
+ {
2465
+ curr++;
2466
+ }
2467
+ int next = find(s, ",", curr+1);
2468
+ int b = find(s, "(", curr+1);
2469
+ if (b != 0 && b < next)
2470
+ {
2471
+ next = find(s, ",", find(s, ")", b+1)+1);
2472
+ }
2473
+ while (next != 0)
2474
+ {
2475
+ L[index] = string(s[curr, next-curr]);
2476
+ index++;
2477
+ curr = next+1;
2478
+ while (s[curr] == " ")
2479
+ {
2480
+ curr++;
2481
+ }
2482
+ next = find(s, ",", curr+1);
2483
+ b = find(s, "(", curr+1);
2484
+ if (b != 0 && b < next)
2485
+ {
2486
+ next = find(s, ",", find(s, ")", b+1)+1);
2487
+ }
2488
+ }
2489
+ L[index] = string(s[curr, size(s)-curr]);
2490
+ return(L);
2491
+ }
2492
+
2493
+ /*
2494
+ * parses
2495
+ * "0" and "(0)" to 0,
2496
+ * "32003" and "(32003)" to 32003, and
2497
+ * "(32003,a,b,c)" to
2498
+ * list(32003, list("a", "b", "c"), list(list("lp", 1:3)), ideal(0))
2499
+ */
2500
+ static proc parse_L1(string l1)
2501
+ {
2502
+ list tokens;
2503
+ if (l1[1] != "(")
2504
+ {
2505
+ tokens[1] = l1;
2506
+ }
2507
+ else
2508
+ {
2509
+ tokens = tuple_to_tokens(l1);
2510
+ }
2511
+ if (tokens[1] == "real")
2512
+ {
2513
+ int p1 = 6;
2514
+ int p2 = 6;
2515
+ if (size(tokens) > 1)
2516
+ {
2517
+ p1 = int(tokens[2]);
2518
+ p2 = p1;
2519
+ }
2520
+ if (size(tokens) > 2)
2521
+ {
2522
+ p2 = int(tokens[3]);
2523
+ }
2524
+ return(list(0, list(p1, p2)));
2525
+ }
2526
+ if (tokens[1] == "complex")
2527
+ {
2528
+ int p1 = 6;
2529
+ int p2 = 6;
2530
+ string imag_unit = "i";
2531
+ if (int(tokens[size(tokens)]) == 0) // not an integer
2532
+ {
2533
+ imag_unit = tokens[size(tokens)];
2534
+ tokens = delete(tokens, size(tokens));
2535
+ }
2536
+ if (size(tokens) > 1)
2537
+ {
2538
+ p1 = int(tokens[2]);
2539
+ p2 = p1;
2540
+ }
2541
+ if (size(tokens) > 2)
2542
+ {
2543
+ p2 = int(tokens[3]);
2544
+ }
2545
+ return(list(0, list(p1, p2), imag_unit));
2546
+ }
2547
+ if (size(tokens) == 1)
2548
+ {
2549
+ return(int(tokens[1]));
2550
+ }
2551
+ list L = int(tokens[1]);
2552
+ L[2] = list(tokens[2..size(tokens)]);
2553
+ L[3] = list(list("lp", 1:(size(tokens)-1)));
2554
+ L[4] = ideal(0);
2555
+ return(L);
2556
+ }
2557
+
2558
+ static proc parse_var(string v)
2559
+ {
2560
+ if (v[1, 4] == "var(" && defined(basering))
2561
+ {
2562
+ int i = int(v[5,size(v)-5]);
2563
+ v = ring_list(basering)[2][i];
2564
+ }
2565
+ return(v);
2566
+ }
2567
+
2568
+ /*
2569
+ * parses
2570
+ * "x" to list("x") and
2571
+ * "(x,y,z)" to list("x", "y", "z")
2572
+ */
2573
+ static proc parse_L2(string l2)
2574
+ {
2575
+ if (l2[1] != "(")
2576
+ {
2577
+ return(list(parse_var(l2)));
2578
+ }
2579
+ list V = tuple_to_tokens(l2);
2580
+ for (int i = size(V); i > 0; i--)
2581
+ {
2582
+ V[i] = parse_var(V[i]);
2583
+ }
2584
+ return(V);
2585
+ }
2586
+
2587
+ /*
2588
+ * parses
2589
+ * "dp" to list("dp", 1:n_vars),
2590
+ * "dp(3)" to list("dp", 1:3),
2591
+ * "c" to list("c", intvec(0)), and
2592
+ * "wp(3,4)" to list("wp", intvec(3, 4))
2593
+ */
2594
+ static proc parse_ordering(string ordering, int n_vars)
2595
+ {
2596
+ string name;
2597
+ int b1 = find(ordering, "(", 1);
2598
+ if (b1 == 0) // no parentheses
2599
+ {
2600
+ name = ordering;
2601
+ if (name == "C" || name == "c")
2602
+ {
2603
+ intvec @w = intvec(0);
2604
+ }
2605
+ else
2606
+ {
2607
+ intvec @w = 1:n_vars;
2608
+ }
2609
+ }
2610
+ else
2611
+ {
2612
+ name = ordering[1, b1-1];
2613
+ int b2 = find(ordering, ")", b1+1);
2614
+ int c = find(ordering, ",", b1+1);
2615
+ if (c == 0)
2616
+ {
2617
+ if (name == "L")
2618
+ {
2619
+ int @w = int(ordering[b1+1, b2-b1-1]);
2620
+ }
2621
+ if (name == "wp" || name == "Wp" || name == "ws" || name == "Ws"
2622
+ || name == "a")
2623
+ {
2624
+ intvec @w = int(ordering[b1+1, b2-b1-1]);
2625
+ }
2626
+ if (!defined(@w)) // else
2627
+ {
2628
+ intvec @w = 1:int(ordering[b1+1, b2-b1-1]);
2629
+ }
2630
+ }
2631
+ else
2632
+ {
2633
+ list W = tuple_to_tokens(ordering[b1, b2-b1+1]);
2634
+ intvec @w = intvec(int(W[1..size(W)]));
2635
+ }
2636
+ }
2637
+ return(list(name, @w));
2638
+ }
2639
+
2640
+ static proc parse_L3(string l3, int n_vars)
2641
+ {
2642
+ if (l3[1] != "(")
2643
+ {
2644
+ list L = parse_ordering(l3, n_vars);
2645
+ return(list(L));
2646
+ }
2647
+ // block orderings
2648
+ list L = tuple_to_tokens(l3);
2649
+ for (int i = size(L); i > 0; i--)
2650
+ {
2651
+ L[i] = parse_ordering(L[i], n_vars);
2652
+ }
2653
+ return(L);
2654
+ }
2655
+
2656
+ proc create_ring(def l1, def l2, def l3, list #)
2657
+ "USAGE: create_ring(l1, l2, l3[, l4, \"no_minpoly\"]);
2658
+ l1 int or list, l2 list or string, l3 list or string, l4 ideal
2659
+ RETURN: ring(list(l1, l2, l3, l4))
2660
+ NOTE: l1, l2, l3, l4 are assumed to be the four entries of ring_list(R)
2661
+ where R is the ring to be returned.
2662
+ @* Optional arguments: If l4 is not given, it is assumed to be
2663
+ ideal(0). If \"no_minpoly\" is given, then the minimal polynomial
2664
+ in l1, if present, is set to 0.
2665
+ @* Shortcuts: Strings such as \"0\", \"(32003)\" or \"(0,a,b,c)\" can
2666
+ be given as l1. Indexed parameters as in \"(0,a(1..3))\" are
2667
+ not supported. Strings such as \"(x,y,z)\" can be given as l2.
2668
+ Indexed variables as in \"(x(1..3),y,z)\" are not supported.
2669
+ Strings representing orderings such as \"dp\" or \"(lp(3), ds(2))\"
2670
+ can be given as l3, except matrix orderings given by
2671
+ \"M([intmat_expression])\".
2672
+ EXAMPLE: example create_ring; shows an example
2673
+ "
2674
+ {
2675
+ /* setup */
2676
+ list L; L[4]=def(0);
2677
+ int kill_ring;
2678
+ if (!defined(basering))
2679
+ {
2680
+ ring R;
2681
+ kill_ring = 1;
2682
+ }
2683
+
2684
+ /* read optional arguments */
2685
+ ideal l4;
2686
+ int no_minpoly;
2687
+ if (size(#) > 0)
2688
+ {
2689
+ if (typeof(#[1]) == "ideal")
2690
+ {
2691
+ ideal l4 = #[1];
2692
+ # = delete(#, 1);
2693
+ }
2694
+ if (typeof(#[1]) == "string")
2695
+ {
2696
+ if (#[1] == "no_minpoly")
2697
+ {
2698
+ no_minpoly = 1;
2699
+ }
2700
+ }
2701
+ }
2702
+
2703
+ /* L[1] */
2704
+ if (typeof(l1) == "list")
2705
+ {
2706
+ if (no_minpoly)
2707
+ {
2708
+ if (typeof(l1) == "list")
2709
+ {
2710
+ if (size(l1) == 4)
2711
+ {
2712
+ if (typeof(l1[4]) == "ideal")
2713
+ {
2714
+ l1[4] = ideal(0);
2715
+ }
2716
+ }
2717
+ }
2718
+ }
2719
+ }
2720
+ if (typeof(l1) == "string")
2721
+ {
2722
+ L[1] = parse_L1(l1);
2723
+ }
2724
+ else
2725
+ {
2726
+ L[1] = l1;
2727
+ }
2728
+
2729
+ /* L[2] */
2730
+ if (typeof(l2) == "list")
2731
+ {
2732
+ L[2] = l2;
2733
+ }
2734
+ else
2735
+ {
2736
+ L[2] = parse_L2(l2);
2737
+ }
2738
+
2739
+ /* L[3] */
2740
+ if (typeof(l3) == "list")
2741
+ {
2742
+ L[3] = l3;
2743
+ }
2744
+ else
2745
+ {
2746
+ L[3] = parse_L3(l3, size(L[2]));
2747
+ }
2748
+
2749
+ /* L[4] */
2750
+ L[4] = l4;
2751
+
2752
+ /* return ring */
2753
+ def S = ring(L);
2754
+ if (kill_ring)
2755
+ {
2756
+ kill(R);
2757
+ }
2758
+ return(S);
2759
+ }
2760
+ example
2761
+ {
2762
+ "EXAMPLE:"; echo = 2;
2763
+ ring R = (0,a), x, lp;
2764
+ ring_list(R);
2765
+ minpoly = a^2+1;
2766
+ qring Q = ideal(x^3-2);
2767
+ ring S = create_ring(ring_list(Q)[1], "(x,y,t)", "dp", "no_minpoly");
2768
+ basering;
2769
+ }