passagemath-singular 10.6.31rc3__cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

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

Potentially problematic release.


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

Files changed (491) hide show
  1. PySingular.cpython-314-x86_64-linux-gnu.so +0 -0
  2. passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
  3. passagemath_singular-10.6.31rc3.dist-info/RECORD +491 -0
  4. passagemath_singular-10.6.31rc3.dist-info/WHEEL +6 -0
  5. passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
  6. passagemath_singular.libs/libSingular-4-20aec911.4.1.so +0 -0
  7. passagemath_singular.libs/libcddgmp-21acf0c6.so.0.1.3 +0 -0
  8. passagemath_singular.libs/libfactory-4-fcee31da.4.1.so +0 -0
  9. passagemath_singular.libs/libflint-66e12231.so.21.0.0 +0 -0
  10. passagemath_singular.libs/libgf2x-a4cdec90.so.3.0.0 +0 -0
  11. passagemath_singular.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
  12. passagemath_singular.libs/libgmp-6e109695.so.10.5.0 +0 -0
  13. passagemath_singular.libs/libgsl-cda90e79.so.28.0.0 +0 -0
  14. passagemath_singular.libs/libmpfr-82690d50.so.6.2.1 +0 -0
  15. passagemath_singular.libs/libntl-e6f0d543.so.44.0.1 +0 -0
  16. passagemath_singular.libs/libomalloc-0-5c9e866e.9.6.so +0 -0
  17. passagemath_singular.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
  18. passagemath_singular.libs/libpolys-4-5c0a87e0.4.1.so +0 -0
  19. passagemath_singular.libs/libquadmath-2284e583.so.0.0.0 +0 -0
  20. passagemath_singular.libs/libreadline-ea270e21.so.8.2 +0 -0
  21. passagemath_singular.libs/libsingular_resources-4-a1aafc6d.4.1.so +0 -0
  22. passagemath_singular.libs/libtinfo-ceb117d9.so.6.3 +0 -0
  23. sage/algebras/all__sagemath_singular.py +3 -0
  24. sage/algebras/fusion_rings/all.py +19 -0
  25. sage/algebras/fusion_rings/f_matrix.py +2448 -0
  26. sage/algebras/fusion_rings/fast_parallel_fmats_methods.cpython-314-x86_64-linux-gnu.so +0 -0
  27. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +5 -0
  28. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +538 -0
  29. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.cpython-314-x86_64-linux-gnu.so +0 -0
  30. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +3 -0
  31. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +331 -0
  32. sage/algebras/fusion_rings/fusion_double.py +899 -0
  33. sage/algebras/fusion_rings/fusion_ring.py +1580 -0
  34. sage/algebras/fusion_rings/poly_tup_engine.cpython-314-x86_64-linux-gnu.so +0 -0
  35. sage/algebras/fusion_rings/poly_tup_engine.pxd +24 -0
  36. sage/algebras/fusion_rings/poly_tup_engine.pyx +579 -0
  37. sage/algebras/fusion_rings/shm_managers.cpython-314-x86_64-linux-gnu.so +0 -0
  38. sage/algebras/fusion_rings/shm_managers.pxd +24 -0
  39. sage/algebras/fusion_rings/shm_managers.pyx +780 -0
  40. sage/algebras/letterplace/all.py +1 -0
  41. sage/algebras/letterplace/free_algebra_element_letterplace.cpython-314-x86_64-linux-gnu.so +0 -0
  42. sage/algebras/letterplace/free_algebra_element_letterplace.pxd +18 -0
  43. sage/algebras/letterplace/free_algebra_element_letterplace.pyx +755 -0
  44. sage/algebras/letterplace/free_algebra_letterplace.cpython-314-x86_64-linux-gnu.so +0 -0
  45. sage/algebras/letterplace/free_algebra_letterplace.pxd +35 -0
  46. sage/algebras/letterplace/free_algebra_letterplace.pyx +914 -0
  47. sage/algebras/letterplace/letterplace_ideal.cpython-314-x86_64-linux-gnu.so +0 -0
  48. sage/algebras/letterplace/letterplace_ideal.pyx +408 -0
  49. sage/algebras/quatalg/all.py +2 -0
  50. sage/algebras/quatalg/quaternion_algebra.py +4778 -0
  51. sage/algebras/quatalg/quaternion_algebra_cython.cpython-314-x86_64-linux-gnu.so +0 -0
  52. sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
  53. sage/algebras/quatalg/quaternion_algebra_element.cpython-314-x86_64-linux-gnu.so +0 -0
  54. sage/algebras/quatalg/quaternion_algebra_element.pxd +29 -0
  55. sage/algebras/quatalg/quaternion_algebra_element.pyx +2176 -0
  56. sage/all__sagemath_singular.py +11 -0
  57. sage/ext_data/all__sagemath_singular.py +1 -0
  58. sage/ext_data/singular/function_field/core.lib +98 -0
  59. sage/interfaces/all__sagemath_singular.py +1 -0
  60. sage/interfaces/singular.py +2835 -0
  61. sage/libs/all__sagemath_singular.py +1 -0
  62. sage/libs/singular/__init__.py +1 -0
  63. sage/libs/singular/decl.pxd +1168 -0
  64. sage/libs/singular/function.cpython-314-x86_64-linux-gnu.so +0 -0
  65. sage/libs/singular/function.pxd +87 -0
  66. sage/libs/singular/function.pyx +1901 -0
  67. sage/libs/singular/function_factory.py +61 -0
  68. sage/libs/singular/groebner_strategy.cpython-314-x86_64-linux-gnu.so +0 -0
  69. sage/libs/singular/groebner_strategy.pxd +22 -0
  70. sage/libs/singular/groebner_strategy.pyx +582 -0
  71. sage/libs/singular/option.cpython-314-x86_64-linux-gnu.so +0 -0
  72. sage/libs/singular/option.pyx +671 -0
  73. sage/libs/singular/polynomial.cpython-314-x86_64-linux-gnu.so +0 -0
  74. sage/libs/singular/polynomial.pxd +39 -0
  75. sage/libs/singular/polynomial.pyx +661 -0
  76. sage/libs/singular/ring.cpython-314-x86_64-linux-gnu.so +0 -0
  77. sage/libs/singular/ring.pxd +58 -0
  78. sage/libs/singular/ring.pyx +893 -0
  79. sage/libs/singular/singular.cpython-314-x86_64-linux-gnu.so +0 -0
  80. sage/libs/singular/singular.pxd +72 -0
  81. sage/libs/singular/singular.pyx +1944 -0
  82. sage/libs/singular/standard_options.py +145 -0
  83. sage/matrix/all__sagemath_singular.py +1 -0
  84. sage/matrix/matrix_mpolynomial_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  85. sage/matrix/matrix_mpolynomial_dense.pxd +7 -0
  86. sage/matrix/matrix_mpolynomial_dense.pyx +615 -0
  87. sage/rings/all__sagemath_singular.py +1 -0
  88. sage/rings/function_field/all__sagemath_singular.py +1 -0
  89. sage/rings/function_field/derivations_polymod.py +911 -0
  90. sage/rings/function_field/element_polymod.cpython-314-x86_64-linux-gnu.so +0 -0
  91. sage/rings/function_field/element_polymod.pyx +406 -0
  92. sage/rings/function_field/function_field_polymod.py +2611 -0
  93. sage/rings/function_field/ideal_polymod.py +1775 -0
  94. sage/rings/function_field/order_polymod.py +1475 -0
  95. sage/rings/function_field/place_polymod.py +681 -0
  96. sage/rings/polynomial/all__sagemath_singular.py +1 -0
  97. sage/rings/polynomial/multi_polynomial_ideal_libsingular.cpython-314-x86_64-linux-gnu.so +0 -0
  98. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +5 -0
  99. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +339 -0
  100. sage/rings/polynomial/multi_polynomial_libsingular.cpython-314-x86_64-linux-gnu.so +0 -0
  101. sage/rings/polynomial/multi_polynomial_libsingular.pxd +30 -0
  102. sage/rings/polynomial/multi_polynomial_libsingular.pyx +6277 -0
  103. sage/rings/polynomial/plural.cpython-314-x86_64-linux-gnu.so +0 -0
  104. sage/rings/polynomial/plural.pxd +48 -0
  105. sage/rings/polynomial/plural.pyx +3171 -0
  106. sage/symbolic/all__sagemath_singular.py +1 -0
  107. sage/symbolic/comparison_impl.pxi +428 -0
  108. sage/symbolic/constants_c_impl.pxi +178 -0
  109. sage/symbolic/expression.cpython-314-x86_64-linux-gnu.so +0 -0
  110. sage/symbolic/expression.pxd +7 -0
  111. sage/symbolic/expression.pyx +14200 -0
  112. sage/symbolic/getitem_impl.pxi +202 -0
  113. sage/symbolic/pynac.pxi +572 -0
  114. sage/symbolic/pynac_constant_impl.pxi +133 -0
  115. sage/symbolic/pynac_function_impl.pxi +206 -0
  116. sage/symbolic/pynac_impl.pxi +2576 -0
  117. sage/symbolic/pynac_wrap.h +124 -0
  118. sage/symbolic/series_impl.pxi +272 -0
  119. sage/symbolic/substitution_map_impl.pxi +94 -0
  120. sage_wheels/bin/ESingular +0 -0
  121. sage_wheels/bin/Singular +0 -0
  122. sage_wheels/bin/TSingular +0 -0
  123. sage_wheels/lib/singular/MOD/cohomo.la +41 -0
  124. sage_wheels/lib/singular/MOD/cohomo.so +0 -0
  125. sage_wheels/lib/singular/MOD/customstd.la +41 -0
  126. sage_wheels/lib/singular/MOD/customstd.so +0 -0
  127. sage_wheels/lib/singular/MOD/freealgebra.la +41 -0
  128. sage_wheels/lib/singular/MOD/freealgebra.so +0 -0
  129. sage_wheels/lib/singular/MOD/gfanlib.la +41 -0
  130. sage_wheels/lib/singular/MOD/gfanlib.so +0 -0
  131. sage_wheels/lib/singular/MOD/gitfan.la +41 -0
  132. sage_wheels/lib/singular/MOD/gitfan.so +0 -0
  133. sage_wheels/lib/singular/MOD/interval.la +41 -0
  134. sage_wheels/lib/singular/MOD/interval.so +0 -0
  135. sage_wheels/lib/singular/MOD/loctriv.la +41 -0
  136. sage_wheels/lib/singular/MOD/loctriv.so +0 -0
  137. sage_wheels/lib/singular/MOD/machinelearning.la +41 -0
  138. sage_wheels/lib/singular/MOD/machinelearning.so +0 -0
  139. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.la +41 -0
  140. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.so +0 -0
  141. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.la +41 -0
  142. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.so +0 -0
  143. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.la +41 -0
  144. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.so +0 -0
  145. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.la +41 -0
  146. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.so +0 -0
  147. sage_wheels/lib/singular/MOD/partialgb.la +41 -0
  148. sage_wheels/lib/singular/MOD/partialgb.so +0 -0
  149. sage_wheels/lib/singular/MOD/pyobject.la +41 -0
  150. sage_wheels/lib/singular/MOD/pyobject.so +0 -0
  151. sage_wheels/lib/singular/MOD/singmathic.la +41 -0
  152. sage_wheels/lib/singular/MOD/singmathic.so +0 -0
  153. sage_wheels/lib/singular/MOD/sispasm.la +41 -0
  154. sage_wheels/lib/singular/MOD/sispasm.so +0 -0
  155. sage_wheels/lib/singular/MOD/subsets.la +41 -0
  156. sage_wheels/lib/singular/MOD/subsets.so +0 -0
  157. sage_wheels/lib/singular/MOD/systhreads.la +41 -0
  158. sage_wheels/lib/singular/MOD/systhreads.so +0 -0
  159. sage_wheels/lib/singular/MOD/syzextra.la +41 -0
  160. sage_wheels/lib/singular/MOD/syzextra.so +0 -0
  161. sage_wheels/libexec/singular/MOD/change_cost +0 -0
  162. sage_wheels/libexec/singular/MOD/singularsurf +11 -0
  163. sage_wheels/libexec/singular/MOD/singularsurf_jupyter +9 -0
  164. sage_wheels/libexec/singular/MOD/singularsurf_win +10 -0
  165. sage_wheels/libexec/singular/MOD/solve_IP +0 -0
  166. sage_wheels/libexec/singular/MOD/surfex +16 -0
  167. sage_wheels/libexec/singular/MOD/toric_ideal +0 -0
  168. sage_wheels/share/factory/gftables/10201 +342 -0
  169. sage_wheels/share/factory/gftables/1024 +37 -0
  170. sage_wheels/share/factory/gftables/10609 +356 -0
  171. sage_wheels/share/factory/gftables/11449 +384 -0
  172. sage_wheels/share/factory/gftables/11881 +398 -0
  173. sage_wheels/share/factory/gftables/121 +6 -0
  174. sage_wheels/share/factory/gftables/12167 +408 -0
  175. sage_wheels/share/factory/gftables/125 +7 -0
  176. sage_wheels/share/factory/gftables/12769 +428 -0
  177. sage_wheels/share/factory/gftables/128 +7 -0
  178. sage_wheels/share/factory/gftables/1331 +47 -0
  179. sage_wheels/share/factory/gftables/1369 +48 -0
  180. sage_wheels/share/factory/gftables/14641 +490 -0
  181. sage_wheels/share/factory/gftables/15625 +523 -0
  182. sage_wheels/share/factory/gftables/16 +3 -0
  183. sage_wheels/share/factory/gftables/16129 +540 -0
  184. sage_wheels/share/factory/gftables/16384 +549 -0
  185. sage_wheels/share/factory/gftables/16807 +563 -0
  186. sage_wheels/share/factory/gftables/1681 +58 -0
  187. sage_wheels/share/factory/gftables/169 +8 -0
  188. sage_wheels/share/factory/gftables/17161 +574 -0
  189. sage_wheels/share/factory/gftables/1849 +64 -0
  190. sage_wheels/share/factory/gftables/18769 +628 -0
  191. sage_wheels/share/factory/gftables/19321 +646 -0
  192. sage_wheels/share/factory/gftables/19683 +659 -0
  193. sage_wheels/share/factory/gftables/2048 +71 -0
  194. sage_wheels/share/factory/gftables/2187 +75 -0
  195. sage_wheels/share/factory/gftables/2197 +76 -0
  196. sage_wheels/share/factory/gftables/2209 +76 -0
  197. sage_wheels/share/factory/gftables/22201 +742 -0
  198. sage_wheels/share/factory/gftables/22801 +762 -0
  199. sage_wheels/share/factory/gftables/2401 +82 -0
  200. sage_wheels/share/factory/gftables/243 +11 -0
  201. sage_wheels/share/factory/gftables/24389 +815 -0
  202. sage_wheels/share/factory/gftables/24649 +824 -0
  203. sage_wheels/share/factory/gftables/25 +3 -0
  204. sage_wheels/share/factory/gftables/256 +11 -0
  205. sage_wheels/share/factory/gftables/26569 +888 -0
  206. sage_wheels/share/factory/gftables/27 +3 -0
  207. sage_wheels/share/factory/gftables/27889 +932 -0
  208. sage_wheels/share/factory/gftables/2809 +96 -0
  209. sage_wheels/share/factory/gftables/28561 +954 -0
  210. sage_wheels/share/factory/gftables/289 +12 -0
  211. sage_wheels/share/factory/gftables/29791 +995 -0
  212. sage_wheels/share/factory/gftables/29929 +1000 -0
  213. sage_wheels/share/factory/gftables/3125 +107 -0
  214. sage_wheels/share/factory/gftables/32 +4 -0
  215. sage_wheels/share/factory/gftables/32041 +1070 -0
  216. sage_wheels/share/factory/gftables/32761 +1094 -0
  217. sage_wheels/share/factory/gftables/32768 +1095 -0
  218. sage_wheels/share/factory/gftables/343 +14 -0
  219. sage_wheels/share/factory/gftables/3481 +118 -0
  220. sage_wheels/share/factory/gftables/361 +14 -0
  221. sage_wheels/share/factory/gftables/36481 +1218 -0
  222. sage_wheels/share/factory/gftables/3721 +126 -0
  223. sage_wheels/share/factory/gftables/37249 +1244 -0
  224. sage_wheels/share/factory/gftables/38809 +1296 -0
  225. sage_wheels/share/factory/gftables/39601 +1322 -0
  226. sage_wheels/share/factory/gftables/4 +3 -0
  227. sage_wheels/share/factory/gftables/4096 +139 -0
  228. sage_wheels/share/factory/gftables/44521 +1486 -0
  229. sage_wheels/share/factory/gftables/4489 +152 -0
  230. sage_wheels/share/factory/gftables/49 +4 -0
  231. sage_wheels/share/factory/gftables/4913 +166 -0
  232. sage_wheels/share/factory/gftables/49729 +1660 -0
  233. sage_wheels/share/factory/gftables/5041 +170 -0
  234. sage_wheels/share/factory/gftables/50653 +1691 -0
  235. sage_wheels/share/factory/gftables/512 +20 -0
  236. sage_wheels/share/factory/gftables/51529 +1720 -0
  237. sage_wheels/share/factory/gftables/52441 +1750 -0
  238. sage_wheels/share/factory/gftables/529 +20 -0
  239. sage_wheels/share/factory/gftables/5329 +180 -0
  240. sage_wheels/share/factory/gftables/54289 +1812 -0
  241. sage_wheels/share/factory/gftables/57121 +1906 -0
  242. sage_wheels/share/factory/gftables/58081 +1938 -0
  243. sage_wheels/share/factory/gftables/59049 +1971 -0
  244. sage_wheels/share/factory/gftables/6241 +210 -0
  245. sage_wheels/share/factory/gftables/625 +23 -0
  246. sage_wheels/share/factory/gftables/63001 +2102 -0
  247. sage_wheels/share/factory/gftables/64 +5 -0
  248. sage_wheels/share/factory/gftables/6561 +221 -0
  249. sage_wheels/share/factory/gftables/6859 +231 -0
  250. sage_wheels/share/factory/gftables/6889 +232 -0
  251. sage_wheels/share/factory/gftables/729 +27 -0
  252. sage_wheels/share/factory/gftables/7921 +266 -0
  253. sage_wheels/share/factory/gftables/8 +3 -0
  254. sage_wheels/share/factory/gftables/81 +5 -0
  255. sage_wheels/share/factory/gftables/8192 +276 -0
  256. sage_wheels/share/factory/gftables/841 +30 -0
  257. sage_wheels/share/factory/gftables/9 +3 -0
  258. sage_wheels/share/factory/gftables/9409 +316 -0
  259. sage_wheels/share/factory/gftables/961 +34 -0
  260. sage_wheels/share/info/singular.info +191898 -0
  261. sage_wheels/share/singular/LIB/GND.lib +1359 -0
  262. sage_wheels/share/singular/LIB/JMBTest.lib +976 -0
  263. sage_wheels/share/singular/LIB/JMSConst.lib +1363 -0
  264. sage_wheels/share/singular/LIB/KVequiv.lib +699 -0
  265. sage_wheels/share/singular/LIB/SingularityDBM.lib +491 -0
  266. sage_wheels/share/singular/LIB/VecField.lib +1542 -0
  267. sage_wheels/share/singular/LIB/absfact.lib +959 -0
  268. sage_wheels/share/singular/LIB/ainvar.lib +730 -0
  269. sage_wheels/share/singular/LIB/aksaka.lib +419 -0
  270. sage_wheels/share/singular/LIB/alexpoly.lib +2542 -0
  271. sage_wheels/share/singular/LIB/algebra.lib +1193 -0
  272. sage_wheels/share/singular/LIB/all.lib +136 -0
  273. sage_wheels/share/singular/LIB/arcpoint.lib +514 -0
  274. sage_wheels/share/singular/LIB/arnold.lib +4553 -0
  275. sage_wheels/share/singular/LIB/arnoldclassify.lib +2058 -0
  276. sage_wheels/share/singular/LIB/arr.lib +3486 -0
  277. sage_wheels/share/singular/LIB/assprimeszerodim.lib +755 -0
  278. sage_wheels/share/singular/LIB/autgradalg.lib +3361 -0
  279. sage_wheels/share/singular/LIB/bfun.lib +1964 -0
  280. sage_wheels/share/singular/LIB/bimodules.lib +774 -0
  281. sage_wheels/share/singular/LIB/brillnoether.lib +226 -0
  282. sage_wheels/share/singular/LIB/brnoeth.lib +5017 -0
  283. sage_wheels/share/singular/LIB/central.lib +2169 -0
  284. sage_wheels/share/singular/LIB/chern.lib +4162 -0
  285. sage_wheels/share/singular/LIB/cimonom.lib +571 -0
  286. sage_wheels/share/singular/LIB/cisimplicial.lib +1835 -0
  287. sage_wheels/share/singular/LIB/classify.lib +3239 -0
  288. sage_wheels/share/singular/LIB/classify2.lib +1462 -0
  289. sage_wheels/share/singular/LIB/classifyMapGerms.lib +1515 -0
  290. sage_wheels/share/singular/LIB/classify_aeq.lib +3253 -0
  291. sage_wheels/share/singular/LIB/classifyceq.lib +2092 -0
  292. sage_wheels/share/singular/LIB/classifyci.lib +1133 -0
  293. sage_wheels/share/singular/LIB/combinat.lib +91 -0
  294. sage_wheels/share/singular/LIB/compregb.lib +276 -0
  295. sage_wheels/share/singular/LIB/control.lib +1636 -0
  296. sage_wheels/share/singular/LIB/crypto.lib +3795 -0
  297. sage_wheels/share/singular/LIB/curveInv.lib +667 -0
  298. sage_wheels/share/singular/LIB/curvepar.lib +1817 -0
  299. sage_wheels/share/singular/LIB/customstd.lib +100 -0
  300. sage_wheels/share/singular/LIB/deRham.lib +5979 -0
  301. sage_wheels/share/singular/LIB/decodegb.lib +2134 -0
  302. sage_wheels/share/singular/LIB/decomp.lib +1655 -0
  303. sage_wheels/share/singular/LIB/deflation.lib +872 -0
  304. sage_wheels/share/singular/LIB/deform.lib +925 -0
  305. sage_wheels/share/singular/LIB/difform.lib +3055 -0
  306. sage_wheels/share/singular/LIB/divisors.lib +750 -0
  307. sage_wheels/share/singular/LIB/dmod.lib +5817 -0
  308. sage_wheels/share/singular/LIB/dmodapp.lib +3269 -0
  309. sage_wheels/share/singular/LIB/dmodideal.lib +1211 -0
  310. sage_wheels/share/singular/LIB/dmodloc.lib +2645 -0
  311. sage_wheels/share/singular/LIB/dmodvar.lib +818 -0
  312. sage_wheels/share/singular/LIB/dummy.lib +17 -0
  313. sage_wheels/share/singular/LIB/elim.lib +1009 -0
  314. sage_wheels/share/singular/LIB/ellipticcovers.lib +548 -0
  315. sage_wheels/share/singular/LIB/enumpoints.lib +146 -0
  316. sage_wheels/share/singular/LIB/equising.lib +2127 -0
  317. sage_wheels/share/singular/LIB/ffmodstd.lib +2384 -0
  318. sage_wheels/share/singular/LIB/ffsolve.lib +1289 -0
  319. sage_wheels/share/singular/LIB/findifs.lib +778 -0
  320. sage_wheels/share/singular/LIB/finitediff.lib +1768 -0
  321. sage_wheels/share/singular/LIB/finvar.lib +7989 -0
  322. sage_wheels/share/singular/LIB/fpadim.lib +2429 -0
  323. sage_wheels/share/singular/LIB/fpalgebras.lib +1666 -0
  324. sage_wheels/share/singular/LIB/fpaprops.lib +1462 -0
  325. sage_wheels/share/singular/LIB/freegb.lib +3853 -0
  326. sage_wheels/share/singular/LIB/general.lib +1350 -0
  327. sage_wheels/share/singular/LIB/gfan.lib +1768 -0
  328. sage_wheels/share/singular/LIB/gitfan.lib +3130 -0
  329. sage_wheels/share/singular/LIB/gkdim.lib +99 -0
  330. sage_wheels/share/singular/LIB/gmspoly.lib +589 -0
  331. sage_wheels/share/singular/LIB/gmssing.lib +1739 -0
  332. sage_wheels/share/singular/LIB/goettsche.lib +909 -0
  333. sage_wheels/share/singular/LIB/graal.lib +1366 -0
  334. sage_wheels/share/singular/LIB/gradedModules.lib +2541 -0
  335. sage_wheels/share/singular/LIB/graphics.lib +360 -0
  336. sage_wheels/share/singular/LIB/grobcov.lib +7706 -0
  337. sage_wheels/share/singular/LIB/groups.lib +1123 -0
  338. sage_wheels/share/singular/LIB/grwalk.lib +507 -0
  339. sage_wheels/share/singular/LIB/hdepth.lib +194 -0
  340. sage_wheels/share/singular/LIB/help.cnf +57 -0
  341. sage_wheels/share/singular/LIB/hess.lib +1946 -0
  342. sage_wheels/share/singular/LIB/hnoether.lib +4292 -0
  343. sage_wheels/share/singular/LIB/hodge.lib +400 -0
  344. sage_wheels/share/singular/LIB/homolog.lib +1965 -0
  345. sage_wheels/share/singular/LIB/hyperel.lib +975 -0
  346. sage_wheels/share/singular/LIB/inout.lib +679 -0
  347. sage_wheels/share/singular/LIB/integralbasis.lib +6224 -0
  348. sage_wheels/share/singular/LIB/interval.lib +1418 -0
  349. sage_wheels/share/singular/LIB/intprog.lib +778 -0
  350. sage_wheels/share/singular/LIB/invar.lib +443 -0
  351. sage_wheels/share/singular/LIB/involut.lib +980 -0
  352. sage_wheels/share/singular/LIB/jacobson.lib +1215 -0
  353. sage_wheels/share/singular/LIB/kskernel.lib +534 -0
  354. sage_wheels/share/singular/LIB/latex.lib +3146 -0
  355. sage_wheels/share/singular/LIB/lejeune.lib +651 -0
  356. sage_wheels/share/singular/LIB/linalg.lib +2040 -0
  357. sage_wheels/share/singular/LIB/locnormal.lib +212 -0
  358. sage_wheels/share/singular/LIB/lrcalc.lib +526 -0
  359. sage_wheels/share/singular/LIB/makedbm.lib +294 -0
  360. sage_wheels/share/singular/LIB/mathml.lib +813 -0
  361. sage_wheels/share/singular/LIB/matrix.lib +1372 -0
  362. sage_wheels/share/singular/LIB/maxlike.lib +1132 -0
  363. sage_wheels/share/singular/LIB/methods.lib +212 -0
  364. sage_wheels/share/singular/LIB/moddiq.lib +322 -0
  365. sage_wheels/share/singular/LIB/modfinduni.lib +181 -0
  366. sage_wheels/share/singular/LIB/modnormal.lib +218 -0
  367. sage_wheels/share/singular/LIB/modprimdec.lib +1278 -0
  368. sage_wheels/share/singular/LIB/modquotient.lib +269 -0
  369. sage_wheels/share/singular/LIB/modstd.lib +1024 -0
  370. sage_wheels/share/singular/LIB/modular.lib +545 -0
  371. sage_wheels/share/singular/LIB/modules.lib +2561 -0
  372. sage_wheels/share/singular/LIB/modwalk.lib +609 -0
  373. sage_wheels/share/singular/LIB/mondromy.lib +1016 -0
  374. sage_wheels/share/singular/LIB/monomialideal.lib +3851 -0
  375. sage_wheels/share/singular/LIB/mprimdec.lib +2353 -0
  376. sage_wheels/share/singular/LIB/mregular.lib +1863 -0
  377. sage_wheels/share/singular/LIB/multigrading.lib +5629 -0
  378. sage_wheels/share/singular/LIB/ncHilb.lib +777 -0
  379. sage_wheels/share/singular/LIB/ncModslimgb.lib +791 -0
  380. sage_wheels/share/singular/LIB/ncalg.lib +16311 -0
  381. sage_wheels/share/singular/LIB/ncall.lib +31 -0
  382. sage_wheels/share/singular/LIB/ncdecomp.lib +468 -0
  383. sage_wheels/share/singular/LIB/ncfactor.lib +13371 -0
  384. sage_wheels/share/singular/LIB/ncfrac.lib +1023 -0
  385. sage_wheels/share/singular/LIB/nchilbert.lib +448 -0
  386. sage_wheels/share/singular/LIB/nchomolog.lib +759 -0
  387. sage_wheels/share/singular/LIB/ncloc.lib +361 -0
  388. sage_wheels/share/singular/LIB/ncpreim.lib +795 -0
  389. sage_wheels/share/singular/LIB/ncrat.lib +2849 -0
  390. sage_wheels/share/singular/LIB/nctools.lib +1887 -0
  391. sage_wheels/share/singular/LIB/nets.lib +1456 -0
  392. sage_wheels/share/singular/LIB/nfmodstd.lib +1000 -0
  393. sage_wheels/share/singular/LIB/nfmodsyz.lib +732 -0
  394. sage_wheels/share/singular/LIB/noether.lib +1106 -0
  395. sage_wheels/share/singular/LIB/normal.lib +8700 -0
  396. sage_wheels/share/singular/LIB/normaliz.lib +2226 -0
  397. sage_wheels/share/singular/LIB/ntsolve.lib +362 -0
  398. sage_wheels/share/singular/LIB/numerAlg.lib +560 -0
  399. sage_wheels/share/singular/LIB/numerDecom.lib +2261 -0
  400. sage_wheels/share/singular/LIB/olga.lib +1933 -0
  401. sage_wheels/share/singular/LIB/orbitparam.lib +351 -0
  402. sage_wheels/share/singular/LIB/parallel.lib +319 -0
  403. sage_wheels/share/singular/LIB/paraplanecurves.lib +3110 -0
  404. sage_wheels/share/singular/LIB/perron.lib +202 -0
  405. sage_wheels/share/singular/LIB/pfd.lib +2223 -0
  406. sage_wheels/share/singular/LIB/phindex.lib +642 -0
  407. sage_wheels/share/singular/LIB/pointid.lib +673 -0
  408. sage_wheels/share/singular/LIB/polybori.lib +1430 -0
  409. sage_wheels/share/singular/LIB/polyclass.lib +525 -0
  410. sage_wheels/share/singular/LIB/polylib.lib +1174 -0
  411. sage_wheels/share/singular/LIB/polymake.lib +1902 -0
  412. sage_wheels/share/singular/LIB/presolve.lib +1533 -0
  413. sage_wheels/share/singular/LIB/primdec.lib +9576 -0
  414. sage_wheels/share/singular/LIB/primdecint.lib +1782 -0
  415. sage_wheels/share/singular/LIB/primitiv.lib +401 -0
  416. sage_wheels/share/singular/LIB/puiseuxexpansions.lib +1631 -0
  417. sage_wheels/share/singular/LIB/purityfiltration.lib +960 -0
  418. sage_wheels/share/singular/LIB/qhmoduli.lib +1561 -0
  419. sage_wheels/share/singular/LIB/qmatrix.lib +293 -0
  420. sage_wheels/share/singular/LIB/random.lib +455 -0
  421. sage_wheels/share/singular/LIB/ratgb.lib +489 -0
  422. sage_wheels/share/singular/LIB/realclassify.lib +5759 -0
  423. sage_wheels/share/singular/LIB/realizationMatroids.lib +772 -0
  424. sage_wheels/share/singular/LIB/realrad.lib +1197 -0
  425. sage_wheels/share/singular/LIB/recover.lib +2628 -0
  426. sage_wheels/share/singular/LIB/redcgs.lib +3984 -0
  427. sage_wheels/share/singular/LIB/reesclos.lib +465 -0
  428. sage_wheels/share/singular/LIB/resbinomial.lib +2802 -0
  429. sage_wheels/share/singular/LIB/resgraph.lib +789 -0
  430. sage_wheels/share/singular/LIB/resjung.lib +820 -0
  431. sage_wheels/share/singular/LIB/resolve.lib +5110 -0
  432. sage_wheels/share/singular/LIB/resources.lib +170 -0
  433. sage_wheels/share/singular/LIB/reszeta.lib +5473 -0
  434. sage_wheels/share/singular/LIB/ring.lib +1328 -0
  435. sage_wheels/share/singular/LIB/ringgb.lib +343 -0
  436. sage_wheels/share/singular/LIB/rinvar.lib +1153 -0
  437. sage_wheels/share/singular/LIB/rootisolation.lib +1481 -0
  438. sage_wheels/share/singular/LIB/rootsmr.lib +709 -0
  439. sage_wheels/share/singular/LIB/rootsur.lib +886 -0
  440. sage_wheels/share/singular/LIB/rstandard.lib +607 -0
  441. sage_wheels/share/singular/LIB/rwalk.lib +336 -0
  442. sage_wheels/share/singular/LIB/sagbi.lib +1353 -0
  443. sage_wheels/share/singular/LIB/sagbiNormaliz.lib +1622 -0
  444. sage_wheels/share/singular/LIB/sagbiNormaliz0.lib +1498 -0
  445. sage_wheels/share/singular/LIB/sagbigrob.lib +449 -0
  446. sage_wheels/share/singular/LIB/schreyer.lib +321 -0
  447. sage_wheels/share/singular/LIB/schubert.lib +2551 -0
  448. sage_wheels/share/singular/LIB/sets.lib +524 -0
  449. sage_wheels/share/singular/LIB/sheafcoh.lib +1663 -0
  450. sage_wheels/share/singular/LIB/signcond.lib +437 -0
  451. sage_wheels/share/singular/LIB/sing.lib +1094 -0
  452. sage_wheels/share/singular/LIB/sing4ti2.lib +419 -0
  453. sage_wheels/share/singular/LIB/solve.lib +2243 -0
  454. sage_wheels/share/singular/LIB/spcurve.lib +1077 -0
  455. sage_wheels/share/singular/LIB/spectrum.lib +62 -0
  456. sage_wheels/share/singular/LIB/sresext.lib +757 -0
  457. sage_wheels/share/singular/LIB/ssi.lib +143 -0
  458. sage_wheels/share/singular/LIB/standard.lib +2769 -0
  459. sage_wheels/share/singular/LIB/stanleyreisner.lib +473 -0
  460. sage_wheels/share/singular/LIB/stdmodule.lib +547 -0
  461. sage_wheels/share/singular/LIB/stratify.lib +1070 -0
  462. sage_wheels/share/singular/LIB/surf.lib +506 -0
  463. sage_wheels/share/singular/LIB/surf_jupyter.lib +223 -0
  464. sage_wheels/share/singular/LIB/surfacesignature.lib +522 -0
  465. sage_wheels/share/singular/LIB/surfex.lib +1462 -0
  466. sage_wheels/share/singular/LIB/swalk.lib +877 -0
  467. sage_wheels/share/singular/LIB/symodstd.lib +1570 -0
  468. sage_wheels/share/singular/LIB/systhreads.lib +74 -0
  469. sage_wheels/share/singular/LIB/tasks.lib +1324 -0
  470. sage_wheels/share/singular/LIB/tateProdCplxNegGrad.lib +2412 -0
  471. sage_wheels/share/singular/LIB/teachstd.lib +858 -0
  472. sage_wheels/share/singular/LIB/template.lib +116 -0
  473. sage_wheels/share/singular/LIB/toric.lib +1119 -0
  474. sage_wheels/share/singular/LIB/transformation.lib +116 -0
  475. sage_wheels/share/singular/LIB/triang.lib +1197 -0
  476. sage_wheels/share/singular/LIB/tropical.lib +8741 -0
  477. sage_wheels/share/singular/LIB/tropicalEllipticCovers.lib +2922 -0
  478. sage_wheels/share/singular/LIB/tropicalNewton.lib +1128 -0
  479. sage_wheels/share/singular/LIB/tst.lib +1108 -0
  480. sage_wheels/share/singular/LIB/weierstr.lib +241 -0
  481. sage_wheels/share/singular/LIB/zeroset.lib +1478 -0
  482. sage_wheels/share/singular/emacs/.emacs-general +184 -0
  483. sage_wheels/share/singular/emacs/.emacs-singular +234 -0
  484. sage_wheels/share/singular/emacs/COPYING +44 -0
  485. sage_wheels/share/singular/emacs/cmd-cmpl.el +241 -0
  486. sage_wheels/share/singular/emacs/ex-cmpl.el +1681 -0
  487. sage_wheels/share/singular/emacs/hlp-cmpl.el +4318 -0
  488. sage_wheels/share/singular/emacs/lib-cmpl.el +179 -0
  489. sage_wheels/share/singular/emacs/singular.el +4273 -0
  490. sage_wheels/share/singular/emacs/singular.xpm +39 -0
  491. sage_wheels/share/singular/singular.idx +5002 -0
@@ -0,0 +1,2561 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ version="version modules.lib 4.1.2.0 Feb_2019 "; // $Id: c75205a956e2064a09eb3d8f6805d5eed9e904fc $
3
+ category="Commutative Algebra";
4
+ info="
5
+ LIBRARY: modules.lib Modules
6
+
7
+ AUTHORS: J. Boehm, boehm@mathematik.uni-kl.de
8
+ D. Wienholz wienholz@mathematik.uni-kl.de
9
+ C. Koenen koenen@rhrk.uni-kl.de
10
+ M. Mayer mayer@mathematik.uni-kl.de
11
+
12
+ OVERVIEW:
13
+ This library is used for the computation of graded free resolutions with an own graduation of
14
+ the monomials. For these Resolution is a new class of modules needed. These modules, can be
15
+ computed via the image, kernel, cokernel of a matrix or the subquotient of two matrices.
16
+ The used matrices also have a free module as source and target, with graded generators if the
17
+ matrix is homogeneous. A matrix of this new form is created by a normal matrix, source, target and
18
+ the graduatin, if the matrix is homogeneous, are done automatically. With this matrices it is then
19
+ possible to compute the new class of modules.
20
+ This library also offers the opppurtunity to create R-module-homomorphisms betweens two modules.
21
+ For these homorphisms the kernel can be computed an will be returned as a module of the new class.
22
+
23
+ This is experimental work in progress!!!
24
+
25
+
26
+ KEYWORDS: graded-module, graded-resolution, homogenoues-matrix, R-module-homomorphism
27
+
28
+ TYPES:
29
+ Matrix the class of matrices with source and target in form of free modules
30
+ FreeModule free modules representet with the ring and degree
31
+ Resolution class of graded resolutions
32
+ Module modules represented by either the image, coker, kernelof a matrix or the subquotient of two matrices
33
+ Vector element of a Module
34
+ Ideal same as ideal, but with it's own basering saved, used to compute resolutions
35
+ Homomorphism class of R-module-homomormphisms
36
+
37
+ PROCEDURES:
38
+ id(int n) return a nxn identity Matrix
39
+ zero(int n,int m) return a nxm zero Matrix
40
+ freeModule(ring,int,list) creating a graded free module
41
+ makeMatrix(matrix,#int) creating a Matrix with graded target and source if the matrix is homogeneous. If # is set to 1, makeMatrix ignores the grading of source & target.
42
+ makeIdeal(ideal) creates an Ideal from an given ideal, is used to compute a resolution of the ideal
43
+ Target(Matrix) return target of the Matrix
44
+ Source(Matrix) return source of the Matrix
45
+ printMatrix(Matrix) print a Matrix
46
+ printFreeModule(FreeModule) print a FreeModule
47
+ printResolution(Resolution) print a Resolution
48
+ printModule(Module) print a Module
49
+ printHom(Homomorphism) print a Homomorphism
50
+ mRes(Module/Ideal,#int) return a minimized graded Resolution
51
+ sRes(Module/Ideal,#int) return a graded Resolution computet with Schreyer's method
52
+ Res(Module/Ideal,#int) return a graded Resolution
53
+ Betti(Resolution) return the Betti-Matrix of the Resolution
54
+ printBetti(Resolution) prints the Betti-matrix of the Resolution
55
+ SetDeg(list/intvec) sets an own graduatuation for the monomials
56
+ Deg(poly) same as deg, but can be used with an own graduation
57
+ Degree(FreeModule) return list with degrees of the module
58
+ Degrees(Module) return list with degrees of the module
59
+ subquotient(Matrix,Matrix) return a Module, the subquotient of the two Matrices
60
+ coker(Matrix) return a Module, the cokernel of the Matrix
61
+ image(Matrix) return a Module, the image of the Matrix
62
+ Ker(Matrix) return a Module, the kernel of the Matrix
63
+ compareModules(Module,Module) return 0 or 1, compares the two Modules up to isomorphism
64
+ addModules(Module,Module) return a Module, sum of the two Modules
65
+ homomorphism(matrix,Module,Module) creates a R-Modul-Homomorphism
66
+ target(Homomorphism) return a Module, target of the Homomorphism
67
+ source(Homomorphism) return a Module, source of the Homomorphism
68
+ compareMatrix(Matrix,Matrix) return 0 or 1, compares two Matrices
69
+
70
+
71
+ freeModule2Module(FreeModule) converts a FreeModule into a Module
72
+ makeVector(vector,Module) creates Vector in the given Module
73
+ netVector(Vector) prints Vector
74
+ netMatrix(Matrix) prints Matrix
75
+ presentation(Module) converts M as a Subquotient to the Coker of a matrix C
76
+ tensorMatrix(Matrix,Matrix) computes tensorproduct of two Matrices
77
+ tensorModule(Module,Module) computes tensorproduct of two Modules
78
+ tensorModFreemod(Module,FreeModule) computes tensorproduct of Module and FreeModule
79
+ tensorFreemodMod(FreeModule,Module) computes tensorproduct of FreeModule and Module
80
+ tensorFreeModule(FreeModule,FreeModule) computes tensorproduct ot two FreeModules
81
+ tensorProduct(def,def) computes tensorproduct
82
+ pruneModule(Module) simplifies the presentation of a Module
83
+ hom(Module,Module) computes Hom(M,N)
84
+ kerHom(Homomorphism) computes the kernel of a Homomorphism
85
+ interpret(Vector) interprets the Vector in some Module or abstract space
86
+ interpretInv(def,Module) interprets a Vector or Homomorphism into the given Module
87
+ reduceIntChain(Module,#int) reduces a chain of interpretations to minimal size or # steps
88
+ interpretElem(Vector,#int) interpret a Vector with # steps or until can't interpret further
89
+ interpretList(list,#int) interpret a list of Vectors as far as possible
90
+ compareVectors(Vector,Vector) compares two Vectors with regard to the relations of their Module
91
+ simplePrune(Module) simplify module
92
+
93
+ ";
94
+
95
+ LIB "matrix.lib";
96
+ LIB "homolog.lib";
97
+
98
+
99
+ static proc mod_init()
100
+ {
101
+ LIB "nets.lib";
102
+
103
+ newstruct("FreeModule","int Rank,ring over,int isgraded,list grading");
104
+ newstruct("Matrix","matrix hom, FreeModule source, FreeModule target, ring over,int ishomogeneous");
105
+ newstruct("Module","Matrix generators,Matrix relations,ring over,int isgraded, list grading, list interpretation");
106
+ //interpretation is a list of two sublists: the first one gives the interpretation into another module M (entries are of type Vector), while the second denotes the inverse of this map (entries are of type vector, since the targetspace is clear).
107
+ newstruct("Vector","Module space, vector entries");
108
+ newstruct("Homomorphism","Module target,Module source,matrix rule,ring over");
109
+ newstruct("Resolution","resolution reso,ring over,int isgraded,list dd");
110
+ newstruct("Ideal","ring over, ideal gens");
111
+
112
+ system("install","FreeModule","==",compareFreeModules,2);
113
+ system("install","Resolution","print",printResolution,1);
114
+ system("install","Matrix","print",printMatrix,1);
115
+ system("install","FreeModule","print",printFreeModule,1);
116
+ system("install","Module","print",printModule,1);
117
+ system("install","Homomorphism","print",printHom,1);
118
+ system("install","Module","+",addModules,2);
119
+ system("install","Module","==",compareModules,2);
120
+ system("install","Matrix","==",compareMatrix,2);
121
+ system("install","Vector","+",addVector,2);
122
+ system("install","Vector","*",multVecPoly,2);
123
+ system("install","Vector","print",printVector,1);
124
+ system("install","Vector","=",makeVector,1);
125
+ system("install","Ideal","=",makeIdeal,1);
126
+ system("install","Matrix","=",makeMatrix,1);
127
+ system("install","Homomorphism","=",homomorphism,1);
128
+ system("install","Homomorphism","*",scaleHomomorphism,2);
129
+ system("install","Homomorphism","+",addHomomorphism,2);
130
+ system("install","Vector","==",compareVectors,2);
131
+ HashTable netH = hashTable(list(list("Module")),list("netModule"));
132
+ HashTable netMat = hashTable(list(list("Matrix"),list("Vector"),list("Homomorphism")),list("netMatrix","netVector","netHom"));
133
+ Method netM = method(netH);
134
+ Method netNat = method(netMat);
135
+ Method netN = Nets::net_;
136
+ Method netS = netN + netM + netNat;
137
+ installMethod(netS,"net");
138
+ Nets::net_=netS;
139
+ HashTable kerH = hashTable(list(list("matrix"),list("Matrix"),list("Homomorphism")),list("kermat","kerMat","kerHom"));
140
+ Method ker_ = method(kerH);
141
+ export(ker_);
142
+ installMethod(ker_,"ker");
143
+
144
+
145
+ list tensortypes = list("Module","Module"),list("FreeModule","FreeModule"),list("Matrix","Matrix"),list("FreeModule","Module"),list("Module","FreeModule");
146
+ list tensorfuncs = "tensorModule","tensorFreeModule","tensorMatrix","tensorFreemodMod","tensorModFreemod";
147
+ HashTable tensors = hashTable(tensortypes,tensorfuncs);
148
+ Method Tens_ = method(tensors);
149
+ installMethod(Tens_,"tensorProduct");
150
+ system("install","Module","*",tensorProduct,2);
151
+ }
152
+
153
+
154
+ static proc kermat(matrix A){
155
+ return(syz(A));}
156
+
157
+ static proc kerMat(Matrix A){
158
+ Matrix M = syz(A.hom);
159
+ return(M);}
160
+
161
+
162
+ proc id(int n)
163
+ "USAGE: id(n); n integer
164
+ RETURN: returns the n x n identity matrix, with nongraded free modules for source and target
165
+ EXAMPLE: example id, shows an example"
166
+ {
167
+ matrix E[n][n];
168
+ E=E+1;
169
+ Matrix M=makeMatrix(E);
170
+ return(M);
171
+ }
172
+
173
+ example
174
+ {
175
+ "EXAMPLE:"; echo=2;
176
+ ring r;
177
+ int n=4;
178
+ id(n);
179
+ }
180
+
181
+ /////////////////////////////////////////////////////////////////////////////////////////
182
+
183
+ proc zero(int n,int m)
184
+ "USAGE: zero(n); n and m integer
185
+ RETURN: returns the n x m zero matrix, with nongraded free modules for source and target
186
+ EXAMPLE: example zero, shows an example"
187
+ {
188
+ matrix E[n][m];
189
+ Matrix M=makeMatrix(E);
190
+ return(M);
191
+ }
192
+
193
+ example
194
+ {
195
+ "EXAMPLE:"; echo=2;
196
+ ring r;
197
+ int n=4;
198
+ int m=3;
199
+ zero(n,m);
200
+ }
201
+
202
+ /////////////////////////////////////////////////////////////////////////////////////////
203
+
204
+ proc SetDeg(def mydeg)
205
+ "USAGE: SetDeg(l), l list or intvec
206
+ RETURN: nothing, saves own degrees for the different variables of the basering
207
+ NOTE: should be used after declaration of the ring and shouldn't be changed afterwards
208
+ EXAMPLE: example SetDeg, shows an example"
209
+ {
210
+ list R=ringlist(basering);
211
+ if(size(R[2])!=size(mydeg)){
212
+ ERROR("Number of arguments doesn't match number of variables");
213
+ }
214
+ intvec I;
215
+ if(typeof(mydeg)=="intvec"){
216
+ I=mydeg;
217
+ }else{
218
+ if(typeof(mydeg)=="list"){
219
+ for(int i=1;i<=size(mydeg);i++){
220
+ I[i]=mydeg[i];
221
+ }
222
+ }
223
+ else{
224
+ ERROR("Input isn't a list or intvec");
225
+ }
226
+ }
227
+ attrib(basering,"Grading",I);
228
+ }
229
+
230
+ example
231
+ {
232
+ "EXAMPLE:"; echo=2;
233
+ ring r;
234
+ Deg(x);
235
+ list l=2,2,2;
236
+ SetDeg(l);
237
+ Deg(x);
238
+ }
239
+
240
+ ////////////////////////////////////////////////////////////////////////////////
241
+
242
+ proc Deg(def p)
243
+ "USAGE: same as deg
244
+ NOTE: only needed if custom degrees are set with SetDeg
245
+ EXAMPLE: example Deg, shows an example"
246
+ {
247
+ if(size(attrib(basering,"Grading"))==0){return(deg(p));}
248
+ else{return(deg(p,attrib(basering,"Grading")));}
249
+ }
250
+ example
251
+ {
252
+ "EXAMPLE:"; echo=2;
253
+ ring r;
254
+ Deg(x);
255
+ list l=2,2,2;
256
+ SetDeg(l);
257
+ Deg(x);
258
+ }
259
+
260
+ ////////////////////////////////////////////////////////////////////////////////
261
+
262
+ proc printResolution(Resolution R)
263
+ "USAGE: printResolution(R); or R; R Resolution
264
+ RETURN: nothing, prints the resolution
265
+ EXAMPLE: example Res, shows and example"
266
+ {
267
+ R.reso;
268
+ }
269
+ example
270
+ {
271
+ "EXAMPLE:"; echo=2;
272
+ ring r;
273
+ matrix m[1][3]=x,y,z;
274
+ Matrix M=m;
275
+ Module N=coker(M);
276
+ N;
277
+ Resolution R = Res(N);
278
+ R;
279
+ }
280
+
281
+ ///////////////////////////////////////////////////////////////////////////////////
282
+
283
+ proc freeModule(def basis,int myrank,list degrees)
284
+ "USAGE: freeModule(r,n,l); r ring, n integer, l list
285
+ RETURN: a free Module over the ring r, with rank n, and degrees l for the generators
286
+ NOTE: -1 for nor graduation and 0 to set every degree to 0
287
+ EXAMPLE: example freeModule, shows an example"
288
+ {
289
+ def R=basering;
290
+ setring(basis);
291
+ int mydeg=0;
292
+ FreeModule M;
293
+ M.over= basis;
294
+ M.Rank = myrank;
295
+ list l=-1;
296
+ M.isgraded=0;
297
+ if(!(comparedeg(degrees,l))){
298
+ M.isgraded=1;
299
+ l=0;
300
+ if(comparedeg(degrees,l)){
301
+ for(int j=1;j<=myrank;j++){
302
+ M.grading[j]=mydeg;
303
+ }
304
+ }
305
+
306
+ else{
307
+ if(myrank!=size(degrees)){ERROR("Graduation incorrect")}
308
+ M.grading=degrees;
309
+ }
310
+ }
311
+ setring(R);
312
+ return(M);
313
+ }
314
+ example
315
+ {
316
+ "EXAMPLE:"; echo=2;
317
+ ring r;
318
+ int n=3;
319
+ list l=1,2,3;
320
+ freeModule(r,n,l);
321
+ }
322
+
323
+ ///////////////////////////////////////////////////////////////////////////////
324
+
325
+ static proc gradedMatrix(matrix m,list mydeg){
326
+ Matrix M;
327
+ M.ishomogeneous=1;
328
+ M.over=basering;
329
+ M.target = freeModule(basering,nrows(m),0);
330
+ M.source = freeModule(basering,ncols(m),mydeg);
331
+ M.hom = m;
332
+ return(M);
333
+ }
334
+
335
+ //////////////////////////////////////////////////////////////////////////////////
336
+
337
+ static proc resMatrix(matrix m,list t,FreeModule N){
338
+ def R=basering;
339
+ setring(N.over);
340
+ list mydeg;
341
+ Matrix M;
342
+ M.ishomogeneous=1;
343
+ M.over=basering;
344
+ int a;
345
+ int j;
346
+ for(int i=1;i<=ncols(m);i++){
347
+ a=0;
348
+ for(j=1;j<=nrows(m);j++){
349
+ if(m[i][j]!=0){
350
+ a=Deg(m[i][j]);
351
+ break;
352
+ }
353
+ }
354
+ mydeg[i]=t[j]+a;
355
+ }
356
+ M.target = N;
357
+ M.source = freeModule(basering,ncols(m),mydeg);
358
+ M.hom = m;
359
+ setring(R);
360
+ return(M);
361
+ }
362
+
363
+ ////////////////////////////////////////////////////////////////////////////////////////////
364
+
365
+ static proc comparedeg(list l,list j){
366
+ if(size(l)!=size(j)){return(0);}
367
+ for(int i=1;i<=size(l);i++){
368
+ if(l[i]!=j[i]){return(0);}
369
+ }
370
+ return(1);
371
+ }
372
+
373
+ /////////////////////////////////////////////////////////////////////////////////////////////
374
+
375
+ static proc isHomogenous(matrix m)
376
+ {
377
+ int j;
378
+ int f;
379
+ list mydeg;
380
+ list controldeg;
381
+ for(int i=1;i<=ncols(m);i++){
382
+ mydeg[i]=0;
383
+ controldeg[i]=0;
384
+ for(j=1;j<=nrows(m);j++){
385
+ if(m[j,i]!=0){
386
+ if(controldeg[i]==1){
387
+ if(mydeg[i]!=Deg(m[j,i])){return(-1)}
388
+ }
389
+ mydeg[i]=Deg(m[j,i]);
390
+ controldeg[i]=1;
391
+ }
392
+ }
393
+ }
394
+ return(mydeg)
395
+ }
396
+
397
+ ////////////////////////////////////////////////////////////////////////////////////////////////
398
+
399
+ proc printFreeModule(FreeModule M)
400
+ "USAGE: printFreeModule(M); or M; M FreeModule
401
+ RETURN: nothing, prints a free Module
402
+ EXAMPLE: example freeModule, shows an example"
403
+ {
404
+ string l1;
405
+ string l2;
406
+ l2=nameof(basering);
407
+ for(int i=1;i<=size(l2);i++){
408
+ l1=l1+" ";
409
+ }
410
+ l1=l1+string(M.Rank);
411
+ print(l1);
412
+ print(l2);
413
+ print("free Module");
414
+ if(M.isgraded){
415
+ string l3 = "Degrees of the generators: ";
416
+ for(i=1;i<=size(M.grading);i++){
417
+ l3=l3+"{"+string(M.grading[i])+"} ";
418
+ }
419
+ print(l3);
420
+ }
421
+ }
422
+ example
423
+ {
424
+ "EXAMPLE:"; echo=2;
425
+ ring r;
426
+ int n=3;
427
+ list l=1,2,3;
428
+ freeModule(r,n,l);
429
+ }
430
+
431
+
432
+ //////////////////////////////////////////////////////////////////////////////////////////////////
433
+
434
+ proc makeIdeal(ideal i)
435
+ "USAGE: makeIdeal(i) or Ideal I=i; i ideal
436
+ RETURN: Ideal with saved basering
437
+ EXAMPLE: example makeIdeal, shows an example"
438
+ {
439
+ Ideal I;
440
+ I.over =basering;
441
+ I.gens=i;
442
+ return(I);
443
+ }
444
+
445
+ example
446
+ {
447
+ "EXAMPLE:"; echo=2;
448
+ ring r;
449
+ ideal i=x,y,z+x;
450
+ i;
451
+ Ideal I=i;
452
+ }
453
+
454
+ static proc printIdeal(Ideal I)
455
+ {
456
+ stackNets(net(I.gens),net("ideal over ")+net(I.over));
457
+ }
458
+
459
+ //////////////////////////////////////////////////////////////////////////////////////////////////
460
+
461
+ proc mRes(def M,int #)
462
+ "USAGE: mRes(M,n); M Module or Ideal, n integer
463
+ RETURN: Resolution, minimized resolution with graded modules
464
+ NOTE: n is optional, if n ist positiv only that many steps will be computed
465
+ use R.dd[i]; to return the different modules as image of matrices, R Resolution i integer
466
+ EXAMPLE. example mRes, shows an example"
467
+ {
468
+ module m;
469
+ def S =basering;
470
+ if(typeof(M)=="Ideal"){
471
+ setring(M.over);
472
+ m=M.gens;
473
+ }
474
+ if(typeof(M)=="Module"){
475
+ setring(M.over);
476
+ module gens=M.generators.hom;
477
+ module rels=M.relations.hom;
478
+ m=modulo(gens,rels);
479
+ }
480
+ int j=0;
481
+ if(size(#)!=0){j=#;}
482
+ list mydeg;
483
+ Resolution R;
484
+ R.reso=mres(m,j);
485
+ matrix a=R.reso[1];
486
+ R.dd[1]=makeMatrix(a);
487
+ if(!(R.dd[1].ishomogeneous)){
488
+ R.isgraded=0;
489
+ for(int i=2;i<=(size(R.reso)+1);i++)
490
+ {
491
+ if(size(module(a))>0)
492
+ {
493
+ a=R.reso[i];
494
+ R.dd[i]=nongradedMatrix(a);
495
+ }
496
+ }
497
+
498
+ }
499
+ else{
500
+ R.isgraded=1;
501
+ for(int i=2;i<=(size(R.reso));i++)
502
+ {
503
+ a=R.reso[i];
504
+ if(size(module(a))>0)
505
+ {
506
+ mydeg=R.dd[i-1].source.grading;
507
+ R.dd[i]=resMatrix(a,mydeg,R.dd[i-1].source);
508
+ }
509
+ }
510
+ }
511
+ R.over=M.over;
512
+ setring(S);
513
+ return(R);
514
+ }
515
+
516
+ example
517
+ {
518
+ "EXAMPLE:"; echo=2;
519
+ ring r;
520
+ matrix m[1][3]=x,y,z;
521
+ Matrix M=m;
522
+ Module N=coker(M);
523
+ N;
524
+ Resolution R = mRes(N);
525
+ R;
526
+ R.dd[2];
527
+ }
528
+
529
+ /////////////////////////////////////////////////////////////////////////////////////////////////
530
+
531
+ proc sRes(def M,int #)
532
+ "USAGE: sRes(M,n); M Module or Ideal, n integer
533
+ RETURN: Resolution, with graded modules, computed with Schreyer's method using the function sres
534
+ NOTE: n is optional, if n ist positiv only that many steps will be computed
535
+ use R.dd[i]; to return the different modules as image of matrices, R Resolution i integer
536
+ EXAMPLE. example sRes, shows an example"
537
+ {
538
+ module m;
539
+ def S =basering;
540
+ if(typeof(M)=="Ideal"){
541
+ setring(M.over);
542
+ m=M.gens;
543
+ }
544
+ if(typeof(M)=="Module"){
545
+ setring(M.over);
546
+ module gens=M.generators.hom;
547
+ module rels=M.relations.hom;
548
+ m=modulo(gens,rels);
549
+ }
550
+ int j=0;
551
+ if(size(#)!=0){j=#;}
552
+ list mydeg;
553
+ Resolution R;
554
+ R.reso=sres(m,j);
555
+ matrix a=R.reso[1];
556
+ R.dd[1]=makeMatrix(a);
557
+ if(!(R.dd[1].ishomogeneous)){
558
+ R.isgraded=0;
559
+ for(int i=2;i<(size(R.reso)+1);i++){
560
+ a=R.reso[i];
561
+ R.dd[i]=nongradedMatrix(a);
562
+ }
563
+
564
+ }
565
+ else{
566
+ R.isgraded=1;
567
+ for(int i=2;i<(size(R.reso));i++){
568
+ a=R.reso[i];
569
+ mydeg=R.dd[i-1].source.grading;
570
+ R.dd[i]=resMatrix(a,mydeg,R.dd[i-1].source);
571
+ }
572
+ }
573
+ R.over=basering;
574
+ setring(S);
575
+ return(R);
576
+ }
577
+
578
+ example
579
+ {
580
+ "EXAMPLE:"; echo=2;
581
+ ring r;
582
+ matrix m[1][3]=x,y,z;
583
+ Matrix M=m;
584
+ Module N=coker(M);
585
+ N;
586
+ Resolution R = sRes(N);
587
+ R;
588
+ R.dd[2];
589
+ }
590
+
591
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
592
+
593
+ proc Res(def M,int #)
594
+ "USAGE: Res(M,n); M Module or Ideal, n integer
595
+ RETURN: Resolution, resolution with graded modules
596
+ NOTE: n is optional, if n ist positiv only that many steps will be computed
597
+ use R.dd[i]; to return the different modules as image of matrices, R Resolution i integer
598
+ EXAMPLE. example Res, shows an example"
599
+ {
600
+ module m;
601
+ def S =basering;
602
+ if(typeof(M)=="Ideal"){
603
+ setring(M.over);
604
+ m=M.gens;
605
+ }
606
+ if(typeof(M)=="Module"){
607
+ setring(M.over);
608
+ module gens=M.generators.hom;
609
+ module rels=M.relations.hom;
610
+ m=modulo(gens,rels);
611
+ }
612
+ int j=0;
613
+ if(size(#)!=0){j=#;}
614
+ list mydeg;
615
+ Resolution R;
616
+ R.reso=res(m,j);
617
+ matrix a=R.reso[1];
618
+ R.dd[1]=makeMatrix(a);
619
+ if(!(R.dd[1].ishomogeneous)){
620
+ R.isgraded=0;
621
+ for(int i=2;i<(size(R.reso)+1);i++){
622
+ a=R.reso[i];
623
+ R.dd[i]=nongradedMatrix(a);
624
+ }
625
+
626
+ }
627
+ else{
628
+ R.isgraded=1;
629
+ for(int i=2;i<(size(R.reso));i++){
630
+ a=R.reso[i];
631
+ mydeg=R.dd[i-1].source.grading;
632
+ R.dd[i]=resMatrix(a,mydeg,R.dd[i-1].source);
633
+ }
634
+ }
635
+ R.over=basering;
636
+ setring(S);
637
+ return(R);
638
+ }
639
+ example
640
+ {
641
+ "EXAMPLE:"; echo=2;
642
+ ring r;
643
+ matrix m[1][3]=x,y,z;
644
+ Matrix M=m;
645
+ Module N=coker(M);
646
+ N;
647
+ Resolution R = Res(N);
648
+ R;
649
+ R.dd[2];
650
+ }
651
+
652
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
653
+
654
+ proc Betti(Resolution resi)
655
+ "USAGE: Betti(reso); reso Resolution
656
+ RETURN: intmat, Bettimatrix of the resolution
657
+ NOTE: for a clear overview use printBetti
658
+ EXAMPLE: example Betti, shows an example"
659
+ {
660
+ Matrix M;
661
+ int j;
662
+ list l;
663
+ int i=size(resi.dd);
664
+ M=resi.dd[i];
665
+ for(j=1;j<=size(M.source.grading);j++){
666
+ l[M.source.grading[j]-i+1]=0;
667
+ }
668
+ intmat Bet[size(l)][size(resi.dd)+1];
669
+ for(j=1;j<=size(M.source.grading);j++){
670
+ Bet[M.source.grading[j]-i+1,i+1]=Bet[M.source.grading[j]-i+1,i+1]+1;
671
+ }
672
+ for(i=1;i<=size(resi.dd);i++){
673
+ M=resi.dd[i];
674
+ for(j=1;j<=size(M.target.grading);j++){
675
+ Bet[M.target.grading[j]-i+2,i]=Bet[M.target.grading[j]-i+2,i]+1;
676
+ }
677
+ }
678
+ return(Bet);
679
+ }
680
+ example
681
+ {
682
+ "EXAMPLE:"; echo=2;
683
+ ring r;
684
+ matrix m[1][3]=x,y,z;
685
+ Matrix M=m;
686
+ Module N=coker(M);
687
+ Resolution R=mRes(N);
688
+ R;
689
+ Betti(R);
690
+ }
691
+
692
+ ////////////////////////////////////////////////////////////////////////////////////
693
+
694
+ proc printBetti(Resolution resi)
695
+ "USAGE: printBetti(resi), resi Resolution
696
+ RETURN: nothing, prints the Bettimatrix of the Resolution
697
+ EXAMPLE: example printBetti, shows an example"
698
+ {
699
+ print(Betti(resi),"betti");
700
+ }
701
+ example
702
+ {
703
+ "EXAMPLE:"; echo=2;
704
+ ring r;
705
+ matrix m[1][3]=x,y,z;
706
+ Matrix M=m;
707
+ Module N=coker(M);
708
+ Resolution R=mRes(N);
709
+ R;
710
+ printBetti(R);
711
+ }
712
+ example
713
+ {
714
+ "EXAMPLE:"; echo=2;
715
+ ring r;
716
+ matrix m[1][3]=x,y,z;
717
+ Matrix M=m;
718
+ Module N=coker(M);
719
+ Resolution R=mRes(N);
720
+ R;
721
+ Betti(R);
722
+ }
723
+
724
+
725
+ ///////////////////////////////////////////////////////////////////////////////////////
726
+
727
+ proc makeMatrix(matrix m, int #)
728
+ "USAGE:makeMatrix(m), m matrix
729
+ RETURN Matrix, with graded source and target if the matrix is homogeneous
730
+ EXAMPLE: example makeMatrix, shows an example"
731
+ {
732
+ Matrix M;
733
+ list mydeg=isHomogenous(m);
734
+ if(mydeg[1]==-1 || # == 1){
735
+ return(nongradedMatrix(m));
736
+ }
737
+ return(gradedMatrix(m,mydeg));
738
+ }
739
+
740
+ example
741
+ {
742
+ "EXAMPLE:"; echo=2;
743
+ ring r;
744
+ matrix m[2][2]=x,y3,z,xz;
745
+ m;
746
+ Matrix M=m;
747
+ }
748
+
749
+
750
+ //////////////////////////////////////////////////////////////////////////////////////////
751
+
752
+ static proc nongradedMatrix(matrix m){
753
+ Matrix M;
754
+ M.ishomogeneous=0;
755
+ M.over=basering;
756
+ M.target = freeModule(basering,nrows(m),-1);
757
+ M.source = freeModule(basering,ncols(m),-1);
758
+ M.hom = m;
759
+ return(M);
760
+ }
761
+
762
+ ///////////////////////////////////////////////////////////////////////////////////////////
763
+
764
+ proc Target(Matrix M)
765
+ "USAGE: Target(M); M Matrix
766
+ RETURN: FreeModule, target of the Matrix
767
+ EXAMPLE: example Target, shows an example"
768
+ {
769
+ return(M.target);
770
+ }
771
+
772
+ example
773
+ {
774
+ "EXAMPLE:"; echo=2;
775
+ ring r;
776
+ matrix m[2][2]=x,y3,z,xz;
777
+ Matrix M=m;
778
+ M;
779
+ Target(M);
780
+ }
781
+
782
+ ///////////////////////////////////////////////////////////////////////////////////////////
783
+
784
+ proc Source(Matrix M)
785
+ "USAGE: Source(M); M Matrix
786
+ RETURN: FreeModule, source of the Matrix
787
+ EXAMPLE: example Source, shows an example"
788
+ {
789
+ return(M.source);
790
+ }
791
+
792
+ example
793
+ {
794
+ "EXAMPLE:"; echo=2;
795
+ ring r;
796
+ matrix m[2][2]=x,y3,z,xz;
797
+ Matrix M=m;
798
+ M;
799
+ Source(M);
800
+ }
801
+
802
+ ///////////////////////////////////////////////////////////////////////////////////////////
803
+
804
+ proc Degree(FreeModule M)
805
+ "USAGE: Degree(M); M FreeModule
806
+ RETURN: list, degrees of the generators from the module, if they are graded
807
+ EXAMPLE: example Degree, shows an example"
808
+ {
809
+ if(M.isgraded){
810
+ return(M.grading);
811
+ }
812
+ print("The module isn't graded");
813
+ }
814
+
815
+ example
816
+ {
817
+ "EXAMPLE:"; echo=2;
818
+ ring r;
819
+ matrix m[2][2]=x,y3,z,xz;
820
+ Matrix Ma=m;
821
+ FreeModule M=Source(Ma);
822
+ M;
823
+ Degree(M);
824
+ }
825
+
826
+ ///////////////////////////////////////////////////////////////////////////////////////////
827
+
828
+
829
+ proc printMatrix(Matrix M)
830
+ "USAGE: printMatrix(M); or M; M Matrix
831
+ RETURN: nothing, prints the matrix with degrees of the generators from target and source
832
+ EXAMPLE: example printMatrix, shows an example"
833
+ {
834
+ def R=basering;
835
+ setring(M.over);
836
+ matrix m=M.hom;
837
+ if(M.ishomogeneous){
838
+ string s1;
839
+ string s2;
840
+ list l1;
841
+ int j;
842
+ for(int i=1;i<=ncols(m);i++){
843
+ l1[i]=0;
844
+ for(j=1;j<=nrows(m);j++){
845
+ if(size(string(m[i][j]))>l1[i]){
846
+ l1[i]=size(string(m[i][j]));
847
+ }
848
+ }
849
+ }
850
+ s1=" ";
851
+ for(i=1;i<=ncols(m);i++){
852
+ for(j=1;j<=(l1[i]);j++){
853
+ s1=s1+" ";
854
+ }
855
+ s1=s1+"{"+string(M.source.grading[i])+"}";
856
+ }
857
+ print(s1);
858
+ for(int k=1;k<=nrows(m);k++){
859
+ s2="{"+string(M.target.grading[k])+"}";
860
+ for(i=1;i<=ncols(m);i++){
861
+ for(j=1;j<=(l1[i]+3-size(string(m[i][k])));j++){
862
+ s2=s2+" ";
863
+ }
864
+ s2=s2+string(m[i][k]);
865
+ }
866
+ print(s2);
867
+ }
868
+
869
+ }
870
+ else{print(m);}
871
+ setring(R);
872
+ }
873
+
874
+ example
875
+ {
876
+ "EXAMPLE:"; echo=2;
877
+ ring r;
878
+ matrix m[2][2]=x,y3,z,xz;
879
+ Matrix M=m;
880
+ M;
881
+ }
882
+
883
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
884
+
885
+ static proc compareRing(def r, def t){
886
+ list a=ring_list(r);
887
+ list b=ring_list(t);
888
+ if(!(a[1]==b[1])){return(0);}
889
+ for(int i=1;i<=size(a[2]);i++){
890
+ if(a[2][i]!=b[2][i]){return(0);}
891
+ }
892
+ if(a[3][1][1]!=b[3][1][1]){return(0);}
893
+ if(a[3][1][2]!=b[3][1][2]){return(0);}
894
+ if(a[3][2][1]!=b[3][2][1]){return(0);}
895
+ if(a[3][2][2]!=b[3][2][2]){return(0);}
896
+ ideal I = std(a[4]);
897
+ ideal J = std(b[4]);
898
+ if(size(I)!=size(J)){
899
+ return(0);
900
+ }
901
+ for(int j = 1;i<=size(I); i++){
902
+ if(I[i]!=J[i]){
903
+ return(0);
904
+ }
905
+ }
906
+ return(1);
907
+ }
908
+
909
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
910
+
911
+ static proc compareFreeModules(FreeModule M, FreeModule N){
912
+ if(!(compareRing(M.over,N.over)))
913
+ {
914
+ return(0);}
915
+ if(M.Rank!=N.Rank){
916
+ return(0);}
917
+ return(1);
918
+ }
919
+
920
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
921
+
922
+ proc subquotient(Matrix gens, Matrix rels)
923
+ "USAGE: subquotient(gens,rels); gens and rels Matrices
924
+ RETURN: Module, the subquotient of two entered Matrices
925
+ EXAMPLE: example suquotient; shows an example"
926
+ {
927
+ ring R=basering;
928
+ setring(gens.over);
929
+ Module S;
930
+ S.isgraded=0;
931
+ if(gens.ishomogeneous){
932
+ S.grading=gens.source.grading;
933
+ S.isgraded=1;
934
+ }
935
+ if(!(gens.target==rels.target)){
936
+ setring(R);
937
+ ERROR("the two matrices don't have the same target");
938
+ }
939
+ S.generators = gens;
940
+ S.relations = rels;
941
+ S.over = gens.over;
942
+ setring(R);
943
+ return(S);
944
+ }
945
+
946
+ example
947
+ {
948
+ "EXAMPLE:"; echo=2;
949
+ ring r;
950
+ matrix m[2][2]=x,y2,z,xz;
951
+ Matrix M=m;
952
+ matrix n[2][3]=z2,xyz,x2y2,xy,x3,y4;
953
+ Matrix N=n;
954
+ M;
955
+ N;
956
+ subquotient(M,N);
957
+ }
958
+
959
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
960
+
961
+ proc homomorphism(matrix rules,Module sources, Module targets)
962
+ "USAGE: homomorphism(rules,sources,targets); rules a matrix, sources and targets are Modules
963
+ Return: Homomorphism
964
+ EXAMPLE: example homomorphism; shows an example"
965
+ {
966
+ ring S=basering;
967
+ setring(sources.over);
968
+ module d=targets.relations.hom;
969
+ module b=rules*sources.relations.hom;
970
+ d=std(d);
971
+ for(int i=1;i<=size(b);i++){
972
+ if(reduce(b[i],d)!=0){
973
+ ERROR("The given homomorphism between the two modules isn't possible");}
974
+ }
975
+ Homomorphism H;
976
+ H.source=sources;
977
+ H.target=targets;
978
+ H.rule=rules;
979
+ H.over=sources.over;
980
+ setring(S);
981
+ return(H);
982
+ }
983
+
984
+ example
985
+ {
986
+ "EXAMPLE:"; echo=2;
987
+ ring R=0,(x,y),(lp,c);
988
+ Matrix M=id(2);
989
+ Module src=image(M);
990
+ matrix rules[2][2]=x,y,x2,y2;
991
+ Module tar=coker(M);
992
+ src;
993
+ tar;
994
+ rules;
995
+ homomorphism(rules,src,tar);
996
+ }
997
+
998
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
999
+
1000
+ proc coker(Matrix rels)
1001
+ "USAGE:coker(M), M a Matrix
1002
+ RETURN:Module, the coker of M
1003
+ EXAMPLE: example coker; shows an example"
1004
+ {
1005
+ int i;
1006
+ int n = nrows(rels.hom);
1007
+ matrix new = rels.hom;
1008
+ //Delete Zerocolumns in relations:
1009
+ for (i=2;i<ncols(new);i++) {
1010
+ if ([new[1..n,i]]==0) {
1011
+ new = deleteCol(new,i);
1012
+ }
1013
+ }
1014
+ Module M;
1015
+ if(rels.ishomogeneous){M.isgraded=1;}
1016
+ else{M.isgraded=0;}
1017
+ Matrix New = new;
1018
+ M=subquotient(id(nrows(new)),New);
1019
+ return(M);
1020
+ }
1021
+
1022
+ example
1023
+ {
1024
+ "EXAMPLE:"; echo=2;
1025
+ ring r;
1026
+ matrix m[2][2]=x,y2,z,xz;
1027
+ Matrix M=m;
1028
+ M;
1029
+ coker(M);
1030
+ }
1031
+
1032
+ /////////////////////////////////////////////////////////////////////////////////////////////////
1033
+
1034
+
1035
+ proc image(Matrix gens)
1036
+ "USAGE:image(M); M a Matrix
1037
+ RETURN: Module, the image of M
1038
+ EXAMPLE: example image; shows an example"
1039
+ {
1040
+ Module M;
1041
+ M=subquotient(gens,zero(nrows(gens.hom),1));
1042
+ return(M);
1043
+ }
1044
+
1045
+ example
1046
+ {
1047
+ "EXAMPLE:"; echo=2;
1048
+ ring r;
1049
+ matrix m[2][2]=x,y2,z,xz;
1050
+ Matrix M=m;
1051
+ M;
1052
+ image(M);
1053
+ }
1054
+
1055
+ /////////////////////////////////////////////////////////////////////////////////////
1056
+
1057
+ proc Ker(Matrix mat)
1058
+ "USAGE: Ker(M); M a Matrix
1059
+ RETURN: Module, image of a Matrix N with image(N)=Ker(M)
1060
+ EXAMPLE: example Ker; shows an example"
1061
+ {
1062
+ matrix m=syz(mat.hom);
1063
+ if (mat.source.isgraded){
1064
+ Matrix M=resMatrix(m,mat.source.grading,mat.source);
1065
+ }else{
1066
+ Matrix M = makeMatrix(m,1);
1067
+ }
1068
+ return(image(M));
1069
+ }
1070
+
1071
+ example
1072
+ {
1073
+ "EXAMPLE:"; echo=2;
1074
+ ring r;
1075
+ matrix m[1][3]=x,y2,z3;
1076
+ Matrix M=m;
1077
+ M;
1078
+ Ker(M);
1079
+ }
1080
+
1081
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////
1082
+
1083
+ static proc isZero(matrix M)
1084
+ {
1085
+ int n=nrows(M);
1086
+ int m=ncols(M);
1087
+ Matrix Z=zero(n,m);
1088
+ return(M==Z.hom);
1089
+ }
1090
+
1091
+ /////////////////////////////////////////////////////////////////////////////////////////////////////
1092
+
1093
+ static proc isIdentity(matrix M)
1094
+ {
1095
+ int n=ncols(M);
1096
+ Matrix Z=id(n);
1097
+ return(M==Z.hom);
1098
+ }
1099
+
1100
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////
1101
+
1102
+ static proc nameOver(Module M){
1103
+ def R= basering;
1104
+ setring(M.over);
1105
+ string n = nameof(basering);
1106
+ setring R;
1107
+ return(n);}
1108
+
1109
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
1110
+
1111
+ proc netModule(Module M)
1112
+ {
1113
+ def R=basering;
1114
+ setring(M.over);
1115
+ matrix rels = M.relations.hom;
1116
+ matrix gens = M.generators.hom;
1117
+ int zerorel=isZero(rels);
1118
+ int idgens=isIdentity(gens);
1119
+ Net ret,ret2,ret3,ret4;
1120
+ if (zerorel) {
1121
+ if (idgens){
1122
+ ret=net(nameOver(M))+net("^")+net(nrows(gens));
1123
+ ret2=net(", free");
1124
+ } else {
1125
+ typeof(gens);
1126
+ ret=net("image ")+net(gens);
1127
+ ret2=net(", submodule of ")+net(nameof(basering))+net("^")+net((nrows(rels)));
1128
+ }
1129
+ }
1130
+ if ((!zerorel)&&idgens) {
1131
+ ret=net("cokernel ")+net(rels);
1132
+ ret2=net(", quotient of ")+net(nameof(basering))+net("^")+net((nrows(rels)));
1133
+ }
1134
+ if ((!idgens)&&(!zerorel)) {
1135
+ ret=net("subquotient (")+net(gens)+net(", ")+net(rels)+net(")");
1136
+ ret2=net(", subquotient of ")+net(nameof(basering))+net("^")+net((nrows(rels)));
1137
+ }
1138
+
1139
+ if (M.isgraded == 1){
1140
+ ret3 = net("Graded with:") + net(M.grading);
1141
+ }
1142
+
1143
+ //interpretationlist:
1144
+
1145
+ if (size(M.interpretation)==0){ret4 = net("The Interpretationmap is the Identity.");}
1146
+ else {
1147
+ ret4 = netList(M.interpretation[1]);
1148
+ ret4.rows = (net("Interpretation:")).rows + ret4.rows;
1149
+ if (size(M.interpretation[2])!=0) {
1150
+ ret4.rows = ret4.rows + (net("inverse Interpretation:")).rows + (net(M.interpretation[2])).rows;
1151
+ }
1152
+ }
1153
+
1154
+
1155
+ Net output = ret+ret2;
1156
+ output.rows = output.rows + ret3.rows + ret4.rows;
1157
+
1158
+ setring(R);
1159
+ return(output);
1160
+ }
1161
+
1162
+
1163
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////
1164
+
1165
+ static proc present(Module M)
1166
+ {
1167
+ def R=basering;
1168
+ setring(M.over);
1169
+ int n=ncols(M.generators.hom);
1170
+ matrix MM;
1171
+ if (isZero(M.relations.hom)){
1172
+ MM=M.generators.hom;
1173
+ } else {
1174
+ MM=concat(M.generators.hom,M.relations.hom);
1175
+ }
1176
+ matrix K = syz(MM);
1177
+ K=submat(K,1..n, 1..ncols(K));
1178
+ Matrix L=K;
1179
+ Module cc = coker(L);
1180
+ setring R;
1181
+ return(cc);
1182
+ }
1183
+
1184
+ //////////////////////////////////////////////////////////////////////////////////////////
1185
+
1186
+ static proc minimize(Module M)
1187
+ {
1188
+ def R=basering;
1189
+ setring(M.over);
1190
+ Module MM = present(M);
1191
+ module Mold = MM.relations.hom;
1192
+ matrix gM = pruneModule(Mold);
1193
+ Module cc=coker(gM);
1194
+ setring R;
1195
+ return(cc);
1196
+ }
1197
+
1198
+ /////////////////////////////////////////////////////////////////////////////////////////////
1199
+
1200
+
1201
+ proc printHom(Homomorphism f)
1202
+ "USAGE:printHom(M); f a Homomorphism
1203
+ RETURN: nothing, prints f
1204
+ EXAMPLE: example printHom; shows an example"
1205
+ {
1206
+ ring R=basering;
1207
+ setring(f.over);
1208
+ print(net(f.rule));
1209
+ print("");
1210
+ print(netModuleShort(f.target)+net(" <--- ")+netModuleShort(f.source));
1211
+ setring R;
1212
+ }
1213
+
1214
+ example
1215
+ {
1216
+ "EXAMPLE:"; echo=2;
1217
+ ring R=0,(x,y),(lp,c);
1218
+ Matrix M=id(2);
1219
+ Module src=image(M);
1220
+ matrix rules[2][2]=x,y,x2,y2;
1221
+ Module tar=coker(M);
1222
+ src;
1223
+ tar;
1224
+ rules;
1225
+ Homomorphism f=homomorphism(rules,src,tar);
1226
+ f;
1227
+ }
1228
+
1229
+
1230
+ //////////////////////////////////////////////////////////////////////////////////////////////////
1231
+
1232
+ proc target(Homomorphism f)
1233
+ "USAGE:target(f); f Homomorphism
1234
+ RETURN: Module, the target of f
1235
+ EXAMPLE: example target; shows an example"
1236
+ {
1237
+ return(f.target);
1238
+ }
1239
+
1240
+ example
1241
+ {
1242
+ "EXAMPLE:"; echo=2;
1243
+ ring R=0,(x,y),(lp,c);
1244
+ Matrix M=id(2);
1245
+ Module src=image(M);
1246
+ matrix rules[2][2]=x,y,x2,y2;
1247
+ Module tar=coker(M);
1248
+ src;
1249
+ tar;
1250
+ rules;
1251
+ Homomorphism f=homomorphism(rules,src,tar);
1252
+ f;
1253
+ target(f);
1254
+ }
1255
+
1256
+ ////////////////////////////////////////////////////////////////////////////////////////////////
1257
+
1258
+ proc source(Homomorphism f)
1259
+ "USAGE:source(f); f Homomorphism
1260
+ RETURN: Module, the source of f
1261
+ EXAMPLE: example source; shows an example"
1262
+ {
1263
+ return(f.source);
1264
+ }
1265
+
1266
+ example
1267
+ {
1268
+ "EXAMPLE:"; echo=2;
1269
+ ring R=0,(x,y),(lp,c);
1270
+ Matrix M=id(2);
1271
+ Module src=image(M);
1272
+ matrix rules[2][2]=x,y,x2,y2;
1273
+ Module tar=coker(M);
1274
+ src;
1275
+ tar;
1276
+ rules;
1277
+ Homomorphism f=homomorphism(rules,src,tar);
1278
+ f;
1279
+ source(f);
1280
+ }
1281
+
1282
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
1283
+
1284
+ static proc kerHom_old(Homomorphism f)
1285
+ "USAGE:kerHom_old(f); f Homomorphism
1286
+ RETURN: Module, the kernel of f
1287
+ EXAMPLE: example kerHom_old; shows an example"
1288
+ {
1289
+ Module T=f.target;
1290
+ ring R=basering;
1291
+ setring(T.over);
1292
+ Module NN=present(f.target);
1293
+ Module MM=present(f.source);
1294
+ module N=NN.relations.hom;
1295
+ module M=MM.relations.hom;
1296
+ matrix A=f.rule;
1297
+ matrix K=hom_kernel(A,M,N);
1298
+ Matrix KER=K;
1299
+ Module KE=coker(KER);
1300
+ setring R;
1301
+ return(KE);
1302
+ }
1303
+
1304
+ example
1305
+ {
1306
+ "EXAMPLE:"; echo=2;
1307
+ ring R=0,(x,y),(lp,c);
1308
+ Matrix M=id(2);
1309
+ Module src=image(M);
1310
+ matrix rules[2][2]=x,y,xy,y2;
1311
+ Module tar=coker(M);
1312
+ Homomorphism f=homomorphism(rules,src,tar);
1313
+ f;
1314
+ kerHom_old(f);
1315
+ }
1316
+
1317
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
1318
+
1319
+ proc addModules(Module M, Module N)
1320
+ "USAGE: addModules(M,N); or M+N; M and N Modules
1321
+ RETURN: Module, sum of the two Modules
1322
+ EXAMPLE: example addModules; shows an example"
1323
+ {
1324
+ def R=basering;
1325
+ setring(M.over);
1326
+ if (!((image(M.relations))==(image(N.relations)))){ERROR("expected submodules of the same module")};
1327
+ Module MN;
1328
+ MN.over = basering;
1329
+ matrix gens = concat(M.generators.hom,N.generators.hom);
1330
+ MN.generators = makeMatrix(gens);
1331
+ MN.relations = N.relations;
1332
+ //MN=minimize(MN);
1333
+ setring R;
1334
+ return(MN);
1335
+ }
1336
+
1337
+ example
1338
+ {
1339
+ "EXAMPLE:"; echo=2;
1340
+ ring r;
1341
+ matrix ma[2][2]=x,y,x2,y2;
1342
+ Matrix m=ma;
1343
+ Module M=image(m);
1344
+ matrix na[2][2]=xy,x2,y2,x;
1345
+ Matrix n=na;
1346
+ Module N=image(na);
1347
+ M;
1348
+ N;
1349
+ N+M;
1350
+ }
1351
+
1352
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
1353
+
1354
+ proc compareModules(Module M, Module N)
1355
+ "USAGE:compareModules(M,N); or M==N; compares two Modules up to isomorphism
1356
+ RETURN: 1 or 0, if the are ismomophic or aren't
1357
+ EXAMPLE: example compareModules; shows an example"
1358
+ {
1359
+ def R=basering;
1360
+ setring(M.over);
1361
+ int re =1;
1362
+ if(M.isgraded!=N.isgraded){re=0;}
1363
+ if(M.isgraded){
1364
+ if(size(M.grading)!=size(N.grading)){re=0;}
1365
+ for(int i=1;i<=size(M.grading);i++){
1366
+ if(M.grading[i]!=N.grading[i]){re=0;}
1367
+ }
1368
+ }
1369
+ module gensm=M.generators.hom;
1370
+ module relsm=M.relations.hom;
1371
+ matrix m=modulo(gensm,relsm);
1372
+ module gensn=N.generators.hom;
1373
+ module relsn=N.relations.hom;
1374
+ matrix n=modulo(gensn,relsn);
1375
+ if (m!=n){re=0;};
1376
+ setring R;
1377
+ return(re);
1378
+ }
1379
+
1380
+ example
1381
+ {
1382
+ "EXAMPLE:"; echo=2;
1383
+ ring r;
1384
+ matrix ma[2][2]=x,y,x,y;
1385
+ Matrix m=ma;
1386
+ Module M=image(m);
1387
+ matrix na[2][1]=-y,x;
1388
+ Matrix n=na;
1389
+ M;
1390
+ Module N=image(n);
1391
+ N;
1392
+ N==M;
1393
+ N=coker(n);
1394
+ N;
1395
+ N==M;
1396
+ }
1397
+
1398
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////
1399
+
1400
+ proc Degrees(Module M)
1401
+ "USAGE:Degrees(M); M a Module
1402
+ RETURN: list, grading of the Module
1403
+ EXAMPLE: example Degrees; shows an example"
1404
+ {
1405
+ def R=basering;
1406
+ setring(M.over);
1407
+ if(M.isgraded){
1408
+ return(M.grading);
1409
+ }else{
1410
+ Error("The Module isn't graded.");
1411
+ }
1412
+ setring R;
1413
+ }
1414
+
1415
+ example
1416
+ {
1417
+ "EXAMPLE:"; echo=2;
1418
+ ring r;
1419
+ matrix ma[2][2]=x,y,x,y;
1420
+ Matrix m=ma;
1421
+ Module M=image(m);
1422
+ M;
1423
+ Degrees(M);
1424
+ }
1425
+
1426
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1427
+
1428
+ proc compareMatrix(Matrix M, Matrix N)
1429
+ "USAGE:compareMatrix(M,N); or M==N; compares two Matrices
1430
+ RETURN: 1 or 0, if the are the same or aren't
1431
+ EXAMPLE: example compareMatrix; shows an example"
1432
+ {
1433
+ return(M.hom==N.hom);
1434
+ }
1435
+
1436
+ example
1437
+ {
1438
+ "EXAMPLE:"; echo=2;
1439
+ ring r;
1440
+ matrix ma[2][2]=x,y,x,y;
1441
+ Matrix M=ma;
1442
+ matrix na[2][1]=-y,x;
1443
+ Matrix N=na;
1444
+ M;
1445
+ N;
1446
+ N==M;
1447
+ M==M;
1448
+ }
1449
+
1450
+
1451
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1452
+
1453
+ //Eigene Funktionen
1454
+
1455
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1456
+
1457
+
1458
+ proc printModule(Module M)
1459
+ "USAGE: printModule(M); or M; M a Module
1460
+ RETURN: nothing, prints the Module
1461
+ EXAMPLE: example printModule; shows an example
1462
+ {
1463
+ netModuleShort(M);
1464
+ }
1465
+ example
1466
+ {
1467
+ "EXAMPLE:"; echo=2;
1468
+ ring r;
1469
+ matrix m[2][2]=x,y2,z,xz;
1470
+ Matrix M=m;
1471
+ M;
1472
+ Module N=image(M);
1473
+ N;
1474
+ }
1475
+
1476
+
1477
+ static proc netModuleShort(Module M)
1478
+ {
1479
+ def R=basering;
1480
+ setring(M.over);
1481
+ matrix rels = M.relations.hom;
1482
+ matrix gens = M.generators.hom;
1483
+ int zerorel=isZero(rels);
1484
+ int idgens=isIdentity(gens);
1485
+ Net ret;
1486
+ if (zerorel) {
1487
+ if (idgens){
1488
+ ret=net(nameOver(M))+net("^")+net(nrows(gens));
1489
+ } else {
1490
+ ret=net("image ")+net(gens);
1491
+ }
1492
+ }
1493
+ if ((!zerorel)&&idgens) {
1494
+ ret=net("cokernel ")+net(rels);
1495
+ }
1496
+ if ((!idgens)&&(!zerorel)) {
1497
+ ret=net("subquotient (")+net(gens)+net(", ")+net(rels)+net(")");
1498
+ }
1499
+ setring(R);
1500
+ return(ret);
1501
+ }
1502
+
1503
+
1504
+ static proc netHom(Homomorphism f) {
1505
+ return(net(f.rule));
1506
+ }
1507
+
1508
+
1509
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1510
+
1511
+
1512
+ proc freeModule2Module(FreeModule F)
1513
+ "USAGE: freeModule2Module(F); F FreeModule
1514
+ RETURN: returns F as a Module
1515
+ EXAMPLE: example freeModule2Module, shows an example"
1516
+ {
1517
+ Module M = image (id(F.Rank));
1518
+ M.isgraded = F.isgraded;
1519
+ M.grading = F.grading;
1520
+ return(M);
1521
+ }
1522
+ example
1523
+ {
1524
+ "EXAMPLE:"; echo=2;
1525
+ ring r;
1526
+ list L = 1,1,1;
1527
+ FreeModule F = freeModule(r,3,L);
1528
+ freeModule2Module(F);
1529
+ }
1530
+
1531
+
1532
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1533
+
1534
+
1535
+ proc netMatrix(Matrix M)
1536
+ "USAGE = netMatrix(M); M Matrix
1537
+ RETURN: nothing, prints M
1538
+ KEYWORDS: Output
1539
+ EXAMPLE: example netMatrix; shows an example"
1540
+ {
1541
+ Net N = netmatrix(M.hom); /*
1542
+ N;
1543
+ print("");
1544
+ print("From source");
1545
+ printFreeModule(M.source);
1546
+ print("");
1547
+ print("to target");
1548
+ printFreeModule(M.target);
1549
+ print("");
1550
+ print("Ring:");
1551
+ M.over;*/
1552
+ return(N);
1553
+ }
1554
+ example
1555
+ {
1556
+ "EXAMPLE:"; echo=2;
1557
+ ring r;
1558
+ matrix m[2][2]=x,y2,z,xz;
1559
+ Matrix M=m;
1560
+ netMatrix(M);
1561
+ }
1562
+
1563
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1564
+ ////////////////////////////////// Vector related functions ///////////////////////////////////////
1565
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1566
+
1567
+
1568
+ proc makeVector(vector v, Module M)
1569
+ "USAGE = makeVector(v,M); vector v, Module M
1570
+ RETURN: a Vector V, element of M with entries v
1571
+ EXAMPLE: example makeVector; shows an example"
1572
+ {
1573
+ //assure that v has the right size:
1574
+ if (nrows(v)>nrows(M.generators.hom)){ERROR("The Element has too many entries");}
1575
+ //assure that V is in M:
1576
+ list DivVec = division(v,M.generators.hom);
1577
+ if ((DivVec[2])[1] != 0) {ERROR("The vector isn't in the Module");}
1578
+
1579
+ Vector V;
1580
+ V.space = M;
1581
+ V.entries = v;
1582
+ return(V);
1583
+ }
1584
+ example
1585
+ {
1586
+ "EXAMPLE:"; echo=2;
1587
+ ring r;
1588
+ Module M = image(id(3));
1589
+ makeVector([x,y,z],M);
1590
+ }
1591
+
1592
+
1593
+ proc netVector(Vector V)
1594
+ "USAGE: netVector(V); V Vector
1595
+ RETURN: pretty print for Vector
1596
+ EXAMPLE: example netVector; shows an example"
1597
+ {
1598
+ int i = nrows(V.space.generators.hom);
1599
+ matrix ents[i][1] = V.entries;
1600
+ Net ret = net(ents);
1601
+ return(ret);
1602
+ }
1603
+ example
1604
+ {
1605
+ "EXAMPLE:"; echo=2;
1606
+ ring r;
1607
+ Module M = image(id(3));
1608
+ Vector V = makeVector([x,y,z],M);
1609
+ netVector(V);
1610
+ }
1611
+
1612
+ static proc printVector(Vector V) {
1613
+ net(V);
1614
+ }
1615
+
1616
+ proc compareVectors(Vector V1, Vector V2)
1617
+ "USAGE: compareVector(V1,V2); Vector V1,V2
1618
+ RETURN: compares the given Vectors up tu equivalence
1619
+ EXAMPLE: example compareVector; shows an example"
1620
+ {
1621
+ if (V1.space == V2.space){
1622
+ int n = nrows(((V1.space).generators).hom);
1623
+ matrix vecDiff[n][1] = V1.entries-V2.entries;
1624
+ list divList = division(vecDiff,V1.space.relations.hom);
1625
+ if (divList[2][1] == 0){return(1);} else {return(0);}
1626
+ }else{return(0);}
1627
+ }
1628
+ example
1629
+ {
1630
+ "EXAMPLE:"; echo=2;
1631
+ ring r;
1632
+ matrix m[2][1] = x,-y;
1633
+ Module M = subquotient(id(2),m);
1634
+ Vector V = [x,y],M;
1635
+ Vector W = [0,2y],M;
1636
+ Vector U = [x,y2],M;
1637
+ compareVectors(V,W);
1638
+ compareVectors(U,V);
1639
+ }
1640
+
1641
+
1642
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1643
+ //////////////////////////////////// Presentation of Module ///////////////////////////////////////
1644
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1645
+
1646
+
1647
+ proc presentation(Module M)
1648
+ "USAGE = presentation(M); M Module
1649
+ RETURN: Subquotient M converted to coker(C)
1650
+ EXAMPLE: example presentation; shows an example"
1651
+ {
1652
+ //TODO Grading
1653
+ matrix A = M.generators.hom;
1654
+ // If M is already given as a cokernel, don't change anything:
1655
+ if (M.generators == id(M.generators.source.Rank)){
1656
+ return(M);
1657
+ }
1658
+ matrix B = M.relations.hom;
1659
+ int n = nrows(A);
1660
+ int m = ncols(A) + ncols(B);
1661
+ matrix ab[n][m] = A,B;
1662
+ Matrix AB = ab;
1663
+ Module Kern = Ker(AB);
1664
+ matrix c = Kern.generators.hom;
1665
+ n = ncols(A);
1666
+ m = ncols(c);
1667
+ matrix helpmat[n][m] = c[1..n,1..m];
1668
+ Matrix C = helpmat;
1669
+ Module N = coker(C);
1670
+ int i;
1671
+ list L = list(),list();
1672
+ for (i=1;i<=ncols(A);i++) {
1673
+ (L)[1][i] = makeVector([A[1..nrows(A),i]],M);
1674
+ }
1675
+ matrix gens = N.generators.hom;
1676
+ for (i=1;i<=ncols(gens);i++){
1677
+ (L)[2][i] = [gens[1..nrows(gens),i]];
1678
+ }
1679
+ N.interpretation = L;
1680
+ return(N);
1681
+ }
1682
+
1683
+ example
1684
+ {
1685
+ "EXAMPLE:"; echo=2;
1686
+ ring R = 0,(x,y),dp;
1687
+ matrix a[1][2] = x,y;
1688
+ Matrix A = a;
1689
+ matrix b[1][2] = x2,y2;
1690
+ Matrix B = b;
1691
+ Module M = subquotient(A,B);
1692
+ presentation(M);
1693
+ }
1694
+
1695
+
1696
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1697
+ //////////////////////////////////// Tensor products ///////////////////////////////////////
1698
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1699
+
1700
+
1701
+ proc tensorMatrix(Matrix A, Matrix B)
1702
+ "USAGE = tensorMatrix(A,B); A,B Matrix over the same ring
1703
+ RETURN: Tensorprodukt of A,B
1704
+ EXAMPLE: example tensorMatrix; shows an example"
1705
+ {
1706
+ if (A.over != B.over) {
1707
+ ERROR("A and B don't work over the same ring")
1708
+ }
1709
+ int i;
1710
+ int j;
1711
+ Matrix T = tensor(A.hom,B.hom);
1712
+ list source_grading; //TODO Grading
1713
+ list target_grading;
1714
+ list betweenSafe = B.source.grading; //english for Runaways
1715
+ if (A.source.isgraded==0 || B.source.isgraded==0) {
1716
+ source_grading = -1;
1717
+ }else{
1718
+ /*If both Matrices have dimension 1x1, we only need to add the degrees. Especially if both gradings are zero.*/
1719
+ if (size(A.source.grading)==1 && size(B.source.grading)==1) {
1720
+ source_grading = A.source.grading[1]+B.source.grading[1];
1721
+ }else{
1722
+ for (i=1;i<=A.source.Rank;i++) {
1723
+ for (j=1;j<=B.source.Rank;j++) {
1724
+ source_grading = source_grading + list(betweenSafe[j] + A.source.grading[i]);
1725
+ }
1726
+ }
1727
+ }
1728
+ }
1729
+ T.source = freeModule(A.over,A.source.Rank*B.source.Rank,source_grading);
1730
+ if (A.target.isgraded==0 || B.target.isgraded==0) {
1731
+ target_grading = -1;
1732
+ }else{
1733
+ target_grading = 0; //vorlaeufig
1734
+ }
1735
+ T.target = freeModule(A.over,A.target.Rank*B.target.Rank,target_grading);
1736
+ return(T);
1737
+ }
1738
+
1739
+ example
1740
+ {
1741
+ "EXAMPLE:"; echo=2;
1742
+ ring r;
1743
+ matrix m[2][2]=x,y2,z,xz;
1744
+ matrix n[2][2]=1,2,3,4;
1745
+ Matrix M = m;
1746
+ Matrix N = n;
1747
+ tensorMatrix(M,N);
1748
+ }
1749
+
1750
+
1751
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1752
+
1753
+
1754
+ proc tensorModule(Module M, Module N)
1755
+ "USAGE = tensorModule(M,N); M,N Modules over the same ring
1756
+ RETURN: Tensorprodukt of M,N
1757
+ EXAMPLE: example tensorModule; shows an example"
1758
+ {
1759
+ //TODO Grading
1760
+ if (M.over != N.over) {
1761
+ ERROR("The modules don't live over the same ring");
1762
+ }
1763
+ Module M2 = presentation(M);
1764
+ Module N2 = presentation(N);
1765
+ Matrix Tensormatrix1 = tensorMatrix(N2.generators, M2.relations);
1766
+ Matrix Tensormatrix2 = tensorMatrix(N2.relations, M2.generators);
1767
+ Matrix Tensormatrix = concMatrix(Tensormatrix1,Tensormatrix2);
1768
+ Module T = coker(Tensormatrix);
1769
+ return(T);
1770
+ }
1771
+
1772
+ example
1773
+ {
1774
+ "EXAMPLE:"; echo=2;
1775
+ ring R = 0,(x,y,z),dp;
1776
+ matrix a[1][2] = x,y;
1777
+ Matrix A = a;
1778
+ matrix b[1][2] = x2,y2;
1779
+ Matrix B = b;
1780
+ Module M = subquotient(A,B);
1781
+ M;
1782
+ matrix c[2][2]=x,y2,z,xz;
1783
+ Matrix C=c;
1784
+ matrix d[2][3]=z2,xyz,x2y2,xy,x3,y4;
1785
+ Matrix D=d;
1786
+ Module N = subquotient(C,D);
1787
+ N;
1788
+ tensorModule(M,N);
1789
+ }
1790
+
1791
+
1792
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1793
+
1794
+
1795
+ proc tensorModFreemod(Module M, FreeModule F)
1796
+ "USAGE = tensorModFreemod(M,F); M Module,F FreeModule over the same ring
1797
+ RETURN: Tensorprodukt of M,F
1798
+ EXAMPLE: example tensorModFreemod; shows an example"
1799
+ {
1800
+ //TODO Grading
1801
+ if (M.over != F.over) {
1802
+ ERROR("The modules don't live over the same ring");
1803
+ }
1804
+ Module M2 = presentation(M);
1805
+ Matrix Tensormatrix = tensorMatrix(M2.relations, id(F.Rank));
1806
+ Module T = coker(Tensormatrix);
1807
+ return(T);
1808
+ }
1809
+
1810
+ example
1811
+ {
1812
+ "EXAMPLE:"; echo=2;
1813
+ ring R = 0,(x,y,z),dp;
1814
+ matrix a[1][2] = x,y;
1815
+ Matrix A = a;
1816
+ matrix b[1][2] = x2,y2;
1817
+ Matrix B = b;
1818
+ Module M = subquotient(A,B);
1819
+ M;
1820
+ FreeModule F = freeModule(R,3,0);
1821
+ F;
1822
+ tensorModFreemod(M,F);
1823
+ }
1824
+
1825
+
1826
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1827
+
1828
+
1829
+ proc tensorFreemodMod(FreeModule F, Module M) //Dreht input um
1830
+ {
1831
+ if (M.over != F.over) {
1832
+ ERROR("The modules don't live over the same ring");
1833
+ }
1834
+ Module T = tensorModFreemod(M,F);
1835
+ return(T);
1836
+ }
1837
+
1838
+
1839
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1840
+
1841
+
1842
+ proc tensorFreeModule(FreeModule M, FreeModule N)
1843
+ "USAGE = tensorFreeModule(M,N); M,N FreeModule over the same ring
1844
+ RETURN: Tensorprodukt of M,N
1845
+ EXAMPLE: example tensorFreeModule; shows an example"
1846
+ {
1847
+ if (M.over != N.over) {
1848
+ ERROR("The modules don't live over the same ring");
1849
+ }
1850
+ FreeModule T = freeModule(M.over,M.Rank*N.Rank,-1); //vorlaeufig ohne grading //TODO Grading
1851
+ return(T);
1852
+ }
1853
+
1854
+ example
1855
+ {
1856
+ "EXAMPLE:"; echo=2;
1857
+ ring R = 0,(x,y,z),dp;
1858
+ FreeModule F = freeModule(R,3,0);
1859
+ F;
1860
+ tensorFreeModule(F,F);
1861
+ }
1862
+
1863
+
1864
+
1865
+
1866
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1867
+ /////////////////////////////////// Pruning maps //////////////////////////////////////////
1868
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1869
+
1870
+
1871
+ proc pruneModule(Module M)
1872
+ "USAGE = pruneModule(M); M Module
1873
+ RETURN: M in a simplified presentation
1874
+ EXAMPLE: example pruneModule; shows an example"
1875
+ {
1876
+ ring s = basering;
1877
+ Module P = presentation(M);
1878
+ Matrix Rels = P.relations;
1879
+ //R HIR: calculate Hermite-NF
1880
+ ring r = Rels.over;
1881
+ if (charstr(r)=="ZZ"){
1882
+ matrix new = hermiteNormalForm(Rels.hom);
1883
+ P.relations = new;
1884
+ return(P);
1885
+ }
1886
+ //run prunefunctions
1887
+ Rels = pruneModule1(Rels);
1888
+ Rels = pruneModule2(Rels);
1889
+ P.relations = Rels;
1890
+ //adjust pruningmap:
1891
+ //while dimension changes, use adjust pruning-map
1892
+ int dimension = nrows(P.generators.hom);
1893
+ P = simplePrune(P);
1894
+ while (dimension != nrows(P.generators.hom)){
1895
+ dimension--;
1896
+ P = simplePrune(P);
1897
+ P = reduceIntChain(P);
1898
+ }
1899
+ //compute GB of relations:
1900
+ Rels = P.relations;
1901
+ Rels = pruneModule1(Rels);
1902
+ P.relations = Rels;
1903
+ setring(s);
1904
+ return(P);
1905
+ }
1906
+
1907
+ example
1908
+ {
1909
+ "EXAMPLE:"; echo=2;
1910
+ ring R = 0,(x,y,z),dp;
1911
+ matrix a[2][3] = -x,-y^2,x^3,y,x,0;
1912
+ matrix b[1][2] = x^2-y^3,xy;
1913
+ Matrix A = a;
1914
+ Matrix B = b;
1915
+ Module M = coker(A);
1916
+ Module N = coker(B);
1917
+ Module H = hom(M,N);
1918
+ H;
1919
+ pruneModule(H);
1920
+ }
1921
+
1922
+
1923
+
1924
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1925
+
1926
+
1927
+ static proc pruneModule1(Matrix M) {
1928
+ matrix gens = std(M.hom);
1929
+ /* if (homog(gens)==1) {
1930
+ matrix gens = minbase(M.hom);
1931
+ }*/
1932
+ Matrix Gens = gens;
1933
+ return(Gens);
1934
+ }
1935
+
1936
+
1937
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1938
+
1939
+
1940
+ static proc pruneModule2(Matrix M) {
1941
+ matrix m = M.hom;
1942
+ poly factor;
1943
+ poly pivot;
1944
+ int i,j,k,l;
1945
+ int rows = nrows(m);
1946
+ int cols = ncols(m);
1947
+ for (i=1;i<=rows;i++) {
1948
+ for (j=1;j<=cols;j++) {
1949
+ if (isUnit(m[i,j])) {
1950
+ //if the entry is a unit, it's Pivot element
1951
+ pivot = m[i,j];
1952
+ if (pivot!=1) {for(k=1;k<=rows;k++) { m[k,j] = m[k,j]/pivot; }}
1953
+ //dividing Pivot col with Pivot element
1954
+ //Now add multiples of Pivot column to the other columns to make the row to zero:
1955
+ for(k=1;k<=cols;k++) {
1956
+ if (k!=j) {
1957
+ factor = -m[i,k];
1958
+ m[1..rows,k] = m[1..rows,k] + factor*m[1..rows,j];
1959
+ }//change all columns except pivot column
1960
+ }
1961
+ }
1962
+ }
1963
+ }
1964
+ Matrix Mat = m;
1965
+ return (Mat);
1966
+ }
1967
+
1968
+
1969
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
1970
+
1971
+
1972
+ proc simplePrune(Module M)
1973
+ "USAGE = simplePrune(M); M Module
1974
+ RETURN: Simplified Module with reduced dimension
1975
+ EXAMPLE: example simplePrune; shows an example"
1976
+ /*
1977
+ Whenever the relations of a presented Module include a 1-entry, we can reduce the dimension of the Module by representing the relevant variable. This allows us, to 'forget' this row after killing all the other row entries to 0. Therefore, we can reduce the dimension of the Module by 1 without losing any information.
1978
+ */
1979
+ {
1980
+ //TODO Grading
1981
+ //M must be presented as a cokernel
1982
+ matrix rels = M.relations.hom;
1983
+ int abbruch = 0;
1984
+ int i,j;
1985
+ while (i<nrows(rels) && abbruch==0) {
1986
+ i++;
1987
+ for (j=1;j<=ncols(rels);j++) {
1988
+ if (rels[i,j] == 1) {abbruch=1;break;}
1989
+ }
1990
+ }
1991
+ if (abbruch==0){return(M);} //no 1 found
1992
+ //Have now indices (i,j) of a 1-entry
1993
+ Module N;
1994
+ N.over = M.over;
1995
+ if (ncols(rels)>1){
1996
+ matrix newrels[ncols(rels)][nrows(rels)-1] = deleteCol(transpose(rels),i);
1997
+ matrix needthislater = transpose(newrels);
1998
+ newrels = deleteCol(needthislater,j);
1999
+ Matrix Newrels = newrels;
2000
+ }else{
2001
+ Matrix Newrels = zero(nrows(rels)-1,1);
2002
+ matrix needthislater = Newrels.hom;
2003
+ }
2004
+ N.relations = Newrels;
2005
+ int rows = nrows(M.generators.hom)-1;
2006
+ N.generators = id(rows);
2007
+ N.interpretation = list(list(),list());
2008
+ //Need to insert 0 in the i-th row which is for the identitymatrix equivalent to deleting the i-th column:
2009
+ matrix m[rows+1][rows] = deleteCol(id(rows+1).hom,i);
2010
+ int k;
2011
+ list interpr;
2012
+ Vector V;
2013
+ for (k=1;k<=rows;k++) {
2014
+ V = makeVector([m[1..(rows+1),k]],M);
2015
+ interpr[k] = V;
2016
+ }
2017
+ N.interpretation[1] = interpr;
2018
+ //Now construct the inverse map: 'forget' the i-th row and send the i-th unitvector to the according negative relations.
2019
+ list preinterpr;
2020
+ vector v;
2021
+ matrix n[rows][rows];
2022
+ n = n+1;
2023
+ for (k=1;k<=rows+1;k++) {
2024
+ if (k!=i) {
2025
+ if (k<i) {
2026
+ v = [n[1..rows,k]];
2027
+ preinterpr[k] = v;
2028
+ }else{
2029
+ v = [n[1..rows,k-1]];
2030
+ preinterpr[k] = v;
2031
+ }
2032
+ }else{
2033
+ v = [(-1)*needthislater[1..rows,j]];
2034
+ preinterpr[k] = v;
2035
+ }
2036
+ }
2037
+ N.interpretation[2] = preinterpr;
2038
+ return(N);
2039
+ }
2040
+ example
2041
+ {
2042
+ "EXAMPLE:"; echo=2;
2043
+ ring R;
2044
+ matrix a[5][4];
2045
+ Module M = coker(a+1);
2046
+ Module N = simplePrune(M);
2047
+ }
2048
+
2049
+
2050
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2051
+
2052
+
2053
+ static proc isUnit(poly p) {
2054
+ if (deg(p)!=0){ return (0); }
2055
+ int i = int(p);
2056
+ if (char(basering) != 0) {
2057
+ if (gcd(char(basering),i) == 1){ return(1); }
2058
+ else{ return(0); }
2059
+ }else{
2060
+ if (charstr(basering) == "ZZ" && absValue(i) != 1){ return(0); }
2061
+ else{ return(1); }
2062
+ }
2063
+ }
2064
+
2065
+
2066
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2067
+ /////////////////////////////////// Interpretation functions //////////////////////////////////////////
2068
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2069
+
2070
+
2071
+ proc interpretElem(Vector Elmt, int #)
2072
+ "USAGE = interpretElem(V,n); Vector Elmt, n integer
2073
+ RETURN: interpretation of a Vector with # steps or until can't interpret further
2074
+ EXAMPLE: example interpretElem; shows an example"
2075
+ {
2076
+ if (# == 0){#=-1;} //if we want to interpret as far as possible
2077
+ while (# != 0 && size(Elmt.space.interpretation) != 0){
2078
+ Elmt = interpret(Elmt);
2079
+ # = # - 1;
2080
+ }
2081
+ return(Elmt);
2082
+ }
2083
+ example
2084
+ {
2085
+ "EXAMPLE:"; echo=2;
2086
+ ring R;
2087
+ matrix a[5][4];
2088
+ Module M = coker(a+1);
2089
+ Module N = simplePrune(simplePrune(simplePrune(simplePrune(M))));
2090
+ Vector V = [x+y],N;
2091
+ interpretElem(V,3);
2092
+ }
2093
+
2094
+
2095
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2096
+
2097
+
2098
+ proc interpretList(list Elements, int #)
2099
+ "USAGE = interpretList(L,n); list L of Vectors all of the same Module, n integer
2100
+ RETURN: interpretation of Elements in some abstract structure defined by the user or into a Module
2101
+ EXAMPLE: example interpretList; shows an example"
2102
+ {
2103
+ Vector Cache;
2104
+ Module C = (Elements[1]).space;
2105
+ C = reduceIntChain(C,#);
2106
+ int i;
2107
+ list newEls;
2108
+ for (i=1;i<=size(Elements);i++) {
2109
+ Cache = makeVector((Elements[i]).entries,C);
2110
+ newEls = newEls + list(interpret(Cache));
2111
+ }
2112
+ return(newEls);
2113
+ }
2114
+ example
2115
+ {
2116
+ "EXAMPLE:"; echo=2;
2117
+ ring R;
2118
+ matrix a[5][4];
2119
+ Module M = coker(a+1);
2120
+ Module N = simplePrune(simplePrune(simplePrune(simplePrune(M))));
2121
+ Vector V = [x+y],N;
2122
+ Vector W = [x2+y2+3*z2],N;
2123
+ Vector U = [x+2y+27z],N;
2124
+ list L = U,V,W;
2125
+ //interpretList(L,3);
2126
+ }
2127
+
2128
+
2129
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2130
+
2131
+
2132
+ proc reduceIntChain(Module C, int #)
2133
+ "USAGE = reduceIntChain(C,n); C Module, n int
2134
+ RETURN: Module C with minimized (or # steps) interpretation list
2135
+ EXAMPLE: example reduceIntChain; shows an example"
2136
+ {
2137
+ Module M;
2138
+ list preList;
2139
+ Vector V;
2140
+ Vector cacheVec;
2141
+ list intList;
2142
+ if (size(C.interpretation) != 0) { // either there is no interpretation list or at least the "interpret direction" exists
2143
+ int i;
2144
+ if (#==0){#=-1;}
2145
+ while ((typeof((C.interpretation)[1][1])=="Vector") && (#<>0))
2146
+ {
2147
+ if (size(((C.interpretation)[1][1]).space.interpretation)==0){break;}
2148
+ // M is in each iteration step precisely the module, which will be cut out of the chain
2149
+ M = ((C.interpretation)[1][1]).space;
2150
+ // First construct the concatenation of the inverse maps
2151
+ preList = list();
2152
+ if (size(C.interpretation[2]) != 0 && size(M.interpretation[2]) != 0){
2153
+ for (i=1; i<=size((M.interpretation)[2]);i++){
2154
+ V = makeVector(((M.interpretation)[2])[i],M);
2155
+ cacheVec = interpretInv(V,C);
2156
+ preList[i] = cacheVec.entries;
2157
+ }
2158
+ }
2159
+ (C.interpretation)[2] = preList;
2160
+ // Second concatenate the interpretation maps
2161
+ for(i=1;i<=size((C.interpretation)[1]);i++) {
2162
+ intList[i] = interpret((C.interpretation)[1][i]);
2163
+ }
2164
+ C.interpretation[1] = intList;
2165
+ intList = list();
2166
+ # = #-1;
2167
+ }
2168
+ }
2169
+ return(C);
2170
+ }
2171
+
2172
+ example
2173
+ {
2174
+ "EXAMPLE:"; echo=2;
2175
+ ring R;
2176
+ matrix a[5][4];
2177
+ Module M = coker(a+1);
2178
+ Module N = simplePrune(simplePrune(simplePrune(simplePrune(M))));
2179
+ //reduceIntChain(N);
2180
+ }
2181
+
2182
+
2183
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2184
+
2185
+
2186
+ proc interpret(Vector V)
2187
+ "USAGE = interpret(V); V Vector
2188
+ RETURN: interpretation of V into some space that is stored in the interpretationlist of V.space
2189
+ EXAMPLE: example interpret; shows an example"
2190
+ {
2191
+ int i;
2192
+ if (size(V.space.interpretation) == 0) {return(V);}
2193
+ //nothing to interpret
2194
+
2195
+ if (V.space.generators == id(ncols(V.space.generators.hom))) {
2196
+ def W = V.space.interpretation[1][1];
2197
+ W = V.space.interpretation[1][1]*V.entries[1];
2198
+ for (i=2;i<=nrows(V.entries);i++) {
2199
+ W = W + V.space.interpretation[1][i]*V.entries[i];
2200
+ }
2201
+ return(W);
2202
+ }//Have cokernel-presentation in this case
2203
+
2204
+ //general case:
2205
+ list DivVec = division(V.entries,V.space.generators.hom);
2206
+ matrix myCoeffs = DivVec[1];
2207
+ def W = V.space.interpretation[1][1]*myCoeffs[1,1]; //user needs to define '*' in advance
2208
+ for (i=2;i<=nrows(myCoeffs);i++) {
2209
+ W = W + V.space.interpretation[1][i]*myCoeffs[i,1]; //user needs to define '+' as well
2210
+ }
2211
+ return(W);
2212
+ }
2213
+
2214
+
2215
+ example
2216
+ {
2217
+ "EXAMPLE:"; echo=2;
2218
+ "example 1:";
2219
+ ring R = 0,(x,y),dp;
2220
+ matrix a[1][2] = x,y;
2221
+ Matrix A = a;
2222
+ matrix b[1][2] = x2,y2;
2223
+ Matrix B = b;
2224
+ Module M = subquotient(A,B);
2225
+ Module C = presentation(M);
2226
+ Vector V = [x2,y4],C;
2227
+ interpret(V);
2228
+
2229
+ "example 2:";
2230
+ ring S;
2231
+ matrix gens[2][3] = x2+y-3z4,y+xy,xyz+4,3+z2x,z3-3x+3,2+x+y+z7;
2232
+ vector v = 2x*[gens[1..2,1]] + (y-z2)*[gens[1..2,2]] + 5*[gens[1..2,3]];
2233
+ Matrix Gens = gens;
2234
+ M = subquotient(Gens,zero(2,3));
2235
+ M.interpretation = list(list(1,1,1),list());
2236
+ V = v,M;
2237
+ interpret(V);
2238
+ }
2239
+
2240
+
2241
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2242
+
2243
+
2244
+ proc interpretInv(def V, Module N)
2245
+ "USAGE = interpretInv(V,N); V Vector or Homomorphism, N Module
2246
+ RETURN: interpretation of V into some Module N (inverse to interpret)
2247
+ EXAMPLE: example interpretInv; shows an example"
2248
+ {
2249
+ if (typeof(V)=="Vector"){
2250
+ Module M = V.space;
2251
+ //Check whether there is a inverse interpretationlist:
2252
+ if ((size(N.interpretation)!=0) && (size((N.interpretation)[2])!=0) && (((N.interpretation)[1][1]).space == M)) {
2253
+ // third condition checks whether the given modules are related
2254
+ //in this case we decompose v into the generators of its Module and project those onto the generators of N
2255
+ list DivVec = division(V.entries,M.generators.hom);
2256
+ matrix myCoeffs = DivVec[1];
2257
+ vector w = N.interpretation[2][1]*myCoeffs[1,1];
2258
+ //inverse maps only contain elements of type vector
2259
+ int i;
2260
+ for (i=2;i<=nrows(myCoeffs);i++) {
2261
+ w = w + N.interpretation[2][i]*myCoeffs[i,1];
2262
+ }
2263
+ Vector W = w,N;
2264
+ return(W);
2265
+ }
2266
+ //If not, check whether there exists an interpretationlist to N in the Module of V:
2267
+ if ((size(M.interpretation)!=0) && (((M.interpretation)[1][1]).space == N)){return(interpret(V));}
2268
+ //If neither exist, can't interpretInv:
2269
+ ERROR("There exists no inverse map into the given module");
2270
+ }
2271
+ if (typeof(V)=="Homomorphism"){
2272
+ //generators of Hom are the tensors of the canonical basevectors
2273
+ matrix cache = V.rule;
2274
+ int n = nrows(cache);
2275
+ int m = ncols(cache);
2276
+ int i,j;
2277
+ vector ret_bar;
2278
+ if (size(N.interpretation)==0){ERROR("There exists no inverse map into the given module");}
2279
+ if (size(N.interpretation[2])!=n*m){ERROR("Homomorphism has wrong dimension");}
2280
+ list int_inv = N.interpretation[2];
2281
+ for (i=1;i<=n;i++){
2282
+ for(j=1;j<=m;j++){
2283
+ ret_bar = ret_bar + cache[i,j]*int_inv[(j-1)*n+i];
2284
+ }
2285
+ }
2286
+ Vector ret = ret_bar,N;
2287
+ return(ret);
2288
+ }
2289
+ else {ERROR("Can't interpret object of the given type into the Module");}
2290
+ }
2291
+
2292
+ example
2293
+ {
2294
+ "EXAMPLE:"; echo=2;
2295
+ ring R;
2296
+ matrix gens[2][3] = x2,xy,4,z2x,3x+3,z;
2297
+ vector v = 2x*[gens[1..2,1]] + (y-z2)*[gens[1..2,2]] + 5*[gens[1..2,3]];
2298
+ Matrix Gens = gens;
2299
+ Module S = subquotient(Gens,zero(2,3));
2300
+ Module N = coker(id(3));
2301
+ matrix E = N.generators.hom;
2302
+ Vector E1 = [1,0,0],N;
2303
+ Vector E2 = [0,1,0],N;
2304
+ Vector E3 = [0,0,1],N;
2305
+ S.interpretation = list(list(E1,E2,E3),list([gens[1..2,1]],[gens[1..2,2]],[gens[1..2,3]]));
2306
+ Vector V = v,S;
2307
+ Vector W = interpret(V),N;
2308
+ net(V);
2309
+ Vector Vnew = interpretInv(W,S);
2310
+ net(Vnew);
2311
+ V==Vnew;
2312
+ }
2313
+
2314
+
2315
+
2316
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2317
+ /////////////////////////////////// compute Hom(M,N) //////////////////////////////////////////
2318
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2319
+
2320
+
2321
+ proc hom(Module M, Module N)
2322
+ "USAGE = hom(M,N); M,N Module
2323
+ RETURN: calculates Hom(M,N) as a subquotient and yields an interpretation for the elements
2324
+ EXAMPLE: example hom; shows an example"
2325
+ {
2326
+ //TODO Grading
2327
+ N = presentation(N);
2328
+ M = presentation(M);
2329
+ Matrix T = tensorMatrix(transMat(M.relations.hom),N.generators);
2330
+ Module Targ = coker(tensorMatrix(id(ncols(M.relations.hom)),N.relations));
2331
+ Module Sour = coker(tensorMatrix(id(nrows(M.relations.hom)),N.relations));
2332
+ Homomorphism h = homomorphism(T.hom,Sour,Targ);
2333
+ Module H = kerHom(h);
2334
+ //interpretationlist:
2335
+ list interpretation = list(),list();
2336
+ //Need to write the generators of H as matrices:
2337
+ int m = nrows(M.relations.hom);
2338
+ int n = nrows(N.relations.hom);
2339
+ int i,j;
2340
+ matrix mat[n][m];
2341
+ mat = transpose(mat);
2342
+ matrix H_gens = H.generators.hom;
2343
+ Homomorphism interpr_hom;
2344
+ for (i=1;i<=ncols(H_gens);i++) {
2345
+ mat = H_gens[1..nrows(H_gens),i];
2346
+ interpr_hom = homomorphism(transpose(mat),M,N);
2347
+ interpretation[1] = interpretation[1] + list(interpr_hom);
2348
+ mat = 0;
2349
+ }
2350
+ H.interpretation = interpretation;
2351
+ return(H);
2352
+ }
2353
+ example
2354
+ {
2355
+ "Example:"; echo=2;
2356
+ ring R = 0,(x,y,z),dp;
2357
+ matrix a[2][3] = -x,-y^2,x^3,y,x,0;
2358
+ matrix b[1][2] = x^2-y^3,xy;
2359
+ Matrix A = a;
2360
+ Matrix B = b;
2361
+ Module M = coker(A);
2362
+ Module N = coker(B);
2363
+ hom(M,N);
2364
+ }
2365
+
2366
+
2367
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2368
+
2369
+
2370
+ proc kerHom(Homomorphism H)
2371
+ "USAGE = kerHom(H); H Homomorphism
2372
+ RETURN: returns the kernel of the given homomorphism
2373
+ EXAMPLE: example kerHom; shows an example"
2374
+ {
2375
+ Matrix B = H.rule;
2376
+ Matrix A = H.target.relations;
2377
+ Matrix C = concMatrix(A,B);
2378
+ matrix s = syz(C.hom);
2379
+ int s_rows = nrows(s);
2380
+ int s_cols = ncols(s);
2381
+ int A_cols = ncols(A.hom);
2382
+ matrix k = submat(s,A_cols+1..s_rows,1..s_cols);
2383
+ Module Kernel = subquotient(k,H.source.relations);
2384
+ return(Kernel);
2385
+ }
2386
+ example
2387
+ {
2388
+ ring R=0,(x,y),(lp,c);
2389
+ Matrix M=id(2);
2390
+ Module src=image(M);
2391
+ matrix rules[2][2]=x,y,xy,y2;
2392
+ Module tar=coker(M);
2393
+ Homomorphism f=homomorphism(rules,src,tar);
2394
+ f;
2395
+ kerHom(f);
2396
+ }
2397
+
2398
+
2399
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2400
+ /////////////////////////////////// Auxiliary functions //////////////////////////////////////////
2401
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2402
+
2403
+
2404
+ static proc concMatrix(Matrix A,Matrix B)
2405
+ "USAGE = concMatrix(A,B); A,B Matrix over the same ring
2406
+ RETURN: concatenated Matrix with concatenated grading
2407
+ EXAMPLE: example concMatrix; shows an example"
2408
+ {
2409
+ //TODO Grading
2410
+ if (A.over != B.over) {
2411
+ ERROR("The matrices don't live over the same ring");
2412
+ }
2413
+ Matrix M;
2414
+ int i = ncols(A.hom);
2415
+ int j = ncols(B.hom);
2416
+ int k = nrows(A.hom);
2417
+ if (nrows(A.hom) != nrows(B.hom)){ERROR("Wrong Dimension")};
2418
+ matrix m[k][i+j] = concat(A.hom,B.hom);
2419
+ M.hom = m;
2420
+ list grading = concatGrading(A.source,B.source);
2421
+ M.source = freeModule(A.over,ncols(A.hom)+ncols(B.hom),grading);
2422
+ M.target = A.target; //vorlaeufig
2423
+ M.over = A.over;
2424
+ return(M);
2425
+ }
2426
+
2427
+ example
2428
+ {
2429
+ "EXAMPLE:"; echo=2;
2430
+ ring R;
2431
+ matrix a[2][2] = x,x2,2x,3x2;
2432
+ Matrix A = a;
2433
+ Matrix B = a;
2434
+ B.source.grading = list(2,3);
2435
+ concMatrix(A,B);
2436
+ }
2437
+
2438
+
2439
+ static proc concatGrading(FreeModule F1, FreeModule F2){
2440
+ list L1 = F1.grading;
2441
+ list L2 = F2.grading;
2442
+
2443
+ if (F1.isgraded == 0 || F2.isgraded == 0){
2444
+ return(-1);
2445
+ }
2446
+ return(L1+L2);
2447
+ }
2448
+
2449
+
2450
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2451
+
2452
+
2453
+ static proc transMat(Matrix M){
2454
+ matrix m = transpose(M.hom);
2455
+ M = m;
2456
+ return(M);
2457
+ }
2458
+
2459
+
2460
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2461
+
2462
+
2463
+ static proc addHomomorphism(Homomorphism h1, Homomorphism h2){
2464
+ if (target(h1) == target(h2) && source(h1) == source(h2)){
2465
+ Homomorphism H = homomorphism(h1.rule + h2.rule, h1.source, h2.target);
2466
+ return (H);
2467
+ }else{
2468
+ ERROR("Cannot add those homomorphisms!");generators of hom(M,N)
2469
+ }
2470
+ }
2471
+
2472
+
2473
+ static proc scaleHomomorphism(def P, def H){
2474
+ if (typeof(H) == "Homomorphism"){
2475
+ if (typeof(P) == "poly"){
2476
+ H.rule = H.rule*P;
2477
+ }
2478
+ return(H)
2479
+ }
2480
+ if (typeof(P) == "Homomorphism"){
2481
+ if (typeof(H) == "poly"){
2482
+ P.rule = P.rule*H;
2483
+ }
2484
+ return(P)
2485
+ }
2486
+ return(H*P);
2487
+ }
2488
+
2489
+
2490
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2491
+
2492
+
2493
+ static proc multVecPoly(def V, def P) {
2494
+ if (typeof(V) == "Vector"){
2495
+ if (typeof(P) == "poly"){
2496
+ V.entries = V.entries*P;
2497
+ }
2498
+ return(V)
2499
+ }
2500
+ if (typeof(P) == "Vector"){
2501
+ if (typeof(V) == "poly"){
2502
+ P.entries = P.entries*V;
2503
+ }
2504
+ return(P)
2505
+ }
2506
+ return(V*P);
2507
+ }
2508
+
2509
+
2510
+ static proc addVector(Vector V, Vector W) {
2511
+ int i;
2512
+ if ((V.space==W.space)==0) {ERROR("The Vectors aren't in the same Module");}
2513
+ vector sum = V.entries + W.entries;
2514
+ Vector Sum = makeVector(sum,V.space);
2515
+ return(Sum);
2516
+ }
2517
+
2518
+
2519
+
2520
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2521
+
2522
+
2523
+ static proc deleteCol(matrix mat, int i) {
2524
+ int n = nrows(mat);
2525
+ int m = ncols(mat);
2526
+ if (i<1 || i>m) {return(mat);}
2527
+ if (n == 1) {matrix a[n][1]; return (a)} //if there is only one column, we could return the nx0 matrix but for the use of this function it is easier to set it to the zero matrix
2528
+ if (i==1) {
2529
+ matrix new[n][m-1] = mat[1..n,2..m];
2530
+ return(new);
2531
+ }
2532
+ if (i==m) {
2533
+ matrix new[n][m-1] = mat[1..n,1..m-1];
2534
+ return(new);
2535
+ }
2536
+ matrix thing1[n][i-1] = mat[1..n,1..i-1];
2537
+ matrix thing2[n][m-i] = mat[1..n,i+1..m];
2538
+ matrix new[n][m-1] = concat(thing1,thing2);
2539
+ return(new);
2540
+ }
2541
+
2542
+
2543
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////
2544
+
2545
+
2546
+ static proc convertMat2Vec(matrix A, Module M)
2547
+ "USAGE = convertMat2Vectors(M); A matrix s.th. the columns of A are in M, M Module
2548
+ RETURN: list of columns as Vectors in M"
2549
+ {
2550
+ list ret;
2551
+ vector v;
2552
+ int i;
2553
+ int rows = nrows(A);
2554
+ for (i=1;i<=ncols(A);i++){
2555
+ v = [A[1..rows,i]];
2556
+ ret = ret + list(makeVector(v,M));
2557
+ }
2558
+ return(ret);
2559
+ }
2560
+
2561
+