passagemath-singular 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.whl

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

Potentially problematic release.


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

Files changed (493) hide show
  1. PySingular.cpython-314-x86_64-linux-musl.so +0 -0
  2. passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
  3. passagemath_singular-10.6.31rc3.dist-info/RECORD +493 -0
  4. passagemath_singular-10.6.31rc3.dist-info/WHEEL +5 -0
  5. passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
  6. passagemath_singular.libs/libSingular-4-67059f19.4.1.so +0 -0
  7. passagemath_singular.libs/libcddgmp-30166d29.so.0.1.3 +0 -0
  8. passagemath_singular.libs/libfactory-4-9d37bcf4.4.1.so +0 -0
  9. passagemath_singular.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
  10. passagemath_singular.libs/libgcc_s-0cd532bd.so.1 +0 -0
  11. passagemath_singular.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
  12. passagemath_singular.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
  13. passagemath_singular.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  14. passagemath_singular.libs/libgsl-42cda06f.so.28.0.0 +0 -0
  15. passagemath_singular.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
  16. passagemath_singular.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
  17. passagemath_singular.libs/libntl-26885ca2.so.44.0.1 +0 -0
  18. passagemath_singular.libs/libomalloc-0-e9ff96db.9.6.so +0 -0
  19. passagemath_singular.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
  20. passagemath_singular.libs/libpolys-4-8bcf8e7d.4.1.so +0 -0
  21. passagemath_singular.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
  22. passagemath_singular.libs/libreadline-06542304.so.8.2 +0 -0
  23. passagemath_singular.libs/libsingular_resources-4-73bf7623.4.1.so +0 -0
  24. passagemath_singular.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  25. sage/algebras/all__sagemath_singular.py +3 -0
  26. sage/algebras/fusion_rings/all.py +19 -0
  27. sage/algebras/fusion_rings/f_matrix.py +2448 -0
  28. sage/algebras/fusion_rings/fast_parallel_fmats_methods.cpython-314-x86_64-linux-musl.so +0 -0
  29. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +5 -0
  30. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +538 -0
  31. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.cpython-314-x86_64-linux-musl.so +0 -0
  32. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +3 -0
  33. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +331 -0
  34. sage/algebras/fusion_rings/fusion_double.py +899 -0
  35. sage/algebras/fusion_rings/fusion_ring.py +1580 -0
  36. sage/algebras/fusion_rings/poly_tup_engine.cpython-314-x86_64-linux-musl.so +0 -0
  37. sage/algebras/fusion_rings/poly_tup_engine.pxd +24 -0
  38. sage/algebras/fusion_rings/poly_tup_engine.pyx +579 -0
  39. sage/algebras/fusion_rings/shm_managers.cpython-314-x86_64-linux-musl.so +0 -0
  40. sage/algebras/fusion_rings/shm_managers.pxd +24 -0
  41. sage/algebras/fusion_rings/shm_managers.pyx +780 -0
  42. sage/algebras/letterplace/all.py +1 -0
  43. sage/algebras/letterplace/free_algebra_element_letterplace.cpython-314-x86_64-linux-musl.so +0 -0
  44. sage/algebras/letterplace/free_algebra_element_letterplace.pxd +18 -0
  45. sage/algebras/letterplace/free_algebra_element_letterplace.pyx +755 -0
  46. sage/algebras/letterplace/free_algebra_letterplace.cpython-314-x86_64-linux-musl.so +0 -0
  47. sage/algebras/letterplace/free_algebra_letterplace.pxd +35 -0
  48. sage/algebras/letterplace/free_algebra_letterplace.pyx +914 -0
  49. sage/algebras/letterplace/letterplace_ideal.cpython-314-x86_64-linux-musl.so +0 -0
  50. sage/algebras/letterplace/letterplace_ideal.pyx +408 -0
  51. sage/algebras/quatalg/all.py +2 -0
  52. sage/algebras/quatalg/quaternion_algebra.py +4778 -0
  53. sage/algebras/quatalg/quaternion_algebra_cython.cpython-314-x86_64-linux-musl.so +0 -0
  54. sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
  55. sage/algebras/quatalg/quaternion_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  56. sage/algebras/quatalg/quaternion_algebra_element.pxd +29 -0
  57. sage/algebras/quatalg/quaternion_algebra_element.pyx +2176 -0
  58. sage/all__sagemath_singular.py +11 -0
  59. sage/ext_data/all__sagemath_singular.py +1 -0
  60. sage/ext_data/singular/function_field/core.lib +98 -0
  61. sage/interfaces/all__sagemath_singular.py +1 -0
  62. sage/interfaces/singular.py +2835 -0
  63. sage/libs/all__sagemath_singular.py +1 -0
  64. sage/libs/singular/__init__.py +1 -0
  65. sage/libs/singular/decl.pxd +1168 -0
  66. sage/libs/singular/function.cpython-314-x86_64-linux-musl.so +0 -0
  67. sage/libs/singular/function.pxd +87 -0
  68. sage/libs/singular/function.pyx +1901 -0
  69. sage/libs/singular/function_factory.py +61 -0
  70. sage/libs/singular/groebner_strategy.cpython-314-x86_64-linux-musl.so +0 -0
  71. sage/libs/singular/groebner_strategy.pxd +22 -0
  72. sage/libs/singular/groebner_strategy.pyx +582 -0
  73. sage/libs/singular/option.cpython-314-x86_64-linux-musl.so +0 -0
  74. sage/libs/singular/option.pyx +671 -0
  75. sage/libs/singular/polynomial.cpython-314-x86_64-linux-musl.so +0 -0
  76. sage/libs/singular/polynomial.pxd +39 -0
  77. sage/libs/singular/polynomial.pyx +661 -0
  78. sage/libs/singular/ring.cpython-314-x86_64-linux-musl.so +0 -0
  79. sage/libs/singular/ring.pxd +58 -0
  80. sage/libs/singular/ring.pyx +893 -0
  81. sage/libs/singular/singular.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/libs/singular/singular.pxd +72 -0
  83. sage/libs/singular/singular.pyx +1944 -0
  84. sage/libs/singular/standard_options.py +145 -0
  85. sage/matrix/all__sagemath_singular.py +1 -0
  86. sage/matrix/matrix_mpolynomial_dense.cpython-314-x86_64-linux-musl.so +0 -0
  87. sage/matrix/matrix_mpolynomial_dense.pxd +7 -0
  88. sage/matrix/matrix_mpolynomial_dense.pyx +615 -0
  89. sage/rings/all__sagemath_singular.py +1 -0
  90. sage/rings/function_field/all__sagemath_singular.py +1 -0
  91. sage/rings/function_field/derivations_polymod.py +911 -0
  92. sage/rings/function_field/element_polymod.cpython-314-x86_64-linux-musl.so +0 -0
  93. sage/rings/function_field/element_polymod.pyx +406 -0
  94. sage/rings/function_field/function_field_polymod.py +2611 -0
  95. sage/rings/function_field/ideal_polymod.py +1775 -0
  96. sage/rings/function_field/order_polymod.py +1475 -0
  97. sage/rings/function_field/place_polymod.py +681 -0
  98. sage/rings/polynomial/all__sagemath_singular.py +1 -0
  99. sage/rings/polynomial/multi_polynomial_ideal_libsingular.cpython-314-x86_64-linux-musl.so +0 -0
  100. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +5 -0
  101. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +339 -0
  102. sage/rings/polynomial/multi_polynomial_libsingular.cpython-314-x86_64-linux-musl.so +0 -0
  103. sage/rings/polynomial/multi_polynomial_libsingular.pxd +30 -0
  104. sage/rings/polynomial/multi_polynomial_libsingular.pyx +6277 -0
  105. sage/rings/polynomial/plural.cpython-314-x86_64-linux-musl.so +0 -0
  106. sage/rings/polynomial/plural.pxd +48 -0
  107. sage/rings/polynomial/plural.pyx +3171 -0
  108. sage/symbolic/all__sagemath_singular.py +1 -0
  109. sage/symbolic/comparison_impl.pxi +428 -0
  110. sage/symbolic/constants_c_impl.pxi +178 -0
  111. sage/symbolic/expression.cpython-314-x86_64-linux-musl.so +0 -0
  112. sage/symbolic/expression.pxd +7 -0
  113. sage/symbolic/expression.pyx +14200 -0
  114. sage/symbolic/getitem_impl.pxi +202 -0
  115. sage/symbolic/pynac.pxi +572 -0
  116. sage/symbolic/pynac_constant_impl.pxi +133 -0
  117. sage/symbolic/pynac_function_impl.pxi +206 -0
  118. sage/symbolic/pynac_impl.pxi +2576 -0
  119. sage/symbolic/pynac_wrap.h +124 -0
  120. sage/symbolic/series_impl.pxi +272 -0
  121. sage/symbolic/substitution_map_impl.pxi +94 -0
  122. sage_wheels/bin/ESingular +0 -0
  123. sage_wheels/bin/Singular +0 -0
  124. sage_wheels/bin/TSingular +0 -0
  125. sage_wheels/lib/singular/MOD/cohomo.la +41 -0
  126. sage_wheels/lib/singular/MOD/cohomo.so +0 -0
  127. sage_wheels/lib/singular/MOD/customstd.la +41 -0
  128. sage_wheels/lib/singular/MOD/customstd.so +0 -0
  129. sage_wheels/lib/singular/MOD/freealgebra.la +41 -0
  130. sage_wheels/lib/singular/MOD/freealgebra.so +0 -0
  131. sage_wheels/lib/singular/MOD/gfanlib.la +41 -0
  132. sage_wheels/lib/singular/MOD/gfanlib.so +0 -0
  133. sage_wheels/lib/singular/MOD/gitfan.la +41 -0
  134. sage_wheels/lib/singular/MOD/gitfan.so +0 -0
  135. sage_wheels/lib/singular/MOD/interval.la +41 -0
  136. sage_wheels/lib/singular/MOD/interval.so +0 -0
  137. sage_wheels/lib/singular/MOD/loctriv.la +41 -0
  138. sage_wheels/lib/singular/MOD/loctriv.so +0 -0
  139. sage_wheels/lib/singular/MOD/machinelearning.la +41 -0
  140. sage_wheels/lib/singular/MOD/machinelearning.so +0 -0
  141. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.la +41 -0
  142. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.so +0 -0
  143. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.la +41 -0
  144. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.so +0 -0
  145. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.la +41 -0
  146. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.so +0 -0
  147. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.la +41 -0
  148. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.so +0 -0
  149. sage_wheels/lib/singular/MOD/partialgb.la +41 -0
  150. sage_wheels/lib/singular/MOD/partialgb.so +0 -0
  151. sage_wheels/lib/singular/MOD/pyobject.la +41 -0
  152. sage_wheels/lib/singular/MOD/pyobject.so +0 -0
  153. sage_wheels/lib/singular/MOD/singmathic.la +41 -0
  154. sage_wheels/lib/singular/MOD/singmathic.so +0 -0
  155. sage_wheels/lib/singular/MOD/sispasm.la +41 -0
  156. sage_wheels/lib/singular/MOD/sispasm.so +0 -0
  157. sage_wheels/lib/singular/MOD/subsets.la +41 -0
  158. sage_wheels/lib/singular/MOD/subsets.so +0 -0
  159. sage_wheels/lib/singular/MOD/systhreads.la +41 -0
  160. sage_wheels/lib/singular/MOD/systhreads.so +0 -0
  161. sage_wheels/lib/singular/MOD/syzextra.la +41 -0
  162. sage_wheels/lib/singular/MOD/syzextra.so +0 -0
  163. sage_wheels/libexec/singular/MOD/change_cost +0 -0
  164. sage_wheels/libexec/singular/MOD/singularsurf +11 -0
  165. sage_wheels/libexec/singular/MOD/singularsurf_jupyter +9 -0
  166. sage_wheels/libexec/singular/MOD/singularsurf_win +10 -0
  167. sage_wheels/libexec/singular/MOD/solve_IP +0 -0
  168. sage_wheels/libexec/singular/MOD/surfex +16 -0
  169. sage_wheels/libexec/singular/MOD/toric_ideal +0 -0
  170. sage_wheels/share/factory/gftables/10201 +342 -0
  171. sage_wheels/share/factory/gftables/1024 +37 -0
  172. sage_wheels/share/factory/gftables/10609 +356 -0
  173. sage_wheels/share/factory/gftables/11449 +384 -0
  174. sage_wheels/share/factory/gftables/11881 +398 -0
  175. sage_wheels/share/factory/gftables/121 +6 -0
  176. sage_wheels/share/factory/gftables/12167 +408 -0
  177. sage_wheels/share/factory/gftables/125 +7 -0
  178. sage_wheels/share/factory/gftables/12769 +428 -0
  179. sage_wheels/share/factory/gftables/128 +7 -0
  180. sage_wheels/share/factory/gftables/1331 +47 -0
  181. sage_wheels/share/factory/gftables/1369 +48 -0
  182. sage_wheels/share/factory/gftables/14641 +490 -0
  183. sage_wheels/share/factory/gftables/15625 +523 -0
  184. sage_wheels/share/factory/gftables/16 +3 -0
  185. sage_wheels/share/factory/gftables/16129 +540 -0
  186. sage_wheels/share/factory/gftables/16384 +549 -0
  187. sage_wheels/share/factory/gftables/16807 +563 -0
  188. sage_wheels/share/factory/gftables/1681 +58 -0
  189. sage_wheels/share/factory/gftables/169 +8 -0
  190. sage_wheels/share/factory/gftables/17161 +574 -0
  191. sage_wheels/share/factory/gftables/1849 +64 -0
  192. sage_wheels/share/factory/gftables/18769 +628 -0
  193. sage_wheels/share/factory/gftables/19321 +646 -0
  194. sage_wheels/share/factory/gftables/19683 +659 -0
  195. sage_wheels/share/factory/gftables/2048 +71 -0
  196. sage_wheels/share/factory/gftables/2187 +75 -0
  197. sage_wheels/share/factory/gftables/2197 +76 -0
  198. sage_wheels/share/factory/gftables/2209 +76 -0
  199. sage_wheels/share/factory/gftables/22201 +742 -0
  200. sage_wheels/share/factory/gftables/22801 +762 -0
  201. sage_wheels/share/factory/gftables/2401 +82 -0
  202. sage_wheels/share/factory/gftables/243 +11 -0
  203. sage_wheels/share/factory/gftables/24389 +815 -0
  204. sage_wheels/share/factory/gftables/24649 +824 -0
  205. sage_wheels/share/factory/gftables/25 +3 -0
  206. sage_wheels/share/factory/gftables/256 +11 -0
  207. sage_wheels/share/factory/gftables/26569 +888 -0
  208. sage_wheels/share/factory/gftables/27 +3 -0
  209. sage_wheels/share/factory/gftables/27889 +932 -0
  210. sage_wheels/share/factory/gftables/2809 +96 -0
  211. sage_wheels/share/factory/gftables/28561 +954 -0
  212. sage_wheels/share/factory/gftables/289 +12 -0
  213. sage_wheels/share/factory/gftables/29791 +995 -0
  214. sage_wheels/share/factory/gftables/29929 +1000 -0
  215. sage_wheels/share/factory/gftables/3125 +107 -0
  216. sage_wheels/share/factory/gftables/32 +4 -0
  217. sage_wheels/share/factory/gftables/32041 +1070 -0
  218. sage_wheels/share/factory/gftables/32761 +1094 -0
  219. sage_wheels/share/factory/gftables/32768 +1095 -0
  220. sage_wheels/share/factory/gftables/343 +14 -0
  221. sage_wheels/share/factory/gftables/3481 +118 -0
  222. sage_wheels/share/factory/gftables/361 +14 -0
  223. sage_wheels/share/factory/gftables/36481 +1218 -0
  224. sage_wheels/share/factory/gftables/3721 +126 -0
  225. sage_wheels/share/factory/gftables/37249 +1244 -0
  226. sage_wheels/share/factory/gftables/38809 +1296 -0
  227. sage_wheels/share/factory/gftables/39601 +1322 -0
  228. sage_wheels/share/factory/gftables/4 +3 -0
  229. sage_wheels/share/factory/gftables/4096 +139 -0
  230. sage_wheels/share/factory/gftables/44521 +1486 -0
  231. sage_wheels/share/factory/gftables/4489 +152 -0
  232. sage_wheels/share/factory/gftables/49 +4 -0
  233. sage_wheels/share/factory/gftables/4913 +166 -0
  234. sage_wheels/share/factory/gftables/49729 +1660 -0
  235. sage_wheels/share/factory/gftables/5041 +170 -0
  236. sage_wheels/share/factory/gftables/50653 +1691 -0
  237. sage_wheels/share/factory/gftables/512 +20 -0
  238. sage_wheels/share/factory/gftables/51529 +1720 -0
  239. sage_wheels/share/factory/gftables/52441 +1750 -0
  240. sage_wheels/share/factory/gftables/529 +20 -0
  241. sage_wheels/share/factory/gftables/5329 +180 -0
  242. sage_wheels/share/factory/gftables/54289 +1812 -0
  243. sage_wheels/share/factory/gftables/57121 +1906 -0
  244. sage_wheels/share/factory/gftables/58081 +1938 -0
  245. sage_wheels/share/factory/gftables/59049 +1971 -0
  246. sage_wheels/share/factory/gftables/6241 +210 -0
  247. sage_wheels/share/factory/gftables/625 +23 -0
  248. sage_wheels/share/factory/gftables/63001 +2102 -0
  249. sage_wheels/share/factory/gftables/64 +5 -0
  250. sage_wheels/share/factory/gftables/6561 +221 -0
  251. sage_wheels/share/factory/gftables/6859 +231 -0
  252. sage_wheels/share/factory/gftables/6889 +232 -0
  253. sage_wheels/share/factory/gftables/729 +27 -0
  254. sage_wheels/share/factory/gftables/7921 +266 -0
  255. sage_wheels/share/factory/gftables/8 +3 -0
  256. sage_wheels/share/factory/gftables/81 +5 -0
  257. sage_wheels/share/factory/gftables/8192 +276 -0
  258. sage_wheels/share/factory/gftables/841 +30 -0
  259. sage_wheels/share/factory/gftables/9 +3 -0
  260. sage_wheels/share/factory/gftables/9409 +316 -0
  261. sage_wheels/share/factory/gftables/961 +34 -0
  262. sage_wheels/share/info/singular.info +191898 -0
  263. sage_wheels/share/singular/LIB/GND.lib +1359 -0
  264. sage_wheels/share/singular/LIB/JMBTest.lib +976 -0
  265. sage_wheels/share/singular/LIB/JMSConst.lib +1363 -0
  266. sage_wheels/share/singular/LIB/KVequiv.lib +699 -0
  267. sage_wheels/share/singular/LIB/SingularityDBM.lib +491 -0
  268. sage_wheels/share/singular/LIB/VecField.lib +1542 -0
  269. sage_wheels/share/singular/LIB/absfact.lib +959 -0
  270. sage_wheels/share/singular/LIB/ainvar.lib +730 -0
  271. sage_wheels/share/singular/LIB/aksaka.lib +419 -0
  272. sage_wheels/share/singular/LIB/alexpoly.lib +2542 -0
  273. sage_wheels/share/singular/LIB/algebra.lib +1193 -0
  274. sage_wheels/share/singular/LIB/all.lib +136 -0
  275. sage_wheels/share/singular/LIB/arcpoint.lib +514 -0
  276. sage_wheels/share/singular/LIB/arnold.lib +4553 -0
  277. sage_wheels/share/singular/LIB/arnoldclassify.lib +2058 -0
  278. sage_wheels/share/singular/LIB/arr.lib +3486 -0
  279. sage_wheels/share/singular/LIB/assprimeszerodim.lib +755 -0
  280. sage_wheels/share/singular/LIB/autgradalg.lib +3361 -0
  281. sage_wheels/share/singular/LIB/bfun.lib +1964 -0
  282. sage_wheels/share/singular/LIB/bimodules.lib +774 -0
  283. sage_wheels/share/singular/LIB/brillnoether.lib +226 -0
  284. sage_wheels/share/singular/LIB/brnoeth.lib +5017 -0
  285. sage_wheels/share/singular/LIB/central.lib +2169 -0
  286. sage_wheels/share/singular/LIB/chern.lib +4162 -0
  287. sage_wheels/share/singular/LIB/cimonom.lib +571 -0
  288. sage_wheels/share/singular/LIB/cisimplicial.lib +1835 -0
  289. sage_wheels/share/singular/LIB/classify.lib +3239 -0
  290. sage_wheels/share/singular/LIB/classify2.lib +1462 -0
  291. sage_wheels/share/singular/LIB/classifyMapGerms.lib +1515 -0
  292. sage_wheels/share/singular/LIB/classify_aeq.lib +3253 -0
  293. sage_wheels/share/singular/LIB/classifyceq.lib +2092 -0
  294. sage_wheels/share/singular/LIB/classifyci.lib +1133 -0
  295. sage_wheels/share/singular/LIB/combinat.lib +91 -0
  296. sage_wheels/share/singular/LIB/compregb.lib +276 -0
  297. sage_wheels/share/singular/LIB/control.lib +1636 -0
  298. sage_wheels/share/singular/LIB/crypto.lib +3795 -0
  299. sage_wheels/share/singular/LIB/curveInv.lib +667 -0
  300. sage_wheels/share/singular/LIB/curvepar.lib +1817 -0
  301. sage_wheels/share/singular/LIB/customstd.lib +100 -0
  302. sage_wheels/share/singular/LIB/deRham.lib +5979 -0
  303. sage_wheels/share/singular/LIB/decodegb.lib +2134 -0
  304. sage_wheels/share/singular/LIB/decomp.lib +1655 -0
  305. sage_wheels/share/singular/LIB/deflation.lib +872 -0
  306. sage_wheels/share/singular/LIB/deform.lib +925 -0
  307. sage_wheels/share/singular/LIB/difform.lib +3055 -0
  308. sage_wheels/share/singular/LIB/divisors.lib +750 -0
  309. sage_wheels/share/singular/LIB/dmod.lib +5817 -0
  310. sage_wheels/share/singular/LIB/dmodapp.lib +3269 -0
  311. sage_wheels/share/singular/LIB/dmodideal.lib +1211 -0
  312. sage_wheels/share/singular/LIB/dmodloc.lib +2645 -0
  313. sage_wheels/share/singular/LIB/dmodvar.lib +818 -0
  314. sage_wheels/share/singular/LIB/dummy.lib +17 -0
  315. sage_wheels/share/singular/LIB/elim.lib +1009 -0
  316. sage_wheels/share/singular/LIB/ellipticcovers.lib +548 -0
  317. sage_wheels/share/singular/LIB/enumpoints.lib +146 -0
  318. sage_wheels/share/singular/LIB/equising.lib +2127 -0
  319. sage_wheels/share/singular/LIB/ffmodstd.lib +2384 -0
  320. sage_wheels/share/singular/LIB/ffsolve.lib +1289 -0
  321. sage_wheels/share/singular/LIB/findifs.lib +778 -0
  322. sage_wheels/share/singular/LIB/finitediff.lib +1768 -0
  323. sage_wheels/share/singular/LIB/finvar.lib +7989 -0
  324. sage_wheels/share/singular/LIB/fpadim.lib +2429 -0
  325. sage_wheels/share/singular/LIB/fpalgebras.lib +1666 -0
  326. sage_wheels/share/singular/LIB/fpaprops.lib +1462 -0
  327. sage_wheels/share/singular/LIB/freegb.lib +3853 -0
  328. sage_wheels/share/singular/LIB/general.lib +1350 -0
  329. sage_wheels/share/singular/LIB/gfan.lib +1768 -0
  330. sage_wheels/share/singular/LIB/gitfan.lib +3130 -0
  331. sage_wheels/share/singular/LIB/gkdim.lib +99 -0
  332. sage_wheels/share/singular/LIB/gmspoly.lib +589 -0
  333. sage_wheels/share/singular/LIB/gmssing.lib +1739 -0
  334. sage_wheels/share/singular/LIB/goettsche.lib +909 -0
  335. sage_wheels/share/singular/LIB/graal.lib +1366 -0
  336. sage_wheels/share/singular/LIB/gradedModules.lib +2541 -0
  337. sage_wheels/share/singular/LIB/graphics.lib +360 -0
  338. sage_wheels/share/singular/LIB/grobcov.lib +7706 -0
  339. sage_wheels/share/singular/LIB/groups.lib +1123 -0
  340. sage_wheels/share/singular/LIB/grwalk.lib +507 -0
  341. sage_wheels/share/singular/LIB/hdepth.lib +194 -0
  342. sage_wheels/share/singular/LIB/help.cnf +57 -0
  343. sage_wheels/share/singular/LIB/hess.lib +1946 -0
  344. sage_wheels/share/singular/LIB/hnoether.lib +4292 -0
  345. sage_wheels/share/singular/LIB/hodge.lib +400 -0
  346. sage_wheels/share/singular/LIB/homolog.lib +1965 -0
  347. sage_wheels/share/singular/LIB/hyperel.lib +975 -0
  348. sage_wheels/share/singular/LIB/inout.lib +679 -0
  349. sage_wheels/share/singular/LIB/integralbasis.lib +6224 -0
  350. sage_wheels/share/singular/LIB/interval.lib +1418 -0
  351. sage_wheels/share/singular/LIB/intprog.lib +778 -0
  352. sage_wheels/share/singular/LIB/invar.lib +443 -0
  353. sage_wheels/share/singular/LIB/involut.lib +980 -0
  354. sage_wheels/share/singular/LIB/jacobson.lib +1215 -0
  355. sage_wheels/share/singular/LIB/kskernel.lib +534 -0
  356. sage_wheels/share/singular/LIB/latex.lib +3146 -0
  357. sage_wheels/share/singular/LIB/lejeune.lib +651 -0
  358. sage_wheels/share/singular/LIB/linalg.lib +2040 -0
  359. sage_wheels/share/singular/LIB/locnormal.lib +212 -0
  360. sage_wheels/share/singular/LIB/lrcalc.lib +526 -0
  361. sage_wheels/share/singular/LIB/makedbm.lib +294 -0
  362. sage_wheels/share/singular/LIB/mathml.lib +813 -0
  363. sage_wheels/share/singular/LIB/matrix.lib +1372 -0
  364. sage_wheels/share/singular/LIB/maxlike.lib +1132 -0
  365. sage_wheels/share/singular/LIB/methods.lib +212 -0
  366. sage_wheels/share/singular/LIB/moddiq.lib +322 -0
  367. sage_wheels/share/singular/LIB/modfinduni.lib +181 -0
  368. sage_wheels/share/singular/LIB/modnormal.lib +218 -0
  369. sage_wheels/share/singular/LIB/modprimdec.lib +1278 -0
  370. sage_wheels/share/singular/LIB/modquotient.lib +269 -0
  371. sage_wheels/share/singular/LIB/modstd.lib +1024 -0
  372. sage_wheels/share/singular/LIB/modular.lib +545 -0
  373. sage_wheels/share/singular/LIB/modules.lib +2561 -0
  374. sage_wheels/share/singular/LIB/modwalk.lib +609 -0
  375. sage_wheels/share/singular/LIB/mondromy.lib +1016 -0
  376. sage_wheels/share/singular/LIB/monomialideal.lib +3851 -0
  377. sage_wheels/share/singular/LIB/mprimdec.lib +2353 -0
  378. sage_wheels/share/singular/LIB/mregular.lib +1863 -0
  379. sage_wheels/share/singular/LIB/multigrading.lib +5629 -0
  380. sage_wheels/share/singular/LIB/ncHilb.lib +777 -0
  381. sage_wheels/share/singular/LIB/ncModslimgb.lib +791 -0
  382. sage_wheels/share/singular/LIB/ncalg.lib +16311 -0
  383. sage_wheels/share/singular/LIB/ncall.lib +31 -0
  384. sage_wheels/share/singular/LIB/ncdecomp.lib +468 -0
  385. sage_wheels/share/singular/LIB/ncfactor.lib +13371 -0
  386. sage_wheels/share/singular/LIB/ncfrac.lib +1023 -0
  387. sage_wheels/share/singular/LIB/nchilbert.lib +448 -0
  388. sage_wheels/share/singular/LIB/nchomolog.lib +759 -0
  389. sage_wheels/share/singular/LIB/ncloc.lib +361 -0
  390. sage_wheels/share/singular/LIB/ncpreim.lib +795 -0
  391. sage_wheels/share/singular/LIB/ncrat.lib +2849 -0
  392. sage_wheels/share/singular/LIB/nctools.lib +1887 -0
  393. sage_wheels/share/singular/LIB/nets.lib +1456 -0
  394. sage_wheels/share/singular/LIB/nfmodstd.lib +1000 -0
  395. sage_wheels/share/singular/LIB/nfmodsyz.lib +732 -0
  396. sage_wheels/share/singular/LIB/noether.lib +1106 -0
  397. sage_wheels/share/singular/LIB/normal.lib +8700 -0
  398. sage_wheels/share/singular/LIB/normaliz.lib +2226 -0
  399. sage_wheels/share/singular/LIB/ntsolve.lib +362 -0
  400. sage_wheels/share/singular/LIB/numerAlg.lib +560 -0
  401. sage_wheels/share/singular/LIB/numerDecom.lib +2261 -0
  402. sage_wheels/share/singular/LIB/olga.lib +1933 -0
  403. sage_wheels/share/singular/LIB/orbitparam.lib +351 -0
  404. sage_wheels/share/singular/LIB/parallel.lib +319 -0
  405. sage_wheels/share/singular/LIB/paraplanecurves.lib +3110 -0
  406. sage_wheels/share/singular/LIB/perron.lib +202 -0
  407. sage_wheels/share/singular/LIB/pfd.lib +2223 -0
  408. sage_wheels/share/singular/LIB/phindex.lib +642 -0
  409. sage_wheels/share/singular/LIB/pointid.lib +673 -0
  410. sage_wheels/share/singular/LIB/polybori.lib +1430 -0
  411. sage_wheels/share/singular/LIB/polyclass.lib +525 -0
  412. sage_wheels/share/singular/LIB/polylib.lib +1174 -0
  413. sage_wheels/share/singular/LIB/polymake.lib +1902 -0
  414. sage_wheels/share/singular/LIB/presolve.lib +1533 -0
  415. sage_wheels/share/singular/LIB/primdec.lib +9576 -0
  416. sage_wheels/share/singular/LIB/primdecint.lib +1782 -0
  417. sage_wheels/share/singular/LIB/primitiv.lib +401 -0
  418. sage_wheels/share/singular/LIB/puiseuxexpansions.lib +1631 -0
  419. sage_wheels/share/singular/LIB/purityfiltration.lib +960 -0
  420. sage_wheels/share/singular/LIB/qhmoduli.lib +1561 -0
  421. sage_wheels/share/singular/LIB/qmatrix.lib +293 -0
  422. sage_wheels/share/singular/LIB/random.lib +455 -0
  423. sage_wheels/share/singular/LIB/ratgb.lib +489 -0
  424. sage_wheels/share/singular/LIB/realclassify.lib +5759 -0
  425. sage_wheels/share/singular/LIB/realizationMatroids.lib +772 -0
  426. sage_wheels/share/singular/LIB/realrad.lib +1197 -0
  427. sage_wheels/share/singular/LIB/recover.lib +2628 -0
  428. sage_wheels/share/singular/LIB/redcgs.lib +3984 -0
  429. sage_wheels/share/singular/LIB/reesclos.lib +465 -0
  430. sage_wheels/share/singular/LIB/resbinomial.lib +2802 -0
  431. sage_wheels/share/singular/LIB/resgraph.lib +789 -0
  432. sage_wheels/share/singular/LIB/resjung.lib +820 -0
  433. sage_wheels/share/singular/LIB/resolve.lib +5110 -0
  434. sage_wheels/share/singular/LIB/resources.lib +170 -0
  435. sage_wheels/share/singular/LIB/reszeta.lib +5473 -0
  436. sage_wheels/share/singular/LIB/ring.lib +1328 -0
  437. sage_wheels/share/singular/LIB/ringgb.lib +343 -0
  438. sage_wheels/share/singular/LIB/rinvar.lib +1153 -0
  439. sage_wheels/share/singular/LIB/rootisolation.lib +1481 -0
  440. sage_wheels/share/singular/LIB/rootsmr.lib +709 -0
  441. sage_wheels/share/singular/LIB/rootsur.lib +886 -0
  442. sage_wheels/share/singular/LIB/rstandard.lib +607 -0
  443. sage_wheels/share/singular/LIB/rwalk.lib +336 -0
  444. sage_wheels/share/singular/LIB/sagbi.lib +1353 -0
  445. sage_wheels/share/singular/LIB/sagbiNormaliz.lib +1622 -0
  446. sage_wheels/share/singular/LIB/sagbiNormaliz0.lib +1498 -0
  447. sage_wheels/share/singular/LIB/sagbigrob.lib +449 -0
  448. sage_wheels/share/singular/LIB/schreyer.lib +321 -0
  449. sage_wheels/share/singular/LIB/schubert.lib +2551 -0
  450. sage_wheels/share/singular/LIB/sets.lib +524 -0
  451. sage_wheels/share/singular/LIB/sheafcoh.lib +1663 -0
  452. sage_wheels/share/singular/LIB/signcond.lib +437 -0
  453. sage_wheels/share/singular/LIB/sing.lib +1094 -0
  454. sage_wheels/share/singular/LIB/sing4ti2.lib +419 -0
  455. sage_wheels/share/singular/LIB/solve.lib +2243 -0
  456. sage_wheels/share/singular/LIB/spcurve.lib +1077 -0
  457. sage_wheels/share/singular/LIB/spectrum.lib +62 -0
  458. sage_wheels/share/singular/LIB/sresext.lib +757 -0
  459. sage_wheels/share/singular/LIB/ssi.lib +143 -0
  460. sage_wheels/share/singular/LIB/standard.lib +2769 -0
  461. sage_wheels/share/singular/LIB/stanleyreisner.lib +473 -0
  462. sage_wheels/share/singular/LIB/stdmodule.lib +547 -0
  463. sage_wheels/share/singular/LIB/stratify.lib +1070 -0
  464. sage_wheels/share/singular/LIB/surf.lib +506 -0
  465. sage_wheels/share/singular/LIB/surf_jupyter.lib +223 -0
  466. sage_wheels/share/singular/LIB/surfacesignature.lib +522 -0
  467. sage_wheels/share/singular/LIB/surfex.lib +1462 -0
  468. sage_wheels/share/singular/LIB/swalk.lib +877 -0
  469. sage_wheels/share/singular/LIB/symodstd.lib +1570 -0
  470. sage_wheels/share/singular/LIB/systhreads.lib +74 -0
  471. sage_wheels/share/singular/LIB/tasks.lib +1324 -0
  472. sage_wheels/share/singular/LIB/tateProdCplxNegGrad.lib +2412 -0
  473. sage_wheels/share/singular/LIB/teachstd.lib +858 -0
  474. sage_wheels/share/singular/LIB/template.lib +116 -0
  475. sage_wheels/share/singular/LIB/toric.lib +1119 -0
  476. sage_wheels/share/singular/LIB/transformation.lib +116 -0
  477. sage_wheels/share/singular/LIB/triang.lib +1197 -0
  478. sage_wheels/share/singular/LIB/tropical.lib +8741 -0
  479. sage_wheels/share/singular/LIB/tropicalEllipticCovers.lib +2922 -0
  480. sage_wheels/share/singular/LIB/tropicalNewton.lib +1128 -0
  481. sage_wheels/share/singular/LIB/tst.lib +1108 -0
  482. sage_wheels/share/singular/LIB/weierstr.lib +241 -0
  483. sage_wheels/share/singular/LIB/zeroset.lib +1478 -0
  484. sage_wheels/share/singular/emacs/.emacs-general +184 -0
  485. sage_wheels/share/singular/emacs/.emacs-singular +234 -0
  486. sage_wheels/share/singular/emacs/COPYING +44 -0
  487. sage_wheels/share/singular/emacs/cmd-cmpl.el +241 -0
  488. sage_wheels/share/singular/emacs/ex-cmpl.el +1681 -0
  489. sage_wheels/share/singular/emacs/hlp-cmpl.el +4318 -0
  490. sage_wheels/share/singular/emacs/lib-cmpl.el +179 -0
  491. sage_wheels/share/singular/emacs/singular.el +4273 -0
  492. sage_wheels/share/singular/emacs/singular.xpm +39 -0
  493. sage_wheels/share/singular/singular.idx +5002 -0
@@ -0,0 +1,3486 @@
1
+ //////////////////////////////////////////////////////////////////////////////
2
+ version="version arr.lib 4.1.2.0 Feb_2019 "; // $Id: 511b6bb7657b076c63727e179e54698c640940e8 $
3
+ category="Miscellaneous";
4
+
5
+ /*
6
+
7
+ ** TOPICS ** (Ctrl+f to search)
8
+ #1 NEWSTRUCTS & OVERLOADS
9
+ #2 CONSTRUCTORS
10
+ #3 ACCESS & ASSIGNMENT
11
+ #4 DELETION
12
+ #5 COMPERATORS
13
+ #6 TYPE CASTING
14
+ #7 INHERITED FUNCTIONS
15
+ #8 PRINTING
16
+ #9 MANIPULATING VARIABLES
17
+ #10 CENTER COMPUTATIONS
18
+ #11 GEOMETRIC CONSTRUCTIONS
19
+ #11 EXAMPLES OF ARRANGEMENTS
20
+ #13 ORLIK SOLOMON AND POINCARE POLYNOMIAL
21
+ #14 FREENESS
22
+ #15 MULTI-ARRANGEMENTS
23
+ #16 COMBINATORICS
24
+
25
+ */
26
+
27
+ info="
28
+ LIBRARY: arr.lib a library of algorithms for arrangements of hyperplanes
29
+
30
+ AUTHORS: Randolf Scholz (rscholz@rhrk.uni-kl.de),
31
+ Patrick Serwene (serwene@mathematik.uni-kl.de),
32
+ Lukas Kuehne (lf.kuehne@gmail.com)
33
+
34
+ OVERLOADS:
35
+
36
+ // OPERATORS
37
+ = arrAdd assignment
38
+ + arrAdd union of two arrs
39
+ [ arrGet access to a single/multiple hyperplane(s)
40
+ - arrMinus deletes given hyperplanes from the arr
41
+ <= arrLEQ comparison
42
+ >= arrGEQ comparison
43
+ == arrEQ comparison
44
+ != arrNEQ comparison
45
+ < arrLNEQ comparison
46
+ > arrGNEQ comparison
47
+
48
+ // TYPECASTING
49
+ matrix arr2mat coeff matrix
50
+ poly arr2poly defining polynomial
51
+
52
+ // OTHER
53
+ variables arrVariables ideal generated by the variables the arr depends on
54
+ nvars arrNvars number of variables the arr depends on
55
+ delete arrDelete deletes hyperplanes by indices
56
+ print arrPrint prints the arr on the screen
57
+
58
+ // IDEAL INHERITED FUNCTIONS
59
+ homog arrHomog checks if arrangement is homogeneous
60
+ simplify arrSimplify simplifies arrangement
61
+ size arrSize number of planes
62
+ subst arrSubst substitute variables
63
+
64
+ // MULTI-ARRANGEMENTS
65
+ = multarrAdd assignment of multarr
66
+ + multarrAdd union of multarr
67
+ poly multarr2poly defining polynomial
68
+ size multarrSize number of hyperplanes with mult.
69
+ print multarrPrint displays multiarr
70
+ delete multarrDelete deletes hyperplane
71
+
72
+ PROCEDURES:
73
+ arrSet(arr A, int k, poly p) replaces the k-th Hyperplane with poly p
74
+
75
+ type2arr(#) converts general input to 'arr' using arrAdd.
76
+ mat2arr( matrix M) affine arrangement from coeff matrix
77
+ mat2carr(matrix M) central arrangement from coeff matrix
78
+ arrPrintMatrix(arr A) readable output as a coeff matrix
79
+ varMat(intvec v) matrix of the corresponding ring_variables
80
+ varNum(def u) number of given variable (enh. version of varNum in dmod.lib)
81
+ arrSwapVar(arr A, i, j) swaps two variables in the arrangement
82
+ arrLastVar(arr A) ring_variable of largest index used in arrangement
83
+ arrCenter(arr A) computes center of an arrangement
84
+ arrCentral(arr A) checks if arrangement is central
85
+ arrCentered(arr A) checks if arrangement is centered
86
+ arrCentralize(arr A) makes centered arrangement central
87
+ arrCoordChange(A, T, #) performs coordinate change
88
+ arrCoordNormalize(A, v) performs projection onto coordinate hyperplane
89
+ arrCone(arr A, var) coned arrangement
90
+ arrDecone(arr A, int k) deconed arrangement
91
+ arrLocalize(arr A, intvec v) localization of an arrangement onto a flat
92
+ arrRestrict(arr A, intvec v) restricted arrangement onto a flat
93
+ arrIsEssential(arr A) checks if arrangement is essential
94
+ arrEssentialize(arr A) essentialized arragnement
95
+ arrBoolean(int v) boolean arrangement
96
+ arrBraid(int v) braid arrangement
97
+ arrTypeB(int v) type B arrangement
98
+ arrTypeD(int v) type D arrangement
99
+ arrRandom(d,m,n) random (affine) arrangement
100
+ arrRandomCentral(d,m,n) random central arrangement
101
+ arrEdelmanReiner() Edelman-Reiner arrangement
102
+ arrOrlikSolomon(arr A) Orlik-Solomon algebra of the arrangement
103
+ arrDer(A) module of derivation
104
+ arrIsFree(A) checks if arrangement is free
105
+ arrExponents(A) exponents of a (free) arrangement
106
+ arr2multarr(arr A, intvec v) converts normal arrangement to multiarrangement
107
+ multarr2arr(multarr A) converts multiarrangement to normal arrangement
108
+ multarrRestrict(arr A, v) restriction of A (as arr) to a flat with multiplicities
109
+ multarrMultRestrict(A, int k) restriction of A (as multarr) to a hyperplane with multiplicities
110
+ arrFlats(arr A) intersection lattice
111
+ arrLattice(arr A) computes the intersection lattice / poset
112
+ moebius(arrposet P) computes moebius values
113
+ arrCharPoly(arr A) characteristic polynomial
114
+ arrPoincare(arr A) poincare polynomial of the arrangement
115
+ arrChambers(arr A) number of chambers of the arrangement
116
+ arrBoundedChambers(arr A) number of bounded chambers of the arrangement
117
+ printMoebius(arr A) displays the moebius values of all the flats in the poset
118
+ ";
119
+
120
+ LIB "general.lib";
121
+ LIB "monomialideal.lib";
122
+
123
+ //============================================================================//
124
+ //-------------------------- #1 NEWSTRUCTS & OVERLOADS -----------------------//
125
+ //============================================================================//
126
+
127
+ // initialization of the library
128
+ static proc mod_init()
129
+ {
130
+ // NEWSTRUCTS
131
+ newstruct("arr","ideal l");
132
+ newstruct("flat", "intvec REL, int moebius, intvec parents, int flag");
133
+ newstruct("arrposet","arr A, list r");
134
+ newstruct("arrflats","arr A, list r");
135
+ newstruct("multarr","ideal l, intvec m"); // intvec: multiplicities of hyperplanes
136
+
137
+ // OPERATORS
138
+ system("install","arr","=" ,arrAdd ,1); // assignment
139
+ system("install","arr","+" ,arrAdd ,2); // union of arrs
140
+ system("install","arr","[" ,arrGet ,2); // access
141
+ system("install","arr","-" ,arrMinus ,2); // delete plane
142
+ system("install","arr","<=" ,arrLEQ ,2); // comparison
143
+ system("install","arr",">=" ,arrGEQ ,2); // comparison
144
+ system("install","arr","==" ,arrEQ ,2); // comparison
145
+ system("install","arr","!=" ,arrNEQ ,2); // comparison
146
+ system("install","arr","<" ,arrLNEQ ,2); // comparison
147
+ system("install","arr",">" ,arrGNEQ ,2); // comparison
148
+
149
+ // TYPECASTING
150
+ system("install","arr","matrix" ,arr2mat ,1); // coeff matrix
151
+ system("install","arr","poly" ,arr2poly ,1); // defining polynomial
152
+ system("install","arr","list" ,arr2list ,4); // list of defining polynomials
153
+ system("install","arr","ideal" ,arr2ideal ,4); // list of defining polynomials
154
+
155
+ // OTHER
156
+ system("install","arr","variables" ,arrVariables ,1);
157
+ system("install","arr","nvars" ,arrNvars ,1);
158
+ system("install","arr","delete" ,arrDelete ,2);
159
+ system("install","arr","print" ,arrPrint ,1);
160
+
161
+ // IDEAL INHERITED FUNCTIONS
162
+ system("install","arr","homog" ,arrHomog ,1); // checks if homogeneous
163
+ system("install","arr","homog" ,arrHomog ,2); // checks if homogeneous
164
+ system("install","arr","simplify" ,arrSimplify ,2); // simplifies arrangement
165
+ system("install","arr","size" ,arrSize ,1); // number of planes
166
+ system("install","arr","subst" ,arrSubst ,4); // substitute variables
167
+
168
+ // MULTI-ARRANGEMENTS
169
+ system("install","multarr","=" ,multarrAdd ,1); // assignment of multarr
170
+ system("install","multarr","+" ,multarrAdd ,2); // union of multarr
171
+ system("install","multarr","poly" ,multarr2poly ,1); // defining polynomial
172
+ system("install","multarr","size" ,multarrSize ,1); // number of hyperplanes with mult.
173
+ system("install","multarr","print" ,multarrPrint ,1); // displays multiarr
174
+ system("install","multarr","delete" ,multarrDelete ,2); // deletes hyperplane
175
+
176
+ // COMBINATORICS
177
+ system("install","arr","rank" ,arrRank ,1);
178
+ system("install","arrflats","print" ,arrPrintFlats ,1);
179
+ system("install","arrposet","print" ,arrPrintPoset ,1);
180
+ }
181
+
182
+
183
+ //============================================================================//
184
+ //--------------------------- #2 CONSTRUCTORS --------------------------------//
185
+ //============================================================================//
186
+
187
+
188
+ // general method for creating arrangements
189
+ static proc arrAdd
190
+ "USAGE: A = #; A +#; # list containing arr/ideal/list/matrix/poly
191
+ RETURN: [arr] Arrangement constructed by input parameters.
192
+ REMARKS: The algorithm splits up the list # and uses the appropriate procedure
193
+ to handle the input.
194
+ NOTE: arrAdd simplifies certain inputs, for example A = (x,y,2x); gives the same arrangement
195
+ as A = (x,y);
196
+ SEE ALSO: arrAdd, type2arr
197
+ KEYWORDS: arrangement; equal; constructor; operator
198
+ EXAMPLE: example arrAdd; shows an example"
199
+
200
+ {
201
+ arr A;
202
+ for(int k=1; k<=size(#); k++){
203
+ while(1){ //simulates switch, which singular doesn't offer
204
+ if(typeof(#[k]) == "arr" ){A = arrAddArr (A, #[k]);break;}
205
+ if(typeof(#[k]) == "poly" ){A = arrAddPoly (A, #[k]);break;}
206
+ if(typeof(#[k]) == "ideal" ){A = arrAddIdeal (A, #[k]);break;}
207
+ if(typeof(#[k]) == "matrix"){A = arrAddMatrix(A, #[k]);break;}
208
+ if(typeof(#[k]) == "intmat"){A = arrAddMatrix(A, #[k]);break;}
209
+ if(typeof(#[k]) == "list" ){A = arrAdd ( #[k]);break;}
210
+
211
+ ERROR("bad input type");
212
+ }
213
+ }
214
+
215
+ return (A);
216
+ }
217
+
218
+ example
219
+ {
220
+ "EXAMPLE: Creating a few arrangements"; echo = 2;
221
+ ring R = 0,(x,y,z),dp;
222
+ arr A= ideal(x,y,z); A;
223
+ arr B = A + ideal(x+1, x-1); B;
224
+ arr C = list(A, x+1, x-1); C;
225
+ arr D = x2 - y2; D;
226
+ }
227
+
228
+ // union of two arrangements
229
+ static proc arrAddArr(arr A, arr B){
230
+ return (arrAddIdeal(A, B.l));
231
+ }
232
+
233
+ // adds a single poly to the arrangement
234
+ // if the poly is linear, it is just added, otherwise Singular factorizes
235
+ static proc arrAddPoly(arr A, poly p){
236
+ if(deg(p) == 0){
237
+ ERROR("Given poly is not linear or Singluar is not able to factorize it");}
238
+ else{
239
+ if(deg(p) == 1){
240
+ A.l = A.l + p;
241
+ return (A);
242
+ }
243
+ else{
244
+ ideal I = factorize(p,1);
245
+ if(size(I) == 1){ERROR("Given poly is not a hyperplane");}
246
+ else{ return (arrAdd(A,I)); }
247
+ }
248
+ }
249
+ return(A);
250
+ }
251
+
252
+ // adds defining polys to the arrangement
253
+ static proc arrAddIdeal(arr A, ideal I){
254
+ for(int k=1; k<=size(I); k++){
255
+ A = arrAddPoly(A,I[k]);
256
+ }
257
+
258
+ return (A);
259
+ }
260
+
261
+ // adds defining polys to the arrangement
262
+ static proc arrAddMatrix(arr A, matrix M){
263
+ return ( arrAddArr(A,mat2arr(M)) );
264
+ }
265
+
266
+
267
+ //============================================================================//
268
+ //--------------------------- #3 ACCESS & ASSIGNMENT -------------------------//
269
+ //============================================================================//
270
+
271
+
272
+ // access to hyperplanes, overloads [] operator
273
+ static proc arrGet(arr A, intvec v)
274
+ "USAGE: A[v]; v int/intvec
275
+ RETURN: [poly] if v is [int] The defining poly of the the v-th hyperplane+
276
+ [arr] if v is [intvec] The corresponding subarrangement
277
+ SEE ALSO: arrGet, arrSet
278
+ KEYWORDS: arrangement; get; operator
279
+ EXAMPLE: example arrGet; shows an example"
280
+
281
+ {
282
+ if(size(v) == 1){ return (A.l[v[1]]); } //returns poly if v is integer
283
+ ideal I = A.l;
284
+ A = ideal(I[v]);
285
+ return (A);
286
+ }
287
+
288
+ example
289
+ {
290
+ "EXAMPLE: "; echo = 2;
291
+ ring R = 0,(x,y,z),dp;
292
+ arr A = ideal(x,y,z);
293
+ A[2];
294
+ intvec v = 1,3;
295
+ A[v];
296
+ }
297
+
298
+ // replaces the k-th plane with poly p
299
+ proc arrSet(arr A, int k, poly p)
300
+ "USAGE: arrSet(A, k, p); arr A, int k, poly p;
301
+ RETURN: [arr] Arrangement where the k-th hyperplane is replaced by p.
302
+ NOTE: p must be linear
303
+ KEYWORDS: arrangement; hyperplane; assign; set
304
+ EXAMPLE: example arrSet; shows an example"
305
+
306
+ {
307
+ if(deg(p) != 1){ERROR("Given poly is not a hyperplane");}
308
+ else{ // looks akward but needs to be done this way
309
+ ideal I = A.l;
310
+ I[k] = p;
311
+ A = I;
312
+ }
313
+ return (A);
314
+ }
315
+
316
+ example
317
+ {
318
+ "EXAMPLE: "; echo = 2;
319
+ ring R = 0,(x,y,z),dp;
320
+ arr A = ideal(x,y,z);
321
+ arrSet(A,1,x+1);
322
+ }
323
+
324
+
325
+ //============================================================================//
326
+ //------------------------------- #4 DELETION --------------------------------//
327
+ //============================================================================//
328
+
329
+
330
+ // deletes all hyperplanes of the given indices
331
+ static proc arrDelete(arr A, intvec v)
332
+ "USAGE: delete(A, v); v integer/intvec
333
+ RETURN: [arr] Arrangement A without the hyperplanes given by v;
334
+ NOTE: for deleting hyperplanes via polynomials, use arrMinus instead
335
+ SEE ALSO: arrDelete, arrMinus
336
+ KEYWORDS: arrangement; delete
337
+ EXAMPLE: example arrDelete; shows an example"
338
+
339
+ {
340
+ int i = 0; int k;
341
+ int n = size(A);
342
+ intvec u = 1..n;
343
+
344
+ // puts 0 in u for every element that needs to be deleted
345
+ // is done this way to deal with the case that the user gives the same index multiple times.
346
+ for(k=1; k<=size(v); k++){
347
+ if(u[v[k]] != 0){ u[v[k]] = 0; i++; } // i = #elts that need to be deleted
348
+ }
349
+
350
+ if( i == n){arr emptyArr; return (emptyArr); }
351
+
352
+ // create intvec of the remaining indices
353
+ v = 1..(n-i); i=1;
354
+ for(k=1; k<=n; k++){
355
+ if(u[k] != 0) { v[i] = u[k]; i++; }
356
+ }
357
+
358
+ arr A' = arrGet(A,v);
359
+ return (A');
360
+ }
361
+
362
+ example
363
+ {
364
+ "EXAMPLE: "; echo = 2;
365
+ ring R = 0,(x,y,z),dp;
366
+ arr A = ideal(x,y,z);
367
+ delete(A,2);
368
+ intvec v = (1,3);
369
+ delete(A,v);
370
+ }
371
+
372
+
373
+ // deletes hyperplanes, overloads - operator
374
+ static proc arrMinus
375
+ "USAGE: A - #; # list containing arr/ideal/list/matrix/poly
376
+ RETURN: [arr] arrangement A without the hyperplanes of the arrangement defined by #.
377
+ REMARKS: algorithm creates an arrangement B from # using arrAdd and
378
+ then deletes hyperplanes which occur in both A and B.
379
+ NOTE: The algorithm does not simplify by scalars, i.e. some hyperplanes might
380
+ not be deleted. See example.
381
+ SEE ALSO: arrDelete, arrMinus
382
+ KEYWORDS: arrangement; delete; operator
383
+ EXAMPLE: example arrMinus; shows an example"
384
+
385
+ {
386
+ if(typeof(#[1]) != "arr"){ERROR("First input must be arr!");}
387
+ arr A = #[1];
388
+ arr B = #[2..size(#)]; // collects hyperplanes to be deleted
389
+ list L;
390
+ int k, l;
391
+ for(k=1; k<=size(A); k++){ // create list of hyperplanes to be deleted
392
+ for(l=1; l<=size(B); l++){
393
+ if(A[k] == B[l]){L = insert(L,k);}
394
+ }
395
+ }
396
+
397
+ l = size(L); // transforms list to intvec
398
+ if(l != 0){
399
+ intvec v = 1..l;
400
+ for(k=1; k<=l; k++){v[k] = L[k];}
401
+ A = delete(A,v);
402
+ }
403
+
404
+ return (A);
405
+ }
406
+
407
+ example
408
+ {
409
+ "EXAMPLE: "; echo = 2;
410
+ ring R = 0,(x,y,z),dp;
411
+ arr A = ideal(x,y,z);
412
+ A - ideal(x,y);
413
+ A - poly(2x);
414
+ }
415
+
416
+
417
+ //============================================================================//
418
+ //------------------------------- #5 COMPERATORS -----------------------------//
419
+ //============================================================================//
420
+
421
+
422
+ // returns logical value of 'A<=B'
423
+ static proc arrLEQ(arr A, arr B)
424
+ "USAGE: A<=B; A,B arr
425
+ RETURN: [0,1] true if A is a subarrangement of B
426
+ NOTE: algorithm is based on arrMinus and does not simplify by scalars, hence some
427
+ technically equal hyperplanes might not be detected. See example.
428
+ SEE ALSO: arrLEQ, arrLNEQ, arrGEQ, arrGNEQ, arrEQ, arrNEQ
429
+ KEYWORDS: comparison; subarrangement; operator
430
+ EXAMPLE: example arrLEQ; shows an example"
431
+
432
+ {
433
+ arr C = A - B;
434
+ if(C[1] == 0){ return (1); }
435
+ return (0);
436
+ }
437
+
438
+ example{example arrEQ;}
439
+
440
+
441
+ // returns logical value of 'A>=B'
442
+ static proc arrGEQ(arr A, arr B)
443
+ "USAGE: A>=B; A,B arr
444
+ RETURN: [0,1] true if B is a subarrangement of A
445
+ NOTE: algorithm is based on arrMinus and does not simplify by scalars, hence some
446
+ technically equal hyperplanes might not be detected. See example.
447
+ SEE ALSO: arrLEQ, arrLNEQ, arrGEQ, arrGNEQ, arrEQ, arrNEQ
448
+ KEYWORDS: comparison; subarrangement; operator
449
+ EXAMPLE: example arrLEQ; shows an example"
450
+
451
+ {
452
+ arr C = B - A;
453
+ if(C[1] == 0){ return (1); }
454
+ return (0);
455
+ }
456
+
457
+ example{example arrEQ;}
458
+
459
+
460
+ // returns logical value of 'A==B'
461
+ static proc arrEQ(arr A, arr B)
462
+ "USAGE: A==B; A,B arr
463
+ RETURN: [0,1] true if A equals B
464
+ NOTE: algorithm is based on arrMinus and does not simplify by scalars, hence some
465
+ technically equal hyperplanes might not be detected. See example.
466
+ SEE ALSO: arrLEQ, arrLNEQ, arrGEQ, arrGNEQ, arrEQ, arrNEQ
467
+ KEYWORDS: comparison; equal; operator
468
+ EXAMPLE: example arrLEQ; shows an example"
469
+
470
+ {
471
+ return ((A<=B) & (A>=B));
472
+ }
473
+
474
+ example
475
+ {
476
+ "EXAMPLE: Relationships between a few arrangements."; echo = 2;
477
+ ring R = 0,(x,y,z),dp;
478
+ arr A = ideal(x,y,z);
479
+ arr B = ideal(x,y);
480
+ A<=B;
481
+ A>=B;
482
+ A==B;
483
+ A!=B;
484
+ A<B;
485
+ A>B;
486
+ }
487
+
488
+
489
+ // returns logical value of 'A!=B'
490
+ static proc arrNEQ(arr A, arr B)
491
+ "USAGE: A!=B; A,B arr
492
+ RETURN: [0,1] true if A is not equal to B
493
+ NOTE: algorithm is based on arrMinus and does not simplify by scalars, hence some
494
+ technically equal hyperplanes might not be detected. See example.
495
+ SEE ALSO: arrLEQ, arrLNEQ, arrGEQ, arrGNEQ, arrEQ, arrNEQ
496
+ KEYWORDS: comparison; equal; operator
497
+ EXAMPLE: example arrLEQ; shows an example"
498
+
499
+ {
500
+ return (!(A==B));
501
+ }
502
+
503
+ example{example arrEQ;}
504
+
505
+
506
+ // returns logical value of 'A<B'
507
+ static proc arrLNEQ(arr A, arr B)
508
+ "USAGE: A<B; A,B arr
509
+ RETURN: [0,1] true if A is a proper subarrangement of B
510
+ NOTE: algorithm is based on arrMinus and does not simplify by scalars, hence some
511
+ technically equal hyperplanes might not be detected. See example.
512
+ SEE ALSO: arrLEQ, arrLNEQ, arrGEQ, arrGNEQ, arrEQ, arrNEQ
513
+ KEYWORDS: comparison; subarrangement; operator
514
+ EXAMPLE: example arrLEQ; shows an example"
515
+
516
+ {
517
+ return ((A<=B) & (A!=B));
518
+ }
519
+
520
+ example{example arrEQ;}
521
+
522
+
523
+ // returns logical value of 'A>B'
524
+ static proc arrGNEQ(arr A, arr B)
525
+ "USAGE: A>B; A,B arr
526
+ RETURN: [0,1] true if B is a proper subarrangement of A
527
+ NOTE: algorithm is based on arrMinus and does not simplify by scalars, hence some
528
+ technically equal hyperplanes might not be detected. See example.
529
+ SEE ALSO: arrLEQ, arrLNEQ, arrGEQ, arrGNEQ, arrEQ, arrNEQ
530
+ KEYWORDS: comparison; subarrangement; operator
531
+ EXAMPLE: example arrLEQ; shows an example"
532
+
533
+ {
534
+ return ((A>=B) & (A!=B));
535
+ }
536
+
537
+ example{example arrEQ;}
538
+
539
+
540
+ //============================================================================//
541
+ //------------------------------ #6 TYPE CASTING -----------------------------//
542
+ //============================================================================//
543
+
544
+
545
+ // TYPE => ARRANGEMENT
546
+ proc type2arr(list #)
547
+ "USAGE: type2arr(#); # def
548
+ RETURN: [arr] Arrangement defined by the input
549
+ NOTE: The procedure tries to cast the input to [arr] using arrAdd
550
+ KEYWORDS: typecasting; arrangement
551
+ EXAMPLE: example tye2arr; shows an example"
552
+
553
+ {
554
+ return (arrAdd(#));
555
+ }
556
+
557
+ example
558
+ {
559
+ "EXAMPLE:"; echo = 2;
560
+ ring R = 0,(x,y,z),dp;
561
+ ideal I = x,y,z;
562
+ typeof(type2arr(I));
563
+ }
564
+
565
+
566
+ // ARRANGEMENT => POLY
567
+ static proc arr2poly(arr A)
568
+ "USAGE: poly(A); arr A
569
+ RETURN: [poly] The defining polynomial which is the product of polynomials occurring in arr
570
+ NOTE: The procedure will automatically simplify the polynomial by scalar multiplication.
571
+ SEE ALSO: arrAdd, arr2poly, arr2mat, arr2list, arr2ideal, type2arr
572
+ KEYWORDS: typecasting; defining polynomial
573
+ EXAMPLE: example arr2poly; shows an example"
574
+
575
+ {
576
+ poly f = simplify(product(A.l),1);
577
+ if(f == 0){ return (1); }
578
+ return (f);
579
+ }
580
+
581
+ example
582
+ {
583
+ "EXAMPLE:"; echo = 2;
584
+ ring R = 0,(x,y,z),dp;
585
+ arr A = ideal(x+1, 2x-2, y);
586
+ arr2poly(A);
587
+ }
588
+
589
+
590
+ // ARRANGEMENT => LIST
591
+ static proc arr2list(arr A)
592
+ "USAGE: arr2list(A); A arr
593
+ RETURN: [list] containing all generators of A
594
+ SEE ALSO: arrAdd, arr2poly, arr2mat, arr2list, arr2ideal, type2arr
595
+ KEYWORDS: typecasting; list
596
+ EXAMPLE: example arr2list; shows an example"
597
+
598
+ {
599
+ int n = size(A);
600
+ list L;
601
+ for(int k=1; k<=n; k++){L[k] = A[k];}
602
+
603
+ return (L);
604
+ }
605
+
606
+ example
607
+ {
608
+ "EXAMPLE:"; echo = 2;
609
+ ring R = 0,(x,y,z),dp;
610
+ arr A= ideal(x,y,z);
611
+ arr2list(A);
612
+ }
613
+
614
+
615
+ // ARRANGEMENT => IDEAL
616
+ static proc arr2ideal(arr A)
617
+ "USAGE: arr2ideal(A); A arr
618
+ RETURN: [ideal], the internal ideal of A
619
+ NOTE: arr2ideal(A); is the same as A.l - which may become private
620
+ SEE ALSO: arrAdd, arr2poly, arr2mat, arr2list, arr2ideal, type2arr
621
+ KEYWORDS: typecasting; ideal
622
+ EXAMPLE: example arr2ideal; shows an example"
623
+
624
+ {
625
+ return (A.l);
626
+ }
627
+
628
+ example
629
+ {
630
+ "EXAMPLE:"; echo = 2;
631
+ ring R = 0,(x,y,z),dp;
632
+ arr A = ideal(x,y,z);
633
+ arr2ideal(A);
634
+ }
635
+
636
+
637
+ // ARRANGEMENT => MATRIX
638
+ static proc arr2mat(arr A, list #)
639
+ "USAGE: matrix(A); A arr
640
+ matrix(A, 'c') for central arrangements (shorter matrix)
641
+ RETURN: [matrix] M = [T|b] representing the arrangement
642
+ NOTE: If the arrangement is central or one is not interested in the const
643
+ terms one can use "matrix(A, 'c')" instead to get the same matrix without
644
+ the last column.
645
+ SEE ALSO: arr2mat, mat2arr, mat2carr
646
+ KEYWORDS: typecasting; matrix; coefficient
647
+ EXAMPLE: example arr2mat;"
648
+
649
+ {
650
+ matrix M = jacob(A.l);
651
+ if(size(#) == 0){return ( concat(M, transpose(jet(A.l,0))) );}
652
+ if(#[1] == 'c'){return (M);}
653
+ ERROR("Bad optional input parameter!")
654
+ }
655
+
656
+ example
657
+ {
658
+ "EXAMPLE:"; echo = 2;
659
+ ring R = 0,(x,y,z),dp;
660
+ arr A = ideal(x,y,z);
661
+ arr D = ideal(x+1, y-2, z, x+y+4);
662
+ print(arr2mat(A));
663
+ print(arr2mat(D));
664
+ }
665
+
666
+
667
+ // MATRIX => ARRANGEMENT
668
+ proc mat2arr(matrix M)
669
+ "USAGE: mat2arr(M); matrix (M|b)
670
+ RETURN: [arr] interprets the rows of the matrix as the defining polynomial equations
671
+ of the arrangement where the last column will be considered as the constant
672
+ terms, i.e. if M is an m*(n+1) matrix we have
673
+ H_i = Ker( M_i1*x_1 +...+ M_in*x_n + M_i(n+1) ) for i=1...m and
674
+ A = {H_1,...,H_m} the resulting arrangement.
675
+ SEE ALSO: mat2carr
676
+ KEYWORDS: typecasting; matrix; coefficient
677
+ EXAMPLE: example mat2arr;"
678
+
679
+ {
680
+ if(ncols(M) > nvars(basering)+1)
681
+ {
682
+ ERROR("Matrix too big! Please add variables to basering.");
683
+ }
684
+
685
+ int n = ncols(M)-1;
686
+ matrix X[n+1][1];
687
+ X[1..n,1] = varMat(1..n);
688
+ X[n+1 ,1] = 1;
689
+ arr A = ideal(M*X);
690
+
691
+ return(A);
692
+ }
693
+
694
+ example
695
+ {
696
+ "EXAMPLE:"; echo = 2;
697
+ ring R = 0,(x,y,z),dp;
698
+ matrix M[4][4] = 1,0,1,1,1,1,0,2,0,1,1,3,2,1,1,4;
699
+ print(M);
700
+ mat2arr(M);
701
+ }
702
+
703
+
704
+ // MATRIX => ARRANGEMENT (central)
705
+ proc mat2carr(matrix M)
706
+ "USAGE: mat2carr(M); matrix M
707
+ RETURN: [arr] interprets the rows of the matrix as the defining polynomial equations
708
+ of the arrangement. I.e. if M is an m*n matrix we have
709
+ H_i = Ker( M_i1*x_1 +...+ M_in*x_n) for i=1...m and
710
+ A = {H_1,...,H_m} the resulting arrangement.
711
+ SEE ALSO: mat2arr
712
+ KEYWORDS: typecasting; matrix; coefficient; central
713
+ EXAMPLE: example mat2carr;"
714
+
715
+ {
716
+ if( ncols(M) > nvars(basering) ){
717
+ ERROR("Error! not enough variables in the basering.");
718
+ }
719
+
720
+ arr A = ideal(M*varMat(1..ncols(M)));
721
+
722
+ return(A);
723
+ }
724
+
725
+ example
726
+ {
727
+ "EXAMPLE:"; echo = 2;
728
+ ring R = 0,(x,y,z),dp;
729
+ matrix M[4][3] = 1,0,1,1,1,0,0,1,1,2,1,1;
730
+ print(M);
731
+ mat2carr(M);
732
+ }
733
+
734
+
735
+ //============================================================================//
736
+ //---------------------------- #7 IDEAL FUNCTIONS ----------------------------//
737
+ //============================================================================//
738
+
739
+
740
+ // checks if A is central, homogenizes
741
+ static proc arrHomog(arr A, list #)
742
+ "USAGE: homog(A); arr A
743
+ homog(A, p); arr A, ring_variable p
744
+ RETURN: [0,1] homog(A) is the same as arrCentral(A)
745
+ [arr] homog(A,p) homogenizes A with respect to p
746
+ NOTE: homog(A,p) is not the same as arrCone(A,p) as it does not add the additional hyperplane
747
+ SEE ALSO: arrHomog, arrCentral, arrCone
748
+ KEYWORDS: central; homogenize
749
+ EXAMPLE: example arrHomog; shows an example"
750
+
751
+ {
752
+ if(size(#) == 0){
753
+ return (homog(A.l));
754
+ }
755
+
756
+ if(size(#) == 1){
757
+ A = homog(A.l, #[1]);
758
+ return (A);
759
+ }
760
+
761
+ ERROR("Too many innput arguments!");
762
+
763
+ }
764
+
765
+ example
766
+ {
767
+ "EXAMPLE: "; echo = 2;
768
+ ring R = 0,(x,y,z),dp;
769
+ arr A = ideal(x,y);
770
+ arr B = ideal(x,y,x+y+1);
771
+ homog(A);
772
+ homog(B);
773
+ homog(B,z);
774
+ homog(_);
775
+ }
776
+
777
+
778
+
779
+ // simplified arrangement
780
+ static proc arrSimplify(arr A, list #)
781
+ "USAGE: arrSimplify(A);
782
+ simplify(A, n); arr A, int n
783
+ RETURN: [arr] simplified arrangement.
784
+ NOTE: arrSimplify(A) is the same as simplify(A, 1), simplify with higher ints
785
+ is not needed
786
+ SEE ALSO: arrSimplify
787
+ KEYWORDS: simplify
788
+ EXAMPLE: example arrSimplify; shows an example"
789
+
790
+ {
791
+ if(size(#) == 0){
792
+ A = simplify(A.l, 1);
793
+ return (A);
794
+ }
795
+
796
+ if(size(#) == 1){
797
+ A = simplify(A.l, #[1]);
798
+ return (A);
799
+ }
800
+
801
+ ERROR("Too many input arguments!");
802
+ }
803
+
804
+ example
805
+ {
806
+ "EXAMPLE: "; echo = 2;
807
+ ring R = 0,(x,y,z),dp;
808
+ arr A = ideal(2x,2y-1,2z-2);
809
+ arrSimplify(A);
810
+ }
811
+
812
+
813
+ // number of hyperplanes
814
+ static proc arrSize(arr A)
815
+ "USAGE: size(A); arr A;
816
+ RETURN: [int] number of hyperplanes in the arrangement
817
+ NOTE: size(A) also useable for multi-arrangements
818
+ SEE ALSO: arrSize, multarrSize
819
+ KEYWORDS: hyperplanes; size; number
820
+ EXAMPLE: example arrSize; shows an example"
821
+
822
+ {
823
+ return (size(A.l));
824
+ }
825
+
826
+ example
827
+ {
828
+ "EXAMPLE: "; echo = 2;
829
+ ring R = 0,(x,y,z),dp;
830
+ arr A = ideal(x,y,z);
831
+ size(A);
832
+ }
833
+
834
+
835
+ // substitute variables
836
+ static proc arrSubst(arr A, list #)
837
+ "USAGE: arrSubst(A, #); arr A, ring_variables/integers i,j;
838
+ RETURN: [arr] with the corresponding substitutions made
839
+ NOTE: applies 'subst' on the arrangement
840
+ SEE ALSO: arrSubst
841
+ KEYWORDS: variables; ring_variable; substitute
842
+ EXAMPLE: example arrSubst; shows an example"
843
+
844
+ {
845
+ if(size(#)%2 != 0){
846
+ ERROR("Odd number of parameter inputs!");
847
+ }
848
+
849
+ for(int i=1; i<size(#); i=i+2){
850
+ A = subst(A.l, #[i], #[i+1]);
851
+ }
852
+
853
+ return (A);
854
+ }
855
+
856
+ example
857
+ {
858
+ "EXAMPLE: "; echo = 2;
859
+ ring R = 0,(x,y,z),dp;
860
+ arr A = ideal(x,y,z,x+z);
861
+ arrSubst(A,x,y);
862
+ arrSubst(A,x,y,y,z);
863
+ }
864
+
865
+
866
+ //============================================================================//
867
+ //------------------------------- #8 PRINTING --------------------------------//
868
+ //============================================================================//
869
+
870
+
871
+ // prints arrangement in the console
872
+ static proc arrPrint(arr A)
873
+ "USAGE: A; A arr
874
+ RETURN: [] better readable output in the console as the newstruct print
875
+ SEE ALSO: arrPrint, arrPrintMatrix
876
+ KEYWORDS: print
877
+ EXAMPLE: example arrPrint;"
878
+
879
+ {
880
+ A.l;
881
+ }
882
+
883
+ example
884
+ {
885
+ "EXAMPLE:"; echo = 2;
886
+ ring R = 0,(x,y,z),dp;
887
+ arr A = ideal(x,y,z);
888
+ A;
889
+ }
890
+
891
+
892
+ // readable as a coeff matrix
893
+ proc arrPrintMatrix(arr A)
894
+ "USAGE: arPrintMatrix(arr A)
895
+ RETURN: [] prints arr in matrix form
896
+ NOTE: differs print(matrix(arr A)) since variables included
897
+ KEYWORDS: print; matrix; coefficient
898
+ EXAMPLE: example arrPrintMatrix;"
899
+
900
+ {
901
+ matrix M = matrix(A);
902
+ ideal I = variables(A);
903
+ for(int k=1; k<=size(I); k++){
904
+ M[1..nrows(M),k] = (M[1..nrows(M),k])*(I[k]);
905
+ }
906
+
907
+ print(M);
908
+ }
909
+
910
+ example
911
+ {
912
+ "EXAMPLE:"; echo = 2;
913
+ ring R = 0,(x,y,z),dp;
914
+ arr A = mat2arr(random(20,5,4));
915
+ A;
916
+ arrPrintMatrix(A);
917
+ }
918
+
919
+
920
+ //============================================================================//
921
+ //------------------------- #9 MANIPULATING VARIABLES ------------------------//
922
+ //============================================================================//
923
+
924
+
925
+ // matrix of the corresponding ring_variables
926
+ proc varMat(intvec v)
927
+ "USAGE: varMat(v); v intvec
928
+ RETURN: [matrix] M containing the corresponding ring_variables
929
+ SEE ALSO: varMat, varNum, arrSwapVar, arrLastVar
930
+ KEYWORDS: variables; ring_variable
931
+ EXAMPLE: example varMat; shows an example"
932
+
933
+ {
934
+ matrix M[size(v)][1];
935
+ for(int k=1; k<=size(v); k++){
936
+ M[k,1] = var(v[k]);
937
+ }
938
+ return (M);
939
+ }
940
+
941
+ example
942
+ {
943
+ "EXAMPLE: 'even' ringvariables"; echo = 2;
944
+ ring R = 0,(x(1..6)),dp;
945
+ intvec v = 2,4,6;
946
+ varMat(v);
947
+ }
948
+
949
+
950
+ // number of given variable (enh. version of varNum in dmod.lib)
951
+ proc varNum(def u)
952
+ "USAGE: varnum(string s);
953
+ varnum(ring_variable);
954
+ RETURN: [int] number of given ring variable, or 0 if it does not appear
955
+ NOTE: This procedure has the same functionality as varNum from the dmod.lib
956
+ package, but also accepts polys as input.
957
+ SEE ALSO: varMat, varNum, arrSwapVar, arrLastVar
958
+ KEYWORDS: variables; ring_variable; number
959
+ EXAMPLE: example varNum; shows an example"
960
+
961
+ {
962
+ if(typeof(u) == "string"){
963
+ for(int i=1; i<=nvars(basering); i++){
964
+ if(string(var(i)) == u){return (i);}
965
+ }
966
+ return (0);
967
+ }
968
+
969
+ if(typeof(u) == "poly"){
970
+ for(int i=1; i<=nvars(basering); i++){
971
+ if(var(i) == u){return (i);}
972
+ }
973
+ return (0);
974
+ }
975
+
976
+ ERROR("Wrong input type, expected string or ring_variable (poly)!");
977
+ }
978
+
979
+ example
980
+ {
981
+ "EXAMPLE: "; echo = 2;
982
+ ring R = 0,(x,y,z),dp;
983
+ varNum(y);
984
+ ring S = 0,(x(1..5),y(1..5)),dp;
985
+ varNum("y(3)");
986
+ }
987
+
988
+
989
+ // ideal of all variables the arrangement depends on
990
+ static proc arrVariables(arr A)
991
+ "USAGE: variables(A); A arr
992
+ RETURN: [ideal] whereas generators are variables A uses
993
+ NOTE: inherited from the ideal class
994
+ SEE ALSO: varMat, varNum, arrVariables ,arrNvars, arrSwapVar, arrLastVar
995
+ KEYWORDS: variables; ring_variable
996
+ EXAMPLE: example arrVariables; shows an example"
997
+
998
+ {
999
+ return (variables(A.l));
1000
+ }
1001
+
1002
+ example
1003
+ {
1004
+ "EXAMPLE: "; echo = 2;
1005
+ ring R = 0,(x,y,z),lp;
1006
+ arr A = ideal(x,y,z);
1007
+ variables(A);
1008
+ variables(A-y);
1009
+ }
1010
+
1011
+
1012
+ // number of variables the arrangement uses
1013
+ static proc arrNvars(arr A)
1014
+ "USAGE: arrNvars(A); A arr
1015
+ RETURN: [int] number of variables A uses
1016
+ NOTE: inherited from the ideal class
1017
+ SEE ALSO: varMat, varNum, arrVariables ,arrNvars, arrSwapVar, arrLastVar
1018
+ KEYWORDS: variables; variables; ring_variable; number
1019
+ EXAMPLE: example arrNvars; shows an example"
1020
+
1021
+ {
1022
+ return (size(variables(A)));
1023
+ }
1024
+
1025
+ example
1026
+ {
1027
+ "EXAMPLE: "; echo = 2;
1028
+ ring R = 0,(x,y,z),lp;
1029
+ arr A= ideal(x,y,z);
1030
+ arrNvars(A);
1031
+ arrNvars(A-y);
1032
+ }
1033
+
1034
+
1035
+ // swaps two variables in the arrangement
1036
+ proc arrSwapVar(arr A, def i, def j)
1037
+ "USAGE: arrSwapVar(A, i, j); arr A, ring_variables/integers i,j
1038
+ RETURN: [arr] A where variables i and j are swapped.
1039
+ NOTE: if i and/or j are integers the algorithm considers the variables
1040
+ variables(A)[i] and/or variables(A)[j]
1041
+ SEE ALSO: varMat, varNum, arrSwapVar, arrLastVar
1042
+ KEYWORDS: swap; variables; ring_variable
1043
+ EXAMPLE: example arrSwapVar; shows an example"
1044
+
1045
+ {
1046
+ ideal I = variables(A);
1047
+ poly u,v;
1048
+ if(typeof(i) == "int"){ u = I[i]; } else{ u = i; }
1049
+ if(typeof(j) == "int"){ v = I[j]; } else{ v = j; }
1050
+
1051
+ if(u == v){ return (A); } // special case which messes up the rest
1052
+
1053
+ // using the old trick on how to swap 2 cells without needing a third:
1054
+ // (a|b) =(a->a+b)=> (a+b|b) =(b->b-a)=> (b|b-a) =(a->b-a)=> (b|a)
1055
+ A = subst(A.l, u, u+v);
1056
+ A = subst(A.l, v, v-u);
1057
+ A = subst(A.l, u, v-u);
1058
+
1059
+ return (A);
1060
+ }
1061
+
1062
+ example
1063
+ {
1064
+ "EXAMPLE: "; echo = 2;
1065
+ ring R = 0,(x,y,z),lp;
1066
+ arr A = ideal(x+1,x+y,z);
1067
+ arrSwapVar(A,x,z);
1068
+ }
1069
+
1070
+
1071
+ //ring_variable of largest index used in arrangement
1072
+ proc arrLastVar(arr A)
1073
+ "USAGE: arrLastVar(A); arr A
1074
+ RETURN: [int] number of the last variable A uses
1075
+ NOTE: useful if you want a list containing all variables x_1 ... x_k used in A,
1076
+ but you do not want to skip any like variables(A) does.
1077
+ SEE ALSO: varMat, varNum, arrSwapVar, arrLastVar
1078
+ KEYWORDS: variables; ring_variable
1079
+ EXAMPLE: example arrLastVar; shows an example"
1080
+
1081
+ {
1082
+ return ( rvar(variables(A)[arrNvars(A)]) );
1083
+ }
1084
+
1085
+ example
1086
+ {
1087
+ "EXAMPLE: "; echo = 2;
1088
+ ring R = 0,x(1..10),dp;
1089
+ arr A = ideal(x(1), x(2), x(3), x(6));
1090
+ int n = arrLastVar(A);
1091
+ varMat(1..n);
1092
+ variables(A);
1093
+ }
1094
+
1095
+
1096
+ //============================================================================//
1097
+ //--------------------------- #10 CENTER COMPUTATIONS ------------------------//
1098
+ //============================================================================//
1099
+
1100
+
1101
+ // checks if arr is central
1102
+ proc arrCentral(arr A)
1103
+ "USAGE: arrCentral(A); arr A
1104
+ RETURN: [0,1] true if arr is central(i.e. all planes intersect in 0)
1105
+ NOTE: This is the same as homog(A)
1106
+ SEE ALSO: arrCentered, arrCentral, arrCenter, arrCentralize
1107
+ KEYWORDS: center; central
1108
+ EXAMPLE: example arrCentral;"
1109
+
1110
+ {
1111
+ return (homog(A));
1112
+ }
1113
+
1114
+ example
1115
+ {
1116
+ "EXAMPLE:"; echo = 2;
1117
+ ring R = 0,(x,y,z),dp;
1118
+
1119
+ // centered and central
1120
+ arr A = ideal(x,y,z);
1121
+ arrCentered(A);
1122
+ arrCentral(A);
1123
+
1124
+ // centered but not central (center: (-1,-1/2, 1))
1125
+ arr B = ideal(x+1,2y+1,-z+1);
1126
+ arrCentered(B);
1127
+ arrCentral(B);
1128
+ }
1129
+
1130
+
1131
+ // checks whether arrangement has a center
1132
+ proc arrCentered(arr A)
1133
+ "USAGE: arrCentered(A); arr A
1134
+ RETURN: [0,1] true if A is centered(i.e. intersection of all planes not empty)
1135
+ NOTE: The algorithm uses the rank of matrix: Ax=b has a solution iff
1136
+ rank(A) = rank(A|b)
1137
+ SEE ALSO: arrCentered, arrCentral, arrCenter, arrCentralize
1138
+ KEYWORDS: center
1139
+ EXAMPLE: example arrCentered;"
1140
+
1141
+ {
1142
+ matrix M = matrix(A);
1143
+ // classic test: Ax=b has a solution if and only if rank(A|b) == rank(A)
1144
+ if( rank(M) == rank(submat(M,1..nrows(M), 1..ncols(M)-1))){ return (1); }
1145
+ return (0);
1146
+ }
1147
+
1148
+ example
1149
+ {
1150
+ "EXAMPLE:"; echo = 2;
1151
+ ring R = 0,(x,y,z),dp;
1152
+ arr A= ideal(x,y,x-y+1); // centerless
1153
+ arrCentral(A);
1154
+ arr B= ideal(x,y,z); // central with center being the origin
1155
+ arrCentral(B);
1156
+ arr C= ideal(x+1,2y+1,-z+1); // central with center (-1,-1/2, 1)
1157
+ arrCentral(C);
1158
+ }
1159
+
1160
+
1161
+ // computes center of an arrangement
1162
+ proc arrCenter(arr A)
1163
+ "USAGE: arrCenter(A); arr A
1164
+ RETURN: [list] L entry 0 if A not centered or entries 1, x, H, where x is
1165
+ any particular point of the center and H is a matrix consisting of
1166
+ vectors which spanning linear intersection space.
1167
+ If there is exactly one solution, then H = 0.
1168
+ NOTE: The intersection of all hyperplanes can be expressed in forms of a
1169
+ linear system Ax=b, where (A|b) is the coeff. matrix of the arrange-
1170
+ ment, which is then solved using L-U decomposition
1171
+ SEE ALSO: arrCentered, arrCentral, arrCenter, arrCentralize
1172
+ KEYWORDS: center
1173
+ EXAMPLE: example arrCenter;"
1174
+
1175
+ {
1176
+ matrix M = matrix(A); //return matrix (T|b)
1177
+ matrix T = submat(M, 1..nrows(M), 1..ncols(M)-1);
1178
+ matrix b = submat(M, 1..nrows(M), ncols(M))*(-1);
1179
+ list L = ludecomp(T);
1180
+ list Q = lusolve(L[1], L[2], L[3], b);
1181
+ return (Q);
1182
+ }
1183
+
1184
+ example
1185
+ {
1186
+ "EXAMPLE:"; echo = 2;
1187
+ ring R = 0,(x,y,z),dp;
1188
+
1189
+ arr A= ideal(x,y,x-y+1); // centerless
1190
+ arrCenter(A);
1191
+
1192
+ arr B= ideal(x,y,z); // center is a single point
1193
+ arrCenter(B);
1194
+
1195
+ arr C= ideal(x,z,x+z); // center is a line
1196
+ // here we get a wrong result because the matrix is simplified since A doesn't
1197
+ // contain any "y" the matrix (A|b) will be 3x3 only.
1198
+ arrCenter(C);
1199
+ }
1200
+
1201
+
1202
+ // makes centered arrangement central
1203
+ proc arrCentralize(arr A)
1204
+ "USAGE: arrCenteralize(A); arr A
1205
+ RETURN: [arr] A after centralization via coordinate change
1206
+ NOTE: The coordinate change only does translation, vector of translation is the second
1207
+ output of arrCenter
1208
+ SEE ALSO: arrCentered, arrCentral, arrCenter, arrCentralize
1209
+ KEYWORDS: central; center; coordinate change
1210
+ EXAMPLE: example arrCenter;"
1211
+
1212
+ {
1213
+ if(arrCentral(A)){
1214
+ print("The arrangement is already central!");
1215
+ return ();
1216
+ }
1217
+
1218
+ list L = arrCenter(A);
1219
+
1220
+ if(L[1] == 0){
1221
+ print("The arrangement has no center and therefor cannot be centralized!");
1222
+ return ();
1223
+ }
1224
+
1225
+ int n = nvars(basering);
1226
+
1227
+ matrix T = diag(1,n);
1228
+ matrix c = L[2];
1229
+
1230
+ A = arrCoordChange(A, T, c);
1231
+
1232
+ return (A);
1233
+ }
1234
+
1235
+ example
1236
+ {
1237
+ "EXAMPLE:"; echo = 2;
1238
+ ring R = 0,(x,y,z),dp;
1239
+ arr A = ideal(x-1,y,x-z-1,x-z-1);
1240
+ arrCentralize(A);
1241
+ }
1242
+
1243
+
1244
+ //============================================================================//
1245
+ //------------------------ #11 GEOMETRIC CONSTRUCTIONS -----------------------//
1246
+ //============================================================================//
1247
+
1248
+ // performs coordinate change
1249
+ proc arrCoordChange(arr A, matrix T, list #)
1250
+ "USAGE: arrCoordChange(A, T); arr A, (m*n mat) n*n or n*n+1 matrix T
1251
+ arrCoordChange(A, T , c); arr A, n*n matrix T, n*1 matrix/vector
1252
+ RETURN: [arr]: Arrangement A [A|b] after a coordinate change f: x -> Tx + c with T invertible
1253
+ i.e. [A|b] => [AT^-1|b+AT^-1c] since we have
1254
+ f(H) = f(ker(a1*x1 + ... + an*xn - b)) = {f(x) : a'x -b = 0}
1255
+ = {y : a'f^-1(y) -b = 0)}
1256
+ = {y : a'(T^-1(y-c)) - b = 0}
1257
+ = {y : a'T^-1y -(b + a'T^-1c) = 0}
1258
+ NOTE: There are 3 options how you can give the input (in each case n <= nvars(basering))
1259
+ 1. Just a nxn matrix with
1260
+ => Will automatically complete T by a unit matrix and perform x -> Tx
1261
+ 2. A nxn matrix T and a nx1 vector/matrix c with
1262
+ => Will automatically complete T and c and perform x -> Tx +c
1263
+ 3. A nxn+1 matrix T with
1264
+ => will use last column as translation vector c
1265
+ SEE ALSO: arrCoordChange, arrCoordNormalize
1266
+ KEYWORDS: coordinate change
1267
+ EXAMPLE: example arrCoordChange; shows an example"
1268
+
1269
+ {
1270
+ int n = nvars(basering);
1271
+ int k = nrows(T);
1272
+ int l = ncols(T);
1273
+ matrix c;
1274
+
1275
+ if( k>n || l-1>n ){
1276
+ ERROR("Matrix too big! (It has more cols/rows than there are variables.)");
1277
+ }
1278
+
1279
+ // const vector integrated in matrix => split [T|c] into T and c
1280
+ if( l == k+1 ){
1281
+ if(size(#) > 0){
1282
+ ERROR("Bad input. If given a constant vector the matrix must be square!")
1283
+ }
1284
+ c = submat(T, 1..k, l);
1285
+ T = submat(T, 1..k, 1..k); l=k;
1286
+ }
1287
+
1288
+ if( l != k || rank(T) != k){
1289
+ ERROR("Given matrix is not a base change matrix.")
1290
+ }
1291
+
1292
+ if(size(#) > 0){
1293
+ if(size(#) >= 2){ERROR("Too many input arguments!");}
1294
+ c = matrix(#[1]);
1295
+ if(nrows(c) > n || ncols(c) > 1){
1296
+ ERROR("Constant vector maldefined. Dimension too big.")
1297
+ }
1298
+
1299
+ }
1300
+
1301
+ matrix M[n][n] = diag(1,n);
1302
+ M[1..k,1..k] = T;
1303
+ T = M;
1304
+ T = luinverse(T)[2];
1305
+ M = jacob(A.l);
1306
+
1307
+ matrix b[n][1];
1308
+ b[1..nrows(c),1] = c;
1309
+ c = b; // gives c the right length.
1310
+ b = transpose(jet(A.l, 0)); // constants
1311
+
1312
+ b = b - M*T*c;
1313
+ M = M*T;
1314
+ A = mat2arr(concat(M,b));
1315
+
1316
+ return(A);
1317
+ }
1318
+
1319
+ example
1320
+ {
1321
+ "EXAMPLE: "; echo =2;
1322
+ ring r = 0,(x,y,z),lp;
1323
+ arr A = x,y,z;
1324
+ arrCoordChange(A,1,[0,0,1]); //lifts z-hyperplane by 1 unit
1325
+ matrix T[2][2] = [0,1,1,0]; // swaps x and y
1326
+ arrCoordChange(A,T);
1327
+ matrix c[2][1] = [1,0];
1328
+ T = concat(T,c); // now swap x and y and add 1 to x afterwards
1329
+ arrCoordChange(A,T);
1330
+ // Note how T doesn't even need to be a full 3x3 base change matrix.
1331
+ }
1332
+
1333
+ // performs projection onto coordinate hyperplanes
1334
+ proc arrCoordNormalize(arr A, intvec v)
1335
+ "USAGE: arrCoordChange(A, v);
1336
+ RETURN: [arr]: Arrangement after a coordinate change that transforms the arrangement such that
1337
+ after a transformation x -> Tx + c we have the arrangement has the matrix representation
1338
+ [AT^-1|b+AT^-1c] such that [AT^-1]_v = I and [b+AT^-1c]_v = 0;
1339
+ NOTE: algorithm performs a base change if H_k is homogeneous (i.e. has no)
1340
+ constant term and an affine transformation otherwise
1341
+ Ax+b = 0, Transformation x = Ty+c: AT^-1y + AT^-1c + b = 0
1342
+ Now we want to have (AT^-1)_v = I and (AT^-1c +b)_v = AT^-1_v*c + b_v = 0
1343
+ SEE ALSO: arrCoordChange, arrCoordNormalize
1344
+ KEYWORDS: coordinate change
1345
+ EXAMPLE: example arrCoordChange; shows an example"
1346
+
1347
+ {
1348
+ int n = nvars(basering);
1349
+ if(size(v) > n){
1350
+ ERROR("Too many rows chosen, at max you can choose "+string(n));
1351
+ }
1352
+
1353
+ matrix M = matrix(A);
1354
+ matrix Av[n][n];
1355
+ matrix bv[n][1];
1356
+ Av[1..size(v), 1..n] = submat(M,v,1..n);
1357
+ bv[1..size(v),1] = submat(M,v, n+1);
1358
+
1359
+ if(rank(Av) != n){
1360
+ if(rank(Av) != size(v)){
1361
+ ERROR("Normal vectors of the given hyperplanes are not linearly " +
1362
+ "independent. Cannot perform coordinate change!");
1363
+ }
1364
+ // Adds linearly independent lines to Av in order to make it invertible
1365
+ module F = freemodule(n);
1366
+ module Add = reduce(F,std(transpose(Av)));
1367
+ Add = transpose(simplify(transpose(Add),2));
1368
+ Av[(size(v)+1)..n, 1..n] = matrix(Add);
1369
+ }
1370
+ if(rank(Av) != n){ERROR("Av not invertible!");}
1371
+
1372
+ A = arrCoordChange(A,Av,bv);
1373
+
1374
+ return (A);
1375
+ }
1376
+ example
1377
+ {
1378
+ "EXAMPLE: "; echo=2;
1379
+ ring r = 0,(x,y,z),lp;
1380
+ arr A = ideal(x,y,z,x+z+4);
1381
+ intvec v = 1,2,4;
1382
+ arrCoordNormalize(A,v);
1383
+ }
1384
+
1385
+ // coned arrangement
1386
+ proc arrCone(arr A, list #)
1387
+ "USAGE: arrCone(A);
1388
+ arrCone(A, ring_variable); arr A arrangement in variables x_1...x_n;
1389
+ RETURN: arr, the coned hyperplane Arrangement cA with respect to the given
1390
+ ring_variable, or the last ring_variable if none was given.
1391
+ NOTE: The hyperplanes are homogenized w.r.t. v and a new hyperplane
1392
+ H = ker(x_n+1) is added.
1393
+ SEE ALSO: arrCone, arrDecone, arrRestrict, arrIsEssential, arrEssentialize
1394
+ KEYWORDS: cone; decone
1395
+ EXAMPLE: example arrCone; shows an example"
1396
+
1397
+ {
1398
+ poly p; int i;
1399
+
1400
+ // case 1: no ring_variable given
1401
+ if(size(#) == 0){
1402
+ p = var(nvars(basering));
1403
+ }
1404
+
1405
+ // case 2: a ring_variable is given
1406
+ else{ p = #[1]; }
1407
+
1408
+ // computation
1409
+ A = homog(A, p);
1410
+ A = A + p;
1411
+
1412
+ return(A);
1413
+ }
1414
+
1415
+ example
1416
+ {
1417
+ "EXAMPLE: Coning the arrangement A = (x+1, y) alongside x, y and z:"; echo=2;
1418
+ ring R = 0,(x,y,z),dp;
1419
+ arr A = ideal(x+1, x,x-2,x-1);
1420
+ arrCone(A, y);
1421
+ arr B= ideal(x,y,x+y-1);
1422
+ arrCone(B);
1423
+ }
1424
+
1425
+
1426
+ // deconed arrangement
1427
+ proc arrDecone(arr A, int k)
1428
+ "USAGE: arrDecone(A, k); arrangement A, integer k;
1429
+ RETURN: arr: the deconed hyperplane Arrangement dA
1430
+ NOTE: A has to be non-empty and central. arrDecone is an inverse operation
1431
+ to arrCone since A == arrDecone(arrCone(A),size(A)+1) for any A.
1432
+ One can also decone a central arrangement with respect to any hyper-
1433
+ plane k, but than a coordinate change is necessary to make
1434
+ H_k = ker(x_k). Since such a coordinate change is not unique,
1435
+ use arrCoordchange to do so.
1436
+ SEE ALSO: arrCone, arrDecone, arrRestrict, arrIsEssential, arrEssentialize
1437
+ KEYWORDS: cone; decone
1438
+ EXAMPLE: example arrDecone; shows an example"
1439
+
1440
+ {
1441
+ if( !arrCentral(A) ){
1442
+ ERROR("Non-central arrangement can not be deconed!");}
1443
+ if( size(A) == 0){
1444
+ ERROR("Empty arrangement can not be deconed!");}
1445
+ if( size(A) < k){
1446
+ ERROR("There is no k-th hyperplane");}
1447
+
1448
+ poly p = A[k];
1449
+ int n = rvar(p);
1450
+
1451
+ if( n == 0 ){ ERROR("H_" + string(k) + " = " + string(p) +
1452
+ " is not of the form ker(x_i). Please do a coordinate change first." +
1453
+ "You can use arrCoordinateChange to transform the arrangement accordingly.");
1454
+ }
1455
+
1456
+ A = A - p;
1457
+ A = arrSubst(A, p, 1);
1458
+
1459
+ return(A);
1460
+ }
1461
+
1462
+ example
1463
+ {
1464
+ "EXAMPLE: We decone arr consisting of (x,y,x+z) with respect to y";
1465
+ echo = 2;
1466
+ ring R = 0,(x,y,z),dp;
1467
+ arr A= ideal(x,y,z,x+y-z);
1468
+ arrDecone(A,3);
1469
+ }
1470
+
1471
+ proc arrLocalize(arr A, intvec v)
1472
+ "USAGE: arrLocalize(A, v); arrangement A, intvec v;
1473
+ RETURN: arr: the localized arrangement A_X, i.e. A_X only contains the hyperplanes
1474
+ which contain the flat X, which is defined by the equations A[v]
1475
+ SEE ALSO: arrCone, arrDecone, arrRestrict, arrIsEssential, arrEssentialize
1476
+ KEYWORDS: localization
1477
+ EXAMPLE: example arrLocalize; shows an example"
1478
+ {
1479
+ ideal I=std(arr2ideal(A[v]));
1480
+ arr L;
1481
+ int k;
1482
+ for(k=1; k<size(A); k++){
1483
+ if(NF(A[k],I)==0){
1484
+ L=L+A[k];
1485
+ }
1486
+ }
1487
+ return(L);
1488
+ }
1489
+
1490
+ example
1491
+ {
1492
+ "EXAMPLE: We localize the Braid 3 arrangement at x and y";
1493
+ echo = 2;
1494
+ ring R = 0,(x,y,z),dp;
1495
+ arr A=arrTypeB(3);
1496
+ intvec v=5,8;
1497
+ arr B=arrLocalize(A,v);
1498
+ B;
1499
+ }
1500
+
1501
+ // restricted arrangement onto a hyperplane
1502
+ proc arrRestrict(arr A, intvec v, list #)
1503
+ "USAGE: arrRestrict(A, v); arrangement A, int/intvec v, optional argument "CC";
1504
+ RETURN: arr: the restricted hyperplane Arrangement (A^X)
1505
+ NOTE: A has to be non-empty.
1506
+ REMARKS: We restrict A to the flat X, defined by the equations in A[v].
1507
+ The restriction will only be performed, if the ideal defining
1508
+ the flat X is monomial (i.e. X is an intersection of coordinate planes).
1509
+ If the optional argument CC is given, the arrangement is transformed
1510
+ in such a way that X has the above form.
1511
+ SEE ALSO: arrCone, arrDecone, arrRestrict, arrIsEssential, arrEssentialize
1512
+ KEYWORDS: restriction
1513
+ EXAMPLE: example arrRestrict; shows an example"
1514
+
1515
+ {
1516
+ ideal I=A.l;
1517
+ I=I[v];
1518
+ option(redSB);
1519
+ I=std(I); // defining equations for flat X
1520
+ //option(none);
1521
+ ideal Al=arr2ideal(A);
1522
+ int i;
1523
+
1524
+ if(isMonomial(I)==1){
1525
+ for(i=1;i<= size(I);i++){
1526
+ Al=subst(Al,I[i],0);
1527
+ }
1528
+ arr AR=Al;
1529
+ return(AR);
1530
+ }
1531
+
1532
+ if(size(#) == 0){
1533
+ ERROR("The flat X is not defined by a monomial ideal. " +
1534
+ "Please do a coordinate change first. You can use arrCoordNormalize to " +
1535
+ "transform the arrangement accordingly by adding the argument CC.");
1536
+ }
1537
+ if(#[1]!="CC"){
1538
+ ERROR("The flat X is not defined by a monomial ideal. " +
1539
+ "Please do a coordinate change first. You can use arrCoordNormalize to " +
1540
+ "transform the arrangement accordingly by adding the argument CC.");
1541
+ }
1542
+ if(size(v)==0){return(A);}
1543
+ intvec w=v[1];
1544
+ intvec tmp;
1545
+
1546
+ for(i=2;i<=size(v);i++){
1547
+ tmp=w,v[i];
1548
+ if(rank(matrix(A[w]))==size(tmp)){
1549
+ w=tmp;
1550
+ }
1551
+ }
1552
+
1553
+ arr B=arrCoordNormalize(A,w);
1554
+ ideal Bl=arr2ideal(B);
1555
+
1556
+ for(i=1;i<= size(w);i++){
1557
+ Bl=subst(Bl,Bl[w[i]],0);
1558
+ }
1559
+ arr BR=Bl;
1560
+ return(BR);
1561
+ }
1562
+
1563
+ example
1564
+ {
1565
+ "EXAMPLE: We consider the possible restrictions of the type B3 arrangement ";
1566
+ echo = 2;
1567
+ ring S = 0,(x,y,z),dp;
1568
+ arr A = arrTypeB(3);
1569
+ A;
1570
+ arrRestrict(A,9);
1571
+ arrRestrict(A,4,"CC");
1572
+ intvec v=5,8;
1573
+ arrRestrict(A,v);
1574
+ }
1575
+
1576
+
1577
+ // checks if arrangement is essential
1578
+ proc arrIsEssential(arr A)
1579
+ "USAGE: arrIsEssential(A); arrangement A;
1580
+ RETURN: boolean: 1 if arr is essential, i.e. rank of maximal element of
1581
+ poset is dimension
1582
+ NOTE: A has to be non-empty.
1583
+ SEE ALSO: arrCone, arrDecone, arrRestrict, arrIsEssential, arrEssentialize
1584
+ KEYWORDS: essential
1585
+ EXAMPLE: example arrIsEssential; shows an example"
1586
+
1587
+ {
1588
+ ideal I = variables(A);
1589
+
1590
+ if( var(size(I)) != I[size(I)] ){
1591
+ return(0);
1592
+ } if( rank(jacob(A.l)) == size(I) ){
1593
+ return(1);
1594
+ }
1595
+
1596
+ return(0);
1597
+ }
1598
+
1599
+ example
1600
+ {
1601
+ "EXAMPLE: We check whether these are essential and a non-essential arrangement ";
1602
+ echo = 2;
1603
+ ring S = 0,(x,y,z),lp;
1604
+ arr A = ideal(x,y,z);
1605
+ arr B = ideal(x+y+z,x,y+z);
1606
+ arrIsEssential(A);
1607
+ arrIsEssential(B);
1608
+ }
1609
+
1610
+
1611
+ // essentialized arragnement
1612
+ proc arrEssentialize(arr A)
1613
+ "USAGE: arrEssentialize(A); arrangement A;
1614
+ RETURN: essential arrangement by transformation
1615
+ NOTE: A has to be non-empty.
1616
+ SEE ALSO: arrCone, arrDecone, arrRestrict, arrIsEssential, arrEssentialize
1617
+ KEYWORDS: essential
1618
+ EXAMPLE: example arrEssentialize; shows an example"
1619
+
1620
+ {
1621
+ ideal I = variables(A);
1622
+
1623
+ if( var(size(I)) != I[size(I)] ){
1624
+ for(int k=1; k<=size(I); k++){
1625
+ if( NF(var(k),std(I)) != 0 ){
1626
+ A = subst(A.l, I[size(I)], var(k));
1627
+ return (arrEssentialize(A));
1628
+ }
1629
+ }
1630
+ }
1631
+
1632
+ while(arrIsEssential(A) == 0){
1633
+ A = subst(A.l, I[size(I)], 0);
1634
+ }
1635
+
1636
+ return (A);
1637
+ }
1638
+
1639
+ example
1640
+ {
1641
+ "EXAMPLE: We essentialize a non essential arrangement "; echo = 2;
1642
+ ring S = 0,(x,y,z),dp;
1643
+ arr A=arrBraid(3);
1644
+ arrEssentialize(A);
1645
+ arr B = ideal(x+y+z,x,y+z);
1646
+ arrEssentialize(B);
1647
+ }
1648
+
1649
+ //============================================================================//
1650
+ //------------------------ #12 EXAMPLES OF ARRANGEMENTS ----------------------//
1651
+ //============================================================================//
1652
+
1653
+
1654
+ // boolean arrangement
1655
+ proc arrBoolean(int v)
1656
+ "USAGE: arrBoolean(v); int v
1657
+ RETURN: arr, which uses the first v variables of ring for boolean arrangement
1658
+ SEE ALSO: arrBoolean, arrBraid, arrTypeB, arrTypeD, arrRandom, arrEdelmanReiner
1659
+ KEYWORDS: example; boolean
1660
+ EXAMPLE: example arrBoolean;"
1661
+
1662
+ {
1663
+ if(nvars(basering)<v){ return("not enough variables"); }
1664
+
1665
+ arr A = mat2carr(unitmat(v));
1666
+ return(A);
1667
+ }
1668
+
1669
+ example
1670
+ {
1671
+ "EXAMPLE:Boolean Arrangement, uses the seven first coordinate hyperplanes";
1672
+ echo = 2;
1673
+ ring R = 0,x(1..10),dp;
1674
+ arrBoolean(7);
1675
+ }
1676
+
1677
+
1678
+ // braid arrangement
1679
+ proc arrBraid(int v)
1680
+ "USAGE: arrBraid(v); int v
1681
+ RETURN: Type A (braid) arrangement of dimension v
1682
+ SEE ALSO: arrBoolean, arrBraid, arrTypeB, arrTypeD, arrRandom, arrEdelmanReiner
1683
+ KEYWORDS: example; braid
1684
+ EXAMPLE: example arrBraid;"
1685
+
1686
+ {
1687
+ if(nvars(basering)<v){
1688
+ return("not enough variables");
1689
+ }
1690
+
1691
+ arr A;
1692
+ int i,j;
1693
+ for(i=1; i<=v; i++){
1694
+ for(j=i+1; j<=v; j++){
1695
+ A = A + (var(i) - var(j));
1696
+ }
1697
+ }
1698
+ return(A);
1699
+ }
1700
+
1701
+ example
1702
+ {
1703
+ "EXAMPLE: The braid arrangement consists of the hyperplanes x(i)=x(j)";
1704
+ echo = 2;
1705
+ ring R = 0,x(1..10),dp;
1706
+ arrBraid(7);
1707
+ }
1708
+
1709
+
1710
+ // type B arrangement
1711
+ proc arrTypeB(int v)
1712
+ "USAGE: arrTypeB(v); int v
1713
+ RETURN: arrangement, which uses first v variables of ring for reflection
1714
+ arrangement of type B
1715
+ SEE ALSO: arrBoolean, arrBraid, arrTypeB, arrTypeD, arrRandom, arrEdelmanReiner
1716
+ KEYWORDS: example; type B
1717
+ EXAMPLE: example arrTypeB;"
1718
+
1719
+ {
1720
+ if(nvars(basering)<v){
1721
+ return("not enough variables");
1722
+ }
1723
+
1724
+ arr A;
1725
+ int i,j;
1726
+ for(i=1; i<=v; i++){
1727
+ for(j=i+1; j<=v; j++){
1728
+ A = A + (var(i) - var(j));
1729
+ A = A + (var(i) + var(j));
1730
+
1731
+ }
1732
+ A = A + var(i);
1733
+ }
1734
+ return(A);
1735
+ }
1736
+
1737
+ example
1738
+ {
1739
+ "EXAMPLE: The type B reflection arrangement consists of the hyperplanes " +
1740
+ "x(i)=x(j), x(i)=-x(j) and the coordinate hyperplanes";
1741
+ echo = 2;
1742
+ ring R = 0,x(1..10),dp;
1743
+ arrTypeB(5);
1744
+ }
1745
+
1746
+
1747
+ // type D arrangement
1748
+ proc arrTypeD(int v)
1749
+ "USAGE: arrTypeD(v); int v
1750
+ RETURN: arrangement, which uses first v variables of ring for reflection
1751
+ arrangement of type D
1752
+ SEE ALSO: arrBoolean, arrBraid, arrTypeB, arrTypeD, arrRandom, arrEdelmanReiner
1753
+ KEYWORDS: example; type D
1754
+ EXAMPLE: example arrTypeD;"
1755
+
1756
+ {
1757
+ if(nvars(basering)<v){
1758
+ return("not enough variables");
1759
+ }
1760
+
1761
+ arr A;
1762
+ int i,j;
1763
+ for(i=1; i<=v; i++){
1764
+ for(j=i+1; j<=v; j++){
1765
+ A = A + (var(i) - var(j));
1766
+ A = A + (var(i) + var(j));
1767
+ }
1768
+ }
1769
+ return(A);
1770
+ }
1771
+
1772
+ example
1773
+ {
1774
+ "EXAMPLE: The type D reflection arrangement consists of the hyperplanes " +
1775
+ "x(i)=x(j) and x(i)=-x(j)";
1776
+ echo = 2;
1777
+ ring R = 0,x(1..10),dp;
1778
+ arrTypeD(5);
1779
+ }
1780
+
1781
+
1782
+ // random (affine) arrangement
1783
+ proc arrRandom(int d, int m, int n)
1784
+ "USAGE: arrRandom(n,v,N); int n,v,N
1785
+ RETURN: Random arrangement, where m is the number of hyperplanes, n the
1786
+ dimension, d the upper bound for absolute value of coefficients.
1787
+ NOTE: You can also write arr = random(d,m,n) to create random arrangements
1788
+ SEE ALSO: arrBoolean, arrBraid, arrTypeB, arrTypeD, arrRandom, arrEdelmanReiner
1789
+ KEYWORDS: example; random
1790
+ EXAMPLE: example arrRandom;"
1791
+
1792
+ {
1793
+ if(n > nvars(basering)){
1794
+ return("Error, too few variables or too high dimension");
1795
+ }
1796
+
1797
+ intmat M = random(d,m,n+1);
1798
+ arr A = mat2arr(M);
1799
+ return(A);
1800
+ }
1801
+
1802
+ example
1803
+ {
1804
+ "EXAMPLE:"; echo = 2;
1805
+ ring R = 0,x(1..20),dp;
1806
+ arrRandom(7,3,15);
1807
+ }
1808
+
1809
+
1810
+ // random central arrangement
1811
+ proc arrRandomCentral(int d, int m, int n)
1812
+ "USAGE: arrRandomCentral(d,m,n); int d,m,n
1813
+ RETURN: Random central arrangement, where m is the number of hyperplanes, n
1814
+ the dimension, d the upper bound for absolute value of coefficients.
1815
+ SEE ALSO: arrBoolean, arrBraid, arrTypeB, arrTypeD, arrRandom, arrEdelmanReiner
1816
+ KEYWORDS: example; random; central
1817
+ EXAMPLE: example arrRandomCentral;"
1818
+
1819
+ {
1820
+ if(n > nvars(basering)){
1821
+ return("Error, too few variables or too high dimension");
1822
+ }
1823
+
1824
+ intmat M = random(d,m,n);
1825
+ arr A = mat2carr(M);
1826
+ return(A);
1827
+ }
1828
+
1829
+ example
1830
+ {
1831
+ "EXAMPLE:"; echo = 2;
1832
+ ring R = 0,x(1..20),dp;
1833
+ arrRandomCentral(7,3,15);
1834
+ }
1835
+
1836
+
1837
+ // Edelman-Reiner arrangement
1838
+ proc arrEdelmanReiner()
1839
+ "USAGE: arrEdelmanReiner();
1840
+ RETURN: the Edelman-Reiner arrangement, which is a free arrangement but the
1841
+ restriction to the 6-th hyperplane is nonfree.
1842
+ (i.e. counterexample for Orlik-Conjecture)
1843
+ NOTE: the active ring must have at least five variables
1844
+ SEE ALSO: arrBoolean, arrBraid, arrTypeB, arrTypeD, arrRandom, arrEdelmanReiner
1845
+ KEYWORDS: example; Edelman-Reiner
1846
+ EXAMPLE: example arrEdelmanReiner;"
1847
+
1848
+ {
1849
+ if(nvars(basering) < 5){ ERROR("not enough variables"); }
1850
+
1851
+ arr arrER = arrBoolean(5);
1852
+ int a,b,c,d;
1853
+ for(a=1; a<=2; a++){
1854
+ for(b=1; b<=2; b++){
1855
+ for(c=1; c<=2; c++){
1856
+ for(d=1; d<=2; d++){
1857
+ arrER = arrER + (var(1)+(-1)^a*var(2)+(-1)^b*var(3)+(-1)^c*var(4)+(-1)^d*var(5));
1858
+ }}}}
1859
+
1860
+ return(arrER);
1861
+ }
1862
+
1863
+ example
1864
+ {
1865
+ "EXAMPLE:"; echo = 2;
1866
+ ring r=0,x(1..5),dp;
1867
+ arrEdelmanReiner();
1868
+ }
1869
+
1870
+
1871
+ //============================================================================//
1872
+ //--------------------- #13 Orlik Solomon and Poincare Poly ------------------//
1873
+ //============================================================================//
1874
+
1875
+
1876
+ // Orlik-Solomon algebra of the arrangement
1877
+ proc arrOrlikSolomon(arr A)
1878
+ "USAGE: arrOrlikSolomon(A); arr A
1879
+ RETURN: [ring] exterior Algebra E as ring with Orlik-Solomon ideal as attribute I.
1880
+ The Orlik-Solomon ideal is generated by the differentials of dependent
1881
+ tuples of hyperplanes. For a complex arrangement the quotient E/I is
1882
+ isomorphic to the cohomology ring of the complement of the arrangement.
1883
+ NOTE: In order to access this ideal I activate this exterior algebra with setring.
1884
+ SEE ALSO: arrOrlikSolomon
1885
+ KEYWORDS: Orlik-Solomon
1886
+ EXAMPLE: example arrOrlikSolomon;"
1887
+
1888
+ {
1889
+ int central = arrCentral(A); // 0: non-central, 1: central
1890
+ if(central == 0){
1891
+ A = arrCone(A);
1892
+ }
1893
+
1894
+ module M = syz(A.l);
1895
+ M = jet(M,0); //Only use linear syzygies
1896
+ M = simplify(M,2); // drop zeros
1897
+
1898
+ int n = ncols(A.l);
1899
+ def startRing = basering;
1900
+ ring R = 0,e(1..n),dp;
1901
+ def ER = Exterior();
1902
+ setring ER; // defines the Exterioralgebra
1903
+ ideal I; //final orlik solomon ideal
1904
+
1905
+ matrix X = transpose(varMat(1..n));
1906
+ module M = fetch(startRing,M); //brings the module M to the Exterior Algebra
1907
+ ideal OSI = ideal(X*M);
1908
+
1909
+ if(size(OSI) == 0){ // no relations among hyperplanes, I==0
1910
+ export(I);
1911
+ return(basering);
1912
+ }
1913
+
1914
+ // monomial subideal procedure due to Sorin Popescu
1915
+ ideal K = OSI;
1916
+ ideal J;
1917
+ while(isMonomial(K) == 0){
1918
+ J = lead(std(K));
1919
+ K = intersect(J,OSI);
1920
+ K = interred(K);
1921
+ }
1922
+
1923
+ OSI = K;
1924
+ poly diffOp; //now applying the differential operator
1925
+ ideal vars;
1926
+ int j;
1927
+
1928
+ for(int i=1; i<=ncols(OSI); i++)
1929
+ {
1930
+ vars = variables(OSI[i]);
1931
+ diffOp = 0;
1932
+ for(j=1; j<=ncols(vars); j++)
1933
+ {
1934
+ diffOp = diffOp+(-1)^(j+1)*vars[j];
1935
+ }
1936
+
1937
+ I = I + ideal( diff(diffOp,ideal(OSI[i])) );
1938
+ }
1939
+
1940
+ if(central ==0 ){//project back in the non-central case
1941
+ n = nvars(basering)-1;
1942
+ ring R = 0,e(1..n),dp;
1943
+ def ERDC = Exterior();
1944
+ setring ERDC;
1945
+ ideal I = fetch(ER,I);
1946
+ }
1947
+
1948
+ export(I);
1949
+ return (basering);
1950
+ }
1951
+
1952
+ example
1953
+ {
1954
+ "EXAMPLE: Computing the Orlik-Solomon-Ideal for the D3-Arrangement"; echo = 2;
1955
+ ring R = 0,(x,y,z),dp;
1956
+ arr A = arrTypeB(3);
1957
+ def E = arrOrlikSolomon(A);
1958
+ setring E;
1959
+ //The generators of the Orlik-Solomon-Ideal are:
1960
+ I;
1961
+ }
1962
+
1963
+
1964
+ // The following 3 procedures were replaced by their faster combinatorial counterparts
1965
+
1966
+ /*
1967
+
1968
+ // poincare polynomial of the arrangement
1969
+ proc arrPoincare(arr A)
1970
+ "USAGE: arrPoincare(A); arr A
1971
+ RETURN: [intvec] The Poincare polynomial as integer vector of the arrangement, which
1972
+ is equal to the second kind Poincare-Series of the Orlik-Solomon Algebra.
1973
+ SEE ALSO: arrPoincare, arrChambers, arrBoundedChambers
1974
+ KEYWORDS: Poincare polynomial
1975
+ EXAMPLE: example arrPoincare;"
1976
+
1977
+ {
1978
+ def startRing = basering;
1979
+ def Ext = arrOrlikSolomon(A);
1980
+ setring Ext;
1981
+ ideal OSI = lead(I);
1982
+ OSI = OSI + ideal(Ext);
1983
+ int n = nvars(Ext);
1984
+ ring suppRing = 0,x(1..n),dp;
1985
+ ideal I = fetch(Ext,OSI);
1986
+ intvec HP = hilb(std(I),2);
1987
+
1988
+ return(HP);
1989
+ }
1990
+
1991
+ example
1992
+ {
1993
+ "EXAMPLE: Computing the Poincare polynomial as intvec for the D3-Arrangement"; echo = 2;
1994
+ ring R = 0,(x,y,z),dp;
1995
+ arr A = arrTypeB(3);
1996
+ //The coefficients of the Poincare polynomial are:
1997
+ arrPoincare(A);
1998
+ }
1999
+
2000
+
2001
+ // number of chambers of the arrangement
2002
+ proc arrChambers(arr A)
2003
+ "USAGE: arrChambers(A); arr A
2004
+ RETURN: [int] The number of chambers of an arrangement, which is equal to the
2005
+ evaluation of the Poincare polynomial at 1.
2006
+ SEE ALSO: arrPoincare, arrChambers, arrBoundedChambers
2007
+ KEYWORDS: chambers
2008
+ EXAMPLE: example arrChambers;"
2009
+
2010
+ {
2011
+ intvec HP = arrPoincare(A);
2012
+ intvec ones = 1:(size(HP));
2013
+ return ( transpose(ones)*HP );
2014
+ }
2015
+
2016
+ example
2017
+ {
2018
+ "EXAMPLE: Computing the number of chambers for the D3-Arrangement"; echo = 2;
2019
+ ring R = 0,(x,y,z),dp;
2020
+ arr A = arrTypeD(3);
2021
+ //The number of chambers of the D3-Arrangement is:
2022
+ arrChambers(A);
2023
+ }
2024
+
2025
+
2026
+ // number of bounded chambers of the arrangement
2027
+ proc arrBoundedChambers(arr A)
2028
+ "USAGE: arrBoundedChambers(A); arr A
2029
+ RETURN: [int] The number of bounded chambers of an arrangement, which is equal to
2030
+ the evaluation of the Poincare polynomial at -1.
2031
+ SEE ALSO: arrPoincare, arrChambers, arrBoundedChambers
2032
+ KEYWORDS: chambers
2033
+ EXAMPLE: example arrBoundedChambers;"
2034
+
2035
+ {
2036
+ intvec HP = arrPoincare(A);
2037
+ intvec altOnes;
2038
+ for(int i=1; i<=size(HP); i++){
2039
+ altOnes[i] = (-1)^(i-1);
2040
+ }
2041
+
2042
+ return ( transpose(altOnes)*HP );
2043
+ }
2044
+
2045
+ example
2046
+ {
2047
+ "EXAMPLE: Computing the number of chambers for the D3-Arrangement"; echo = 2;
2048
+ ring R = 0,(x,y,z),dp;
2049
+ arr A = arrTypeD(3);
2050
+ // The number of bounded chambers of the D3-Arrangement is:
2051
+ arrBoundedChambers(A);
2052
+ }
2053
+
2054
+ */
2055
+
2056
+ //============================================================================//
2057
+ //------------------------------- #14 Freeness -------------------------------//
2058
+ //============================================================================//
2059
+
2060
+
2061
+ // module of derivation
2062
+ proc arrDer
2063
+ "USAGE: arrDer(A); arr A , multarr A
2064
+ RETURN: [module] The module Der(A) of derivations of the (multi-)arrangement A, i.e.
2065
+ the derivations tangent to each hyperplane of A (resp. with multiplicities)
2066
+ NOTE: This is only defined for central (multi-)arrangements
2067
+ SEE ALSO: arrDer, arrIsFree, arrExponents
2068
+ KEYWORDS: derivation; multiarrangement
2069
+ EXAMPLE: example arrDer;"
2070
+
2071
+ {
2072
+ def A = #[1];
2073
+ if( (typeof(A) != "arr") && ( typeof(A) != "multarr") ){
2074
+ ERROR("bad input type!");
2075
+ } if(homog(A.l) == 0){
2076
+ ERROR("Arrangement not central!");
2077
+ }
2078
+
2079
+ module fA = jacob(A.l);
2080
+ ideal J;
2081
+
2082
+ if( typeof(A) == "arr" ){
2083
+ J = arr2ideal(A);
2084
+ } if(typeof(A) == "multarr"){
2085
+ J = multIdeal(A);
2086
+ }
2087
+
2088
+ module tA = diag(matrix(J));
2089
+ module K = modulo(fA,tA);
2090
+ module derivations = lessGenerators(K);
2091
+
2092
+ return (derivations);
2093
+ }
2094
+
2095
+ example
2096
+ {
2097
+ "EXAMPLE: Computing the derivation module of the boolean and braid arrangement";
2098
+ echo = 2;
2099
+ ring R = 0,(x,y,z),dp;
2100
+ arr A3 = arrBoolean(3);
2101
+ arr B3 = arrTypeB(3);
2102
+ arr G = ideal(x,y,z,x+y+z);
2103
+ //The derivation module of the Boolean 3-arrangement:
2104
+ arrDer(A3);
2105
+ //The derivation module of the Braid 3-arrangement:
2106
+ arrDer(B3);
2107
+ //The derivation module of the generic arrangement:
2108
+ arrDer(G);
2109
+ }
2110
+
2111
+
2112
+ // checks if arrangement is free
2113
+ proc arrIsFree(list #)
2114
+ "USAGE: arrIsFree(A); arr A, multarr A
2115
+ RETURN: [0,1] 1 if the (multi-)arrangement is free, i.e. Der(A) is a free module
2116
+ NOTE: only defined for central arrangements
2117
+ SEE ALSO: arrDer, arrIsFree, arrExponents
2118
+ KEYWORDS: free; multiarrangement
2119
+ EXAMPLE: example arrIsFree;"
2120
+
2121
+ {
2122
+ def A = #[1];
2123
+ module derivations = arrDer(A);
2124
+ return ( nvars(basering) == ncols(derivations) );
2125
+ }
2126
+
2127
+ example
2128
+ {
2129
+ "EXAMPLE: checking freeness of the Edelman-Reiner arrangement and its restriction: ";
2130
+ echo = 2;
2131
+ ring R = 0,(x,y,z),dp;
2132
+ arr A3 = arrBoolean(3);
2133
+ arr B3 = arrTypeB(3);
2134
+ arr G = ideal(x,y,z,x+y+z);
2135
+
2136
+ arrIsFree(A3);
2137
+
2138
+ arrIsFree(B3);
2139
+
2140
+ arrIsFree(G);
2141
+ }
2142
+
2143
+
2144
+ // exponents of a (free) arrangement
2145
+ proc arrExponents
2146
+ "USAGE: arrExponents(A); arr A, multarr A
2147
+ RETURN: [intvec] The exponents of a free (multi-) arrangement, i.e. the degrees of a
2148
+ basis of D(A) the derivation module.
2149
+ NOTE: only defined for central arrangements
2150
+ SEE ALSO: arrDer, arrIsFree, arrExponents
2151
+ KEYWORDS: free; exponents; multiarrangement
2152
+ EXAMPLE: example arrExponents;"
2153
+
2154
+ {
2155
+ def A = #[1];
2156
+
2157
+ if(arrIsFree(A) != 1){ ERROR("Arrangement is not free!"); }
2158
+
2159
+ module der = arrDer(A);
2160
+ intvec exp;
2161
+
2162
+ for(int i =1; i<=size(der); i++){
2163
+ exp[i] = deg(der[i]);
2164
+ }
2165
+
2166
+ return(exp);
2167
+ }
2168
+
2169
+ example
2170
+ {
2171
+ "EXAMPLE: computing the exponents of the Edelman-Reiner arrangement and its restriction: ";
2172
+ echo = 2;
2173
+ ring R = 0,(x,y,z),dp;
2174
+ arr A3 = arrBoolean(3);
2175
+ arr B3 = arrTypeB(3);
2176
+ arr G = ideal(x,y,z,x+y+z);
2177
+
2178
+ arrExponents(A3);
2179
+
2180
+ arrExponents(B3);
2181
+
2182
+ }
2183
+
2184
+
2185
+ // Tries to reduce the number of generators of a generating set for a module
2186
+ static proc lessGenerators(module X){
2187
+ module Z = syz(X);
2188
+ matrix K = getColumnIndependentUnitPositions(Z);
2189
+
2190
+ if( K == unitmat(nrows(Z)) ){
2191
+ return(X);
2192
+ }
2193
+
2194
+ module Xnew = X*K;
2195
+ Xnew = simplify(Xnew,2);
2196
+
2197
+ return(lessGenerators(Xnew));
2198
+ }
2199
+
2200
+
2201
+ // Looks for a generator which is redundant
2202
+ static proc getColumnIndependentUnitPositions(module Z){
2203
+ int n = nrows(Z); // number of generators of D
2204
+ matrix K = unitmat(n);
2205
+ int i;
2206
+ for(int j=1; j<=ncols(Z); j++){
2207
+ for(i=1; i<=nrows(Z); i++){
2208
+ if(deg(Z[i,j]) == 0){
2209
+ K[i,i] = 0;
2210
+ return(K);
2211
+ }
2212
+ }
2213
+ }
2214
+
2215
+ return(K);
2216
+ }
2217
+
2218
+
2219
+ // Outputs the ideal of powers of hyperplanes of a multiarrangement.
2220
+ // Needed for the computation of arrDer.
2221
+ static proc multIdeal(multarr A){
2222
+ ideal I;
2223
+
2224
+ for(int i=1; i<=size(A.l); i++){
2225
+ I[i] = A.l[i]^A.m[i];
2226
+ }
2227
+
2228
+ return(I);
2229
+ }
2230
+
2231
+
2232
+ //============================================================================//
2233
+ //-------------------------- #15 MULTI-ARRANGEMENTS --------------------------//
2234
+ //============================================================================//
2235
+
2236
+ //============================================================================//
2237
+ //------------------------------- CONSTRUCTORS -------------------------------//
2238
+ //============================================================================//
2239
+
2240
+
2241
+ // general method for creating multiarrangements
2242
+ static proc multarrAdd
2243
+ "USAGE: A = #; A +#; # list containing arr/ideal/list/matrix/poly
2244
+ RETURN: [multarr] multiarrangement constructed by the input parameters.
2245
+ NOTE: algorithm splits up the list # and uses appropriate procedure
2246
+ to handle the input
2247
+ KEYWORDS: multiarrangement; equal; constructor; operator
2248
+ EXAMPLE: example multarrAdd; shows an example"
2249
+
2250
+ {
2251
+ multarr A;
2252
+ for(int k=1; k<=size(#); k++){
2253
+ while(1){ //simulates switch, which singular doesn't offer
2254
+ if(typeof(#[k]) == "poly" ) {A = multarrAddPoly (A, #[k]);break;}
2255
+ if(typeof(#[k]) == "ideal") {A = multarrAddIdeal(A, #[k]);break;}
2256
+ if(typeof(#[k]) == "multarr"){A = multarrAddArr (A, #[k]);break;}
2257
+ if(typeof(#[k]) == "list" ) {A = multarrAdd ( #[k]);break;}
2258
+ ERROR("bad input type");
2259
+ }
2260
+ }
2261
+ return (A);
2262
+ }
2263
+
2264
+ example
2265
+ {
2266
+ "EXAMPLE: Creating a few multiarrangements"; echo = 2;
2267
+ ring R = 0,(x,y,z),dp;
2268
+ multarr A = ideal(x,y,z,x); A;
2269
+ multarr B = A + ideal(x+1, x-1,y); B;
2270
+ multarr C = list(B, x+1, x-1); C;
2271
+ multarr D = (x2 - y2)^2; D;
2272
+ }
2273
+
2274
+
2275
+ // adds a single poly to the arrangement
2276
+ // if the poly is linear, it is just added. If not Singular tries factorization
2277
+ static proc multarrAddPoly(multarr A, poly p)
2278
+ {
2279
+ p=simplify(p,1);
2280
+ if(deg(p) == 0){
2281
+ ERROR("Given poly is not linear or Singluar is not able to factorize it");}
2282
+ else{
2283
+ if(deg(p) == 1){
2284
+ int k;
2285
+ int b = 0;
2286
+ for(k=1; k<=size(A.l); k++){
2287
+ if(A.l[k] == p){
2288
+ A.m[k] = A.m[k]+1;
2289
+ b = 1;
2290
+ }
2291
+ }
2292
+ if(b == 0){
2293
+ A.l[size(A.l)+1] = p;
2294
+ A.m[size(A.l)] = 1;
2295
+ }
2296
+ return(A);
2297
+ }
2298
+ else{
2299
+ list I = factorize(p,2);
2300
+ if((size(I[1]) == 1) && (deg(I[1][1] > 1))){ERROR("Given poly is not a hyperplane");}
2301
+ else{
2302
+ int j,i;
2303
+ ideal J;
2304
+ for(i=1; i<=size(I[1]); i++)
2305
+ {
2306
+ for(j=1; j<=I[2][i]; j++){
2307
+ J[size(J)+1] = I[1][i];
2308
+ }
2309
+ }
2310
+ return (multarrAdd(A,J));
2311
+ }
2312
+ }
2313
+ }
2314
+ return(A);
2315
+ }
2316
+
2317
+
2318
+ // adds defining polys to the arrangement
2319
+ static proc multarrAddIdeal(multarr A, ideal I){
2320
+ for(int k=1; k<=size(I); k++){
2321
+ A = multarrAddPoly(A,I[k]);
2322
+ } return (A);
2323
+ }
2324
+
2325
+
2326
+ // union of two multarrangements
2327
+ static proc multarrAddArr(multarr A, multarr B){
2328
+ return (multarrAddIdeal(A, multIdeal(B)));
2329
+ }
2330
+
2331
+
2332
+ //============================================================================//
2333
+ //------------------------------- TYPE CASTING -------------------------------//
2334
+ //============================================================================//
2335
+
2336
+
2337
+ // computes the defining polynomial
2338
+ static proc multarr2poly(multarr A)
2339
+ "USAGE: multArrQPoly(multarr A);
2340
+ RETURN: [poly] q: defining polynomial of a multiarrangement with multiplicities
2341
+ SEE ALSO: arr2poly, multarr2poly
2342
+ KEYWORDS: multiarrangement; defining polynomial
2343
+ EXAMPLE: example multArrQPolys;"
2344
+
2345
+ {
2346
+ poly q=1;
2347
+ for(int i=1;i<=size(A.l);i=i+1)
2348
+ {
2349
+ q=q*A.l[i]^A.m[i];
2350
+ }
2351
+ return(q);
2352
+ }
2353
+
2354
+ example
2355
+ {
2356
+ "EXAMPLE: Computing the Q-Poly for a multiarrangement"; echo = 2;
2357
+ ring R = 0,(x,y,z),dp;
2358
+ multarr A = ideal(x,y,z,x,y,x-y,x-z,x-z,y-z); A;
2359
+ poly q=multarr2poly(A); q;
2360
+ }
2361
+
2362
+
2363
+ // converts simple arrangement to multiarrangement
2364
+ proc arr2multarr(arr A, intvec v)
2365
+ "USAGE: multArrFromIntvec(arr A, intvec v);
2366
+ RETURN: [multarr] multiarrangement MA, which is the arrangement A with multiplicities v
2367
+ NOTE: the size of v must match the number of hyperplanes of the arrangement A
2368
+ SEE ALSO: arr2multarr, multarr2arr
2369
+ KEYWORDS: multiarrangement; arrangement; constructor
2370
+ EXAMPLE: example arr2multarr"
2371
+
2372
+ {
2373
+ if(ncols(A.l)!=size(v)){
2374
+ ERROR("Vector's size does not match the hyperplanes.");
2375
+ }
2376
+ multarr B;
2377
+ B.l=A.l;
2378
+ B.m=v;
2379
+ return(B);
2380
+ }
2381
+
2382
+ example
2383
+ {
2384
+ "EXAMPLE:"; echo = 2;
2385
+ ring R = 0,(x,y,z),dp;
2386
+ arr A = arrTypeB(3); A;
2387
+ intvec v=2:9; v;
2388
+ multarr MA=arr2multarr(A,v);
2389
+ MA;
2390
+ }
2391
+
2392
+
2393
+ // converts multiarrangement to simple arrangement
2394
+ proc multarr2arr(multarr A)
2395
+ "USAGE: multarr2arr(multarr A, intvec v);
2396
+ RETURN: [arr] arrangement A, with all multiplicities removed
2397
+ SEE ALSO: arr2multarr, multarr2arr
2398
+ KEYWORDS: multiarrangement; arrangement; constructor
2399
+ EXAMPLE: example multarr2arr"
2400
+
2401
+ {
2402
+ arr B;
2403
+ B.l=A.l;
2404
+ return(B);
2405
+ }
2406
+
2407
+ example
2408
+ {
2409
+ "EXAMPLE:"; echo = 2;
2410
+ ring r = 0,(x,y,z),dp;
2411
+ multarr A=x2y3z5; A;
2412
+ arr AS = multarr2arr(A); AS;
2413
+ }
2414
+
2415
+
2416
+ //============================================================================//
2417
+ //------------------------------- PRINTING -----------------------------------//
2418
+ //============================================================================//
2419
+
2420
+
2421
+ // prints arrangement in the console
2422
+ static proc multarrPrint(multarr A)
2423
+ "USAGE: A; A arr
2424
+ RETURN: [] better readable output in the console as newstruct print.
2425
+ SEE ALSO: arrPrint, multarrPrint
2426
+ KEYWORDS: print
2427
+ EXAMPLE: example multarrPrint;"
2428
+
2429
+ {
2430
+ for(int j=1;j<=ncols(A.l);j++){
2431
+ print("_["+string(j)+"]=("+string(A.l[j])+")^"+ string(A.m[j]));
2432
+ }
2433
+ }
2434
+
2435
+ example
2436
+ {
2437
+ "EXAMPLE:"; echo = 2;
2438
+ ring R = 0,(x,y,z),dp;
2439
+ multarr A = ideal(x2,y3,z);
2440
+ A;
2441
+ }
2442
+
2443
+
2444
+ // number of hyperplanes with multiplicities
2445
+ static proc multarrSize(multarr A)
2446
+ "USAGE: size(A); A multarr
2447
+ RETURN: [int] Number of hyperplanes with multiplicities
2448
+ SEE ALSO: arrSize
2449
+ KEYWORDS: multiarrangement; size; number; hyperplanes
2450
+ EXAMPLE: example multarrSize;"
2451
+
2452
+ {
2453
+ return (sum(A.m));
2454
+ }
2455
+
2456
+ example
2457
+ {
2458
+ "EXAMPLE:"; echo = 2;
2459
+ ring R = 0,(x,y,z),dp;
2460
+ multarr A = ideal(x2,y3,z);
2461
+ A;
2462
+ }
2463
+
2464
+
2465
+ //============================================================================//
2466
+ //------------------------ RESTRICTION & DELETION ----------------------------//
2467
+ //============================================================================//
2468
+
2469
+
2470
+ // decrements the multiplicity of a hyperplane by one
2471
+ static proc multarrDelete(multarr A, int k)
2472
+ "USAGE: multarrDelete(A, k); arrangement A, integer k;
2473
+ RETURN: [multarr] the hyperplane Multiarrangement A', i.e. the multiarrangement
2474
+ with multiplicity of H_k decremented by one. If m(H_k)=1, then the hyperplane
2475
+ H_k is deleted
2476
+ SEE ALSO: arrDelete, multarrDelete,
2477
+ KEYWORDS: multiarrangement; delete
2478
+ EXAMPLE: example multarrDelete;"
2479
+
2480
+ {
2481
+ if(k>ncols(A.l)){
2482
+ ERROR("There is no k-th hyperplane");
2483
+ }
2484
+
2485
+ poly q = multarr2poly(A);
2486
+ q = q/(A.l[k]);
2487
+ multarr MA = q;
2488
+ return (MA);
2489
+ }
2490
+
2491
+ example
2492
+ {
2493
+ "EXAMPLE:"; echo = 2;
2494
+ ring R = 0,(x,y,z),dp;
2495
+ multarr A =ideal(x2,y3,z);
2496
+ multarr AD = multarrDelete(A,2); AD;
2497
+ }
2498
+
2499
+
2500
+ // restriction of A (as arr) to a hyperplane with multiplicities
2501
+ proc multarrRestrict(arr A,intvec v, list #)
2502
+ "USAGE: multarrRestrict(A, v); arrangement A, int/intvec v, optional argument "CC";
2503
+ RETURN: [multarr] the restricted hyperplane Multi-Arrangement (A^X) with multiplicities
2504
+ i.e. counting how often one element of the restricted arrangement occurs
2505
+ as intersetion of hyperplane of the first arrangement. This definition
2506
+ is due to Guenter M. Ziegler.
2507
+ NOTE: A has to be non-empty.
2508
+ REMARKS: We restrict A to the flat X, defined by the equations in A[v].
2509
+ The restriction will only be performed, if the ideal defining
2510
+ the flat X is monomial (i.e. X is an intersection of coordinate planes).
2511
+ If the optional argument CC is given, the arrangement is transformed
2512
+ in such a way that X has the above form.
2513
+ SEE ALSO: multarrRestrict, multarrMultRestrict, arrRestrict
2514
+ KEYWORDS: multiarrangement; restriction
2515
+ EXAMPLE: example multarrRestrict; "
2516
+
2517
+ {
2518
+ ideal I=A.l;
2519
+ I=I[v];
2520
+ option(redSB);
2521
+ I=std(I); // defining equations for flat X
2522
+ //option(none);
2523
+ ideal Al=arr2ideal(A);
2524
+ int i;
2525
+
2526
+ if(isMonomial(I)==1){
2527
+ for(i=1;i<= size(I);i++){
2528
+ Al=subst(Al,I[i],0);
2529
+ }
2530
+ multarr AR=simplify(Al,3);
2531
+ return(AR);
2532
+ }
2533
+
2534
+ if(size(#) == 0){
2535
+ ERROR("The flat X is not defined by a monomial ideal. " +
2536
+ "Please do a coordinate change first. You can use arrCoordNormalize to " +
2537
+ "transform the arrangement accordingly by adding the argument CC.");
2538
+ }
2539
+ if(#[1]!="CC"){
2540
+ ERROR("The flat X is not defined by a monomial ideal. " +
2541
+ "Please do a coordinate change first. You can use arrCoordNormalize to " +
2542
+ "transform the arrangement accordingly by adding the argument CC.");
2543
+ }
2544
+ if(size(v)==0){return(A);}
2545
+ intvec w=v[1];
2546
+ intvec tmp;
2547
+
2548
+ for(i=2;i<=size(v);i++){
2549
+ tmp=w,v[i];
2550
+ if(rank(matrix(A[w]))==size(tmp)){
2551
+ w=tmp;
2552
+ }
2553
+ }
2554
+
2555
+ arr B=arrCoordNormalize(A,w);
2556
+ ideal Bl=arr2ideal(B);
2557
+
2558
+ for(i=1;i<= size(w);i++){
2559
+ Bl=subst(Bl,Bl[w[i]],0);
2560
+ }
2561
+ multarr BR=simplify(Bl,3);
2562
+ return(BR);
2563
+ }
2564
+
2565
+ example
2566
+ {
2567
+ "EXAMPLE:"; echo = 2;
2568
+ ring R = 0,x(1..5),dp;
2569
+ arr A = arrEdelmanReiner(); A;
2570
+ multarr AR = multarrRestrict(A,6,"CC"); AR;
2571
+ }
2572
+
2573
+
2574
+ // restriction of A (as multarr) to a hyperplane with multiplicities
2575
+ proc multarrMultRestrict(multarr A,int k)
2576
+ "USAGE: multarrMultRestrict(A, k); multiarrangement A, integer k;
2577
+ RETURN: [multarr] the restricted hyperplane Multi-Arrangement (A^H_k) with multiplicities, i.e.
2578
+ counting with multiplicities how often one element of the restricted arrangement occurs
2579
+ as intersetion of hyperplane of the first multiarrangement.
2580
+ This definition is due to Guenter M. Ziegler.
2581
+ NOTE: A has to be non-empty.
2582
+ REMARKS: The restriction will only be performed, if H_k = ker(x_i) for some i.
2583
+ One can also restrict an arrangement with respect to any hyper-
2584
+ plane k, but than a coordinate change is necessary first to make
2585
+ H_k = ker(x_k). Since such a coordinate change is not unique, please
2586
+ use arrCoordchange to do so.
2587
+ SEE ALSO: multarrRestrict, multarrMultRestrict, arrRestrict
2588
+ KEYWORDS: multiarrangement; restriction
2589
+ EXAMPLE: example multarrMultRestrict; "
2590
+
2591
+ {
2592
+ ideal I = variables(A.l);
2593
+ ideal J;
2594
+ int j,i;
2595
+ for(i=1;i<=size(A.l);i=i+1)
2596
+ {
2597
+ for(j=1;j<=A.m[i];j++){
2598
+ J[ncols(J)+1]=A.l[i];
2599
+ }
2600
+ }
2601
+ poly p = simplify(A.l[k],1);
2602
+ int n = rvar(p);
2603
+ if( n == 0 ){
2604
+ ERROR("H_" + string(k) + " = " + string(p) +
2605
+ " is not of the form ker(x_i). Please do a coordinate change first." +
2606
+ "You can use arrCoordinateChange to transform the arrangement accordingly.");
2607
+ }
2608
+ J = subst(J, p, 0);
2609
+ multarr MA = simplify(J,3);
2610
+ return(MA);
2611
+ }
2612
+
2613
+ example
2614
+ {
2615
+ "EXAMPLE:"; echo = 2;
2616
+ ring R = 0,(x,y,z),dp;
2617
+ multarr A =ideal(x2,y2,z2,(x-y)^3,(x-z)^2,(y-z)); A;
2618
+ //The restriction of the multiarrangement is:
2619
+ multarr AR = multarrMultRestrict(A,1); AR;
2620
+ }
2621
+
2622
+
2623
+ //============================================================================//
2624
+ //----------------------------- #16 COMBINATORICS ---------------------------//
2625
+ //============================================================================//
2626
+
2627
+ /*
2628
+ RELATIONS can have 3 values:
2629
+ -1 : flat&hyperplane are parallel
2630
+ 0 : hyperplane intersects the flat, but only further on in the lattice.
2631
+ +1 : hyperplane is part of the flat.
2632
+
2633
+ */
2634
+ // intvec: multiplicities of hyperplanes
2635
+
2636
+
2637
+ proc arrLattice(arr ARR)
2638
+ "USAGE: arrLattice(arr ARR)
2639
+ RETURN: [arrposet] intersection poset of the arrangement
2640
+ NOTE: The algorithm works by a bottom up approach, i.e. it calculates the
2641
+ SEE ALSO: arrLattice, arrFlats
2642
+ KEYWORDS: intersection lattice; poset; lattice
2643
+ EXAMPLE: example arrFlats;"
2644
+
2645
+ {
2646
+
2647
+ //Performance test
2648
+ system("--ticks-per-sec",1);
2649
+ timer = 0;
2650
+ int start = timer;
2651
+ // start
2652
+ dbprint(3-voice,newline);
2653
+ dbprint(3-voice,"=== Computing poset ===");
2654
+ dbprint(3-voice,newline);
2655
+
2656
+ // Initialization
2657
+ list L,L2;
2658
+ intvec u,v, NFLAT;
2659
+ int i,j,l,m,n,rk, rk2,rk3, tic, toc, numberOfFlats,numberOfHplanes, counter, ntests;
2660
+ matrix NewRel, M;
2661
+
2662
+ // Initialization of matrix
2663
+ ntests = 0;
2664
+ M = matrix(ARR); // m x n+1 matrix
2665
+ m = size(ARR); // m = # hplanes
2666
+ n = nvars(basering); // n = # variables
2667
+ numberOfHplanes = m;
2668
+
2669
+ // Initialization of poset and flat
2670
+ flat F;
2671
+ arrposet P; P.A = ARR;
2672
+ F.REL = 0:m; F.moebius = -1;
2673
+ for(i=1; i<=n; i++){ P.r = insert(P.r,list());}
2674
+ for(i=1; i<=m; i++){ F.REL[i] = 1; L[i] = F; F.REL[i] = 0;}
2675
+ F.moebius = 0;
2676
+ P.r[1] = L;
2677
+
2678
+ // calculating r[i] step by step
2679
+ for(rk=2; rk<=rank(ARR); rk++){ // maximal flat possible has rank A.v ofc
2680
+ counter = 0;
2681
+ tic = timer;
2682
+
2683
+ // Initialization of current round
2684
+ L = P.r[rk-1]; // flats from the last iteration give rise to current ones.
2685
+ numberOfFlats = size(L);
2686
+ L2 = list(); // new list for elts of rk=
2687
+ NewRel = getOldRel(L,m); // contains all the information of the old arrangement
2688
+
2689
+ // find the next leftmost child by looking for intersetion of F_j with hyperplanes
2690
+ for(j=1; j<=numberOfFlats; j++){ // goes over the elts of L.r[i-1]
2691
+
2692
+ NFLAT = L[j].REL;
2693
+
2694
+ for(i=1; i<=numberOfHplanes; i++){
2695
+ if (NewRel[i,j] == 0){
2696
+ //test this hyperplane
2697
+ NFLAT[i] = 1;
2698
+ v = collectHplanes(NFLAT);
2699
+ rk2 = rank(submat(M,v,1..n));
2700
+ ntests = ntests+2;
2701
+
2702
+ // CHILD FOUND BY INTERSECTING WITH H_i
2703
+ if(rk2 == rank(submat(M,v,1..n+1))){
2704
+ NewRel[i,j] = 1; counter++;
2705
+
2706
+ // potentially there exist more hyperplanes which intersect in the same space
2707
+ for(l=i+1; l<=m; l++){
2708
+ if(NewRel[l,j] == 0){
2709
+ NFLAT[l] = 1;
2710
+ u = collectHplanes(NFLAT);
2711
+ rk3 = rank(submat(M, u, 1..n));
2712
+ ntests = ntests +2;
2713
+
2714
+ // FLAT EXISTS
2715
+ if(rk3 == rank(submat(M,u,1..n+1)) ){
2716
+ if(rk2 == rk3){NewRel[l,j] = 1;}
2717
+ else{NFLAT[l] = 0;} //itersecting with both yields higher rank flat
2718
+ }
2719
+
2720
+ // FLAT DOES NOT EXIST
2721
+ else{NFLAT[l] = -1;}
2722
+ }
2723
+ }
2724
+
2725
+ // Add new flat to list, reset NFLAT.
2726
+ F.REL = NFLAT;
2727
+ NFLAT = L[j].REL; // refresh.
2728
+
2729
+ // Find Parents: (most expensive part it seems)
2730
+ F.parents = j:1; //parent in any case
2731
+ for(l=j+1; l<=numberOfFlats; l++){
2732
+ if(isParent(L[l].REL, F.REL)){
2733
+ F.parents = F.parents,l;
2734
+ NewRel[1..m,l] = updateRel(F.REL, submat(NewRel,1..m,l));
2735
+ }
2736
+ }
2737
+
2738
+ L2 = insert(L2,F,size(L2));
2739
+
2740
+ // means that the flat is parallel
2741
+ } else{
2742
+ L[j].REL[i] = -1;
2743
+ NewRel[i,j] = -1;
2744
+ NFLAT[i] = -1;
2745
+ }
2746
+
2747
+ }
2748
+ }
2749
+ }
2750
+
2751
+ toc = timer;
2752
+ dbprint(3-voice,"rank "+string(rk)+": found "+ string(counter) +
2753
+ " flats in "+string(toc - tic)+"s");
2754
+ counter = 0;
2755
+ P.r[rk] = L2;
2756
+ }
2757
+
2758
+ dbprint(3-voice,newline);
2759
+ //dbprint(3-voice,"Computation time: "+string(timer - start)+"s");
2760
+ dbprint(3-voice,"Matrix tests: "+string(ntests));
2761
+ return (P);
2762
+ }
2763
+
2764
+ example
2765
+ {
2766
+ "EXAMPLE: Intersection lattice of the braid arrangement in 3 dimensions "; echo = 2;
2767
+ ring r;
2768
+ arrLattice(arrTypeB(3));
2769
+ }
2770
+
2771
+
2772
+ static proc arrRank(arr A){
2773
+ int n = rank(matrix(A));
2774
+ int m = nvars(A);
2775
+ if(n < m) {return (n);}
2776
+ return (m);
2777
+ }
2778
+
2779
+ static proc getOldRel(list L, int m){
2780
+ int n = size(L);
2781
+ matrix NewRel[m][n];
2782
+
2783
+ for(int i=1; i<=n; i++){
2784
+ NewRel[1..m,i] = L[i].REL;
2785
+ }
2786
+
2787
+ return (NewRel);
2788
+ }
2789
+
2790
+ static proc updateRel(intvec REL, matrix NewRel){
2791
+ for(int i=1; i<=size(REL); i++){
2792
+ if(NewRel[i,1] == 0 && REL[i] == 1){NewRel[i,1] = 1;}
2793
+ }
2794
+
2795
+ return (NewRel);
2796
+ }
2797
+
2798
+ // Flat F is a parent of Flat G if F[i] == 1 => G[i] == 1 for all i
2799
+ static proc isParent(intvec parent, intvec child){
2800
+ int counter = 0;
2801
+ for(int i=1; i<= size(parent); i++){
2802
+ if(parent[i]==1){
2803
+ if(child[i] == 1){counter++;}
2804
+ else{ return (0); }
2805
+ }
2806
+ }
2807
+ if(counter == 0){ return (0); }
2808
+ return (1);
2809
+ }
2810
+
2811
+ // transforms the "rel" intvec into an intvec which contains the indices of the hyperplanes.
2812
+ static proc collectHplanes(intvec RELATIONS){
2813
+ intvec result;
2814
+
2815
+ for(int i=1; i<=size(RELATIONS); i++){
2816
+ if(RELATIONS[i] > 0){result = result,i;}
2817
+ }
2818
+
2819
+ result = result[2..size(result)];
2820
+
2821
+ return (result);
2822
+
2823
+ }
2824
+
2825
+ static proc getFlat(arrposet P, int i, int j){
2826
+ list L = P.r[i];
2827
+ return (L[j]);
2828
+ }
2829
+
2830
+ static proc setFlat(arrposet P, int i, int j, flat F){
2831
+ list L = P.r[i];
2832
+ L[j] = F;
2833
+ P.r[i] = L;
2834
+ return (P);
2835
+ }
2836
+
2837
+ static proc getFlag(arrposet P, int i, int j){
2838
+ flat F = getFlat(P,i,j);
2839
+ return (F.flag);
2840
+ }
2841
+
2842
+ static proc setFlag(arrposet P, int i, int j, int flag){
2843
+ flat F = getFlat(P,i,j);
2844
+ F.flag = flag;
2845
+ return (setFlat(P,i,j,F));
2846
+ }
2847
+
2848
+ //============================================================================//
2849
+ //------------------------- #16 INTERSECTION-LATTICE -------------------------//
2850
+ //============================================================================//
2851
+ //============================================================================//
2852
+ //-------------------------- MOEBIUS -------------------------------------//
2853
+ //============================================================================//
2854
+
2855
+
2856
+ // calculates the moebius values of the poset
2857
+ proc moebius(arrposet P)
2858
+ "USAGE: moebius(arrposet P)
2859
+ RETURN: [arrposet] fills in the moebius values of the flats in the poset
2860
+ SEE ALSO: moebius
2861
+ KEYWORDS: moebius function
2862
+ EXAMPLE: example arrCharPoly; shows an example"
2863
+
2864
+ {
2865
+ list L;
2866
+ int i,j;
2867
+
2868
+ for(i=2; i<=rank(P.A); i++){
2869
+ L = P.r[i];
2870
+
2871
+ for(j=1; j<=size(L); j++){
2872
+ arrposet Q = P;
2873
+ export Q;
2874
+ L[j].moebius = -(1 + moebiusRecursion(i, j));
2875
+ kill Q;
2876
+ }
2877
+ P.r[i] = L;
2878
+
2879
+ }
2880
+
2881
+ return (P);
2882
+ }
2883
+
2884
+ example
2885
+ {
2886
+ "EXAMPLE: We look at the moebius values of the braid arrangement in 4 dimensions: "; echo = 2;
2887
+ ring R = 0,(x,y,z,t),dp;
2888
+ arr A = arrBraid(4);
2889
+ arrposet P = arrLattice(A);
2890
+ P;
2891
+ //As you can see the values are not calculated yet:
2892
+
2893
+ printMoebius(P);
2894
+ P = moebius(P);
2895
+
2896
+ //Now all entries are initialized:
2897
+
2898
+ printMoebius(P);
2899
+ }
2900
+
2901
+
2902
+ // moebiusrecursion(i,j) is the sum moebius(X) over {X | V>X>Flat_ij}
2903
+ // Vss: all moebius values of rank < i are known and correctly saved in P
2904
+ static proc moebiusRecursion(int i, int j){
2905
+ flat F = getFlat(Q, i, j);
2906
+ int m = F.moebius;
2907
+
2908
+ if(getFlag(Q,i,j) == 1){return (0);}
2909
+ else {
2910
+ Q = setFlag(Q,i,j,1);
2911
+ if(i > 1){
2912
+ for(int k=1; k<=size(F.parents); k++){
2913
+ m = m + moebiusRecursion(i-1, F.parents[k]);
2914
+ }
2915
+ }
2916
+ }
2917
+
2918
+ return (m);
2919
+ }
2920
+
2921
+
2922
+ // pi(A,t) = sum[X in L(A); moebius(X)*(-t)^r(X)]
2923
+ proc arrPoincare(def input)
2924
+ "USAGE: arrPoincare(A); arr A
2925
+ RETURN: [intvec] The Poincare polynomial as integer vector of the arrangement, which
2926
+ is equal to the second kind Poincare-Series of the Orlik-Solomon Algebra.
2927
+ SEE ALSO: arrPoincare, arrChambers, arrBoundedChambers
2928
+ KEYWORDS: Poincare polynomial
2929
+ EXAMPLE: example arrPoincare;"
2930
+
2931
+ {
2932
+ while(1){
2933
+ if(typeof(input) == "arr"){
2934
+ arr A = input;
2935
+ arrposet P = arrLattice(A);
2936
+ break;
2937
+ }
2938
+ if(typeof(input) == "arrposet"){
2939
+ arr A = input.A;
2940
+ arrposet P = input;
2941
+ break;
2942
+ }
2943
+ ERROR("Bad input type");
2944
+ }
2945
+
2946
+ P = moebius(P);
2947
+ int i, j, coeff, sign;
2948
+ list L;
2949
+
2950
+ intvec v = 1;
2951
+ sign = 1;
2952
+ for(i=1; i<= rank(A); i++){
2953
+ L = P.r[i];
2954
+ sign = (-1)*sign;
2955
+ coeff = 0;
2956
+ for(j=1;j<=size(L);j++){
2957
+ coeff = coeff + L[j].moebius;
2958
+ }
2959
+ coeff = sign*coeff;
2960
+ v = v,coeff;
2961
+ }
2962
+ return (v);
2963
+ }
2964
+
2965
+ example
2966
+ {
2967
+ "EXAMPLE: The Poincare polynomial of the braid arrangement in k dimensions is given as: " +
2968
+ "pi(A,t) = (1 + t)*...*(1 + (k-1)*t)"; echo = 2;
2969
+ ring R = 0,(x,y,z,u,v),dp;
2970
+ arr A = arrBraid(5);
2971
+ intvec v = arrPoincare(A);
2972
+ (1+x)*(1+2x)*(1+3x)*(1+4x);
2973
+ v;
2974
+ }
2975
+
2976
+
2977
+ // X(A,t) = t^l * pi(A,-t^-1)
2978
+ proc arrCharPoly(def input)
2979
+ "USAGE: arrCharPoly(arr A)
2980
+ RETURN: [intvec] coefficients of the characteristic polynomial of A in increasing order
2981
+ REMARKS: The algorithm only returns the coefficients of the characteristic polynomial since they
2982
+ are whole numbers but the basering could be something different.
2983
+ SEE ALSO: arrCharPoly, arrPoincare
2984
+ KEYWORDS: characteristic polynomial
2985
+ EXAMPLE: example arrCharPoly; shows an example"
2986
+
2987
+ {
2988
+ intvec v = arrPoincare(input);
2989
+ int l = size(v);
2990
+ v = v[l..1]; //reverses order
2991
+ for(int i=2; i<=l; i=i+2){
2992
+ v[i] = -v[i];
2993
+ }
2994
+
2995
+ return (v);
2996
+ }
2997
+
2998
+ example
2999
+ {
3000
+ "EXAMPLE: The characteristic polynomial of the Braid arrangement in k dimensions is given as: " +
3001
+ "X(A,t) = t*(t-1)*...*(t-(k-1)))"; echo = 2;
3002
+ ring R = 0,(x,y,z,u,v),dp;
3003
+ arr A = arrBraid(5);
3004
+ intvec v = arrCharPoly(A);
3005
+ x*(x-1)*(x-2)*(x-3)*(x-4);
3006
+ v;
3007
+ }
3008
+
3009
+
3010
+ // number of chambers of the arrangement
3011
+ proc arrChambers(arr A)
3012
+ "USAGE: arrChambers(A); arr A
3013
+ RETURN: [int] The number of chambers of an arrangement, which is equal to the
3014
+ evaluation of the Poincare polynomial at 1.
3015
+ SEE ALSO: arrPoincare, arrChambers, arrBoundedChambers
3016
+ KEYWORDS: chambers
3017
+ EXAMPLE: example arrChambers;"
3018
+
3019
+ {
3020
+ intvec v = arrPoincare(A);
3021
+ return(sum(v));
3022
+ }
3023
+
3024
+ example
3025
+ {
3026
+ "EXAMPLE: Computing the number of number of chambers in a simple arrangement"; echo = 2;
3027
+ ring R = 0,(x,y),dp;
3028
+ arr A = ideal(x,y,x+y-1);
3029
+ arrChambers(A);
3030
+ }
3031
+
3032
+
3033
+ // number of bounded chambers of the arrangement
3034
+ proc arrBoundedChambers(arr A)
3035
+ "USAGE: arrBoundedChambers(A); arr A
3036
+ RETURN: [int] The number of bounded chambers of an arrangement, which is equal to
3037
+ the evaluation of the Poincare polynomial at -1.
3038
+ SEE ALSO: arrPoincare, arrChambers, arrBoundedChambers
3039
+ KEYWORDS: chambers
3040
+ EXAMPLE: example arrBoundedChambers;"
3041
+
3042
+ {
3043
+ intvec v = arrPoincare(A);
3044
+ for(int i=2; i<=size(v); i=i+2){
3045
+ v[i] = -v[i];
3046
+ }
3047
+ return (sum(v));
3048
+ }
3049
+
3050
+ example
3051
+ {
3052
+ "EXAMPLE: Computing the number of bounded chambers in a simple arrangement"; echo = 2;
3053
+ ring R = 0,(x,y),dp;
3054
+ arr A = ideal(x,y,x+y-1);
3055
+ arrBoundedChambers(A);
3056
+ }
3057
+
3058
+ //============================================================================//
3059
+ //------------------------------- OUTPUT ------------------------------------//
3060
+ //============================================================================//
3061
+
3062
+ static proc arrPrintPoset(arrposet P){
3063
+ print("Given Arrangement:");
3064
+ P.A;
3065
+ print("Corresponding poset:");
3066
+
3067
+ string s;
3068
+ int i,j;
3069
+ list L;
3070
+ for(i=1; i<= size(P.r); i++){
3071
+ print("====== rank "+string(i)+": "+string(size(P.r[i]))+" flats ======");
3072
+ s = "";
3073
+ L = P.r[i];
3074
+ for(j=1; j<=size(L); j++){
3075
+ s = s + " (" + string(collectHplanes(L[j].REL)) + "), ";
3076
+ }
3077
+
3078
+ print(s);
3079
+ if(size(P.r[i]) == 0){break;}
3080
+ }
3081
+ }
3082
+
3083
+
3084
+ proc printMoebius(arrposet P)
3085
+ "USAGE: printMoebius(A); arr A
3086
+ RETURN: [] displays the moebius values of all the flats in the poset
3087
+ REMARKS: Mainly used for debugging.
3088
+ EXAMPLE: example printMoebius;"
3089
+
3090
+ {
3091
+ print("Moebius values: ");
3092
+
3093
+ string s;
3094
+ int i,j;
3095
+ list L;
3096
+ for(i=1; i<= size(P.r); i++){
3097
+ print("====== rank "+string(i)+": "+string(size(P.r[i]))+" flats ======");
3098
+ s = "";
3099
+ L = P.r[i];
3100
+ for(j=1; j<=size(L); j++){
3101
+ s = s + " (" + string(L[j].moebius) + "), ";
3102
+ }
3103
+
3104
+ print(s);
3105
+ if(size(P.r[i]) == 0){break;}
3106
+ }
3107
+ }
3108
+
3109
+ example
3110
+ {
3111
+ "EXAMPLE: We look at the moebius values of the braid arrangement in 4 dimensions: "; echo = 2;
3112
+ ring R = 0,(x,y,z,t),dp;
3113
+ arr A = arrBraid(4);
3114
+ arrposet P = arrLattice(A);
3115
+ P;
3116
+ //As you can see the values are not calculated yet:
3117
+
3118
+ printMoebius(P);
3119
+ P = moebius(P);
3120
+
3121
+ //Now all entries are initialized:
3122
+
3123
+ printMoebius(P);
3124
+ }
3125
+
3126
+ //============================================================================//
3127
+ //-------------------------------- arrFlats Stuff --------------------------------//
3128
+ //============================================================================//
3129
+ // test via hyperplanes.
3130
+ proc arrFlats(arr ARR)
3131
+ "USAGE: size(A); A arr
3132
+ RETURN: [arrposet] Intersection lattice
3133
+ SEE ALSO: arrFlats
3134
+ KEYWORDS: intersection lattice
3135
+ EXAMPLE: example arrFlats;"
3136
+
3137
+ {
3138
+ print(newline);
3139
+ print("=== Computing poset ===");
3140
+ print(newline);
3141
+
3142
+ //Performance test
3143
+ system("--ticks-per-sec",1000);
3144
+ timer = 0;
3145
+ int time = timer;
3146
+
3147
+ // Initialization
3148
+ list L,L2;
3149
+ intvec u,v,w,src;
3150
+ int i,j,k,l,m,n,d, rk,rk2;
3151
+ int counter, ntests; ntests = 0;
3152
+ matrix S,T;
3153
+ intmat REL;
3154
+
3155
+ // Initialization of matrix
3156
+ matrix M = matrix(ARR); // m x n+1 matrix
3157
+ m = size(ARR);
3158
+ n = nvars(basering);
3159
+
3160
+ // Initialization of P
3161
+ arrflats P; P.A = ARR;
3162
+ for(i=1; i<=n; i++){ P.r = insert(P.r,list());}
3163
+ for(i=1; i<=m; i++){ L[i] = i;}
3164
+ P.r[1] = L;
3165
+
3166
+ // calculating r[i] step by step
3167
+ for(i=2; i<=n; i++){ // maximal flat possible has rank A.v ofc
3168
+
3169
+ counter = 0;
3170
+
3171
+ L = P.r[i-1]; // flats from the last iteration give rise to current ones.
3172
+ if(size(L) <= 1){break;} // finish early if no more intersections possible.
3173
+ L2 = list(); // new list for elts of rk=i
3174
+
3175
+
3176
+ // REL is an intmat that contains information about the relations between
3177
+ // the i-1 flats and the Hyperplanes.
3178
+ // REL[i,j] = 1 means that H_i intersects F_j
3179
+ // REL[i,j] = 0 means that it has not been tested yet
3180
+ // REL[i,j] = -1 means that H_i does NOT intersect F_j, i.e. they are parallel
3181
+ // resetting the REL-matrix
3182
+ REL = intmat(intvec(0),m,size(L));
3183
+ // fills in the trivial entries, i.e. each flat intersects all hplanes it is composed of.
3184
+ for(j=1; j<=size(L); j++){
3185
+ u = L[j];
3186
+ for(k=1; k<= size(u); k++){
3187
+ REL[u[k],j] = 1;
3188
+ }
3189
+ }
3190
+
3191
+ //find new flat of rank i
3192
+ for(j=1; j<=size(L); j++){ // goes over the elts of L.r[i-1]
3193
+
3194
+ // Looking for intersetion of F_j with hyperplanes
3195
+ u = L[j];
3196
+
3197
+ for(k=1; k<=m; k++){
3198
+ if (REL[k,j] == 0 ){
3199
+ v = insertVal(u,k);
3200
+ counter++;
3201
+ ntests = ntests +2;
3202
+ rk = rank(submat(M,v,1..n));
3203
+ if(rk == rank(submat(M,v,1..n+1))){
3204
+ //INTERSECTION FOUND
3205
+ // potentially there exist more hyperplanes which intersect in the same
3206
+ // space. For example (x,y,x+y) all intersect in (0,0)
3207
+
3208
+ REL[k,j] = 1;
3209
+
3210
+ for(l=k+1; l<=m; l++){
3211
+ if(REL[l,j] == 0){
3212
+ u = insertVal(v,l);
3213
+ ntests = ntests +2;
3214
+ rk2 = rank(submat(M, u, 1..n));
3215
+
3216
+ if( rk == rk2 && rk == rank(submat(M,u,1..n+1)) ){
3217
+ v = u;
3218
+ REL[l,j] = 1;
3219
+ }
3220
+ }}
3221
+
3222
+ // Add new flat to list, reset u.
3223
+ L2 = insert(L2,v,size(L2));
3224
+ u = L[j]; //if k = m this is not necessary....
3225
+ }
3226
+ }}
3227
+ }
3228
+
3229
+ print("rank: "+string(i)+", expected OPS: "+string(binomial(size(L),2))
3230
+ +", executed OPS: " + string(counter));
3231
+ counter = 0;
3232
+
3233
+ //cleanup => doing this during computation increases speed!!
3234
+ for(j=1; j<size(L2); j++){
3235
+ u = L2[j];
3236
+ for(k=j+1; k<= size(L2); k++){
3237
+ if(u == L2[k]){
3238
+ L2 = delete(L2,k); k--; counter++;
3239
+
3240
+ }
3241
+ }
3242
+ }
3243
+
3244
+ P.r[i] = L2;
3245
+ print("Cleaned up: "+string(counter)+" hyperplanes");
3246
+ print(newline);
3247
+ }
3248
+
3249
+ print(newline);
3250
+ //print("Computation time: "+string(timer - time));
3251
+ print("Matrix tests: "+string(ntests));
3252
+
3253
+ return (P);
3254
+ }
3255
+
3256
+ example
3257
+ {
3258
+ "EXAMPLE: "; echo = 2;
3259
+ ring R = 0,(x(1..5)),dp;
3260
+ arrFlats(arrBraid(5));
3261
+ }
3262
+
3263
+ // inserst k in u in the correct lexicographical place
3264
+ static proc insertVal(intvec u, int k){
3265
+
3266
+ if(k<u[1]){
3267
+ u = k,u;
3268
+ return (u);
3269
+ }
3270
+ if(k>u[size(u)]){
3271
+ u = u,k;
3272
+ return (u);
3273
+ }
3274
+
3275
+ int i = 2;
3276
+ while(u[i]<k){i++;}
3277
+
3278
+ u = u[1..(i-1)],k,u[i..size(u)];
3279
+
3280
+
3281
+ return(u);
3282
+
3283
+ }
3284
+
3285
+ static proc arrPrintFlats(arrflats P){
3286
+ print("Given Arrangement:");
3287
+ P.A;
3288
+ print("Corresponding poset:");
3289
+
3290
+ string s;
3291
+ int i,j;
3292
+ list L;
3293
+ for(i=1; i<= size(P.r); i++){
3294
+ print("====== rank "+string(i)+": "+string(size(P.r[i]))+" flats ======");
3295
+ s = "";
3296
+ L = P.r[i];
3297
+ for(j=1; j<=size(L); j++){
3298
+ s = s + " (" + string(L[j]) + "), ";
3299
+ }
3300
+
3301
+ print(s);
3302
+ }
3303
+ }
3304
+
3305
+
3306
+ // Compares two posets
3307
+ static proc cposet(arrflats P, arrflats Q){
3308
+
3309
+ list L = P.r;
3310
+ list K = Q.r;
3311
+ list L2, K2;
3312
+ int i,j, isequal;
3313
+
3314
+ for(i =1; i<=size(L); i++){
3315
+ L2 = L[i];
3316
+ K2 = K[i];
3317
+ isequal = 1;
3318
+ for(j=1; j<= size(L2); j++){
3319
+ if(L2[j] != K2[j]){isequal = 0; break;}
3320
+ }
3321
+ print("@rank "+string(i)+" |P.r[i]| = "+string(size(L[i]))+", |Q.r[i]| = "+string(size(K[i])));
3322
+ print("Elements are the same: "+string(isequal));
3323
+ }
3324
+
3325
+ }
3326
+
3327
+ //============================================================================//
3328
+ //-------------------------------- END OF CODE -------------------------------//
3329
+ //============================================================================//
3330
+
3331
+ //============================================================================//
3332
+ //------------------------------- UNUSED PROCEDURES --------------------------//
3333
+ //============================================================================//
3334
+
3335
+
3336
+ static proc printParents(arrposet P)
3337
+ "USAGE: printParents(A); arr A
3338
+ RETURN: [] displays the parent-lists of all the flats in the poset
3339
+ REMARKS: Mainly used for debugging.
3340
+ SEE ALSO: printParents, printMoebius, printFlags
3341
+ EXAMPLE: example printParents;"
3342
+
3343
+ {
3344
+ print("Given Arrangement:");
3345
+ P.A;
3346
+ print("Corresponding poset:");
3347
+
3348
+ string s;
3349
+ int i,j;
3350
+ list L;
3351
+ for(i=1; i<= size(P.r); i++){
3352
+ print("====== rank "+string(i)+": "+string(size(P.r[i]))+" flats ======");
3353
+ s = "";
3354
+ L = P.r[i];
3355
+ for(j=1; j<=size(L); j++){
3356
+ s = s + " (" + string(L[j].parents) + "), ";
3357
+ }
3358
+
3359
+ print(s);
3360
+ if(size(P.r[i]) == 0){break;}
3361
+ }
3362
+ }
3363
+
3364
+ static proc printFlags(arrposet P)
3365
+ "USAGE: printFlags(A); arr A
3366
+ RETURN: [] displays the flag bits of all the flats in the poset
3367
+ REMARKS: Mainly used for debugging.
3368
+ SEE ALSO: printParents, printMoebius, printFlags
3369
+ EXAMPLE: example printParents;"
3370
+ {
3371
+ print("Flag values:");
3372
+
3373
+ string s;
3374
+ int i,j;
3375
+ list L;
3376
+ for(i=1; i<= size(P.r); i++){
3377
+ print("====== rank "+string(i)+": "+string(size(P.r[i]))+" flats ======");
3378
+ s = "";
3379
+ L = P.r[i];
3380
+ for(j=1; j<=size(L); j++){
3381
+ s = s + " (" + string(L[j].flag) + "), ";
3382
+ }
3383
+
3384
+ print(s);
3385
+ if(size(P.r[i]) == 0){break;}
3386
+ }
3387
+ }
3388
+
3389
+ // expects 2 intvecs of stric ascending order
3390
+ // returns merged intvec
3391
+ static proc mergeIV(intvec u, intvec v){
3392
+ intvec res;
3393
+ int k;
3394
+ int m = 1;
3395
+ int n = 1;
3396
+ for(k=1; m<=size(u) && n<=size(v); k++){
3397
+ while(1){
3398
+ if(u[m] < v[n]){res[k] = u[m]; m++; break;}
3399
+ if(u[m] > v[n]){res[k] = v[n]; n++; break;}
3400
+ if(u[m] == v[n]){res[k] = u[m]; m++; n++; break;}
3401
+ ERROR("Something went wrong in proc mergeIV");
3402
+ }
3403
+ }
3404
+ while(m <= size(u)){res[k] = u[m]; m++; k++;}
3405
+ while(n <= size(v)){res[k] = v[n]; n++; k++;}
3406
+ return (res);
3407
+ }
3408
+
3409
+ // checks if v[i] < u[i] for all i
3410
+ static proc isSmaller(intvec u, intvec v){
3411
+ for(int i= 1; i<=size(u); i++){
3412
+ if(u[i] > v[i]){
3413
+ return (0);
3414
+ }
3415
+ }
3416
+
3417
+ return (1);
3418
+ }
3419
+
3420
+ static proc new2old(arrposet P){
3421
+ arrflats Q;
3422
+ Q.A = P.A;
3423
+ int i,j;
3424
+ list L = P.r;
3425
+ for(i=1; i<=size(L); i++){
3426
+ list L2 = L[i];
3427
+ for(j=1; j<=size(L2); j++){
3428
+ L2[j] = collectHplanes(L2[j].REL);
3429
+ }
3430
+ L[i] = L2;
3431
+ }
3432
+
3433
+ Q.r = L;
3434
+
3435
+ return (Q);
3436
+ }
3437
+ /*********************************************************************
3438
+ newstruct("arr","ideal l");
3439
+
3440
+ Defines a hyperplane arrangement by a list of linear polynomials such that the hyperplanes are the
3441
+ varieties of those polynomials.
3442
+
3443
+ supported operators:
3444
+ A = input defines an arrangement by the input which may consist of the types arr/ideal/poly/matrix/list
3445
+ A + input adds arrangement defined by the right hand side to the left hand side
3446
+ A - input deletes hyperplanes from the arrangement
3447
+ <, >, <=, >=, ==, != set theoretical comparison of two arrangements
3448
+ A[int] access to a single hyperplane
3449
+ A[intvec] subarrangement defined by the indexed hyperplanes
3450
+ A; prints the arrangement on the screen
3451
+
3452
+ supported type conversions:
3453
+ matrix(A) returns coefficient matrix of the defining polynomials
3454
+ poly(A) returns the defining polynomial which is the product of all the single polynomials
3455
+ list(A) returns the defining polynomials as a list
3456
+ ideal(A) returns the defining polynomials as an ideal
3457
+ type2arr(input) returns arrangement defined by the input which may consist of the types arr/ideal/poly/matrix/list
3458
+
3459
+ supported inherited functions:
3460
+ delete(A, intvec) deletes indexed hyperplanes from the arrangement
3461
+ homog(A) checks whether the defining polys are all homogeneous <=> arr is central
3462
+ homog(A, rvar) homogenizes the def. polys with respect to the given ring variable
3463
+ size(A) number of hyperplanes in the arrangement
3464
+ subst(A,rvar,poly,...) substitutes ringvariables with given polynomials, though they need to remain linear
3465
+ variables(A) ideal generated by the ring variables that A depends on
3466
+ nvars(A) number of ring variables that A depends on
3467
+
3468
+
3469
+
3470
+ newstruct("multarr","ideal l, intvec m");
3471
+
3472
+ Defines a hyperplane arrangement with multiplicities by a list of linear polynomials such that the hyperplanes are the
3473
+ varieties of those polynomials and an intvec in which the multiplicities are saved.
3474
+
3475
+ supported operators:
3476
+ M = input defines an multarr by the input which may consist of the types multarr/ideal/poly/list
3477
+ M + input adds arrangement defined by the right hand side to the left hand side
3478
+ M; prints the multarr on the screen
3479
+
3480
+ supported type conversions:
3481
+ poly(M) returns defining polynomial with multiplicities
3482
+ arr2multarr(A,intvec) returns multarr with multiplicities defined by the intvec.
3483
+ multarr2arr(M) returns the internal arrangement (all multiplicities set to 1)
3484
+ delete(M,int) decrements the multiplicity of the hyperplane defined by the index by 1
3485
+ size(M) returns number of hyperplanes counting multiplicities.
3486
+ *-----------------------------------------------------------------------*/