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,3361 @@
1
+ ////////////////////////////////////////////////////////////////////////////////
2
+ version="version autgradalg.lib 4.1.2.0 Feb_2019 "; // $Id: eeb4c9f7e8bcd4366f1ba1646ae2ea1b7e0d3c1b $
3
+ category="Commutative Algebra, Algebraic Geometry";
4
+ info="
5
+ LIBRARY: autgradalg.lib Compute automorphism groups of pointedly graded algebras and of Mori dream spaces.
6
+
7
+ AUTHORS: Simon Keicher
8
+
9
+ OVERVIEW: This library provides a framework for computing automorphisms of integral, finitely generated algebras that are graded by a finitely generated abelian group. This library also contains functions to compute automorphism groups of Mori dream spaces. The results are ideals I such that the respective automorphism group is isomorphic to the subgroup V(I) in some GL(n).
10
+
11
+ ASSUMPTIONS:
12
+ * the algebra R is given as factor algebra S/I with a graded polynomial ring S = KK[T_1,...,T_r]. We will always assume that the basering is S and it is given over the rationals QQ or a number field QQ(a).
13
+ * R must be minimally presented, i.e., I is contained in <T_1,...,T_r>^2.
14
+ * S (and hence R) are graded via 'setBaseMultigrading(Q)' from 'multigrading.lib'. The last rows of the matrix Q are interpreted over ZZ/a_iZZ if the respective entry of the list TOR is a_i and has been provided as parameter to the respective function. (See the functions for more details.)
15
+ * For all 1 <= i <= r: I_{w_i} = 0 where w_i := deg(T_i).
16
+ * the grading is pointed, i.e., no generator has degree 0 and the cone over all generator degrees is pointed.
17
+ * For Mori dream spaces X, we assume them to be given as X = X(R,w) with the Cox ring R of X (given as the algebra R before) and an ample class w in the grading group K with the torsion entries removed.
18
+
19
+ PROCEDURES:
20
+ autKS(): compute the automorphism group of the basering (must be a polynomial ring) as an algebraic subgroup V(I) of some GL(n)
21
+ autGradAlg(I0, TOR): compute the automorphism group of R as an algebraic subgroup V(I) of some GL(n).
22
+ autGenWeights(): compute the automorphisms of the grading group that fix the generator degrees.
23
+ stabilizer(I0, TOR): compute the stabilizer of the given ideal
24
+ autXhat(I0, w, TOR): compute the automorphism group of \widehat X as an algebraic subgroup V(I) of some GL(n).
25
+ autX(I0, w, TOR): compute the automorphism group of X=X(R,w) as an algebraic subgroup V(I) of some GL(n).
26
+
27
+ NOTE: the following functions were taken from 'quotsingcox.lib' by M.Donten-Bury and S.Keicher: 'hilbertBas'.
28
+ NOTE: This library comes without any warranty whatsoever. Use it at your own risk.
29
+
30
+ KEYWORDS: automorphisms; graded algebra; Mori dream spaces; automorphism group; symmetries
31
+ ";
32
+
33
+ /* Printlevel settings:
34
+ * 0: Silent mode
35
+ * >0: Show status information
36
+ */
37
+
38
+ //Included libraries
39
+ LIB "multigrading.lib";
40
+ LIB "gitfan.lib";
41
+ LIB "normaliz.lib";
42
+ LIB "gfan.lib";
43
+
44
+ ////////////////////////
45
+
46
+ static proc col(intmat Q, int i)
47
+ "USAGE: col(Q, i): Q is an intmat, i an integer.
48
+ PURPOSE: return the i-th column as an intvec.
49
+ RETURN: an intvec.
50
+ EXAMPLE: shows an example."
51
+ {
52
+ return(intvec(Q[1..nrows(Q),i]));
53
+ }
54
+ example
55
+ {
56
+ echo=2;
57
+
58
+ intmat Q[2][4] =
59
+ -2, 2, -1, 1,
60
+ 1, 1, 1, 1;
61
+
62
+ col(Q, 2);
63
+ }
64
+
65
+ ///////////////////////
66
+
67
+ static proc gradedCompIdeal(ideal RL, intvec w, int dd, list #)
68
+ "USAGE: gradedCompIdeal(I, w, dd): I is an ideal, w an intvec, dd an integer (0 or 1). Optional input: a list of integers representing the torsion.
69
+ ASSUME: the basering must be graded (see setBaseMultigrading()) and the cone over the degrees of the variables must be pointed; there must not be 0-degrees. The vector w must be an element of the cone over the degrees of the variables.
70
+ PURPOSE: returns a basis for the component I_w of the ideal; if dd = 0, a list of basis vectors is returned, if dd = 1, a list of monomials is returned.
71
+ RETURN: a list L where L[1] is a list of all monomials of degree w and L[2] is list of polynomials.
72
+ EXAMPLE: shows an example."
73
+ {
74
+ list TOR;
75
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
76
+ TOR = #[1];
77
+ }
78
+
79
+ // columns of Q are the degrees of the variables of the basering
80
+ intmat Q = getVariableWeights();
81
+
82
+ // compute all monomials of degree w:
83
+ dbprint(printlevel, "wmonomials...");
84
+ list MON = wmonomials(w, 0, TOR);
85
+ dbprint(printlevel, "...done");
86
+
87
+ list Iw0 = gradedCompIdeal2basevecs(w, Q, RL, MON, TOR);
88
+
89
+ if(size(Iw0) == 0){
90
+ list L;
91
+ L[1] = MON;
92
+ L[2] = list();
93
+ return(L);
94
+ }
95
+
96
+ // Choose a maximal linearly independent
97
+ // subset out of the elements of Iw0:
98
+ // Iteratively add columns from Tmp:
99
+ int rg1 = 0;
100
+ int rg2 = 0;
101
+
102
+ list Tmp;
103
+ Tmp[1] = Iw0[1];
104
+
105
+ for(int m = 2; m <= size(Iw0); m++){
106
+ matrix IwTmp[size(Tmp)+1][size(MON)];
107
+
108
+ for(int j = 1; j <= size(Tmp); j++){
109
+ IwTmp[j,1..size(MON)] = Tmp[j];
110
+ }
111
+
112
+ // add the new column:
113
+ IwTmp[size(Tmp)+1,1..size(MON)] = Iw0[m];
114
+
115
+ rg1 = rg2;
116
+ rg2 = rank(IwTmp);
117
+
118
+ if(rg1 < rg2){
119
+ Tmp[size(Tmp)+1] = Iw0[m];
120
+ }
121
+
122
+ kill IwTmp, j;
123
+ }
124
+
125
+ list Iw = Tmp;
126
+ list L; // will be returned
127
+ L[1] = MON;
128
+
129
+ // translate back to polynomials unless 'basevecs' specified:
130
+ if(dd == 0){
131
+ L[2] = Iw;
132
+ return(L);
133
+ }
134
+
135
+ matrix MONmat[1][size(MON)] = MON[1..size(MON)];
136
+ matrix Iwmat[size(Iw)][size(MON)];
137
+
138
+ for(m = 1; m <= size(Iw); m++){
139
+ matrix BB = Iw[m]; // has only one column
140
+ Iwmat[m, 1..size(MON)] = BB[1..nrows(BB), 1];
141
+
142
+ kill BB;
143
+ }
144
+
145
+ matrix Iwmons = Iwmat * transpose(MONmat);
146
+ list Iwmonslist = Iwmons[1..nrows(Iwmons),1];
147
+ L[2] = Iwmonslist;
148
+
149
+ return(L);
150
+ }
151
+ example
152
+ {
153
+ echo = 2;
154
+
155
+ // 1st example /////////
156
+ // example with torsion: ZZ + ZZ/5ZZ:
157
+ intmat Q[2][5] =
158
+ 1,1,1,1,1,
159
+ 2,3,1,4,0;
160
+
161
+ list TOR = 5;
162
+ ring R = 0,T(1..5),dp;
163
+
164
+ // attach degree matrix Q to R:
165
+ setBaseMultigrading(Q);
166
+
167
+ ideal I = T(1)*T(2) + T(3)*T(4) + T(5)^2;
168
+ intvec w = 3,1;
169
+
170
+ // as list of polynomials:
171
+ list Lpol = gradedCompIdeal(I, w, 1, TOR);
172
+ Lpol;
173
+
174
+ kill R, w, Q, TOR;
175
+
176
+ // 2nd example /////////
177
+ ring R = 0, T(1..4), dp;
178
+
179
+ // Weights of variables
180
+ intmat Q[2][4] =
181
+ -2, 2, -1, 1,
182
+ 1, 1, 1, 1;
183
+
184
+ // attach degree matrix Q to R:
185
+ setBaseMultigrading(Q);
186
+
187
+ ideal I = T(1)*T(2) + T(3)*T(4);
188
+ intvec w = 0,2;
189
+
190
+ // as basis vectors in \KK^n:
191
+ list Lbas = gradedCompIdeal(I, w, 0);
192
+ Lbas;
193
+
194
+ // as list of polynomials:
195
+ list Lpol = gradedCompIdeal(I, w, 1);
196
+ Lpol;
197
+
198
+ kill w, I, R, Q;
199
+
200
+ // 3rd example /////////
201
+ // torsion, parameter and 2 generators:
202
+ intmat Q[3][6] =
203
+ 1,1,1,1,1,1,
204
+ -1,1,1,-1,0,0,
205
+ 0,0,1,1,1,0;
206
+
207
+ list TOR = 2; // means CL(X) = ZZ + ZZ/TOR[1]*ZZ + ...
208
+
209
+ //int lam = 13;
210
+ ring R = (0,lam),T(1..6),dp;
211
+
212
+ // attach degree matrix Q to R:
213
+ setBaseMultigrading(Q);
214
+
215
+ ideal I =
216
+ T(1)*T(2) + T(3)*T(4) + T(5)^2,
217
+ lam*T(3)*T(4) + T(5)^2 + T(6)^2;
218
+
219
+ intvec w = 2,0,0;
220
+ gradedCompIdeal(I, w, 1, TOR);
221
+ }
222
+
223
+ ///////////////////////////////////
224
+
225
+ // helper
226
+ // returns a list of matrices over the coeff. ring of the basering
227
+ // see also the subsequent example.
228
+ static proc gradedCompIdeal2basevecs(intvec w, intmat Q, ideal RL, list MON, list #){
229
+ list TOR;
230
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
231
+ TOR = #[1];
232
+ }
233
+
234
+ list RLw = gradedCompIdealhelper(w, Q, RL, TOR);
235
+ list EL;
236
+
237
+ for(int j = 1; j <= size(RLw); j++){
238
+ // translate e.g. T[1]^3-T[1]*T[2]^2 to e_1-e_3
239
+ // if T[1]^3 is the 1st entry and T[1]*T[2]^2 the 3rd entry
240
+ // store then 1 in v[...] and -1 in v[...]:
241
+ matrix v[1][size(MON)] = 0:size(MON); // Elements are in the coef-ring
242
+
243
+ for(int k = 1; k <= size(MON); k++){
244
+ v[k,1] = moncoef(RLw[j], MON[k]); // Note: it is v[k,1], not v[1,k].
245
+ }
246
+
247
+ EL[size(EL)+1] = v;
248
+
249
+ kill v, k;
250
+ }
251
+
252
+ return(EL);
253
+ }
254
+ example
255
+ {
256
+ echo=2;
257
+
258
+ ring R = 0, T(1..4), dp;
259
+
260
+ // Weights of variables
261
+ intmat Q[2][4] =
262
+ -2, 2, -1, 1,
263
+ 1, 1, 1, 1;
264
+
265
+ // attach degree matrix Q to R:
266
+ setBaseMultigrading(Q);
267
+
268
+ ideal I = T(1)*T(2) + T(3)*T(4);
269
+
270
+ intvec w = 0,4;
271
+ list MON = wmonomials(w, 0);
272
+ MON;
273
+ gradedCompIdeal2basevecs(w, Q, I, MON);
274
+ }
275
+
276
+ /////////////////////////////////////
277
+
278
+ // helper
279
+ //
280
+ // Returns vector space generators for all polynomials of degree w
281
+ // by shifting the generators in RL to degree w by a monomial.
282
+ //
283
+ // Returns a list of polynomials.
284
+ //
285
+ static proc gradedCompIdealhelper(intvec w, intmat Q, ideal RL, list #){
286
+
287
+ list TOR;
288
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
289
+ TOR = #[1];
290
+ }
291
+
292
+ list RLw;
293
+ cone cQ = coneViaPoints(transpose(Q));
294
+
295
+ for(int i = 1; i <= size(RL); i++){
296
+ // shift RL[i] to deg w by multiplication with T^delta
297
+ intvec delta = reduceIntvec(w - multiDeg(RL[i]), TOR);
298
+
299
+ if(delta == intvec(0:size(w))){
300
+ RLw[size(RLw)+1] = RL[i];
301
+ } else {
302
+ // if delta is not in cQ, then there is no monomial of this degree:
303
+ if(containsInSupport(cQ, delta)){
304
+ // calculate all monomials of degree delta
305
+ list deltaMON = wmonomials(delta, 0, TOR);
306
+
307
+ for(int k = 1; k <= size(deltaMON); k++){
308
+ poly m = deltaMON[k];
309
+ RLw[size(RLw)+1] = RL[i] * m;
310
+
311
+ kill m;
312
+ }
313
+
314
+ kill k;
315
+ }
316
+ }
317
+
318
+ kill delta;
319
+ }
320
+
321
+ return(RLw);
322
+ }
323
+ example
324
+ {
325
+ echo=2;
326
+
327
+ ring R = 0, T(1..4), dp;
328
+
329
+ // Weights of variables
330
+ intmat Q[2][4] =
331
+ -2, 2, -1, 1,
332
+ 1, 1, 1, 1;
333
+
334
+ // attach degree matrix Q to R:
335
+ setBaseMultigrading(Q);
336
+
337
+ ideal I = T(1)*T(2) + T(3)*T(4);
338
+
339
+ intvec w = 0,4;
340
+ gradedCompIdealhelper(w, Q, I);
341
+ }
342
+
343
+ ///////////////////////////////////
344
+
345
+ static proc wmonomials(intvec w1, int dd, list #)
346
+ "USAGE: wmonomials(w, dd): w is an intvec and dd either 1 or 0; 1 means that the function should compute a list of exponent vectors and 0 means the function should compute a list of monomials. As an optional third argument a list of integers may be provided to indicate that the last rows of the degree matrix are residue classes in ZZ/aZZ. For instance [2,3] means that the second to last row consists of elements in ZZ/2ZZ and the last one of elements in ZZ/3ZZ.
347
+ ASSUME: the basering must be graded (see setBAseMultigrading()) and the cone over
348
+ the degrees of the variables must be pointed; there mustn't be 0-degrees.
349
+ PURPOSE: computes all monomials T^\nu with deg(T^\nu) = w where
350
+ the degree of the i-th variable of the basering is assumed to have
351
+ RETURN: a list of monomials or a list of their exponent vectors if a second argument is provided (an integer).
352
+ EXAMPLE: shows an example."
353
+ {
354
+ intmat Qfull = getVariableWeights();
355
+
356
+ // check whether a torsion list is given:
357
+ list TOR;
358
+
359
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
360
+ TOR = #[1];
361
+
362
+ // cut off the degree matrix (i.e., the free part):
363
+ intmat Q[nrows(Qfull) - size(TOR)][ncols(Qfull)];
364
+
365
+ for(int i = 1; i <= nrows(Q); i++){
366
+ Q[i, 1..ncols(Q)] = Qfull[i, 1..ncols(Q)];
367
+ }
368
+
369
+ // cut off the free part w0 of w and store as bigintmat
370
+ // for easier multiplication:
371
+ intvec w0 = w1[1..size(w1)-size(TOR)];
372
+ bigintmat w[1][size(w0)] = w0[1..size(w1)];
373
+ kill i;
374
+
375
+ } else {
376
+ // deg(T_i) =...
377
+ intmat Q = Qfull;
378
+
379
+ // for easier multiplication:
380
+ intvec w0 = w1;
381
+ bigintmat w[1][size(w0)] = w0[1..size(w0)];
382
+ }
383
+
384
+ // look for a bound for monomials:
385
+ cone c = coneViaPoints(transpose(Q));
386
+ cone cd = dualCone(c);
387
+ bigintmat v = transpose(relativeInteriorPoint(cd)); // 1 column
388
+
389
+ // if dotprod(a,w) > dotprod(v,w), then
390
+ // we need not consider T^a any more
391
+ // --> gives a degree bound bnd:
392
+ bigint bnd = (w * v)[1,1];
393
+
394
+ // traverse all possible exponents v_i of T_i:
395
+ // i-th entry of BNDlist will be maximum exponent for T_i
396
+ // such that the bound can still be satisfied.
397
+ int r = nvars(basering);
398
+ intvec BNDlist = 0:r;
399
+
400
+ for(int i = 1; i <= r; i++){
401
+ int bndi = 1;
402
+ intvec coli = col(Q, i);
403
+ bigintmat vi[1][size(coli)] = coli[1..nrows(Q)];
404
+
405
+ while(((bndi * vi) * v)[1,1] < bnd){
406
+ bndi++;
407
+ }
408
+
409
+ BNDlist[i] = bndi;
410
+
411
+ kill bndi, vi, coli;
412
+ }
413
+
414
+ // build up solutions recursively:
415
+ // traverse all possible exponents
416
+ // that still satisfy the bound condition
417
+ //
418
+ // NOTE: this is rather brute-force,
419
+ // but its running time is dominated by the
420
+ // other steps.
421
+ list sol;
422
+ list WL0 = wmonomialsRec(v, bnd, Q, BNDlist, sol); // candidates
423
+
424
+ // - in case of no torsion:
425
+ // select those ww out of WL0 with Q*ww = w0
426
+ // - if case of torsion:
427
+ // select those ww out of WL0 with reduce(Q*ww) = w1
428
+ // where reduce() means to take the last elements mod TOR[i]:
429
+ list WL;
430
+
431
+ for(int m = 1; m <= size(WL0); m++){
432
+ list v0 = WL0[m];
433
+ intvec vv = v0[1..size(v0)];
434
+ //bigintmat vv[1][size(v0)] = v0[1..size(v0)];
435
+
436
+ if(size(TOR) == 0){ // free case
437
+ if(Q * vv == w0){
438
+ WL[size(WL) + 1] = vv;
439
+ }
440
+ } else { // torsion case
441
+ // reduce the last entries mod p:
442
+ intvec Qvvred = Qfull * vv;
443
+ intvec w1red = w1;
444
+ int pos;
445
+
446
+ for(int l = 1; l <= size(TOR); l++){
447
+ pos = nrows(Qfull) - size(TOR) + l;
448
+ Qvvred[pos] = Qvvred[pos] mod TOR[l];
449
+ w1red[pos] = w1red[pos] mod TOR[l];
450
+
451
+ // make positive: e.g. -1 becomes 4 in ZZ/5ZZ:
452
+ if(Qvvred[pos] < 0){
453
+ Qvvred[pos] = Qvvred[pos] + TOR[l];
454
+ }
455
+ if(w1red[pos] < 0){
456
+ w1red[pos] = w1red[pos] + TOR[l];
457
+ }
458
+ }
459
+
460
+ if(Qvvred == w1red){
461
+ WL[size(WL) + 1] = vv;
462
+ }
463
+
464
+ kill pos, l, Qvvred, w1red;
465
+ }
466
+
467
+ kill vv, v0;
468
+ }
469
+
470
+ // output the list of exponentvectors if 2nd argument provided:
471
+ if(dd == 1){
472
+ return(WL);
473
+ }
474
+
475
+ // otherwise: as monomials:
476
+ list MONs;
477
+
478
+ for(i = 1; i <= size(WL); i++){
479
+ MONs[size(MONs)+1] = vec2monomial(WL[i]);
480
+ }
481
+
482
+ return(MONs);
483
+ }
484
+ example
485
+ {
486
+ echo=2;
487
+
488
+ // example with torsion: ZZ + ZZ/5ZZ:
489
+ intmat Q[2][5] =
490
+ 1,1,1,1,1,
491
+ 2,3,1,4,0;
492
+
493
+ list TOR = 5;
494
+ ring R = 0,T(1..5),dp;
495
+
496
+ // attach degree matrix Q to R:
497
+ setBaseMultigrading(Q);
498
+
499
+ ideal I = T(1)*T(2) + T(3)*T(4) + T(5)^2;
500
+ intvec w = 2,0;
501
+ wmonomials(w, 0, TOR);
502
+
503
+ kill R, w, Q;
504
+
505
+ //////////////////////
506
+ // free example:
507
+ ring R = 0, T(1..4), dp;
508
+
509
+ // Weights of variables
510
+ intmat Q[2][4] =
511
+ -2, 2, -1, 1,
512
+ 1, 1, 1, 1;
513
+
514
+ // attach degree matrix Q to R:
515
+ setBaseMultigrading(Q);
516
+
517
+ intvec w = 0,2;
518
+
519
+ // as list of exponent vectors
520
+ wmonomials(w, 1);
521
+
522
+ // as list of monomials
523
+ wmonomials(w, 0);
524
+ }
525
+
526
+ ///////////////////////
527
+
528
+ // helper:
529
+ // returns all vectors (without looking at w0, Q) with i-th entry at most BND[i]
530
+ // but only those v0 with <v,v0> <= bnd for all i
531
+ static proc wmonomialsRec(bigintmat v, bigint bnd, intmat Q, intvec BNDs, list sol){
532
+ int pos = size(sol) + 1;
533
+ list Res;
534
+
535
+ if(size(sol) == nvars(basering)){
536
+ return(list(sol));
537
+ }
538
+
539
+ for(int i = 0; i <= BNDs[pos]; i++){
540
+ list sol0 = sol;
541
+ sol0[pos] = i;
542
+
543
+ list sol0tmp = sol;
544
+
545
+ for(int k = 1; k <= nvars(basering)-size(sol); k++){
546
+ sol0tmp[size(sol)+k] = 0;
547
+ }
548
+
549
+ intvec v0tmp = sol0tmp[1 .. size(sol0tmp)];
550
+ intvec ivQv0tmp = Q*v0tmp;
551
+ bigintmat Qv0tmp[1][size(ivQv0tmp)] = ivQv0tmp[1..size(ivQv0tmp)];
552
+
553
+ // this monmial will be too big to have degree w0:
554
+ if((Qv0tmp * v)[1,1] > bnd){
555
+ return(list(sol0tmp));
556
+ }
557
+
558
+ // otherwise: recurse
559
+ list Res0 = wmonomialsRec(v, bnd, Q, BNDs, sol0);
560
+
561
+ for(k = 1; k <= size(Res0); k++){
562
+ Res[size(Res)+1] = Res0[k];
563
+ }
564
+
565
+ kill k, sol0, Res0, sol0tmp, v0tmp, ivQv0tmp, Qv0tmp;
566
+ }
567
+
568
+ return(Res);
569
+ }
570
+
571
+ //////////////////////////
572
+
573
+ // helper
574
+ static proc vec2monomial(intvec v){
575
+ poly f = 1;
576
+
577
+ for(int i = 1; i <= size(v); i++){
578
+ f = f * var(i)^v[i];
579
+ }
580
+
581
+ return(f);
582
+ }
583
+
584
+ //////////////////////////
585
+
586
+ static proc moncoef(poly f, poly mon)
587
+ "USAGE: moncoef(f, mon): f is a polynomial, mon a monomial.
588
+ PURPOSE: returns the (constant) coefficient of mon in f.
589
+ NOTE: the coefficient of T(1)^2 in T(1)^2*T(2) is assumed to be 1 not T(2). See moncoef2 of the latter is wanted.
590
+ RETURN: a ring element.
591
+ EXAMPLE: shows an example."
592
+ {
593
+
594
+ poly p = f;
595
+
596
+ while (p != 0) {
597
+ if( leadmonom(p) / mon != 0){
598
+ return(leadcoef(p));
599
+ }
600
+
601
+ p = p - lead(p);
602
+ }
603
+
604
+ return(0);
605
+ }
606
+ example
607
+ {
608
+ echo=2;
609
+
610
+ ring R = (0,a),T(1..4),dp;
611
+
612
+ poly f = T(1)^2*T(2)^3 + 7*a*T(3)^3 -8*T(3)^2 +7;
613
+ poly mon = T(3)^3;
614
+
615
+ moncoef(f, mon);
616
+ kill f, mon, R;
617
+
618
+ // 2nd example
619
+ ring R = 0,(T(1..3), Y(1..12)),dp;
620
+ poly f = T(1)^2*Y(1)^2;
621
+ poly m = T(1)^2;
622
+ moncoef(f,m);
623
+ }
624
+
625
+ /////////////////////////////////
626
+
627
+ // helper
628
+ // for autGenWeights, the case of torsion.
629
+ static proc autGenWeightsTorsion(intmat Q, list TOR, list Origs, list OrigDim){
630
+ // cut off the torsion rows:
631
+ intmat Q0[nrows(Q)-size(TOR)][ncols(Q)];
632
+
633
+ for(int i = 1; i <= nrows(Q) - size(TOR); i++){
634
+ Q0[i, 1..ncols(Q)] = Q[i, 1..ncols(Q)];
635
+ }
636
+
637
+ // compute automorphisms B in AUT0 fixing the free part of
638
+ // the generator weights:
639
+ list AUT0 = autGenWeights(Q0);
640
+ list AUT;
641
+
642
+ // each element of AUT should be of shape
643
+ //
644
+ // B | 0
645
+ // C | D
646
+ //
647
+ // where D = diag(d1,..,dn) and C has entries
648
+ // 0 <= c_ij < TOR[i]
649
+
650
+ // form all possible C-matrices and D-matrices:
651
+ list DL = getDmats(TOR);
652
+ list CL = getCmats(TOR, nrows(Q0));
653
+
654
+ int j;
655
+ int k;
656
+
657
+ for(i = 1; i <= size(AUT0); i++){
658
+ for(j = 1; j <= size(CL); j++){
659
+ for(k = 1; k <= size(DL); k++){
660
+ intmat A = concatBCD(AUT0[i], CL[j], DL[k]);
661
+
662
+ // M * Origs = Origs?:
663
+ if(fixesOrig(A, Origs, OrigDim, TOR)){
664
+ AUT[size(AUT)+1] = A;
665
+ }
666
+
667
+ kill A;
668
+ }
669
+ }
670
+ }
671
+
672
+ return(AUT);
673
+ }
674
+
675
+ /////////////////////////////////
676
+
677
+ // helper
678
+ // returns all lattice bases among QQ of size size(QQ[1])
679
+ static proc allLatticeBases(list QQ){
680
+ int d = size(QQ[1]);
681
+ int r = size(QQ);
682
+ list Bases;
683
+ int j;
684
+
685
+ // compute all lattice bases of size d among QQ:
686
+ // traverse subsets (given as binary vectors J):
687
+ for(int i = 1; i <= 2^r; i++){
688
+ intvec J = int2face(i, r);
689
+ list QJ;
690
+
691
+ // status info since this may run for a longer time:
692
+ if(i mod 300 == 0){
693
+ dbprint(printlevel, "i=" + string(i) + " of " + string(2^r));
694
+ }
695
+
696
+ // translate J to a 'subset' QJ (given as a list) of QQ:
697
+ for(j = 1; j <= size(J); j++){
698
+ if(J[j] == 1){
699
+ QJ[size(QJ) + 1] = QQ[j];
700
+ }
701
+ }
702
+
703
+ // sizes are invariant --> look for size d:
704
+ if(size(QJ) == d){
705
+ intmat QJmat[size(QQ[1])][d];
706
+
707
+ for(int k = 1; k <= d; k++){
708
+ QJmat[1..size(QQ[1]), k] = QJ[k];
709
+ }
710
+ if(absValue(det(QJmat)) == 1){
711
+ Bases[size(Bases)+1] = QJmat;
712
+ }
713
+
714
+ kill QJmat, k;
715
+ }
716
+
717
+ kill QJ, J;
718
+ }
719
+
720
+ if(size(Bases) < 1){
721
+ // for only one row, it is ok to return simply [1]:
722
+ if(d == 1){
723
+ intmat QJmat[1][1] = 1;
724
+ Bases[1] = QJmat;
725
+ return(Bases);
726
+ }
727
+
728
+ ERROR("Sorry. Could not find a basis in the columns.");
729
+ }
730
+
731
+ return(Bases);
732
+ }
733
+
734
+ ////////////////////////////////
735
+
736
+ // helper
737
+ // for autGenWeights, the case of no torsion.
738
+ static proc autGenWeightsFree(list QQ, list Origs, list OrigDim)
739
+ {
740
+ dbprint(printlevel, "autGenWeights: entering free case...");
741
+ list Bases = allLatticeBases(QQ);
742
+
743
+ dbprint(printlevel, "Number of bases: " + string(size(Bases)));
744
+
745
+ // take only those A, with A*Origs = Origs:
746
+ list G;
747
+
748
+ // Any basis is mapped to another basis,
749
+ // so it suffices to fix one basis A and
750
+ // see where it is mapped to.
751
+ intmat A = Bases[1];
752
+ list AA;
753
+
754
+ for(int j = 1; j <= ncols(A); j++){
755
+ AA[size(AA)+1] = col(A, j);
756
+ }
757
+
758
+ // does not work for 1x1:
759
+ // workaround:
760
+ if(nrows(A) == 1){
761
+ if(A[1,1] == 1){
762
+ intmat Ainv = A;
763
+ } else{ // = -1
764
+ intmat Ainv = -A;
765
+ }
766
+ } else {
767
+ intmat Ainv = intInverse(A);
768
+ }
769
+
770
+ // we also have to consider permutations of each
771
+ // "image basis":
772
+ int d = size(QQ[1]);
773
+ intvec vd = 1..d;
774
+ list Ld = vd[1..size(vd)];
775
+ list PER = permutations(Ld, list());
776
+
777
+ dbprint(printlevel, "Number of permutations: " + string(size(PER)));
778
+
779
+ int b;
780
+ list RES;
781
+
782
+ for(j = 1; j <= size(Bases); j++){
783
+ dbprint(printlevel, "Checking Basis no. " + string(j) + " of " + string(size(Bases)));
784
+
785
+ intmat B0 = Bases[j]; // note: d == ncols(B0) >= nrows(B0)
786
+
787
+ for(b = 1; b <= size(PER); b++){
788
+ intmat B[nrows(B0)][ncols(B0)];
789
+ list sigma = PER[b];
790
+
791
+ for(int k = 1; k <= d; k++){
792
+ // the k-th col of B is the
793
+ // sigma(k)-th one of B0:
794
+ intvec v = col(B0, sigma[k]);
795
+ B[1..nrows(B0), k] = v[1..size(v)];
796
+
797
+ kill v;
798
+ }
799
+
800
+ // init M: note that det(M) = +-1
801
+ // since det(B)=+-1 and det(Ainv)=+-1.
802
+ intmat M = B * Ainv;
803
+
804
+ // M * Origs = Origs?:
805
+ int takeit = fixesOrig(M, Origs, OrigDim, list());
806
+
807
+ if(takeit){
808
+ // M already present?:
809
+ for(int u = 1; u <= size(RES); u++){
810
+ if(RES[u] == M){
811
+ takeit = 0;
812
+ break;
813
+ }
814
+ }
815
+
816
+ if(takeit){
817
+ RES[size(RES)+1] = M;
818
+ }
819
+
820
+ kill u;
821
+ }
822
+
823
+ kill k, sigma, B, M, takeit;
824
+ }
825
+
826
+ kill B0;
827
+ }
828
+
829
+ return(RES);
830
+ }
831
+
832
+ /////////////////////////////////
833
+
834
+ proc autGenWeights(intmat Q, list #)
835
+ "USAGE: autGenWeights(Q): Q is an intmat (columns must contain a lattice basis).
836
+ ASSUME: the cone over Q must be pointed and the columns of Q contain a lattice basis; there must be no 0-columns in Q. We assume that, in the torsion case, the torsion rows of Q are reduced (for example, a row of Q standing for entries in ZZ/5ZZ must not contain elements > 5 or < 0).
837
+ PURPOSE: computes generators for the subgroup aut(Omega_S) of GL(n, \ZZ) that consists of all invertible integer kxk matrices which fix the set Omega_S of degrees of the variables of the basering S. The set of columns of Q equals Omega_S.
838
+ REFERENCE: Remark 3.1.
839
+ RETURN: a list of integral matrices A with |det A| = 1 such that A*{columns of Q} = {columns of Q}.
840
+ EXAMPLE:"
841
+ {
842
+ dbprint(printlevel, "Entering autGenWeights.");
843
+
844
+ // if S is the basering, and w1, w2 are weights of some generators
845
+ // the component S_w1 can only be mapped to S_w2 if the dimensions
846
+ // coincide. --> store these in OrigDim.
847
+ // Store in Origs the generator weights without repetition (also known as Omega_S).
848
+ list Origs = Q2Origs(Q);
849
+ list OrigDim = Origs[2];
850
+ list QQ = Origs[3]; // store columns of Q here
851
+ Origs = Origs[1];
852
+
853
+ dbprint(printlevel, "--- Originary degrees ---");
854
+ dbprint(printlevel, Origs);
855
+ dbprint(printlevel, "--- Dimension of the respective component ---");
856
+ dbprint(printlevel, OrigDim);
857
+
858
+ // distinguish between torsion and free cases.
859
+ list TOR;
860
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
861
+ // this treats the torsion case
862
+ dbprint(printlevel, "autGenWeights: entering torsion case...");
863
+
864
+ TOR = #[1];
865
+
866
+ return(autGenWeightsTorsion(Q, TOR, Origs, OrigDim));
867
+ }
868
+
869
+ // now, we treat the free case:
870
+ return(autGenWeightsFree(QQ, Origs, OrigDim));
871
+ }
872
+ example
873
+ {
874
+ echo=2;
875
+
876
+ // torsion example
877
+ // ZZ + ZZ/5ZZ:
878
+ intmat Q[2][5] =
879
+ 1,1,1,1,1,
880
+ 2,3,1,4,0;
881
+
882
+ list TOR = 5;
883
+
884
+ autGenWeights(Q, TOR);
885
+ kill Q, TOR;
886
+
887
+ // another free example
888
+ intmat Q[2][6] =
889
+ -2,2,-1,1,-1,1,
890
+ 1,1,1,1,1,1;
891
+
892
+ autGenWeights(Q);
893
+ kill Q;
894
+
895
+ //----------------
896
+ // 2nd free example
897
+ intmat Q[2][4] =
898
+ 1,0,1,1,
899
+ 0,1,1,1;
900
+
901
+ autGenWeights(Q);
902
+ kill Q;
903
+ }
904
+
905
+ ///////////////////////////////////
906
+
907
+ // converts e.g. n=5 to its binary representation, i.e. 0,1,0,1
908
+ // if r = 3.
909
+ // and stores it in an intvec.
910
+ // r gives the bound for n <= 2^r:
911
+ static proc int2face(int n, int r)
912
+ {
913
+ int k = r;
914
+ list v;
915
+ int n0 = n;
916
+
917
+ while(k >= 0){
918
+ if(2^k > n0){
919
+ v[size(v)+1] = 0;
920
+ } else {
921
+ v[size(v)+1] = 1;
922
+ n0 = n0 - 2^k;
923
+ }
924
+
925
+ k--;
926
+ }
927
+
928
+ if(size(v)>=2){
929
+ v = v[2..size(v)];
930
+ }
931
+
932
+ return(intvec(v[1..size(v)]));
933
+ }
934
+ example
935
+ {
936
+ echo = 2;
937
+ int n = 5;
938
+ int r = 4;
939
+ int2face(n, r);
940
+
941
+ n = 1;
942
+ r = 1;
943
+ int2face(n,r);
944
+ }
945
+
946
+ //////////////////////////////
947
+
948
+ // helper
949
+ // returns all permutations of the input list L.
950
+ static proc permutations(list Left, list sol){
951
+ list Res;
952
+
953
+ if(size(Left) == 0){
954
+ return(list(sol));
955
+ }
956
+
957
+ for(int i = 1; i <= size(Left); i++){
958
+ list sol0 = sol;
959
+ sol0[size(sol0)+1] = Left[i];
960
+
961
+ if(i > 1){
962
+ if(i < size(Left)){
963
+ list Left0 = Left[1..i-1], Left[i+1..size(Left)];
964
+ } else { // i = size(Left)
965
+ list Left0 = Left[1..i-1];
966
+ }
967
+ } else{ // i = 1
968
+ if(1 == size(Left)){
969
+ list Left0;
970
+ } else {
971
+ list Left0 = Left[i+1..size(Left)];
972
+ }
973
+ }
974
+
975
+ list Res0 = permutations(Left0, sol0);
976
+
977
+ for(int k = 1; k <= size(Res0); k++){
978
+ Res[size(Res)+1] = Res0[k];
979
+ }
980
+
981
+ kill k, sol0, Res0, Left0;
982
+ }
983
+
984
+ return(Res);
985
+ }
986
+ example
987
+ {
988
+ echo=2;
989
+
990
+ list L = 1,2,3;
991
+ permutations(L, list());
992
+
993
+ kill L;
994
+ }
995
+
996
+ ////////////////////////////
997
+
998
+ static proc fixesOrig(intmat M, list Origs, list OrigDim, list TOR){
999
+ int takeit = 1;
1000
+ intvec found = 0:size(Origs);
1001
+
1002
+ for(int l = 1; l <= size(Origs); l++){
1003
+ intmat W = Origs[l]; // 1 col
1004
+ intmat MW = M * W; // 1 col
1005
+
1006
+ // test whether M*W = some orig
1007
+ // (and also not yet found)?:
1008
+ for(int m = 1; m <= size(Origs); m++){
1009
+ // reduce torsion rows:
1010
+ intmat MWred = MW; // 1 col
1011
+
1012
+ for(int i = 1; i <= size(TOR); i++){
1013
+ MWred[nrows(MWred) - size(TOR) + i,1] = MWred[nrows(MWred) - size(TOR) + i,1] mod TOR[i];
1014
+
1015
+ if(MWred[nrows(MWred) - size(TOR) + i,1] < 0){
1016
+ MWred[nrows(MWred) - size(TOR) + i,1] = MWred[nrows(MWred) - size(TOR) + i,1] + TOR[i];
1017
+ }
1018
+ }
1019
+
1020
+ if(Origs[m] == MWred){
1021
+ if(found[m] == OrigDim[m]){
1022
+ takeit = 0;
1023
+ break;
1024
+ }
1025
+
1026
+ found[m] = 1;
1027
+ }
1028
+
1029
+ kill MWred, i;
1030
+ }
1031
+
1032
+ kill m, W, MW;
1033
+
1034
+ if(!takeit){
1035
+ return(0); // false
1036
+ }
1037
+ }
1038
+
1039
+ if(takeit and found == 1:size(Origs)){
1040
+ return(1); // true
1041
+ }
1042
+
1043
+ return(0); // false
1044
+ }
1045
+
1046
+ /////////////////////////////////////
1047
+
1048
+ // helper:
1049
+ // returns a list of all matrices of shape
1050
+ // diag(d_1,...,d_size(TOR))
1051
+ // where gcd(d_i, TOR[i]) = 1.
1052
+ static proc getDmats(list TOR){
1053
+ list sol;
1054
+ return(getDmatsrec(TOR, sol));
1055
+ }
1056
+ example
1057
+ {
1058
+ list TOR = 3,5;
1059
+ TOR;
1060
+ getDmats(TOR);
1061
+ }
1062
+
1063
+ ///////////////////////////
1064
+
1065
+ // helper
1066
+ // for getDmats
1067
+ static proc getDmatsrec(list TOR, list sol){
1068
+ int pos = size(sol) + 1;
1069
+ list Res;
1070
+
1071
+ if(size(sol) == size(TOR)){
1072
+ intmat D[size(TOR)][size(TOR)];
1073
+
1074
+ for(int k = 1; k <= size(TOR); k++){
1075
+ list L0 = sol[k];
1076
+ D[k, 1..ncols(D)] = L0[1..size(L0)];
1077
+
1078
+ kill L0;
1079
+ }
1080
+
1081
+ return(list(D));
1082
+ }
1083
+
1084
+ for(int i = 1; i < TOR[pos]; i++){
1085
+ list sol0 = sol;
1086
+
1087
+ if(gcd(i, TOR[pos]) == 1){
1088
+ sol0[pos] = i;
1089
+
1090
+ list Res0 = getDmatsrec(TOR, sol0);
1091
+ for(int k = 1; k <= size(Res0); k++){
1092
+ Res[size(Res)+1] = Res0[k];
1093
+ }
1094
+
1095
+ kill k;
1096
+ kill Res0;
1097
+ }
1098
+
1099
+ kill sol0;
1100
+ }
1101
+
1102
+ return(Res);
1103
+ }
1104
+
1105
+ ///////////////////////////
1106
+
1107
+ // helper: returns all intvecs
1108
+ // of length n with entries 0 <= c < m:
1109
+ static proc getCvecsrec(int m, int n, list sol){
1110
+ int pos = size(sol) + 1;
1111
+ list Res;
1112
+
1113
+ if(size(sol) == n){
1114
+ return(list(sol));
1115
+ }
1116
+
1117
+ for(int i = 0; i < m; i++){
1118
+ list sol0 = sol;
1119
+ sol0[pos] = i;
1120
+
1121
+ list Res0 = getCvecsrec(m, n, sol0);
1122
+ for(int k = 1; k <= size(Res0); k++){
1123
+ Res[size(Res)+1] = Res0[k];
1124
+ }
1125
+
1126
+ kill k, Res0, sol0;
1127
+ }
1128
+
1129
+ return(Res);
1130
+ }
1131
+
1132
+ //////////////////////////////////////////
1133
+
1134
+ // helper:
1135
+ // returns a list of all size(TOR) x n
1136
+ // matrices C with entries
1137
+ // 0 <= c_ij < TOR[i]
1138
+ static proc getCmats(list TOR, int n){
1139
+ list ROWS;
1140
+
1141
+ for(int i = 1; i <= size(TOR); i++){
1142
+ list sol;
1143
+ ROWS[i] = getCvecsrec(TOR[i], n, sol);
1144
+
1145
+ kill sol;
1146
+ }
1147
+
1148
+ // choose one from each element of ROWs:
1149
+ // i.e., form the cartesian product:
1150
+ list CL = getCmatsrec(ROWS, list());
1151
+
1152
+ return(CL);
1153
+ }
1154
+ example
1155
+ {
1156
+ list TOR = 3,5;
1157
+
1158
+ TOR;
1159
+
1160
+ "ZZ^2 + ZZ/3ZZ + ZZ/5ZZ:";
1161
+ getCmats(TOR, 2);
1162
+
1163
+ }
1164
+
1165
+ ///////////////////////////
1166
+
1167
+ // helper: chooses one element of each
1168
+ // element of ROWs and forms the matrix
1169
+ static proc getCmatsrec(list ROWS, list sol){
1170
+ int pos = size(sol) + 1;
1171
+ list Res;
1172
+
1173
+ if(size(sol) == size(ROWS)){
1174
+ intmat C[size(ROWS)][size(ROWS[1][1])];
1175
+
1176
+ for(int k = 1; k <= size(ROWS); k++){
1177
+ list ROWSk = sol[k];
1178
+ C[k, 1..ncols(C)] = ROWSk[1..size(ROWSk)];
1179
+
1180
+ kill ROWSk;
1181
+ }
1182
+
1183
+ return(list(C)); //return(list(sol));
1184
+ }
1185
+
1186
+ for(int i = 1; i <= size(ROWS[pos]); i++){
1187
+ list sol0 = sol;
1188
+ sol0[pos] = ROWS[pos][i];
1189
+
1190
+ list Res0 = getCmatsrec(ROWS, sol0);
1191
+ for(int k = 1; k <= size(Res0); k++){
1192
+ Res[size(Res)+1] = Res0[k];
1193
+ }
1194
+
1195
+ kill k, Res0, sol0;
1196
+ }
1197
+
1198
+ return(Res);
1199
+ }
1200
+
1201
+ //////////////////////////////////////////
1202
+
1203
+ // helper: concats the given matrices to
1204
+ // B | 0
1205
+ // C | D
1206
+ static proc concatBCD(intmat B, intmat C, intmat D){
1207
+ intmat A[nrows(B) + nrows(C)][ncols(B) + ncols(D)];
1208
+
1209
+ for(int i = 1; i <= nrows(B); i++){
1210
+ A[i, 1..ncols(B)] = B[i,1..ncols(B)]; //, 0:ncols(D);
1211
+ }
1212
+ for(i = nrows(B)+1; i <= nrows(B) + nrows(C); i++){
1213
+ //A[i, 1..ncols(A)] = C[i - nrows(B), 1..ncols(C)], D[i - nrows(B), 1..ncols(D)];
1214
+ A[i, 1..ncols(C)] = C[i - nrows(B), 1..ncols(C)];
1215
+ A[i, ncols(C)+1..ncols(A)] = D[i - nrows(B), 1..ncols(D)];
1216
+ }
1217
+
1218
+ return(A);
1219
+ }
1220
+
1221
+ /////////////////////////////////
1222
+
1223
+ // helper
1224
+ // assume: BL of shape [[d, w, Rw],...] where d is the dimension of R_w,
1225
+ // Rw a basis of R_w and w the weight vector.
1226
+ // Returns a ring S and exports a matrix of name Aexported over S
1227
+ // and a list of monomials MONSexported.
1228
+ static proc createAutMatrix(list BL)
1229
+ {
1230
+ // A will be nxn; compute n:
1231
+ list MON = sortMons(BL);
1232
+ int n = size(MON);
1233
+
1234
+ // the first rows of A correspond to the variables T(i):
1235
+ def R = basering;
1236
+ int n0 = nvars(basering);
1237
+ intmat Q = getVariableWeights();
1238
+ intmat QS[nrows(Q)][ncols(Q) + n0*n];
1239
+
1240
+ for(int l = 1; l <= ncols(Q); l++){
1241
+ QS[1..nrows(Q),l] = Q[1..nrows(Q),l];
1242
+ }
1243
+
1244
+ int ii;
1245
+ list l3;
1246
+ for (ii = 1; ii <= n0; ii++)
1247
+ {
1248
+ l3[ii] = "T("+string(ii)+")";
1249
+ }
1250
+ for (ii = 1; ii <= n0*n; ii++)
1251
+ {
1252
+ l3[n0+ii] = "Y("+string(ii)+")";
1253
+ }
1254
+ ring S = create_ring(ring_list(basering)[1], l3, "dp("+string(n0+n0*n)+")", "no_minpoly");
1255
+ setring S;
1256
+ setBaseMultigrading(QS);
1257
+
1258
+ matrix A[n][n];
1259
+ map f = R, T(1..n0);
1260
+ list MONS = f(MON);
1261
+ list BLS = f(BL);
1262
+ int k;
1263
+
1264
+ for(int i = 1; i <= n0; i++){
1265
+ // find out j such that BLS[j] contains var(i):
1266
+ int ind = 0;
1267
+
1268
+ for(int j = 1; j <= size(BLS); j++){
1269
+ for(k = 1; k <= size(BLS[j][3]); k++){
1270
+ if(var(i) == BLS[j][3][k]){
1271
+ ind = j;
1272
+ break;
1273
+ }
1274
+ }
1275
+
1276
+ if(ind > 0){
1277
+ break;
1278
+ }
1279
+ }
1280
+
1281
+ list MONi = BLS[ind][3];
1282
+
1283
+ for(j = 1; j <= n; j++){
1284
+ // test if MON[j] is in the set {MONi}:
1285
+ for(int m = 1; m <= size(MONi); m++){
1286
+ if(MONi[m] == MONS[j]){
1287
+ A[i,j] = Y((i-1)*n+j); // the Y-variables are ordered row-wise
1288
+ break;
1289
+ }
1290
+ }
1291
+
1292
+ kill m;
1293
+ }
1294
+
1295
+ kill MONi, ind, j;
1296
+ }
1297
+
1298
+ // Form the A*T[i] first for the lower rows:
1299
+ // store A*T[i] in H[1,i]:
1300
+ matrix H[1][n0];
1301
+
1302
+ for(k = 1; k <= n0; k++){
1303
+ for(i = 1; i <= size(MONS); i++){
1304
+ H[1,k] = H[1,k] + A[k,i] * MONS[i];
1305
+ }
1306
+ }
1307
+
1308
+ // the lower rows of of A
1309
+ // are determined by the first ones:
1310
+ // e.g. A*(T_1^2) = (A*T_1)^2:
1311
+ for(i = n0 + 1; i <= size(MONS); i++){
1312
+ // e.g. for MON[i] = T[1]*T[2]^2,
1313
+ // we have v = [1,2,0,0] and
1314
+ // A * (T[1]*T[2]^2) = (A*T[1])(A*T[2])^2:
1315
+ poly Av = 1;
1316
+ intvec v = leadexp(MONS[i]); // the last entries are all 0s
1317
+
1318
+ for(int m = 1; m <= n0; m++){
1319
+ Av = Av * H[1,m]^v[m];
1320
+ }
1321
+
1322
+ // if in Av there is e.g. the monomial Y(22)^2*T(1)^2
1323
+ // then A[i,j] = Y(22)^2 where MONS[j] = T(1)^2:
1324
+ for(int j = 1; j <= size(MONS); j++){
1325
+ A[i,j] = moncoef2(Av, MONS[j], n0);
1326
+ }
1327
+
1328
+ kill Av, v, m, j;
1329
+ }
1330
+
1331
+ matrix Aexported = A;
1332
+ list MONSexported = MONS;
1333
+
1334
+ // ring-dependent:
1335
+ export(Aexported);
1336
+ export(MONSexported);
1337
+
1338
+ return(S);
1339
+ }
1340
+
1341
+ ////////////////////////////
1342
+
1343
+ // helper
1344
+ // returns bases for <RL>_w for all w in Orig.
1345
+ static proc allMonomials(ideal RL, list #){
1346
+ list TOR;
1347
+
1348
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
1349
+ TOR = #[1];
1350
+ }
1351
+
1352
+ list BL;
1353
+ intmat Q = getVariableWeights();
1354
+
1355
+ // by assumption: Origs = degrees (no repetition)
1356
+ list Origs = Q2Origs(Q)[1];
1357
+
1358
+ for(int i = 1; i <= size(Origs); i++){
1359
+ intvec w = Origs[i];
1360
+ list L = gradedCompRing(RL, w, TOR);
1361
+ list Rw = L[1];
1362
+
1363
+ BL[size(BL)+1] = list(size(Rw), w, Rw);
1364
+
1365
+ kill L, w, Rw;
1366
+ }
1367
+
1368
+ return(BL);
1369
+ }
1370
+
1371
+ ////////////////////////////
1372
+
1373
+ // helper
1374
+ // returns the columns of Q without repetition
1375
+ // and the list of dimensions.
1376
+ static proc Q2Origs(intmat Q){
1377
+ list Origs;
1378
+ list OrigDim;
1379
+ list QQ;
1380
+
1381
+ for(int i = 1; i <= ncols(Q); i++){
1382
+ int takeit = 1;
1383
+ intvec v = col(Q, i);
1384
+ QQ[i] = v;
1385
+
1386
+ for(int j = 1; j <= size(Origs); j++){
1387
+ if(Origs[j] == v){
1388
+ OrigDim[j] = OrigDim[j] + 1; // OrigDim[j] is already defined
1389
+ takeit = 0;
1390
+ break;
1391
+ }
1392
+ }
1393
+
1394
+ if(takeit == 1){
1395
+ Origs[size(Origs)+1] = v;
1396
+ OrigDim[size(OrigDim)+1] = 1;
1397
+ }
1398
+
1399
+ kill j, v, takeit;
1400
+ }
1401
+
1402
+ return(list(Origs, OrigDim, QQ));
1403
+ }
1404
+
1405
+ //////////////////////////////////////////
1406
+
1407
+ static proc gradedCompRing(ideal RL, intvec w, list #)
1408
+ "USAGE: gradedCompRing(I, w): I is an ideal, w an intvec. Optional 3rd argument: a list of integers representing the torsion part.
1409
+ ASSUME: the basering must be graded (see setBAseMultigrading()) and the cone over
1410
+ the degrees of the variables must be pointed; there mustn't be 0-degrees. The vector
1411
+ w must be an element of the cone over the degrees of the variables.
1412
+ PURPOSE: returns a basis for the vector space R_w where R is the factor ring of the basering by I.
1413
+ RETURN: a list L where L[1] = is the (monomial) Basis, L[2] = is a matrix with columns representing the basis vectors, L[3] = Monomials of degree w;
1414
+ EXAMPLE: shows an example."
1415
+ {
1416
+ list TOR;
1417
+
1418
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
1419
+ TOR = #[1];
1420
+ }
1421
+
1422
+ // return a basis for I_w as a list of basis vectors:
1423
+ list L = gradedCompIdeal(RL, w, 0, TOR);
1424
+ list MON = L[1];
1425
+ list RLw = L[2];
1426
+
1427
+ list Bas;
1428
+ int r;
1429
+
1430
+ if(size(RLw) == 0){
1431
+ r = 0;
1432
+ } else {
1433
+ matrix B[size(RLw)][size(MON)];
1434
+
1435
+ for(int i = 1; i <= size(RLw); i++){
1436
+ matrix RLwi = RLw[i];
1437
+ B[i, 1..size(MON)] = RLwi[1..nrows(RLwi), 1];
1438
+
1439
+ kill RLwi;
1440
+ }
1441
+ kill i;
1442
+
1443
+ r = rank(B);
1444
+ }
1445
+
1446
+ // Add Elements to Basis 'Bas' as long as the rank r
1447
+ // of the matrix B increases:
1448
+ for(int j = 1; j <= size(MON); j++){
1449
+ // translate MON[j] to v= -e_j
1450
+ // the new row: e_j, i.e., all zeros (standard) and j-th entry is a 1:
1451
+ if(r == 0){ // this means B is not defined!
1452
+ matrix Btmp[1][size(MON)];
1453
+ Btmp[1,j] = 1;
1454
+ } else {
1455
+ matrix Btmp[nrows(B)+1][ncols(B)] = B[1..nrows(B), 1..ncols(B)];
1456
+ Btmp[nrows(B)+1, j] = 1;
1457
+ }
1458
+
1459
+ int rv = rank(Btmp);
1460
+
1461
+ if(rv > r){
1462
+ if(r == 0){
1463
+ matrix B = Btmp;
1464
+ } else{
1465
+ B = Btmp;
1466
+ }
1467
+
1468
+ r = rv;
1469
+
1470
+ Bas[size(Bas)+1] = MON[j];
1471
+ }
1472
+
1473
+ kill rv, Btmp;
1474
+ }
1475
+
1476
+ // remove columns of RL_w in B:
1477
+ matrix B2[nrows(B) - size(RLw)][ncols(B)] = B[size(RLw)+1..nrows(B), 1..ncols(B)];
1478
+
1479
+ list LL;
1480
+ LL[1] = Bas;
1481
+ LL[2] = B2;
1482
+ LL[3] = MON;
1483
+
1484
+ return(LL);
1485
+ }
1486
+ example
1487
+ {
1488
+ echo=2;
1489
+
1490
+ // example with torsion: ZZ + ZZ/5ZZ:
1491
+ intmat Q[2][5] =
1492
+ 1,1,1,1,1,
1493
+ 2,3,1,4,0;
1494
+
1495
+ list TOR = 5;
1496
+ ring R = 0,T(1..5),dp;
1497
+
1498
+ // attach degree matrix Q to R:
1499
+ setBaseMultigrading(Q);
1500
+
1501
+ ideal I = T(1)*T(2) + T(3)*T(4) + T(5)^2;
1502
+ intvec w = 3,1;
1503
+
1504
+ // as list of polynomials:
1505
+ gradedCompRing(I, w, TOR);
1506
+ kill R, w, Q, TOR;
1507
+
1508
+ // 2nd example: no torsion
1509
+ ring R = 0, T(1..4), dp;
1510
+
1511
+ // Weights of variables
1512
+ intmat Q[2][4] =
1513
+ -2, 2, -1, 1,
1514
+ 1, 1, 1, 1;
1515
+
1516
+ // attach degree matrix Q to R:
1517
+ setBaseMultigrading(Q);
1518
+
1519
+ ideal I = T(1)*T(2) + T(3)*T(4);
1520
+ intvec w = 0,2;
1521
+
1522
+ gradedCompRing(I, w);
1523
+ }
1524
+
1525
+
1526
+ ////////////////////////
1527
+
1528
+ // helper
1529
+ // sort the monomials in the 3rd entry
1530
+ // of each element of BL into a list
1531
+ // according to the dp-ordering (descendingly)
1532
+ static proc sortMons(list BL){
1533
+ list MON;
1534
+
1535
+ // extract monomials
1536
+ for(int i = 1; i <= size(BL); i++){
1537
+ list Tmp = BL[i][3];
1538
+
1539
+ for(int j = 1; j <= size(Tmp); j++){
1540
+ MON[size(MON)+1] = Tmp[j];
1541
+ }
1542
+
1543
+ kill Tmp, j;
1544
+ }
1545
+
1546
+ // sort MON according to the degrevlex ordering (dp)
1547
+ def R = basering;
1548
+
1549
+ list l6;
1550
+ for (int zz = 1; zz <= nvars(basering); zz++)
1551
+ {
1552
+ l6[zz] = "Y("+string(nvars(basering)+1-zz)+")";
1553
+ }
1554
+ ring S = create_ring(ring_list(basering)[1], l6, "dp", "no_minpoly");
1555
+ setring S; //creates a ring of shape '0, Y(nvars(basering)..1), dp'
1556
+
1557
+ map f = R, Y(1..nvars(basering));
1558
+ list fMON = f(MON);
1559
+ list MONS;
1560
+
1561
+ // to sort MONS:
1562
+ // form Sum_i fMON[i] and look
1563
+ // for the leading terms iteratively:
1564
+ poly p = 0;
1565
+
1566
+ for(i = 1; i <= size(fMON); i++){
1567
+ p = p + fMON[i];
1568
+ }
1569
+
1570
+ // sort it descendingly:
1571
+ int c = size(fMON);
1572
+
1573
+ while(p != 0){
1574
+ MONS[c] = lead(p);
1575
+ p = p - lead(p);
1576
+ c--;
1577
+ }
1578
+
1579
+ // translate back to R:
1580
+ setring R;
1581
+
1582
+ ideal mi=maxideal(1);
1583
+ map g = S, mi[nvars(basering)..1];
1584
+ MON = g(MONS);
1585
+
1586
+ return(MON);
1587
+ }
1588
+
1589
+ ////////////////////////
1590
+
1591
+ // helper:
1592
+ // computes the nxn identity matrix:
1593
+ static proc getIdMat(int n){
1594
+ intmat A[n][n];
1595
+
1596
+ for(int i = 1; i <= n; i++){
1597
+ A[i, 1..n] = 0:n;
1598
+ A[i,i] = 1;
1599
+ }
1600
+
1601
+ return(A);
1602
+ }
1603
+
1604
+ //////////////////////////////////////
1605
+
1606
+ // helper
1607
+ static proc insertIntvecIfNew(list L0, intvec v){
1608
+ list L = L0;
1609
+ int takeit = 1;
1610
+
1611
+ for(int j = 1; j <= size(L); j++){
1612
+ if(L[j] == v){
1613
+ takeit = 0;
1614
+ break;
1615
+ }
1616
+ }
1617
+
1618
+ if(takeit == 1){
1619
+ L[size(L) + 1] = v;
1620
+ }
1621
+
1622
+ return(L);
1623
+ }
1624
+
1625
+ //////////////////////////////////////
1626
+
1627
+ // helper:
1628
+ // returns the set
1629
+ // OmegaI = {w in K; I_w \subseteq I_<w}
1630
+ // of unique minimal generator degrees.
1631
+ // Elements of components are of shape
1632
+ // [w, I_w, K[T]_w]
1633
+ // We assume that if I = <f_1,...,f_s> we have
1634
+ // OmegaI = {deg(f_1),...,deg(f_s)}
1635
+ static proc getOmegaI(ideal I, list #){
1636
+ dbprint(printlevel, "Warning: we assume that OmegaI = {deg(f_1),...,deg(f_s)} if the input ideal is generated by f_1,...,f_s. ");
1637
+
1638
+ list TOR;
1639
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
1640
+ TOR = #[1];
1641
+ }
1642
+
1643
+ // OmegaI = {w in K; I_w \subseteq I_<w}
1644
+ list OmegaI;
1645
+
1646
+ // go through each generator f of the ideal:
1647
+ // compute a basis for I_deg(f)
1648
+ for(int i = 1; i <= size(I); i++){
1649
+ poly f = I[i];
1650
+ intvec w = multiDegRedTor(f, TOR);
1651
+
1652
+ OmegaI = insertIntvecIfNew(OmegaI, w);
1653
+ kill f, w;
1654
+ }
1655
+
1656
+ return(OmegaI);
1657
+ }
1658
+ example
1659
+ {
1660
+ echo=2;
1661
+
1662
+ intmat Q[1][5] = 3,3,2,2,1;
1663
+ ring R = 0,T(1..5),dp;
1664
+
1665
+ // attach degree matrix Q to R:
1666
+ setBaseMultigrading(Q);
1667
+
1668
+ ideal I = T(1)*T(2) + T(3)^2*T(4) + T(5)^6,
1669
+ T(3)*T(4) + T(1)*T(5) + T(5)^4 + T(4)^2;
1670
+
1671
+ // expect: OmegaI = {4,6}
1672
+ getOmegaI(I);
1673
+ }
1674
+
1675
+ /////////////////////////////////////
1676
+
1677
+ // helper:
1678
+ // write the variables of the basering in the rows of a matrix.
1679
+ // n0 is the number of variables of the very first basering,
1680
+ // i.e., the number of 'meaningful' rows of the resulting matrix.
1681
+ static proc getAgeneral(int n0){
1682
+ int coldim = (nvars(basering) - 1) div n0; // there is the additional var 'Z'
1683
+ matrix A[coldim][coldim];
1684
+
1685
+ // write the variables into A
1686
+ int j;
1687
+ int v = 1;
1688
+ for(int i = 1; i <= n0; i++){
1689
+ for(j = 1; j <= coldim; j++){
1690
+ A[i,j] = var(v);
1691
+ v++;
1692
+ }
1693
+ }
1694
+
1695
+ return(A);
1696
+ }
1697
+ example
1698
+ {
1699
+ echo = 2;
1700
+ ring R = 0,(Y(1..45),Z),dp;
1701
+ matrix A = getAgeneral(5);
1702
+ print(A);
1703
+ }
1704
+
1705
+ /////////////////////////////////////
1706
+
1707
+ // helper
1708
+ // Applies the action given by A.
1709
+ static proc applyA(matrix A, int n0, list AMONS){
1710
+ // Define the map
1711
+ // T_i --> phi(T_i) = A * T_i:
1712
+ // store A*T[i] in H[1,i]:
1713
+ matrix H[1][n0];
1714
+
1715
+ int l;
1716
+ for(int k = 1; k <= n0; k++){
1717
+ for(l = 1; l <= size(AMONS); l++){
1718
+ H[1,k] = H[1,k] + A[k,l] * AMONS[l];
1719
+ }
1720
+ }
1721
+
1722
+ return(H);
1723
+ }
1724
+ example
1725
+ {
1726
+ echo = 2;
1727
+ ring R = 0,(Y(1..45),Z),dp;
1728
+ matrix AR = getAgeneral(5);
1729
+
1730
+ ring S = 0,(T(1..5),Y(1..45),Z),dp;
1731
+ matrix A = imap(R, AR);
1732
+ print(A);
1733
+ list AMONS = T(1), T(2), T(3), T(4), T(5), T(3)*T(5), T(4)*T(5), T(5)^2, T(5)^3;
1734
+ int n0 = 5;
1735
+ applyA(A, n0, AMONS);
1736
+ }
1737
+
1738
+ //////////////////////////////////////
1739
+
1740
+ // helper
1741
+ // returns A * (generator corresponding to u)
1742
+ // The action of A is stored in H.
1743
+ static proc applyAtoGenerator(matrix u, matrix H, list KTwS, int n0){
1744
+ poly g0 = 0;
1745
+
1746
+ for(int m = 1; m <= nrows(u); m++){
1747
+ if(u[m,1] != 0){
1748
+ intvec v = leadexp(KTwS[m]); // only the first n0 entries are interesting
1749
+ poly g = u[m,1];
1750
+
1751
+ for(int x = 1; x <= n0; x++){
1752
+ g = g * H[1,x]^v[x];
1753
+ }
1754
+
1755
+ g0 = g0 + g;
1756
+
1757
+ kill v, g, x;
1758
+ }
1759
+ }
1760
+
1761
+ return(g0);
1762
+ }
1763
+
1764
+
1765
+ /////////////////////////////////////
1766
+
1767
+ // helper
1768
+ static proc linEqs(list IBw, list MON){
1769
+ // compute linear equations for the vector space IBw:
1770
+ // the elements of the kernel MM correspond to linear forms:
1771
+ // e.g., [1,0,-1,0] means S[1] - S[3]:
1772
+ matrix B[size(IBw)][size(MON)];
1773
+
1774
+ for(int j = 1; j <= size(IBw); j++){
1775
+ B[j, 1..size(MON)] = IBw[j];
1776
+ }
1777
+
1778
+ dbprint(printlevel, "Graded component as vectors:");
1779
+ dbprint(printlevel, B);
1780
+
1781
+ // in this case, this computes the kernel
1782
+ // (since there are only constant entries in B):
1783
+ matrix M = syz(B);
1784
+
1785
+ dbprint(printlevel, "Kernel:");
1786
+ dbprint(printlevel, M);
1787
+
1788
+ return(M);
1789
+ }
1790
+
1791
+ //////////////////////////////////////
1792
+
1793
+ // helper
1794
+ // creates the ring 0,(T(1..n0), Y(1..n1),Z),(dp(n0+n1),dp(1));
1795
+ static proc getFullRingS(intmat Q, int n0, int n1){
1796
+ intmat QS[nrows(Q)][ncols(Q)+1];
1797
+
1798
+ for(int l = 1; l <= ncols(Q); l++){
1799
+ QS[1..nrows(Q),l] = Q[1..nrows(Q),l];
1800
+ }
1801
+
1802
+ int ii;
1803
+ list l4;
1804
+ for (ii = 1; ii <= n0; ii++)
1805
+ {
1806
+ l4[ii] = "T("+string(ii)+")";
1807
+ }
1808
+ for (ii = 1; ii <= n1; ii++)
1809
+ {
1810
+ l4[n0+ii] = "Y("+string(ii)+")";
1811
+ }
1812
+ l4[size(l4)+1] = "Z";
1813
+ ring S = create_ring(ring_list(basering)[1], l4, "(dp("+string(n0+n1)+"),dp(1))", "no_minpoly");
1814
+ setring S;
1815
+ setBaseMultigrading(QS);
1816
+
1817
+ return(S);
1818
+ }
1819
+
1820
+ /////////////////////////////////////
1821
+
1822
+ // helper
1823
+ static proc monomials2basis(poly g0, list BMONS, int n0){
1824
+ // replace in g0 e.g. T[1]^2 by e_1:
1825
+ // store coeffs for e_1 in Res[1] etc:
1826
+ list RES;
1827
+
1828
+ for(int m = 1; m <= size(BMONS); m++){
1829
+ RES[m] = 0;
1830
+ }
1831
+
1832
+ for(m = 1; m <= size(BMONS); m++){
1833
+ poly u0 = moncoef2(g0, BMONS[m], n0);
1834
+
1835
+ if(u0 != 0){
1836
+ RES[m] = RES[m] + u0;
1837
+ }
1838
+
1839
+ kill u0;
1840
+ }
1841
+
1842
+ return(RES);
1843
+ }
1844
+
1845
+ /////////////////////////////////////
1846
+
1847
+ // helper
1848
+ static proc getEqs(matrix MS, list RES){
1849
+ ideal GL;
1850
+
1851
+ for(int m = 1; m <= ncols(MS); m++){
1852
+ poly f0 = 0;
1853
+
1854
+ for(int l = 1; l <= nrows(MS); l++){
1855
+ f0 = f0 + RES[l] * MS[l,m];
1856
+ }
1857
+
1858
+ GL[size(GL)+1] = f0;
1859
+ kill f0, l;
1860
+ }
1861
+
1862
+ return(GL);
1863
+ }
1864
+
1865
+ //////////////////////////////////////
1866
+
1867
+ proc stabilizer(ideal RL, list #)
1868
+ "USAGE: stabilizer(RL, A, BB, AMON, n0): RL is an ideal, A a matrix (standing for a subgroup of GL(n)), BB is an intmat (standing for an automorphism of the grading group), AMON a list of monomials corresponding to the rows/columns of A, n0 an integer such that the first n0 variables of the basering are the T(i), optional: a list of elementary divisors if there is torsion.
1869
+ ASSUME: the basering must be graded (see setBaseMultigrading()) and the cone over
1870
+ the degrees of the variables must be pointed; there mustn't be 0-degrees. The vector
1871
+ w must be an element of the cone over the degrees of the variables. Moreover, B must be such that it permutes the degrees of the variables and the degrees of the generators of RL.
1872
+ PURPOSE: returns relations such that A*I = I.
1873
+ RETURN: a ring. Also exports an ideal Jexported and a list stabExported.
1874
+ EXAMPLE: shows an example."
1875
+ {
1876
+ def R = basering;
1877
+ intmat Q = getVariableWeights();
1878
+
1879
+ // torsion:
1880
+ list TOR;
1881
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
1882
+ TOR = #[1];
1883
+ }
1884
+
1885
+ //list Components = stabPreprocessor(RL);
1886
+ //list OmegaI = getOmegaI(RL);
1887
+ int nTvars = nvars(basering);
1888
+ list DegL = getGenDegsDims(RL, TOR);
1889
+
1890
+ // output of aut_K(S):
1891
+ def RR = autKS(TOR); // = \KK[Y_{ij},Z]
1892
+ setring RR;
1893
+ string AMONSstring = MONexported; // needed for later, dependent on T_i
1894
+
1895
+ list listAutKS = autKSexported;
1896
+ ideal J; // will be the result
1897
+ list stabExported; // also export this
1898
+
1899
+ // ring with both T_i and the Y_{ij}
1900
+ int nYvars = nvars(basering) - 1; // no of Y variables
1901
+ def S = getFullRingS(Q, nTvars, nYvars); // = \KK[T_k,Y_{ij},Z]
1902
+ setring S;
1903
+
1904
+ // prepare for later:
1905
+ // matrix A = imap(RR, Agen);
1906
+ execute("list AMONS = " + AMONSstring); // define AMONS
1907
+
1908
+ int i;
1909
+ setring RR; // KK[Y_i]
1910
+ for(int p = 1; p <= size(listAutKS); p++){
1911
+
1912
+ matrix A = listAutKS[p][1];
1913
+ intmat BB = listAutKS[p][2];
1914
+ ideal JBA = listAutKS[p][3];
1915
+
1916
+ if(!isDimInvar(BB, DegL, TOR)){
1917
+ dbprint(printlevel, "B was not diminvar.");
1918
+
1919
+ kill A, BB, JBA;
1920
+ } else {
1921
+
1922
+ setring S;
1923
+ ideal EQs;
1924
+
1925
+ setring R; // = \KK[T_i]
1926
+
1927
+ // go through each generator g of the ideal RL:
1928
+ // compute a basis for RL_deg(g), linear equations
1929
+ for(i = 1; i <= size(RL); i++){
1930
+ dbprint(printlevel, "computing stabilizer: starting loop with i = " + string(i));
1931
+
1932
+ // w = multidegree and reduce later entries
1933
+ // if there is torsion:
1934
+ intvec w = multiDegRedTor(RL[i], TOR);
1935
+
1936
+ // compute a basis KTw of \KK[T_1,...,T_r]_w:
1937
+ list KTw = wmonomials(w, 0, TOR);
1938
+
1939
+ // compute a basis Iw of I_w:
1940
+ // I_w will be a subspace of KTw:
1941
+ list L = gradedCompIdeal(RL, w, 0, TOR);
1942
+ list Iw = L[2];
1943
+ list MON = L[1];
1944
+
1945
+ // compute a basis IBw of I_(B*w) if B*w != w:
1946
+ // I_(B*w) will be a subspace of KTBw:
1947
+ intvec Bw = BB * w;
1948
+
1949
+ if(Bw != w){
1950
+ list LB = gradedCompIdeal(RL, Bw, 0, TOR);
1951
+ list IBw = LB[2];
1952
+ list BMON = LB[1];
1953
+ } else {
1954
+ list LB = L;
1955
+ list IBw = L[2];
1956
+ list BMON = L[1];
1957
+ }
1958
+
1959
+ matrix M = linEqs(IBw, MON); // kernel computation
1960
+
1961
+ // Define the map
1962
+ // T_i --> phi(T_i) = A * T_i:
1963
+ // store A*T[i] in H[1,i]:
1964
+ setring S;
1965
+ matrix A = imap(RR, A);
1966
+ matrix H = applyA(A, nTvars, AMONS);
1967
+
1968
+ dbprint(printlevel, "the map phi (stored in H[1,j] = A*T_j):");
1969
+ dbprint(printlevel, H);
1970
+
1971
+ // for each basis vector u of Iw:
1972
+ // form g0 := A * (current generator) = Sum A*u_i where u_i <> 0:
1973
+ list IwS = imap(R, Iw);
1974
+ list KTwS = imap(R, KTw);
1975
+
1976
+ for(int k = 1; k <= size(IwS); k++){
1977
+ matrix u = IwS[k]; // ... x 1 matrix
1978
+
1979
+ poly g0 = applyAtoGenerator(u, H, KTwS, nTvars);
1980
+
1981
+ dbprint(printlevel, "Iw=");
1982
+ dbprint(printlevel, IwS);
1983
+ dbprint(printlevel, "current basis vector u of Iw:");
1984
+ dbprint(printlevel, u);
1985
+ dbprint(printlevel, "g0 = A * (current generator) = ");
1986
+ dbprint(printlevel, g0);
1987
+
1988
+ // replace in g0 e.g. T[1]^2 by e_1:
1989
+ // store coeffs for e_1 in Res[1] etc:
1990
+
1991
+ // NOTE: I_w gets mapped to I_(B*w):
1992
+ list BMON = imap(R, BMON);
1993
+ list RES = monomials2basis(g0, BMON, nTvars); // AMONS = BMONS?
1994
+
1995
+ dbprint(printlevel, "after replacing in g0 e.g. T[1]^2 by e_1: (where e_i <--> KTwS[i]), RES = ");
1996
+ dbprint(printlevel, RES);
1997
+ matrix MS = imap(R, M);
1998
+ ideal GL = getEqs(MS, RES);
1999
+
2000
+ if(size(EQs) == 0){
2001
+ EQs = GL[1..size(GL)];
2002
+ } else {
2003
+ EQs = EQs, GL[1..size(GL)];
2004
+ }
2005
+
2006
+ dbprint(printlevel, "applying the linear forms of the kernel MS = ");
2007
+ dbprint(printlevel, MS);
2008
+ dbprint(printlevel, "yields equations GL = ");
2009
+ dbprint(printlevel, GL);
2010
+ dbprint(printlevel, "Total equations so far = EQs = ");
2011
+ dbprint(printlevel, EQs);
2012
+
2013
+ kill MS, GL, u, BMON, g0, RES;
2014
+ setring S;
2015
+ }
2016
+
2017
+ setring S;
2018
+ kill IwS, KTwS, A, H;
2019
+
2020
+ setring R;
2021
+ kill M, w, KTw, L, Iw, MON, Bw, LB, IBw, BMON;
2022
+ }
2023
+
2024
+ //kill k;
2025
+
2026
+ setring RR;
2027
+ ideal JBAnew = JBA + imap(S, EQs);
2028
+ stabExported[size(stabExported) + 1] = list(A, BB, JBAnew);
2029
+
2030
+ if(size(J) == 0){
2031
+ J = JBAnew;
2032
+ } else {
2033
+ //J = J * JBAnew;
2034
+ J = intersect(J, JBAnew); // in Singular, intersection is usually quicker
2035
+ }
2036
+
2037
+
2038
+ setring S;
2039
+ kill EQs;
2040
+ setring RR;
2041
+ kill JBAnew, BB, A, JBA;
2042
+ }
2043
+ }
2044
+
2045
+ // return the ring RR, export the ideal J:
2046
+ setring RR;
2047
+ ideal Jexported = J;
2048
+ export(Jexported);
2049
+ export(stabExported);
2050
+
2051
+ return(RR);
2052
+ }
2053
+ example
2054
+ {
2055
+ echo=2;
2056
+
2057
+ //////////////////
2058
+ // example: fano 15:
2059
+ intmat Q[1][5] = 3,3,2,2,1;
2060
+ ring R = 0,T(1..5),dp;
2061
+
2062
+ // attach degree matrix Q to R:
2063
+ setBaseMultigrading(Q);
2064
+
2065
+ ideal I = T(1)*T(2) + T(3)^2*T(4) + T(5)^6;
2066
+ def RR = stabilizer(I);
2067
+ setring RR;
2068
+ RR;
2069
+ Jexported;
2070
+ dim(std(Jexported));
2071
+ getVariableWeights();
2072
+
2073
+ kill RR, Q, R;
2074
+
2075
+ /////////////
2076
+ // example 3.14 from the paper
2077
+ intmat Q[3][5] =
2078
+ 1,1,1,1,1,
2079
+ 1,-1,0,0,1,
2080
+ 1,1,1,0,0;
2081
+
2082
+ list TOR = 2;
2083
+ ring R = 0,T(1..5),dp;
2084
+
2085
+ // attach degree matrix Q to R:
2086
+ setBaseMultigrading(Q);
2087
+
2088
+ ideal I = T(1)*T(2) + T(3)^2 + T(4)^2;
2089
+ list TOR = 2;
2090
+ def RR = stabilizer(I, TOR);
2091
+ setring RR;
2092
+ RR;
2093
+ Jexported;
2094
+ dim(std(Jexported));
2095
+
2096
+ stabExported;
2097
+ kill RR, Q, R;
2098
+ }
2099
+
2100
+
2101
+ //////////////////////////////////
2102
+
2103
+ // helper:
2104
+ // computes the multidegree of f and reduces its later entries
2105
+ // mod TOR[i] if # is defined
2106
+ static proc multiDegRedTor(poly f, list #){
2107
+ list TOR;
2108
+
2109
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
2110
+ TOR = #[1];
2111
+ }
2112
+
2113
+ intmat Q = getVariableWeights();
2114
+ intvec w = multiDeg(f);
2115
+
2116
+ // reduce w if there is torsion:
2117
+ return(reduceIntvec(w, TOR));
2118
+ }
2119
+
2120
+ ///////////////////////////////////
2121
+
2122
+ // helper:
2123
+ // reduce later entries of w0
2124
+ // mod TOR[i] if TOR is non-empty:
2125
+ static proc reduceIntvec(intvec w0, list TOR){
2126
+ intvec w = w0;
2127
+ int pos;
2128
+
2129
+ for(int l = 1; l <= size(TOR); l++){
2130
+ pos = size(w0) - size(TOR) + l;
2131
+ w[pos] = w[pos] mod TOR[l];
2132
+
2133
+ // make positive:
2134
+ if(w[pos] < 0){
2135
+ w[pos] = w[pos] + TOR[l];
2136
+ }
2137
+ }
2138
+
2139
+ return(w);
2140
+ }
2141
+
2142
+ /////////////////////////////////
2143
+
2144
+ static proc moncoef2(poly f, poly mon, int n0)
2145
+ "USAGE: moncoef(f, mon): f is a polynomial, mon a monomial, n0 an integer.
2146
+ PURPOSE: returns the (not necessarily constant) coefficient of mon in f.
2147
+ For example the coefficient of T(1)^2 in T(1)^2*T(2) will be T(2).
2148
+ The integer n0 means that the variables var(n0+1),... will be considered to be coefficients.
2149
+ RETURN: a ring element.
2150
+ EXAMPLE: shows an example."
2151
+ {
2152
+ poly p = f;
2153
+ poly res = 0;
2154
+
2155
+ while (p != 0) {
2156
+ poly lp = lead(p) / mon;
2157
+
2158
+ if(lp != 0){
2159
+ // test whether there is still some T(i)-factor in lp:
2160
+ for(int i = 1; i <= n0; i++){
2161
+ lp = subst(lp, var(i), 0);
2162
+ }
2163
+
2164
+ if(lp != 0){
2165
+ //return(lp);
2166
+ res = res + lp;
2167
+ }
2168
+
2169
+ kill i;
2170
+ }
2171
+
2172
+ p = p - lead(p);
2173
+
2174
+ kill lp;
2175
+ }
2176
+
2177
+ return(res);
2178
+ }
2179
+ example
2180
+ {
2181
+ echo=2;
2182
+
2183
+ ring R = (0,a),T(1..4),dp;
2184
+
2185
+ poly f = T(1)^2*T(2)^3 + 7*a*T(3)^3 -8*T(3)^2 +7;
2186
+ poly mon = T(3)^3;
2187
+ poly mon = 1;
2188
+
2189
+ moncoef2(f, mon,4);
2190
+
2191
+ // example 2:
2192
+ ring R = 0,(T(1..3), Y(1..12)),dp;
2193
+ poly f = T(1)^2*Y(1)^2 + Y(9)*T(1)*Y(10)^2*T(1);
2194
+ poly m = T(1)^2;
2195
+
2196
+ // only the first three variables
2197
+ // are considered for taking the coefficient:
2198
+ moncoef2(f, m, 3);
2199
+ }
2200
+
2201
+ //////////////////////////////
2202
+
2203
+ // helper
2204
+ static proc fixesDim(intmat B, list ABL, list TOR){
2205
+ // ABL is of shape
2206
+ // [1]:
2207
+ // [1]:
2208
+ // 2 = dim of basering_w
2209
+ // [2]:
2210
+ // 1,0 = w
2211
+ // [3]: = generators of basering_w
2212
+ // [1]:
2213
+ // T(2)
2214
+ // [2]:
2215
+ // T(1)
2216
+ int j;
2217
+ for(int i = 1; i <= size(ABL); i++){
2218
+ int dimw = ABL[i][1]; // the dimension
2219
+ intvec w = ABL[i][2]; // the weight vector
2220
+ intvec Bw = reduceIntvec(B * w, TOR); // Bw must appear among some ABL[j]
2221
+
2222
+ for(j = 1; j <= size(ABL); j++){
2223
+ if(ABL[j][2] == Bw){
2224
+ if(ABL[j][1] != dimw){
2225
+ return(0);
2226
+ }
2227
+
2228
+ break;
2229
+ }
2230
+ }
2231
+
2232
+ if(j > size(ABL)){
2233
+ ERROR("B * w not found among generator weights. This should not happen.");
2234
+ }
2235
+
2236
+ kill dimw, w, Bw;
2237
+ }
2238
+
2239
+ return(1);
2240
+ }
2241
+
2242
+ ///////////////////////////////
2243
+
2244
+ proc autKS(list #)
2245
+ "USAGE: autKS(TOR); TOR: optional list of elementary divisors in case of torsion.
2246
+ ASSUME: the basering is multigraded having used the command setBaseMultigrading(Q) from 'multigrading.lib'.
2247
+ PURPOSE: Compute the subgroup Aut_K(S) of GL(n) of graded automorphisms of the polynomial ring S (the basering).
2248
+ RETURN: returns a ring S and exports an ideal ideal Iexported in the coordinate ring S = K[Y_ij] of GL(n) such that Aut_K(S) = V(I).
2249
+ EXAMPLE: shows an example."
2250
+ {
2251
+ list TOR;
2252
+
2253
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
2254
+ TOR = #[1];
2255
+ }
2256
+
2257
+ def R = basering;
2258
+ int n0 = nvars(basering);
2259
+
2260
+ list BL = allMonomials(ideal(0), TOR); //list BL = allMonomials(RL, TOR);
2261
+ list MONS = sortMons(BL);
2262
+
2263
+ // needed later for the S-admissible equations:
2264
+ // Note: the 2nd components of the elements of BL
2265
+ // are the origs so use BL:
2266
+ // form first the list of all [w, [M, N]]
2267
+ // where M and N contain the monomials T^a, T^b
2268
+ // such that deg(T^(a+b)) = w.
2269
+ list sums = origsSumUp(BL, TOR);
2270
+ list adMons = getSadmissibleMonomials(sums);
2271
+ int nadMons = size(adMons);
2272
+
2273
+ // create formal matrix out of this:
2274
+ // phi(R_w) = R_w for all w in Orig and all automorphisms phi.
2275
+ def S = createAutMatrix(BL);
2276
+ setring S;
2277
+ basering;
2278
+
2279
+ matrix A = Aexported;
2280
+ list AMON = MONSexported;
2281
+ string MONexported = string(AMON);
2282
+ int n = size(MONSexported);
2283
+
2284
+ dbprint(printlevel, ".... matrix A, the monomials corresponding to rows/cols:...");
2285
+ dbprint(printlevel, A);
2286
+ dbprint(printlevel, AMON);
2287
+
2288
+ // will be needed later for grading:
2289
+ intmat Qnew = getCharacteristicGrading(AMON, TOR);
2290
+
2291
+ // compute originary weights:
2292
+ // return the elements as permutation matrices
2293
+ setring R;
2294
+ intmat Q = getVariableWeights();
2295
+ list Autor0 = autGenWeights(Q, TOR);
2296
+
2297
+ // redefine omegaSdiagEqs as the product
2298
+ // omegaSdiagEqs * (B^* omegaSdiagEqs)
2299
+ // where B in Autor0:
2300
+ setring S;
2301
+ ideal J;
2302
+
2303
+ // convert the elements of Autor0 to permutation matrices:
2304
+ list Autor;
2305
+ list ABL = imap(R, BL);
2306
+
2307
+ for(int i = 1; i <= size(Autor0); i++){
2308
+ if(fixesDim(Autor0[i], ABL, TOR)){
2309
+ Autor[size(Autor)+1] = matrix2compper(Autor0[i], ABL, AMON, Q, TOR); // of type matrix
2310
+ } else {
2311
+ dbprint(printlevel, "Did not fix dimension.");
2312
+ dbprint(printlevel, string(Autor0[i]));
2313
+ }
2314
+ }
2315
+
2316
+ dbprint(printlevel, ".... automorphisms of the originary weight vectors as permutation matrices: ....");
2317
+ dbprint(printlevel, Autor);
2318
+
2319
+ // equations cutting out the S-admissible matrices:
2320
+ // A*(T^(a + b)) - (A*(T^a))(A*(T^b)) = 0
2321
+ // where A*f means to substitute T_i by sum(A_(i*)T_j):
2322
+ list MONS = imap(R, MONS);
2323
+ list adMons;
2324
+
2325
+ if(nadMons > 0){
2326
+ adMons = imap(R, adMons);
2327
+ }
2328
+
2329
+ // add determinant condition:
2330
+ // we need one more variable for this:
2331
+ def S2 = adjoinVar(n0);
2332
+ setring S2;
2333
+ poly deter; // we need to store it for the grading
2334
+
2335
+ ideal J = 1; // init with 1 --> used for product later
2336
+ list listAutKS; // elements are of shape list(BA, B, equations for BA)
2337
+ setring S;
2338
+
2339
+ for(i = 1; i <= size(Autor); i++){
2340
+ intmat BB = Autor0[i];
2341
+ intmat B = Autor[i];
2342
+
2343
+ // compute B*A and then admissible equations
2344
+ matrix BA = B*A;
2345
+
2346
+ dbprint(printlevel, "Starting computation of admissible equations:");
2347
+
2348
+ ideal Iadmiss = getAdmissibleEquations(adMons, BA, n0, MONS);
2349
+ dbprint(printlevel, "Admissible equations: done.");
2350
+
2351
+ BA = relabelEntries(BA, n0);
2352
+
2353
+ dbprint(printlevel, "permuted matrix A:");
2354
+ dbprint(printlevel, BA);
2355
+
2356
+ // add variable Y((i-1)*n+j) to Jexported
2357
+ // if BA[i,j] = 0 where 1 <= i <= n0:
2358
+ ideal omegaSdiagEqs = getMonomialsFor0Entries(BA, n0);
2359
+
2360
+ // also store in listAutKS
2361
+ // will be useful for stabilizer
2362
+ setring S2;
2363
+ matrix BA2 = imap(S, BA);
2364
+
2365
+ dbprint(printlevel, "computing determinant...");
2366
+ deter = det(BA2);
2367
+ poly detEq = deter * Z - 1;
2368
+ dbprint(printlevel, "Determinant: done.");
2369
+
2370
+ ideal JBA = imap(S, Iadmiss) + imap(S, omegaSdiagEqs) + ideal(detEq);
2371
+ listAutKS[size(listAutKS) + 1] = list(BA2, BB, JBA, MONexported); // MONexported is an explanatory string
2372
+
2373
+ dbprint(printlevel, "Computing intersection of ideals...");
2374
+ //J = J * JBA;
2375
+ J = intersect(J, JBA); // in Singular, this is usually quicker
2376
+ dbprint(printlevel, "Intersection of ideal: done.");
2377
+
2378
+ kill JBA, detEq, BA2;
2379
+ setring S;
2380
+ kill BA, B, BB, Iadmiss, omegaSdiagEqs;
2381
+ }
2382
+
2383
+ setring S2;
2384
+
2385
+ setGLnGrading(Qnew, deter);
2386
+ ideal Iexported = J; //imap(S, J) + ideal(detEq);
2387
+ list autKSexported = listAutKS;
2388
+
2389
+ export(Iexported);
2390
+ export(autKSexported); // list of elements of shape list(A, B)
2391
+ export(MONexported);
2392
+ return(S2);
2393
+ }
2394
+ example
2395
+ {
2396
+ echo=2;
2397
+
2398
+ //////////////////
2399
+ // example: fano 15:
2400
+ intmat Q[1][5] = 3,3,2,2,1;
2401
+ ring R = 0,T(1..5),dp;
2402
+
2403
+ // attach degree matrix Q to R:
2404
+ setBaseMultigrading(Q);
2405
+
2406
+ //ideal I = T(1)*T(2) + T(3)^2*T(4) + T(5)^6;
2407
+ def S = autKS();
2408
+ setring S;
2409
+
2410
+ dim(std(Iexported));
2411
+ basering;
2412
+
2413
+ autKSexported;
2414
+ getVariableWeights();
2415
+
2416
+ kill S, Q, R;
2417
+
2418
+ /////////////
2419
+ // example 3.14 from the paper
2420
+ intmat Q[3][5] =
2421
+ 1,1,1,1,1,
2422
+ 1,-1,0,0,1,
2423
+ 1,1,1,0,0;
2424
+
2425
+ list TOR = 2;
2426
+ ring R = 0,T(1..5),dp;
2427
+
2428
+ // attach degree matrix Q to R:
2429
+ setBaseMultigrading(Q);
2430
+
2431
+ //ideal I = T(1)*T(2) + T(3)^2 + T(4)^2;
2432
+ def S = autKS();
2433
+ setring S;
2434
+
2435
+ Iexported;
2436
+ print(getVariableWeights());
2437
+ kill S, R, Q;
2438
+ }
2439
+
2440
+ ////////////////////////////////////
2441
+
2442
+ // helper
2443
+ static proc setGLnGrading(intmat Qnew, poly deter, list #){
2444
+ list TOR;
2445
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
2446
+ TOR = #[1];
2447
+ }
2448
+
2449
+ // set deg(Y_ij) = j-th col of Qnew
2450
+ int k = nrows(Qnew);
2451
+ int n = ncols(Qnew);
2452
+
2453
+ // the last variable is the rabinovic trick variable Z
2454
+ int nv = nvars(basering) - 1;
2455
+ intmat Qlarge[nrows(Qnew)][nv + 1];
2456
+
2457
+ for(int m = 1; m <= nv; m++){
2458
+ int i = m div n; // 9 div 9 = 1
2459
+ int j = m mod n;
2460
+
2461
+ if(j == 0){ // 9 --> i = 0, j = 9
2462
+ i = i - 1;
2463
+ j = n;
2464
+ }
2465
+
2466
+ Qlarge[1..k, m] = Qnew[1..k, j];
2467
+ kill i, j;
2468
+ }
2469
+
2470
+ // grading is valid for all variables
2471
+ // except Z: use it for deter:
2472
+ setBaseMultigrading(Qlarge);
2473
+
2474
+ // treat the last variable Z:
2475
+ // deg(deter) = - deg(Z):
2476
+ intvec degDet = reduceIntvec(- multiDeg(deter), TOR);
2477
+ Qlarge[1..k, nvars(basering)] = degDet[1..size(degDet)];
2478
+
2479
+ // now set the final grading
2480
+ setBaseMultigrading(Qlarge);
2481
+ }
2482
+
2483
+ ////////////////////////////////////
2484
+
2485
+ // helper
2486
+ static proc adjoinVar(int n0){
2487
+ string S2str = "(";
2488
+
2489
+ for(int i = n0 + 1; i <= nvars(basering); i++){
2490
+ S2str = S2str + string(var(i));
2491
+
2492
+ if(i < nvars(basering)){
2493
+ S2str = S2str + ", ";
2494
+ } else {
2495
+ S2str = S2str + ", Z)";
2496
+ }
2497
+ }
2498
+ ring S2 = create_ring(ring_list(basering)[1], S2str, "(dp("+string(nvars(basering) - n0)+"), dp(1))", "no_minpoly");
2499
+ return(S2);
2500
+ }
2501
+
2502
+
2503
+ /////////////////////////////////////
2504
+
2505
+ // helper
2506
+ static proc getMonomialsFor0Entries(matrix BA, int n0) {
2507
+ ideal relB;
2508
+ int j;
2509
+
2510
+ for(int i = 1; i <= n0; i++){
2511
+ for( j = 1; j <= ncols(BA); j++){
2512
+ if(BA[i,j] == 0){
2513
+ relB[size(relB)+1] = Y((i-1)*ncols(BA)+j);
2514
+ }
2515
+ }
2516
+ }
2517
+
2518
+ return(relB);
2519
+ }
2520
+
2521
+ /////////////////////////////////////
2522
+
2523
+ // helper
2524
+ static proc getAdmissibleEquations(list adMons, matrix A, int n0, list MONS){
2525
+ // S is the name of the current basering when calling this function, S --> S
2526
+ ideal imageVars; // images of the T_i
2527
+ int j;
2528
+
2529
+ for(int i = 1; i <= n0; i++){
2530
+ imageVars[i] = 0;
2531
+
2532
+ for(j = 1; j <= size(MONS); j++){
2533
+ imageVars[i] = imageVars[i] + A[i, j] * MONS[j];
2534
+ }
2535
+ }
2536
+ def S = basering;
2537
+ map applyA = S, imageVars;
2538
+
2539
+ // go through all possibilities:
2540
+ int k, l;
2541
+ ideal IadmissibleExported;
2542
+
2543
+ for(i = 1; i <= size(adMons); i++){
2544
+ list AL = adMons[i][2][1];
2545
+ list BL = adMons[i][2][2];
2546
+
2547
+ for(k = 1; k <= size(AL); k++){
2548
+ for(l = 1; l <= size(BL); l++){
2549
+ poly Ta = AL[k];
2550
+ poly Tb = BL[l];
2551
+ poly Tab = Ta * Tb;
2552
+
2553
+ IadmissibleExported[size(IadmissibleExported) + 1] = applyA(Tab) - applyA(Ta) * applyA(Tb);
2554
+
2555
+ kill Tab, Ta, Tb;
2556
+ }
2557
+ }
2558
+
2559
+ kill AL, BL;
2560
+ }
2561
+
2562
+ return(IadmissibleExported);
2563
+ }
2564
+
2565
+ ///////////////////////////////////////
2566
+
2567
+ // Get generator degrees w1,...,ws --> store in GenDegs.
2568
+ // Also compute dimensions of I_wi where wi in GenDegs:
2569
+ static proc getGenDegsDims(ideal I, list TOR){
2570
+ list GenDegs;
2571
+ list GenDims;
2572
+ int i = 1;
2573
+ int c = 1;
2574
+
2575
+ while(c <= size(I)){ // there may be 0-entries in I
2576
+ if(I[i] != 0){
2577
+ c++;
2578
+
2579
+ GenDegs[i] = reduceIntvec(multiDeg(I[i]), TOR);
2580
+ list L = gradedCompIdeal(I, GenDegs[i], 0, TOR); //gradedcompbasis(I, GenDegs[i], TOR);
2581
+ GenDims[i] = size(L[1]); // this is dim(R_(deg f_i)), not dim(I_(deg f_i))
2582
+
2583
+ kill L;
2584
+ }
2585
+
2586
+ i++;
2587
+ }
2588
+
2589
+ list RES;
2590
+ RES[1] = GenDegs;
2591
+ RES[2] = GenDims;
2592
+
2593
+ return(RES);
2594
+ }
2595
+
2596
+ ///////////////////////////////////
2597
+
2598
+ // helper:
2599
+ // checks a given matrix B in Autor0
2600
+ // if it satisfies dim(I_wi) = dim(I_(B*wi))
2601
+ // for all i where w1,...,ws
2602
+ // are the generator degrees of I.
2603
+ static proc isDimInvar(intmat B, list GenDegsDims, list TOR){
2604
+ list GenDegs = GenDegsDims[1];
2605
+ list GenDims = GenDegsDims[2];
2606
+
2607
+ // return true iff B is
2608
+ // such that dim(I_wi) = dim(I_(B*wi))
2609
+ // holds for all i, where wi in GenDegs:
2610
+ int j;
2611
+
2612
+ for(j = 1; j <= size(GenDegs); j++){
2613
+ intvec wj = GenDegs[j];
2614
+
2615
+ //intvec Bwj = B * wj;
2616
+ intvec Bwj = reduceIntvec(intvec(B * wj), TOR);
2617
+
2618
+ // find out dim(I_Bwj):
2619
+ int dimBwj;
2620
+ for(int bb = 1; bb <= size(GenDegs); bb++){
2621
+ if(GenDegs[bb] == Bwj){
2622
+ dimBwj = GenDims[bb];
2623
+ break;
2624
+ }
2625
+ }
2626
+
2627
+ // if dim(I_wi) != dim(I_(B*wi)), then B is not valid.
2628
+ if(dimBwj != GenDims[j]){
2629
+ return(0);
2630
+ }
2631
+
2632
+ kill bb, wj, Bwj, dimBwj;
2633
+ }
2634
+
2635
+ return(1);
2636
+ }
2637
+
2638
+
2639
+ ////////////////////////////////////////
2640
+
2641
+ static proc getSadmissibleMonomials(list sums){
2642
+ list Combs;
2643
+
2644
+ // the elements of sums are of shape
2645
+ // Comb = [c, [a,b]] where c = a + b.
2646
+ // Form first the list of all [K, [M, N]]
2647
+ // where M and N contain the monomials T^a, T^b
2648
+ // such that deg(T^(a+b)) = deg(T^c) for each T^c in K.
2649
+ for(int i= 1; i <= size(sums); i++){
2650
+ list K = wmonomials(sums[i][1], 0); // as monomials
2651
+ list M = wmonomials(sums[i][2][1], 0); // as monomials
2652
+ list N = wmonomials(sums[i][2][2], 0); // as monomials
2653
+
2654
+ Combs[size(Combs) + 1] = list(K, list(M, N));
2655
+
2656
+ kill M, N, K;
2657
+ }
2658
+
2659
+ return(Combs);
2660
+ }
2661
+
2662
+ ///////////////////////////////////////
2663
+
2664
+ // helper
2665
+ static proc origsSumUp(list BL, list #) {
2666
+ list TOR;
2667
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
2668
+ TOR = #[1];
2669
+ }
2670
+
2671
+ list RES; // elements of the form [c, [a,b]] such that c=a+b
2672
+ int j, k;
2673
+
2674
+ // note: the 2nd components of the entries
2675
+ // of BL are the origs
2676
+ for(int i = 1; i <= size(BL); i++){
2677
+ for(j = 1; j <= size(BL); j++){
2678
+ intvec sum = reduceIntvec(BL[i][2] + BL[j][2], TOR);
2679
+
2680
+ // check if sum is not already in RES (no duplicates):
2681
+ for(k = 1; k <= size(RES); k++){
2682
+ if(RES[k][1] == sum){
2683
+ break;
2684
+ }
2685
+ }
2686
+
2687
+ if(k > size(RES)){ // then is it new
2688
+ // check if sum is also in Origs
2689
+ for(k = 1; k <= size(BL); k++){
2690
+ if(BL[k][2] == sum){
2691
+ RES[size(RES) + 1] = list(sum, list(BL[i][2], BL[j][2]));
2692
+ }
2693
+ }
2694
+ }
2695
+
2696
+ kill sum;
2697
+ }
2698
+ }
2699
+
2700
+ return(RES);
2701
+ }
2702
+ example
2703
+ {
2704
+ echo = 2;
2705
+
2706
+ // 1st example
2707
+ list BL =
2708
+ list(0, intvec(2,1), 0),
2709
+ list(0, intvec(1,1), 0),
2710
+ list(0, intvec(1,0), 0),
2711
+ list(0, intvec(2,1), 0);
2712
+
2713
+ list TOR = 2;
2714
+
2715
+ origsSumUp(BL);
2716
+ kill BL;
2717
+
2718
+ // 2nd example
2719
+ list BL =
2720
+ list(0, intvec(3), 0),
2721
+ list(0, intvec(3), 0),
2722
+ list(0, intvec(2), 0),
2723
+ list(0, intvec(2), 0),
2724
+ list(0, intvec(1), 0);
2725
+
2726
+ origsSumUp(BL);
2727
+ }
2728
+
2729
+ ///////////////////////////////////////
2730
+
2731
+ // helper
2732
+ // Given an automorphism K --> K as an invertible matrix A
2733
+ // this function computes a permutation matrix.
2734
+ // Assume: BL is of the form [[dim, w, [T[1]*T[2]^2, T[3]]],...]
2735
+ // where the w are the originary weights.
2736
+ // we also assume that Origs are ordered as occurring in Q
2737
+ // returns a list of matrices (not intmats).
2738
+ static proc matrix2compper(intmat B, list BL, list MON, intmat Q, list TOR){
2739
+ list Origs;
2740
+ list MONweight;
2741
+
2742
+ for(int i = 1; i <= size(BL); i++){
2743
+ Origs[i] = BL[i][2];
2744
+ }
2745
+
2746
+ for(int j = 1; j <= size(MON); j++){
2747
+ MONweight[j] = reduceIntvec(multiDeg(MON[j]), TOR);
2748
+ }
2749
+
2750
+ // initialize the permutation matrix (to be returned)
2751
+ // as zero-rows:
2752
+ int d = size(MON);
2753
+ intmat PER[d][d];
2754
+ intvec done = 0:size(MONweight);
2755
+
2756
+ for(i = 1; i <= size(MONweight); i++){
2757
+ intvec w = MONweight[i];
2758
+ intmat mW[size(w)][1];
2759
+ mW[1..size(w),1] = w;
2760
+
2761
+ intmat BmW = B * mW; // ...x1 matrix
2762
+ intvec v = BmW[1..nrows(BmW), 1];
2763
+ intvec vred = reduceIntvec(v, TOR);
2764
+
2765
+ for(j = 1; j <= size(MONweight); j++){
2766
+ intvec zred = reduceIntvec(MONweight[j], TOR);
2767
+
2768
+ // test if MONweight[j] == v (possibly with Torsion, i.e. after reduction)
2769
+ // and done[j] != 1:
2770
+ if(vred == zred and done[j] != 1){
2771
+ PER[i,j] = 1;
2772
+ done[j] = 1;
2773
+
2774
+ kill zred;
2775
+ break;
2776
+ }
2777
+
2778
+ kill zred;
2779
+ }
2780
+
2781
+ kill vred, v, w, mW, BmW;
2782
+ }
2783
+
2784
+ return(PER);
2785
+ }
2786
+
2787
+ ////////////////////////////////////////
2788
+
2789
+ proc autXhat(ideal RL, intvec w, list #)
2790
+ "
2791
+ USAGE: autXhat(RL, w0, TOR): RL is an ideal, w an intvec, TOR a list of integers
2792
+ ASSUME: the basering is multigraded, the elements of TOR stand for the torsion rows of the matrix getVariableWeights(), w is an ample class or the free part of such a class.
2793
+ PURPOSE: compute an ideal J such that V(J) in some GL(n) is isomorphic to the H-equivariant automorphisms \widehat X --> \widehat X.
2794
+ EXAMPLE: example autXhat; shows an example
2795
+ "
2796
+ {
2797
+ list TOR;
2798
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
2799
+ TOR = #[1];
2800
+ }
2801
+
2802
+ def R = basering;
2803
+ intmat Q = getVariableWeights();
2804
+ intmat Q0 = gradingFreePart(Q, TOR);
2805
+
2806
+ int k0 = nrows(Q0);
2807
+ bigintmat w0[1][k0] = w[1..k0];
2808
+
2809
+ if(size(w) < nrows(Q)){
2810
+ ERROR("size of w must equal the number of rows of the degree matrix.");
2811
+ }
2812
+
2813
+ cone c = gitCone(RL, Q0, w0);
2814
+ def RR = stabilizer(RL, TOR);
2815
+ setring RR;
2816
+
2817
+ list RES;
2818
+ for(int i = 1; i <= size(stabExported); i++){
2819
+ intmat B = stabExported[i][2];
2820
+ intvec wB = B * w;
2821
+
2822
+ setring R;
2823
+ bigintmat wB0[1][k0] = wB[1..k0];
2824
+ cone cB = gitCone(RL, Q0, wB0);
2825
+ kill wB0;
2826
+ setring RR;
2827
+
2828
+ if(cB == c){
2829
+ RES[size(RES) + 1] = stabExported[i];
2830
+ }
2831
+
2832
+ kill B, wB, cB;
2833
+ }
2834
+
2835
+ export(RES);
2836
+ return(RR);
2837
+ }
2838
+ example
2839
+ {
2840
+ echo=2;
2841
+
2842
+ intmat Q[3][5] =
2843
+ 1,1,1,1,1,
2844
+ 1,-1,0,0,1,
2845
+ 1,1,1,0,0;
2846
+
2847
+ list TOR = 2;
2848
+ ring R = 0,T(1..5),dp;
2849
+
2850
+ setBaseMultigrading(Q);
2851
+
2852
+ ideal I = T(1)*T(2) + T(3)^2 + T(4)^2;
2853
+
2854
+ intvec w0 = 2,1,0;
2855
+ def RR = autXhat(I, w0, TOR);
2856
+ setring RR;
2857
+
2858
+ RES;
2859
+ kill RR, Q, R;
2860
+ }
2861
+
2862
+ //////////////////////////////////////////
2863
+
2864
+ static proc gradingFreePart(intmat Q, list TOR){
2865
+ intmat Q0[nrows(Q) - size(TOR)][ncols(Q)];
2866
+
2867
+ for(int i = 1; i <= nrows(Q0); i++){
2868
+ Q0[i, 1..ncols(Q0)] = Q[i, 1..ncols(Q0)];
2869
+ }
2870
+
2871
+ return(Q0);
2872
+ }
2873
+
2874
+ ////////////////////////////////////////
2875
+
2876
+ // helper
2877
+ // compute the image cone by applying A to
2878
+ // the rays of c. We assume c is pointed.
2879
+ static proc imageCone(cone c, intmat A){
2880
+ bigintmat R = rays(c);
2881
+ cone cc = coneViaPoints(R * transpose(A));
2882
+
2883
+ return(cc);
2884
+ }
2885
+ example
2886
+ {
2887
+ echo=2;
2888
+
2889
+ intmat M[2][2] =
2890
+ 1,0,
2891
+ 1,2;
2892
+
2893
+ cone c = coneViaPoints(M);
2894
+ rays(c);
2895
+
2896
+ intmat A[2][2] =
2897
+ 1,0,
2898
+ 0,2;
2899
+
2900
+ cone cc = imageCone(c, A);
2901
+ rays(cc);
2902
+ }
2903
+
2904
+ /////////////////////////////////////
2905
+
2906
+ // helper.
2907
+ // Assume: basering variables are
2908
+ // T(1..n0), Y(1..), Z:
2909
+ // Replaces in M each non-zero entry M[i,j] by V[i,j]:
2910
+ // however: replace the lower entries, e.g., Y(11)^2,
2911
+ // by Y(2)^2 if Y(11) --> Y(2).
2912
+ static proc relabelEntries(matrix A, int n0){
2913
+ def R = basering;
2914
+ int n = ncols(A);
2915
+
2916
+ // define a map: A[i,j] --> V[i,j]
2917
+ // for the case of M[i,j] being a single variable;
2918
+ // this is true for the first n0 rows of A:
2919
+ // Store in Img[i] the image of Y(i):
2920
+ intvec v = 0:(nvars(R));
2921
+ list Img = v[1..size(v)]; // initialize with 0.
2922
+
2923
+ int i, j, pos, k, m;
2924
+
2925
+ for(i = 1; i <= n0; i++){
2926
+ for(j = 1; j <= ncols(A); j++){
2927
+ if(A[i,j] != 0){ // then it is some Y(k) --> replace it by V[i,j]:
2928
+ // ordering of variables in R is
2929
+ // T(1..n0), Y(1..n^2), Z:
2930
+ pos = (i-1)*n + j;
2931
+
2932
+ // A[i,j] should be Y(pos):
2933
+ // find out k with A[i,j] = Y(k):
2934
+ for(m = 1; m <= n*n; m++){
2935
+ if(A[i,j] == Y(m)){
2936
+ Img[m + n0] = Y(pos); //+n0 since vars T(1..n0) are at front
2937
+ break;
2938
+ }
2939
+ }
2940
+ }
2941
+ }
2942
+ }
2943
+
2944
+ // define the map:
2945
+ map f = R, Img[1..size(Img)];
2946
+
2947
+ return(f(A));
2948
+ }
2949
+
2950
+ ///////////////////////
2951
+
2952
+ // helper
2953
+ // returns the grading by the characteristic
2954
+ // quasitorus.
2955
+ static proc getCharacteristicGrading(list BL, list #){
2956
+ list TOR;
2957
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
2958
+ TOR = #[1];
2959
+ }
2960
+
2961
+ intmat Q = getVariableWeights();
2962
+ intmat Qnew[nrows(Q)][size(BL)];
2963
+
2964
+ for(int i = 1; i <= size(BL); i++){
2965
+ intvec w = reduceIntvec(multiDeg(BL[i]), TOR);
2966
+
2967
+ Qnew[1..nrows(Q), i] = w[1..size(w)];
2968
+ kill w;
2969
+ }
2970
+
2971
+ return(Qnew);
2972
+ }
2973
+
2974
+ ///////////////////////////
2975
+
2976
+ // helper
2977
+ // compute the linear hull over the columns of P.
2978
+ static proc linearHull(intmat P){
2979
+ // the linear hull over the columns of P:
2980
+ // equivalent: cone(P, -P):
2981
+ intmat M[ncols(P) * 2][nrows(P)]; // rows are rays
2982
+
2983
+ for(int i = 1; i <= ncols(P); i++){
2984
+ M[i, 1..nrows(P)] = P[1..nrows(P), i];
2985
+ M[i + ncols(P), 1..nrows(P)] = -P[1..nrows(P), i];
2986
+ }
2987
+ cone V = coneViaPoints(M);
2988
+
2989
+ return(V);
2990
+ }
2991
+
2992
+ ////////////////////////////
2993
+
2994
+ // helper
2995
+ // compute generators for the veronese subalgebra
2996
+ static proc veron(intmat P){
2997
+ // linear hull of P:
2998
+ intmat Pplusminus[2*nrows(P)][ncols(P)] = P, -P;
2999
+
3000
+ cone V = coneViaPoints(Pplusminus);
3001
+ cone posorth = coneViaPoints(getIdMat(ambientDimension(V)));
3002
+ cone c = convexIntersection(V, posorth);
3003
+
3004
+ intmat H = hilbertBas(c);
3005
+ return(H);
3006
+ }
3007
+ example
3008
+ {
3009
+ echo = 2;
3010
+
3011
+ intmat P[2][3] =
3012
+ 1,0,-1,
3013
+ 0,1,-1;
3014
+
3015
+ veron(transpose(P));
3016
+ }
3017
+
3018
+ //////////////////////////
3019
+
3020
+ proc autX(ideal RL, intvec w, list #)
3021
+ "
3022
+ USAGE: autX(RL, w, TOR); RL: ideal, w: intvec, TOR: optional list of integers.
3023
+ PURPOSE: compute generators for the hopf algebra O(Aut(X))
3024
+ of the Mori dream space X given by Cox(X) := basering/RL and
3025
+ the ample class w.
3026
+ ASSUME: there is no torsion.
3027
+ RETURN: a ring. Also exports an ideal Iexported.
3028
+ EXAMPLE: example autX; shows an example
3029
+ "
3030
+ {
3031
+ list TOR;
3032
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
3033
+ TOR = #[1];
3034
+ }
3035
+
3036
+ def RR = autXhat(RL, w, TOR);
3037
+ setring RR;
3038
+ intmat Q = getVariableWeights();
3039
+
3040
+ // ideal:
3041
+ ideal J = RES[1][3];
3042
+ for(int i = 2; i <= size(RES); i++){
3043
+ J = J * RES[i][3];
3044
+ }
3045
+
3046
+ intmat P = degMat2P(Q, TOR);
3047
+ intmat V = veron(transpose(P));
3048
+
3049
+ // creat map:
3050
+ ideal imMap;
3051
+ for(int i = 1; i <= nrows(V); i++){
3052
+ intvec v = V[i, 1..ncols(V)];
3053
+
3054
+ imMap[size(imMap) + 1] = vec2monomial(v);
3055
+ kill v;
3056
+ }
3057
+
3058
+ list l5;
3059
+ for (int ii = 1; ii <= size(V); ii++)
3060
+ {
3061
+ l5[ii] = "T("+string(ii)+")";
3062
+ }
3063
+ ring S = create_ring(ring_list(RR)[1], l5, "dp", "no_minpoly");
3064
+ setring S;
3065
+ setring RR;
3066
+
3067
+ // f: S --> RR, T_i --> T^mu
3068
+ map f = S, imMap;
3069
+
3070
+ setring S;
3071
+ ideal Iexported = preimage(RR, f, J);
3072
+
3073
+ export(Iexported);
3074
+ return(S);
3075
+ }
3076
+ example
3077
+ {
3078
+ ///////////////
3079
+ //// CAREFUL: the following examples seems to be unfeasible at the moment, see remark in the paper
3080
+
3081
+ //echo=2;
3082
+ ///////////////
3083
+ //// PP2
3084
+ //intmat Q[1][4] =
3085
+ // 1,1,1,1;
3086
+
3087
+ //ring R = 0,T(1..ncols(Q)),dp;
3088
+
3089
+ //// attach degree matrix Q to R:
3090
+ //setBaseMultigrading(Q);
3091
+ //ideal I = 0;
3092
+ //intvec w0 = 1;
3093
+
3094
+ //def RR = autX(I, w0);
3095
+ //setring RR;
3096
+ //Iexported;
3097
+
3098
+ //basering;
3099
+ //dim(std(Iexported));
3100
+
3101
+ //kill RR, Q, R;
3102
+
3103
+ ///////////////
3104
+ //// example 3.14 from the paper
3105
+ //intmat Q[3][5] =
3106
+ // 1,1,1,1,1,
3107
+ // 1,-1,0,0,1,
3108
+ // 1,1,1,0,0;
3109
+
3110
+ //list TOR = 2;
3111
+ //ring R = 0,T(1..5),dp;
3112
+
3113
+ //// attach degree matrix Q to R:
3114
+ //setBaseMultigrading(Q);
3115
+
3116
+ //ideal I = T(1)*T(2) + T(3)^2 + T(4)^2;
3117
+ //list TOR = 2;
3118
+
3119
+ //intvec w0 = 2,1,0;
3120
+ //def RR = autX(I, w0, TOR);
3121
+ //setring RR;
3122
+
3123
+ //kill RR, Q, R;
3124
+ }
3125
+
3126
+ ////////////////////
3127
+
3128
+ // helper
3129
+ // compute the hilbert basis of c.
3130
+ static proc hilbertBas(cone c){
3131
+ intmat A = intmat(rays(c));
3132
+ intmat B = normaliz(A, 0);
3133
+
3134
+ return(B);
3135
+ }
3136
+ example
3137
+ {
3138
+ echo = 2;
3139
+
3140
+ intmat A[2][2] =
3141
+ 1,0,
3142
+ 1,3;
3143
+
3144
+ intmat B = hilbertBas(coneViaPoints(A));
3145
+ print(B);
3146
+
3147
+ // 2nd ex:
3148
+ intmat C[3][4] =
3149
+ 1, 0, 0, 0,
3150
+ 1, 1, 0, 0,
3151
+ 6, 3, 4, 2;
3152
+
3153
+ intmat D = hilbertBas(coneViaPoints(C));
3154
+ print(D);
3155
+
3156
+ }
3157
+
3158
+ /////////////////////////
3159
+
3160
+ // helper
3161
+ // compute the gale dual P of the degree matrix Q
3162
+ static proc degMat2P(intmat Q, list TOR){
3163
+ int k = nrows(Q);
3164
+ int nfree = nrows(Q) - size(TOR);
3165
+
3166
+ int n = size(TOR);
3167
+ if(n == 0){
3168
+ n = 1; // then L = (0,...0)^t
3169
+ }
3170
+
3171
+ intmat L[k][n];
3172
+
3173
+ for(int i = 1; i <= size(TOR); i++){
3174
+ L[i + nfree, i] = TOR[i];
3175
+ }
3176
+ intmat U0 = preimageLattice(Q, L);
3177
+
3178
+ return(transpose(U0));
3179
+ }
3180
+ example
3181
+ {
3182
+ echo = 2;
3183
+
3184
+ intmat Q[2][4] =
3185
+ 1,1,1,1,
3186
+ 1,0,1,0;
3187
+
3188
+ list TOR = 2;
3189
+ intmat P = degMat2P(Q, TOR);
3190
+ print(P);
3191
+
3192
+ }
3193
+
3194
+ ///////////////////////////
3195
+
3196
+ // helper
3197
+ static proc compsAreTrivial(ideal RL, list TOR){
3198
+ // for each col w of Q
3199
+ // we require I_w = 0:
3200
+ intmat Q = getVariableWeights();
3201
+
3202
+ for(int i = 1; i <= ncols(Q); i++){
3203
+ intvec w = Q[1..nrows(Q), i];
3204
+
3205
+ // compute a basis Iw of I_w:
3206
+ // I_w will be a subspace of KTw:
3207
+ list Iw = gradedCompIdeal(RL, w, 0, TOR)[2];
3208
+
3209
+ if(size(Iw) > 0){
3210
+ return(0);
3211
+ }
3212
+
3213
+ kill w, Iw;
3214
+ }
3215
+
3216
+ return(1);
3217
+ }
3218
+
3219
+ ///////////////////////////
3220
+
3221
+ proc autGradAlg(ideal I, list #)
3222
+ "
3223
+ USAGE: autGradAlg(I, TOR); I is an ideal, TOR is an optional list of integers representing the torsion part of the grading group.
3224
+ ASSUME: minimally presented, degrees of the generators of I
3225
+ are the minimal degrees, basering multigraded pointedly, I_w = 0
3226
+ for all w = deg(var(i))
3227
+ RETURN: a ring. Also exports an ideal Jexported and a list stabExported.
3228
+ EXAMPLE: example autGradAlg; shows an example
3229
+ "
3230
+ {
3231
+ list TOR;
3232
+ if(size(#) > 0 and typeof(#) == "list" and typeof(#[1]) == "int"){
3233
+ TOR = #[1];
3234
+ }
3235
+
3236
+ // for each col w of Q
3237
+ // we require I_w = 0:
3238
+ if(!compsAreTrivial(I, TOR)){
3239
+ ERROR("For some i, w = deg(var(i)) did not satisfy I_w = 0. We do not support this case at the moment. Sorry.");
3240
+ }
3241
+
3242
+ def RR = stabilizer(I, TOR);
3243
+ setring RR;
3244
+
3245
+ // Jexported is already being exported
3246
+ return(RR);
3247
+ }
3248
+ example
3249
+ {
3250
+ echo = 2;
3251
+
3252
+ intmat Q[1][3] =
3253
+ 1,1,1;
3254
+
3255
+ ring R = 0,T(1..3), dp;
3256
+ setBaseMultigrading(Q);
3257
+
3258
+ ideal I = 0; //T(1)*T(2) + T(3)*T(4);
3259
+ def RR = autGradAlg(I);
3260
+ setring RR;
3261
+
3262
+ "resulting ideal:";
3263
+ Jexported;
3264
+
3265
+ "dimension:";
3266
+ dim(std(Jexported));
3267
+
3268
+ "as a detailed list:";
3269
+ stabExported;
3270
+ }
3271
+
3272
+ //////////////////////////
3273
+
3274
+ static proc shrink(ideal I)
3275
+ "
3276
+ USAGE: shrink(I): I is an ideal
3277
+ ASSUME: There are variable generators in I and I does not contain 0-generators.
3278
+ PURPOSE: returns a new ring S obtained from the old one by removing all variables Y(i)
3279
+ such that some generator of I is Y(i). Exports the image of the given ideal in S.
3280
+ RETURN: a ring. Exports an ideal Ishrink.
3281
+ EXAMPLE: example shrink; shows an example
3282
+ "
3283
+ {
3284
+ // create smaller ring:
3285
+ // we will map Y(i) --> 0 if i is in the list zeros:
3286
+ def R = basering;
3287
+ ideal take = var(1); // initialize as the list of all variables
3288
+
3289
+ for(int i = 2; i <= nvars(R); i++){
3290
+ take = take, var(i);
3291
+ }
3292
+
3293
+ list zeros;
3294
+ int j;
3295
+ i = 1;
3296
+ int c = 1;
3297
+
3298
+ while(c <= size(I)){ // i may have 0-entries:
3299
+ for(j = 1; j <= nvars(R); j++){
3300
+ if(I[i] == var(j)){
3301
+ zeros[size(zeros)+1] = j;
3302
+ break;
3303
+ }
3304
+ }
3305
+
3306
+ if(I[i] != 0){
3307
+ c++;
3308
+ }
3309
+
3310
+ i++;
3311
+ }
3312
+
3313
+ for(i = 1; i <= size(zeros); i++){
3314
+ take[zeros[i]] = 0;
3315
+ }
3316
+
3317
+ string s = "(";
3318
+ int firstone = 1;
3319
+ int n = 0; // no of variables in new ring
3320
+
3321
+ for(i = 1; i <= nvars(R); i++){
3322
+ if(take[i] != 0){
3323
+ if(firstone){
3324
+ s = s + string(take[i]);
3325
+ firstone = 0;
3326
+ n++;
3327
+ } else {
3328
+ s = s + ", " + string(take[i]);
3329
+ n++;
3330
+ }
3331
+ }
3332
+ }
3333
+
3334
+ s = s + ")";
3335
+ ring S = create_ring(ring_list(R)[1], s, "(dp(" + string(n-1) + "), dp(1))", "no_minpoly"); //charstr: e.g. 0,a
3336
+
3337
+ // map the ideal to Small:
3338
+ ideal Ishrink = imap(R, I);
3339
+
3340
+ export Ishrink;
3341
+ return(S);
3342
+ }
3343
+ example
3344
+ {
3345
+ echo=2;
3346
+
3347
+ ring R = 0,(T(1..10),Y(1..3),Z),dp;
3348
+ ideal I =
3349
+ T(1)*T(3),
3350
+ Y(1),
3351
+ T(2)*Y(1),
3352
+ Y(3),
3353
+ Z*T(7)-7*Y(3),
3354
+ T(8);
3355
+
3356
+ def S = shrink(I);
3357
+ setring S;
3358
+
3359
+ Ishrink;
3360
+
3361
+ }