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