passagemath-pari 10.6.32__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-pari might be problematic. Click here for more details.

Files changed (331) hide show
  1. PARIKernel/__init__.py +2 -0
  2. PARIKernel/__main__.py +5 -0
  3. PARIKernel/io.cpython-314-x86_64-linux-musl.so +0 -0
  4. PARIKernel/io.pxd +7 -0
  5. PARIKernel/io.pyx +84 -0
  6. PARIKernel/kernel.cpython-314-x86_64-linux-musl.so +0 -0
  7. PARIKernel/kernel.pyx +260 -0
  8. PARIKernel/paridecl.pxd +95 -0
  9. PARIKernel/svg.cpython-314-x86_64-linux-musl.so +0 -0
  10. PARIKernel/svg.pyx +52 -0
  11. cypari2/__init__.py +8 -0
  12. cypari2/auto_paridecl.pxd +1070 -0
  13. cypari2/closure.cpython-314-x86_64-linux-musl.so +0 -0
  14. cypari2/closure.pxd +5 -0
  15. cypari2/closure.pyx +246 -0
  16. cypari2/convert.cpython-314-x86_64-linux-musl.so +0 -0
  17. cypari2/convert.pxd +80 -0
  18. cypari2/convert.pyx +613 -0
  19. cypari2/custom_block.cpython-314-x86_64-linux-musl.so +0 -0
  20. cypari2/custom_block.pyx +30 -0
  21. cypari2/cypari.h +13 -0
  22. cypari2/gen.cpython-314-x86_64-linux-musl.so +0 -0
  23. cypari2/gen.pxd +69 -0
  24. cypari2/gen.pyx +4819 -0
  25. cypari2/handle_error.cpython-314-x86_64-linux-musl.so +0 -0
  26. cypari2/handle_error.pxd +7 -0
  27. cypari2/handle_error.pyx +232 -0
  28. cypari2/pari_instance.cpython-314-x86_64-linux-musl.so +0 -0
  29. cypari2/pari_instance.pxd +27 -0
  30. cypari2/pari_instance.pyx +1438 -0
  31. cypari2/paridecl.pxd +5353 -0
  32. cypari2/paripriv.pxd +34 -0
  33. cypari2/pycore_long.h +98 -0
  34. cypari2/pycore_long.pxd +9 -0
  35. cypari2/stack.cpython-314-x86_64-linux-musl.so +0 -0
  36. cypari2/stack.pxd +27 -0
  37. cypari2/stack.pyx +278 -0
  38. cypari2/string_utils.cpython-314-x86_64-linux-musl.so +0 -0
  39. cypari2/string_utils.pxd +29 -0
  40. cypari2/string_utils.pyx +65 -0
  41. cypari2/types.pxd +147 -0
  42. passagemath_pari-10.6.32.data/data/etc/jupyter/nbconfig/notebook.d/gp-mode.json +5 -0
  43. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.js +28 -0
  44. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.json +6 -0
  45. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/logo-64x64.png +0 -0
  46. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/kernel.json +13 -0
  47. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-32x32.png +0 -0
  48. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-64x64.png +0 -0
  49. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-svg.svg +75 -0
  50. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/gp.js +284 -0
  51. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/main.js +15 -0
  52. passagemath_pari-10.6.32.dist-info/METADATA +209 -0
  53. passagemath_pari-10.6.32.dist-info/RECORD +331 -0
  54. passagemath_pari-10.6.32.dist-info/WHEEL +5 -0
  55. passagemath_pari-10.6.32.dist-info/top_level.txt +4 -0
  56. passagemath_pari.libs/libcrypto-f04afe95.so.3 +0 -0
  57. passagemath_pari.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
  58. passagemath_pari.libs/libgcc_s-0cd532bd.so.1 +0 -0
  59. passagemath_pari.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
  60. passagemath_pari.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
  61. passagemath_pari.libs/libgivaro-9a94c711.so.9.2.1 +0 -0
  62. passagemath_pari.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  63. passagemath_pari.libs/libgmpxx-9e08595c.so.4.7.0 +0 -0
  64. passagemath_pari.libs/libgsl-42cda06f.so.28.0.0 +0 -0
  65. passagemath_pari.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
  66. passagemath_pari.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
  67. passagemath_pari.libs/libntl-26885ca2.so.44.0.1 +0 -0
  68. passagemath_pari.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
  69. passagemath_pari.libs/libpari-gmp-tls-f31f908f.so.2.17.2 +0 -0
  70. passagemath_pari.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
  71. passagemath_pari.libs/libreadline-06542304.so.8.2 +0 -0
  72. passagemath_pari.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  73. passagemath_pari.libs/libuuid-f3770415.so.1.3.0 +0 -0
  74. passagemath_pari.libs/libxeus-735780ff.so.13.1.0 +0 -0
  75. passagemath_pari.libs/libxeus-zmq-c68577b4.so.6.0.1 +0 -0
  76. passagemath_pari.libs/libzmq-1ba9a3da.so.5.2.5 +0 -0
  77. sage/all__sagemath_pari.py +26 -0
  78. sage/databases/all__sagemath_pari.py +7 -0
  79. sage/databases/conway.py +274 -0
  80. sage/ext/all__sagemath_pari.py +1 -0
  81. sage/ext/memory.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/ext/memory.pyx +98 -0
  83. sage/ext_data/pari/buzzard/DimensionSk.g +286 -0
  84. sage/ext_data/pari/buzzard/Tpprog.g +179 -0
  85. sage/ext_data/pari/buzzard/genusn.g +129 -0
  86. sage/ext_data/pari/dokchitser/computel.gp +740 -0
  87. sage/ext_data/pari/dokchitser/computel.gp.template +740 -0
  88. sage/ext_data/pari/dokchitser/ex-bsw +43 -0
  89. sage/ext_data/pari/dokchitser/ex-chgen +48 -0
  90. sage/ext_data/pari/dokchitser/ex-chqua +37 -0
  91. sage/ext_data/pari/dokchitser/ex-delta +35 -0
  92. sage/ext_data/pari/dokchitser/ex-eisen +30 -0
  93. sage/ext_data/pari/dokchitser/ex-gen2 +38 -0
  94. sage/ext_data/pari/dokchitser/ex-gen3 +49 -0
  95. sage/ext_data/pari/dokchitser/ex-gen4 +54 -0
  96. sage/ext_data/pari/dokchitser/ex-nf +48 -0
  97. sage/ext_data/pari/dokchitser/ex-shin +50 -0
  98. sage/ext_data/pari/dokchitser/ex-tau2 +30 -0
  99. sage/ext_data/pari/dokchitser/ex-zeta +27 -0
  100. sage/ext_data/pari/dokchitser/ex-zeta2 +47 -0
  101. sage/ext_data/pari/dokchitser/testall +13 -0
  102. sage/ext_data/pari/simon/ell.gp +2129 -0
  103. sage/ext_data/pari/simon/ellQ.gp +2151 -0
  104. sage/ext_data/pari/simon/ellcommon.gp +126 -0
  105. sage/ext_data/pari/simon/qfsolve.gp +722 -0
  106. sage/ext_data/pari/simon/resultant3.gp +306 -0
  107. sage/groups/all__sagemath_pari.py +3 -0
  108. sage/groups/pari_group.py +175 -0
  109. sage/interfaces/all__sagemath_pari.py +1 -0
  110. sage/interfaces/genus2reduction.py +464 -0
  111. sage/interfaces/gp.py +1114 -0
  112. sage/libs/all__sagemath_pari.py +2 -0
  113. sage/libs/linkages/__init__.py +1 -0
  114. sage/libs/linkages/padics/API.pxi +617 -0
  115. sage/libs/linkages/padics/Polynomial_ram.pxi +388 -0
  116. sage/libs/linkages/padics/Polynomial_shared.pxi +554 -0
  117. sage/libs/linkages/padics/__init__.py +1 -0
  118. sage/libs/linkages/padics/fmpz_poly_unram.pxi +869 -0
  119. sage/libs/linkages/padics/mpz.pxi +691 -0
  120. sage/libs/linkages/padics/relaxed/API.pxi +518 -0
  121. sage/libs/linkages/padics/relaxed/__init__.py +1 -0
  122. sage/libs/linkages/padics/relaxed/flint.pxi +543 -0
  123. sage/libs/linkages/padics/unram_shared.pxi +247 -0
  124. sage/libs/pari/__init__.py +210 -0
  125. sage/libs/pari/all.py +5 -0
  126. sage/libs/pari/convert_flint.cpython-314-x86_64-linux-musl.so +0 -0
  127. sage/libs/pari/convert_flint.pxd +14 -0
  128. sage/libs/pari/convert_flint.pyx +159 -0
  129. sage/libs/pari/convert_gmp.cpython-314-x86_64-linux-musl.so +0 -0
  130. sage/libs/pari/convert_gmp.pxd +14 -0
  131. sage/libs/pari/convert_gmp.pyx +210 -0
  132. sage/libs/pari/convert_sage.cpython-314-x86_64-linux-musl.so +0 -0
  133. sage/libs/pari/convert_sage.pxd +16 -0
  134. sage/libs/pari/convert_sage.pyx +588 -0
  135. sage/libs/pari/convert_sage_complex_double.cpython-314-x86_64-linux-musl.so +0 -0
  136. sage/libs/pari/convert_sage_complex_double.pxd +14 -0
  137. sage/libs/pari/convert_sage_complex_double.pyx +132 -0
  138. sage/libs/pari/convert_sage_matrix.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/libs/pari/convert_sage_matrix.pyx +106 -0
  140. sage/libs/pari/convert_sage_real_double.cpython-314-x86_64-linux-musl.so +0 -0
  141. sage/libs/pari/convert_sage_real_double.pxd +5 -0
  142. sage/libs/pari/convert_sage_real_double.pyx +14 -0
  143. sage/libs/pari/convert_sage_real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
  144. sage/libs/pari/convert_sage_real_mpfr.pxd +7 -0
  145. sage/libs/pari/convert_sage_real_mpfr.pyx +108 -0
  146. sage/libs/pari/misc.cpython-314-x86_64-linux-musl.so +0 -0
  147. sage/libs/pari/misc.pxd +4 -0
  148. sage/libs/pari/misc.pyx +26 -0
  149. sage/libs/pari/tests.py +1848 -0
  150. sage/matrix/all__sagemath_pari.py +1 -0
  151. sage/matrix/matrix_integer_pari.cpython-314-x86_64-linux-musl.so +0 -0
  152. sage/matrix/matrix_integer_pari.pyx +187 -0
  153. sage/matrix/matrix_rational_pari.cpython-314-x86_64-linux-musl.so +0 -0
  154. sage/matrix/matrix_rational_pari.pyx +160 -0
  155. sage/quadratic_forms/all__sagemath_pari.py +10 -0
  156. sage/quadratic_forms/genera/all.py +9 -0
  157. sage/quadratic_forms/genera/genus.py +3506 -0
  158. sage/quadratic_forms/genera/normal_form.py +1519 -0
  159. sage/quadratic_forms/genera/spinor_genus.py +243 -0
  160. sage/quadratic_forms/qfsolve.py +255 -0
  161. sage/quadratic_forms/quadratic_form__automorphisms.py +427 -0
  162. sage/quadratic_forms/quadratic_form__genus.py +141 -0
  163. sage/quadratic_forms/quadratic_form__local_density_interfaces.py +140 -0
  164. sage/quadratic_forms/quadratic_form__local_normal_form.py +421 -0
  165. sage/quadratic_forms/quadratic_form__local_representation_conditions.py +889 -0
  166. sage/quadratic_forms/quadratic_form__mass.py +69 -0
  167. sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +663 -0
  168. sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +373 -0
  169. sage/quadratic_forms/quadratic_form__siegel_product.py +198 -0
  170. sage/quadratic_forms/special_values.py +323 -0
  171. sage/rings/all__sagemath_pari.py +15 -0
  172. sage/rings/factorint_pari.cpython-314-x86_64-linux-musl.so +0 -0
  173. sage/rings/factorint_pari.pyx +80 -0
  174. sage/rings/finite_rings/all__sagemath_pari.py +1 -0
  175. sage/rings/finite_rings/element_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  176. sage/rings/finite_rings/element_givaro.pxd +91 -0
  177. sage/rings/finite_rings/element_givaro.pyx +1769 -0
  178. sage/rings/finite_rings/element_ntl_gf2e.cpython-314-x86_64-linux-musl.so +0 -0
  179. sage/rings/finite_rings/element_ntl_gf2e.pxd +22 -0
  180. sage/rings/finite_rings/element_ntl_gf2e.pyx +1333 -0
  181. sage/rings/finite_rings/element_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  182. sage/rings/finite_rings/element_pari_ffelt.pxd +13 -0
  183. sage/rings/finite_rings/element_pari_ffelt.pyx +1441 -0
  184. sage/rings/finite_rings/finite_field_givaro.py +612 -0
  185. sage/rings/finite_rings/finite_field_pari_ffelt.py +238 -0
  186. sage/rings/finite_rings/hom_finite_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  187. sage/rings/finite_rings/hom_finite_field_givaro.pxd +28 -0
  188. sage/rings/finite_rings/hom_finite_field_givaro.pyx +280 -0
  189. sage/rings/finite_rings/residue_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  190. sage/rings/finite_rings/residue_field_givaro.pyx +133 -0
  191. sage/rings/finite_rings/residue_field_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  192. sage/rings/finite_rings/residue_field_pari_ffelt.pyx +128 -0
  193. sage/rings/function_field/all__sagemath_pari.py +1 -0
  194. sage/rings/function_field/valuation.py +1450 -0
  195. sage/rings/function_field/valuation_ring.py +212 -0
  196. sage/rings/number_field/all__sagemath_pari.py +14 -0
  197. sage/rings/number_field/totallyreal.cpython-314-x86_64-linux-musl.so +0 -0
  198. sage/rings/number_field/totallyreal.pyx +509 -0
  199. sage/rings/number_field/totallyreal_data.cpython-314-x86_64-linux-musl.so +0 -0
  200. sage/rings/number_field/totallyreal_data.pxd +26 -0
  201. sage/rings/number_field/totallyreal_data.pyx +928 -0
  202. sage/rings/number_field/totallyreal_phc.py +144 -0
  203. sage/rings/number_field/totallyreal_rel.py +1018 -0
  204. sage/rings/padics/CA_template.pxi +1847 -0
  205. sage/rings/padics/CA_template_header.pxi +50 -0
  206. sage/rings/padics/CR_template.pxi +2563 -0
  207. sage/rings/padics/CR_template_header.pxi +57 -0
  208. sage/rings/padics/FM_template.pxi +1575 -0
  209. sage/rings/padics/FM_template_header.pxi +50 -0
  210. sage/rings/padics/FP_template.pxi +2176 -0
  211. sage/rings/padics/FP_template_header.pxi +57 -0
  212. sage/rings/padics/all.py +3 -0
  213. sage/rings/padics/all__sagemath_pari.py +11 -0
  214. sage/rings/padics/common_conversion.cpython-314-x86_64-linux-musl.so +0 -0
  215. sage/rings/padics/common_conversion.pxd +15 -0
  216. sage/rings/padics/common_conversion.pyx +508 -0
  217. sage/rings/padics/eisenstein_extension_generic.py +232 -0
  218. sage/rings/padics/factory.py +3623 -0
  219. sage/rings/padics/generic_nodes.py +1615 -0
  220. sage/rings/padics/lattice_precision.py +2889 -0
  221. sage/rings/padics/morphism.cpython-314-x86_64-linux-musl.so +0 -0
  222. sage/rings/padics/morphism.pxd +11 -0
  223. sage/rings/padics/morphism.pyx +366 -0
  224. sage/rings/padics/padic_base_generic.py +467 -0
  225. sage/rings/padics/padic_base_leaves.py +1235 -0
  226. sage/rings/padics/padic_capped_absolute_element.cpython-314-x86_64-linux-musl.so +0 -0
  227. sage/rings/padics/padic_capped_absolute_element.pxd +15 -0
  228. sage/rings/padics/padic_capped_absolute_element.pyx +520 -0
  229. sage/rings/padics/padic_capped_relative_element.cpython-314-x86_64-linux-musl.so +0 -0
  230. sage/rings/padics/padic_capped_relative_element.pxd +14 -0
  231. sage/rings/padics/padic_capped_relative_element.pyx +614 -0
  232. sage/rings/padics/padic_extension_generic.py +990 -0
  233. sage/rings/padics/padic_extension_leaves.py +738 -0
  234. sage/rings/padics/padic_fixed_mod_element.cpython-314-x86_64-linux-musl.so +0 -0
  235. sage/rings/padics/padic_fixed_mod_element.pxd +15 -0
  236. sage/rings/padics/padic_fixed_mod_element.pyx +584 -0
  237. sage/rings/padics/padic_floating_point_element.cpython-314-x86_64-linux-musl.so +0 -0
  238. sage/rings/padics/padic_floating_point_element.pxd +14 -0
  239. sage/rings/padics/padic_floating_point_element.pyx +447 -0
  240. sage/rings/padics/padic_generic_element.cpython-314-x86_64-linux-musl.so +0 -0
  241. sage/rings/padics/padic_generic_element.pxd +48 -0
  242. sage/rings/padics/padic_generic_element.pyx +4642 -0
  243. sage/rings/padics/padic_lattice_element.py +1342 -0
  244. sage/rings/padics/padic_printing.cpython-314-x86_64-linux-musl.so +0 -0
  245. sage/rings/padics/padic_printing.pxd +38 -0
  246. sage/rings/padics/padic_printing.pyx +1505 -0
  247. sage/rings/padics/padic_relaxed_element.cpython-314-x86_64-linux-musl.so +0 -0
  248. sage/rings/padics/padic_relaxed_element.pxd +56 -0
  249. sage/rings/padics/padic_relaxed_element.pyx +18 -0
  250. sage/rings/padics/padic_relaxed_errors.cpython-314-x86_64-linux-musl.so +0 -0
  251. sage/rings/padics/padic_relaxed_errors.pxd +11 -0
  252. sage/rings/padics/padic_relaxed_errors.pyx +71 -0
  253. sage/rings/padics/padic_template_element.pxi +1212 -0
  254. sage/rings/padics/padic_template_element_header.pxi +50 -0
  255. sage/rings/padics/padic_valuation.py +1423 -0
  256. sage/rings/padics/pow_computer_flint.cpython-314-x86_64-linux-musl.so +0 -0
  257. sage/rings/padics/pow_computer_flint.pxd +38 -0
  258. sage/rings/padics/pow_computer_flint.pyx +641 -0
  259. sage/rings/padics/pow_computer_relative.cpython-314-x86_64-linux-musl.so +0 -0
  260. sage/rings/padics/pow_computer_relative.pxd +29 -0
  261. sage/rings/padics/pow_computer_relative.pyx +415 -0
  262. sage/rings/padics/qadic_flint_CA.cpython-314-x86_64-linux-musl.so +0 -0
  263. sage/rings/padics/qadic_flint_CA.pxd +21 -0
  264. sage/rings/padics/qadic_flint_CA.pyx +130 -0
  265. sage/rings/padics/qadic_flint_CR.cpython-314-x86_64-linux-musl.so +0 -0
  266. sage/rings/padics/qadic_flint_CR.pxd +13 -0
  267. sage/rings/padics/qadic_flint_CR.pyx +172 -0
  268. sage/rings/padics/qadic_flint_FM.cpython-314-x86_64-linux-musl.so +0 -0
  269. sage/rings/padics/qadic_flint_FM.pxd +14 -0
  270. sage/rings/padics/qadic_flint_FM.pyx +111 -0
  271. sage/rings/padics/qadic_flint_FP.cpython-314-x86_64-linux-musl.so +0 -0
  272. sage/rings/padics/qadic_flint_FP.pxd +12 -0
  273. sage/rings/padics/qadic_flint_FP.pyx +165 -0
  274. sage/rings/padics/relative_extension_leaves.py +429 -0
  275. sage/rings/padics/relative_ramified_CA.cpython-314-x86_64-linux-musl.so +0 -0
  276. sage/rings/padics/relative_ramified_CA.pxd +9 -0
  277. sage/rings/padics/relative_ramified_CA.pyx +33 -0
  278. sage/rings/padics/relative_ramified_CR.cpython-314-x86_64-linux-musl.so +0 -0
  279. sage/rings/padics/relative_ramified_CR.pxd +8 -0
  280. sage/rings/padics/relative_ramified_CR.pyx +33 -0
  281. sage/rings/padics/relative_ramified_FM.cpython-314-x86_64-linux-musl.so +0 -0
  282. sage/rings/padics/relative_ramified_FM.pxd +9 -0
  283. sage/rings/padics/relative_ramified_FM.pyx +33 -0
  284. sage/rings/padics/relative_ramified_FP.cpython-314-x86_64-linux-musl.so +0 -0
  285. sage/rings/padics/relative_ramified_FP.pxd +8 -0
  286. sage/rings/padics/relative_ramified_FP.pyx +33 -0
  287. sage/rings/padics/relaxed_template.pxi +4229 -0
  288. sage/rings/padics/relaxed_template_header.pxi +160 -0
  289. sage/rings/padics/tests.py +35 -0
  290. sage/rings/padics/tutorial.py +341 -0
  291. sage/rings/padics/unramified_extension_generic.py +335 -0
  292. sage/rings/padics/witt_vector.py +917 -0
  293. sage/rings/padics/witt_vector_ring.py +934 -0
  294. sage/rings/pari_ring.py +235 -0
  295. sage/rings/polynomial/all__sagemath_pari.py +1 -0
  296. sage/rings/polynomial/padics/all.py +1 -0
  297. sage/rings/polynomial/padics/polynomial_padic.py +360 -0
  298. sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +1324 -0
  299. sage/rings/polynomial/padics/polynomial_padic_flat.py +72 -0
  300. sage/rings/power_series_pari.cpython-314-x86_64-linux-musl.so +0 -0
  301. sage/rings/power_series_pari.pxd +6 -0
  302. sage/rings/power_series_pari.pyx +934 -0
  303. sage/rings/tate_algebra.py +1282 -0
  304. sage/rings/tate_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  305. sage/rings/tate_algebra_element.pxd +49 -0
  306. sage/rings/tate_algebra_element.pyx +3464 -0
  307. sage/rings/tate_algebra_ideal.cpython-314-x86_64-linux-musl.so +0 -0
  308. sage/rings/tate_algebra_ideal.pxd +7 -0
  309. sage/rings/tate_algebra_ideal.pyx +1307 -0
  310. sage/rings/valuation/all.py +7 -0
  311. sage/rings/valuation/augmented_valuation.py +2118 -0
  312. sage/rings/valuation/developing_valuation.py +362 -0
  313. sage/rings/valuation/gauss_valuation.py +812 -0
  314. sage/rings/valuation/inductive_valuation.py +1686 -0
  315. sage/rings/valuation/limit_valuation.py +946 -0
  316. sage/rings/valuation/mapped_valuation.py +656 -0
  317. sage/rings/valuation/scaled_valuation.py +322 -0
  318. sage/rings/valuation/trivial_valuation.py +382 -0
  319. sage/rings/valuation/valuation.py +1119 -0
  320. sage/rings/valuation/valuation_space.py +1615 -0
  321. sage/rings/valuation/valuations_catalog.py +10 -0
  322. sage/rings/valuation/value_group.py +697 -0
  323. sage/schemes/all__sagemath_pari.py +1 -0
  324. sage/schemes/elliptic_curves/all__sagemath_pari.py +1 -0
  325. sage/schemes/elliptic_curves/descent_two_isogeny_pari.cpython-314-x86_64-linux-musl.so +0 -0
  326. sage/schemes/elliptic_curves/descent_two_isogeny_pari.pyx +46 -0
  327. sage_wheels/bin/gp +0 -0
  328. sage_wheels/bin/gp2c +0 -0
  329. sage_wheels/bin/gp2c-run +57 -0
  330. sage_wheels/bin/xeus-gp +0 -0
  331. sage_wheels/share/gp2c/func.dsc +18414 -0
cypari2/convert.pyx ADDED
@@ -0,0 +1,613 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ # cython: cdivision = True
3
+ """
4
+ Convert PARI objects to/from Python/C native types
5
+ **************************************************
6
+
7
+ This modules contains the following conversion routines:
8
+
9
+ - integers, long integers <-> PARI integers
10
+ - list of integers -> PARI polynomials
11
+ - doubles -> PARI reals
12
+ - pairs of doubles -> PARI complex numbers
13
+
14
+ PARI integers are stored as an array of limbs of type ``pari_ulong``
15
+ (which are 32-bit or 64-bit integers). Depending on the kernel
16
+ (GMP or native), this array is stored little-endian or big-endian.
17
+ This is encapsulated in macros like ``int_W()``:
18
+ see section 4.5.1 of the
19
+ `PARI library manual <http://pari.math.u-bordeaux.fr/pub/pari/manuals/2.7.0/libpari.pdf>`_.
20
+
21
+ Python integers of type ``int`` are just C longs. Python integers of
22
+ type ``long`` are stored as a little-endian array of type ``digit``
23
+ with 15 or 30 bits used per digit. The internal format of a ``long`` is
24
+ not documented, but there is some information in
25
+ `longintrepr.h <https://github.com/python-git/python/blob/master/Include/longintrepr.h>`_.
26
+
27
+ Because of this difference in bit lengths, converting integers involves
28
+ some bit shuffling.
29
+ """
30
+
31
+ # ****************************************************************************
32
+ # Copyright (C) 2016 Jeroen Demeyer <jdemeyer@cage.ugent.be>
33
+ # Copyright (C) 2016 Luca De Feo <luca.defeo@polytechnique.edu>
34
+ # Copyright (C) 2016 Vincent Delecroix <vincent.delecroix@u-bordeaux.fr>
35
+ #
36
+ # This program is free software: you can redistribute it and/or modify
37
+ # it under the terms of the GNU General Public License as published by
38
+ # the Free Software Foundation, either version 2 of the License, or
39
+ # (at your option) any later version.
40
+ # https://www.gnu.org/licenses/
41
+ # ****************************************************************************
42
+
43
+ from cysignals.signals cimport sig_on, sig_off, sig_error
44
+
45
+ from cpython.version cimport PY_MAJOR_VERSION
46
+ from cpython.long cimport PyLong_AsLong, PyLong_FromLong
47
+ from cpython.longintrepr cimport (_PyLong_New,
48
+ digit, PyLong_SHIFT, PyLong_MASK)
49
+ from libc.limits cimport LONG_MIN, LONG_MAX
50
+ from libc.math cimport INFINITY
51
+
52
+ from .paridecl cimport *
53
+ from .stack cimport new_gen, reset_avma
54
+ from .string_utils cimport to_string, to_bytes
55
+ from .pycore_long cimport (ob_digit, _PyLong_IsZero, _PyLong_IsPositive,
56
+ _PyLong_DigitCount, _PyLong_SetSignAndDigitCount)
57
+
58
+ ########################################################################
59
+ # Conversion PARI -> Python
60
+ ########################################################################
61
+
62
+ cpdef gen_to_python(Gen z):
63
+ r"""
64
+ Convert the PARI element ``z`` to a Python object.
65
+
66
+ OUTPUT:
67
+
68
+ - a Python integer for integers (type ``t_INT``)
69
+
70
+ - a ``Fraction`` (``fractions`` module) for rationals (type ``t_FRAC``)
71
+
72
+ - a ``float`` for real numbers (type ``t_REAL``)
73
+
74
+ - a ``complex`` for complex numbers (type ``t_COMPLEX``)
75
+
76
+ - a ``list`` for vectors (type ``t_VEC`` or ``t_COL``). The function
77
+ ``gen_to_python`` is then recursively applied on the entries.
78
+
79
+ - a ``list`` of Python integers for small vectors (type ``t_VECSMALL``)
80
+
81
+ - a ``list`` of ``list``s for matrices (type ``t_MAT``). The function
82
+ ``gen_to_python`` is then recursively applied on the entries.
83
+
84
+ - the floating point ``inf`` or ``-inf`` for infinities (type ``t_INFINITY``)
85
+
86
+ - a string for strings (type ``t_STR``)
87
+
88
+ - other PARI types are not supported and the function will raise a
89
+ ``NotImplementedError``
90
+
91
+ Examples:
92
+
93
+ >>> from cypari2 import Pari
94
+ >>> from cypari2.convert import gen_to_python
95
+ >>> pari = Pari()
96
+
97
+ Converting integers:
98
+
99
+ >>> z = pari('42'); z
100
+ 42
101
+ >>> a = gen_to_python(z); a
102
+ 42
103
+ >>> type(a)
104
+ <... 'int'>
105
+
106
+ >>> gen_to_python(pari('3^50')) == 3**50
107
+ True
108
+ >>> type(gen_to_python(pari('3^50'))) == type(3**50)
109
+ True
110
+
111
+ Converting rational numbers:
112
+
113
+ >>> z = pari('2/3'); z
114
+ 2/3
115
+ >>> a = gen_to_python(z); a
116
+ Fraction(2, 3)
117
+ >>> type(a)
118
+ <class 'fractions.Fraction'>
119
+
120
+ Converting real numbers (and infinities):
121
+
122
+ >>> z = pari('1.2'); z
123
+ 1.20000000000000
124
+ >>> a = gen_to_python(z); a
125
+ 1.2
126
+ >>> type(a)
127
+ <... 'float'>
128
+
129
+ >>> z = pari('oo'); z
130
+ +oo
131
+ >>> a = gen_to_python(z); a
132
+ inf
133
+ >>> type(a)
134
+ <... 'float'>
135
+
136
+ >>> z = pari('-oo'); z
137
+ -oo
138
+ >>> a = gen_to_python(z); a
139
+ -inf
140
+ >>> type(a)
141
+ <... 'float'>
142
+
143
+ Converting complex numbers:
144
+
145
+ >>> z = pari('1 + I'); z
146
+ 1 + I
147
+ >>> a = gen_to_python(z); a
148
+ (1+1j)
149
+ >>> type(a)
150
+ <... 'complex'>
151
+
152
+ >>> z = pari('2.1 + 3.03*I'); z
153
+ 2.10000000000000 + 3.03000000000000*I
154
+ >>> a = gen_to_python(z); a
155
+ (2.1+3.03j)
156
+
157
+ Converting vectors:
158
+
159
+ >>> z1 = pari('Vecsmall([1,2,3])'); z1
160
+ Vecsmall([1, 2, 3])
161
+ >>> z2 = pari('[1, 3.4, [-5, 2], oo]'); z2
162
+ [1, 3.40000000000000, [-5, 2], +oo]
163
+ >>> z3 = pari('[1, 5.2]~'); z3
164
+ [1, 5.20000000000000]~
165
+ >>> z1.type(), z2.type(), z3.type()
166
+ ('t_VECSMALL', 't_VEC', 't_COL')
167
+
168
+ >>> a1 = gen_to_python(z1); a1
169
+ [1, 2, 3]
170
+ >>> type(a1)
171
+ <... 'list'>
172
+ >>> [type(x) for x in a1]
173
+ [<... 'int'>, <... 'int'>, <... 'int'>]
174
+
175
+ >>> a2 = gen_to_python(z2); a2
176
+ [1, 3.4, [-5, 2], inf]
177
+ >>> type(a2)
178
+ <... 'list'>
179
+ >>> [type(x) for x in a2]
180
+ [<... 'int'>, <... 'float'>, <... 'list'>, <... 'float'>]
181
+
182
+ >>> a3 = gen_to_python(z3); a3
183
+ [1, 5.2]
184
+ >>> type(a3)
185
+ <... 'list'>
186
+ >>> [type(x) for x in a3]
187
+ [<... 'int'>, <... 'float'>]
188
+
189
+ Converting matrices:
190
+
191
+ >>> z = pari('[1,2;3,4]')
192
+ >>> gen_to_python(z)
193
+ [[1, 2], [3, 4]]
194
+
195
+ >>> z = pari('[[1, 3], [[2]]; 3, [4, [5, 6]]]')
196
+ >>> gen_to_python(z)
197
+ [[[1, 3], [[2]]], [3, [4, [5, 6]]]]
198
+
199
+ Converting strings:
200
+
201
+ >>> z = pari('"Hello"')
202
+ >>> a = gen_to_python(z); a
203
+ 'Hello'
204
+ >>> type(a)
205
+ <... 'str'>
206
+
207
+ Some currently unsupported types:
208
+
209
+ >>> z = pari('x')
210
+ >>> z.type()
211
+ 't_POL'
212
+ >>> gen_to_python(z)
213
+ Traceback (most recent call last):
214
+ ...
215
+ NotImplementedError: conversion not implemented for t_POL
216
+
217
+ >>> z = pari('12 + O(2^13)')
218
+ >>> z.type()
219
+ 't_PADIC'
220
+ >>> gen_to_python(z)
221
+ Traceback (most recent call last):
222
+ ...
223
+ NotImplementedError: conversion not implemented for t_PADIC
224
+ """
225
+ return PyObject_FromGEN(z.g)
226
+
227
+
228
+ cpdef gen_to_integer(Gen x):
229
+ """
230
+ Convert a PARI ``gen`` to a Python ``int`` or ``long``.
231
+
232
+ INPUT:
233
+
234
+ - ``x`` -- a PARI ``t_INT``, ``t_FRAC``, ``t_REAL``, a purely
235
+ real ``t_COMPLEX``, a ``t_INTMOD`` or ``t_PADIC`` (which are
236
+ lifted).
237
+
238
+ Examples:
239
+
240
+ >>> from cypari2.convert import gen_to_integer
241
+ >>> from cypari2 import Pari
242
+ >>> pari = Pari()
243
+ >>> a = gen_to_integer(pari("12345")); a; type(a)
244
+ 12345
245
+ <... 'int'>
246
+ >>> gen_to_integer(pari("10^30")) == 10**30
247
+ True
248
+ >>> gen_to_integer(pari("19/5"))
249
+ 3
250
+ >>> gen_to_integer(pari("1 + 0.0*I"))
251
+ 1
252
+ >>> gen_to_integer(pari("3/2 + 0.0*I"))
253
+ 1
254
+ >>> gen_to_integer(pari("Mod(-1, 11)"))
255
+ 10
256
+ >>> gen_to_integer(pari("5 + O(5^10)"))
257
+ 5
258
+ >>> gen_to_integer(pari("Pol(42)"))
259
+ 42
260
+ >>> gen_to_integer(pari("u"))
261
+ Traceback (most recent call last):
262
+ ...
263
+ TypeError: unable to convert PARI object u of type t_POL to an integer
264
+ >>> s = pari("x + O(x^2)")
265
+ >>> s
266
+ x + O(x^2)
267
+ >>> gen_to_integer(s)
268
+ Traceback (most recent call last):
269
+ ...
270
+ TypeError: unable to convert PARI object x + O(x^2) of type t_SER to an integer
271
+ >>> gen_to_integer(pari("1 + I"))
272
+ Traceback (most recent call last):
273
+ ...
274
+ TypeError: unable to convert PARI object 1 + I of type t_COMPLEX to an integer
275
+
276
+ Tests:
277
+
278
+ >>> gen_to_integer(pari("1.0 - 2^64")) == -18446744073709551615
279
+ True
280
+ >>> gen_to_integer(pari("1 - 2^64")) == -18446744073709551615
281
+ True
282
+ >>> import sys
283
+ >>> if sys.version_info.major == 3:
284
+ ... long = int
285
+ >>> for i in range(10000):
286
+ ... x = 3**i
287
+ ... if long(pari(x)) != long(x) or int(pari(x)) != x:
288
+ ... print(x)
289
+
290
+ Check some corner cases:
291
+
292
+ >>> for s in [1, -1]:
293
+ ... for a in [1, 2**31, 2**32, 2**63, 2**64]:
294
+ ... for b in [-1, 0, 1]:
295
+ ... Nstr = str(s * (a + b))
296
+ ... N1 = gen_to_integer(pari(Nstr)) # Convert via PARI
297
+ ... N2 = int(Nstr) # Convert via Python
298
+ ... if N1 != N2:
299
+ ... print(Nstr, N1, N2)
300
+ ... if type(N1) is not type(N2):
301
+ ... print(N1, type(N1), N2, type(N2))
302
+ """
303
+ return PyInt_FromGEN(x.g)
304
+
305
+
306
+ cdef PyObject_FromGEN(GEN g):
307
+ cdef long t = typ(g)
308
+ cdef Py_ssize_t i, j
309
+ cdef Py_ssize_t lr, lc
310
+
311
+ if t == t_INT:
312
+ return PyInt_FromGEN(g)
313
+ elif t == t_FRAC:
314
+ from fractions import Fraction
315
+ num = PyInt_FromGEN(gel(g, 1))
316
+ den = PyInt_FromGEN(gel(g, 2))
317
+ return Fraction(num, den)
318
+ elif t == t_REAL:
319
+ return rtodbl(g)
320
+ elif t == t_COMPLEX:
321
+ re = PyObject_FromGEN(gel(g, 1))
322
+ im = PyObject_FromGEN(gel(g, 2))
323
+ return complex(re, im)
324
+ elif t == t_VEC or t == t_COL:
325
+ return [PyObject_FromGEN(gel(g, i)) for i in range(1, lg(g))]
326
+ elif t == t_VECSMALL:
327
+ return [g[i] for i in range(1, lg(g))]
328
+ elif t == t_MAT:
329
+ lc = lg(g)
330
+ if lc <= 1:
331
+ return [[]]
332
+ lr = lg(gel(g, 1))
333
+ return [[PyObject_FromGEN(gcoeff(g, i, j)) for j in range(1, lc)]
334
+ for i in range(1, lr)]
335
+ elif t == t_INFINITY:
336
+ if inf_get_sign(g) >= 0:
337
+ return INFINITY
338
+ else:
339
+ return -INFINITY
340
+ elif t == t_STR:
341
+ return to_string(GSTR(g))
342
+ else:
343
+ tname = to_string(type_name(t))
344
+ raise NotImplementedError(f"conversion not implemented for {tname}")
345
+
346
+
347
+ cdef PyInt_FromGEN(GEN g):
348
+ # First convert the input to a t_INT
349
+ try:
350
+ g = gtoi(g)
351
+ finally:
352
+ # Reset avma now. This is OK as long as we are not calling further
353
+ # PARI functions before this function returns.
354
+ reset_avma()
355
+
356
+ if not signe(g):
357
+ return PyLong_FromLong(0)
358
+
359
+ cdef ulong u
360
+ if PY_MAJOR_VERSION == 2:
361
+ # Try converting to a Python 2 "int" first. Note that we cannot
362
+ # use itos() from PARI since that does not deal with LONG_MIN
363
+ # correctly.
364
+ if lgefint(g) == 3: # abs(x) fits in a ulong
365
+ u = g[2] # u = abs(x)
366
+ # Check that <long>(u) or <long>(-u) does not overflow
367
+ if signe(g) >= 0:
368
+ if u <= <ulong>LONG_MAX:
369
+ return PyLong_FromLong(u)
370
+ else:
371
+ if u <= -<ulong>LONG_MIN:
372
+ return PyLong_FromLong(-u)
373
+
374
+ # Result does not fit in a C long
375
+ res = PyLong_FromINT(g)
376
+ return res
377
+
378
+
379
+ cdef GEN gtoi(GEN g0) except NULL:
380
+ """
381
+ Convert a PARI object to a PARI integer.
382
+
383
+ This function is shallow and not stack-clean.
384
+ """
385
+ if typ(g0) == t_INT:
386
+ return g0
387
+ cdef GEN g
388
+ try:
389
+ sig_on()
390
+ g = simplify_shallow(g0)
391
+ if typ(g) == t_COMPLEX:
392
+ if gequal0(gel(g, 2)):
393
+ g = gel(g, 1)
394
+ if typ(g) == t_INTMOD:
395
+ g = gel(g, 2)
396
+ g = trunc_safe(g)
397
+ if typ(g) != t_INT:
398
+ sig_error()
399
+ sig_off()
400
+ except RuntimeError:
401
+ s = to_string(stack_sprintf(
402
+ "unable to convert PARI object %Ps of type %s to an integer",
403
+ g0, type_name(typ(g0))))
404
+ raise TypeError(s)
405
+ return g
406
+
407
+
408
+ cdef PyLong_FromINT(GEN g):
409
+ # Size of input in words, bits and Python digits. The size in
410
+ # digits might be a small over-estimation, but that is not a
411
+ # problem.
412
+ cdef size_t sizewords = (lgefint(g) - 2)
413
+ cdef size_t sizebits = sizewords * BITS_IN_LONG
414
+ cdef size_t sizedigits = (sizebits + PyLong_SHIFT - 1) // PyLong_SHIFT
415
+
416
+ # Actual correct computed size
417
+ cdef Py_ssize_t sizedigits_final = 0
418
+
419
+ cdef py_long x = _PyLong_New(sizedigits)
420
+ cdef digit* D = ob_digit(x)
421
+
422
+ cdef digit d
423
+ cdef ulong w
424
+ cdef size_t i, j, bit
425
+ for i in range(sizedigits):
426
+ # The least significant bit of digit number i of the output
427
+ # integer is bit number "bit" of word "j".
428
+ bit = i * PyLong_SHIFT
429
+ j = bit // BITS_IN_LONG
430
+ bit = bit % BITS_IN_LONG
431
+
432
+ w = int_W(g, j)[0]
433
+ d = w >> bit
434
+
435
+ # Do we need bits from the next word too?
436
+ if BITS_IN_LONG - bit < PyLong_SHIFT and j+1 < sizewords:
437
+ w = int_W(g, j+1)[0]
438
+ d += w << (BITS_IN_LONG - bit)
439
+
440
+ d = d & PyLong_MASK
441
+ D[i] = d
442
+
443
+ # Keep track of last non-zero digit
444
+ if d:
445
+ sizedigits_final = i+1
446
+
447
+ # Set correct size
448
+ _PyLong_SetSignAndDigitCount(x, signe(g), sizedigits_final)
449
+
450
+ return x
451
+
452
+
453
+ ########################################################################
454
+ # Conversion Python -> PARI
455
+ ########################################################################
456
+
457
+ cdef GEN PyLong_AS_GEN(py_long x) noexcept:
458
+ cdef const digit* D = ob_digit(x)
459
+
460
+ # Size of the input
461
+ cdef size_t sizedigits
462
+ cdef long sgn
463
+ if _PyLong_IsZero(x):
464
+ return gen_0
465
+ elif _PyLong_IsPositive(x):
466
+ sizedigits = _PyLong_DigitCount(x)
467
+ sgn = evalsigne(1)
468
+ else:
469
+ sizedigits = _PyLong_DigitCount(x)
470
+ sgn = evalsigne(-1)
471
+
472
+ # Size of the output, in bits and in words
473
+ cdef size_t sizebits = sizedigits * PyLong_SHIFT
474
+ cdef size_t sizewords = (sizebits + BITS_IN_LONG - 1) // BITS_IN_LONG
475
+
476
+ # Compute the most significant word of the output.
477
+ # This is a special case because we need to be careful not to
478
+ # overflow the ob_digit array. We also need to check for zero,
479
+ # in which case we need to decrease sizewords.
480
+ # See the loop below for an explanation of this code.
481
+ cdef size_t bit = (sizewords - 1) * BITS_IN_LONG
482
+ cdef size_t dgt = bit // PyLong_SHIFT
483
+ bit = bit % PyLong_SHIFT
484
+
485
+ cdef ulong w = <ulong>(D[dgt]) >> bit
486
+ if 1*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+1 < sizedigits:
487
+ w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
488
+ if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < sizedigits:
489
+ w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
490
+ if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < sizedigits:
491
+ w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
492
+ if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < sizedigits:
493
+ w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
494
+ if 5*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+5 < sizedigits:
495
+ w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
496
+
497
+ # Effective size in words plus 2 special codewords
498
+ cdef size_t pariwords = sizewords+2 if w else sizewords+1
499
+ cdef GEN g = cgeti(pariwords)
500
+ g[1] = sgn + evallgefint(pariwords)
501
+
502
+ if w:
503
+ int_MSW(g)[0] = w
504
+
505
+ # Fill all words
506
+ cdef GEN ptr = int_LSW(g)
507
+ cdef size_t i
508
+ for i in range(sizewords - 1):
509
+ # The least significant bit of word number i of the output
510
+ # integer is bit number "bit" of Python digit "dgt".
511
+ bit = i * BITS_IN_LONG
512
+ dgt = bit // PyLong_SHIFT
513
+ bit = bit % PyLong_SHIFT
514
+
515
+ # Now construct the output word from the Python digits: we need
516
+ # to check that we shift less than the number of bits in the
517
+ # type. 6 digits are enough assuming that PyLong_SHIFT >= 15 and
518
+ # BITS_IN_LONG <= 76. A clever compiler should optimize away all
519
+ # but one of the "if" statements below.
520
+ w = <ulong>(D[dgt]) >> bit
521
+ if 1*PyLong_SHIFT - bit < BITS_IN_LONG:
522
+ w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
523
+ if 2*PyLong_SHIFT - bit < BITS_IN_LONG:
524
+ w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
525
+ if 3*PyLong_SHIFT - bit < BITS_IN_LONG:
526
+ w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
527
+ if 4*PyLong_SHIFT - bit < BITS_IN_LONG:
528
+ w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
529
+ if 5*PyLong_SHIFT - bit < BITS_IN_LONG:
530
+ w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
531
+
532
+ ptr[0] = w
533
+ ptr = int_nextW(ptr)
534
+
535
+ return g
536
+
537
+
538
+ cdef GEN PyObject_AsGEN(x) except? NULL:
539
+ """
540
+ Convert basic Python types to a PARI GEN.
541
+ """
542
+ cdef GEN g = NULL
543
+ if isinstance(x, unicode):
544
+ x = to_bytes(x)
545
+ if isinstance(x, bytes):
546
+ sig_on()
547
+ g = gp_read_str(<bytes>x)
548
+ sig_off()
549
+ elif isinstance(x, int):
550
+ sig_on()
551
+ g = PyLong_AS_GEN(x)
552
+ sig_off()
553
+ elif isinstance(x, float):
554
+ sig_on()
555
+ g = PyFloat_AS_GEN(x)
556
+ sig_off()
557
+ elif isinstance(x, complex):
558
+ sig_on()
559
+ g = PyComplex_AS_GEN(x)
560
+ sig_off()
561
+ return g
562
+
563
+
564
+ ####################################
565
+ # Deprecated functions
566
+ ####################################
567
+
568
+ cdef Gen new_gen_from_double(double x):
569
+ sig_on()
570
+ return new_gen(double_to_REAL(x))
571
+
572
+
573
+ cdef Gen new_t_COMPLEX_from_double(double re, double im):
574
+ sig_on()
575
+ return new_gen(doubles_to_COMPLEX(re, im))
576
+
577
+
578
+ def integer_to_gen(x):
579
+ """
580
+ Convert a Python ``int`` or ``long`` to a PARI ``gen`` of type
581
+ ``t_INT``.
582
+
583
+ Examples:
584
+
585
+ >>> from cypari2.convert import integer_to_gen
586
+ >>> from cypari2 import Pari
587
+ >>> pari = Pari()
588
+ >>> a = integer_to_gen(int(12345)); a; type(a)
589
+ 12345
590
+ <... 'cypari2.gen.Gen'>
591
+ >>> integer_to_gen(float(12345))
592
+ Traceback (most recent call last):
593
+ ...
594
+ TypeError: integer_to_gen() needs an int or long argument, not float
595
+ >>> integer_to_gen(2**100)
596
+ 1267650600228229401496703205376
597
+
598
+ Tests:
599
+
600
+ >>> import sys
601
+ >>> if sys.version_info.major == 3:
602
+ ... long = int
603
+ >>> assert integer_to_gen(long(12345)) == 12345
604
+ >>> for i in range(10000):
605
+ ... x = 3**i
606
+ ... if pari(long(x)) != pari(x) or pari(int(x)) != pari(x):
607
+ ... print(x)
608
+ """
609
+ if isinstance(x, int):
610
+ sig_on()
611
+ return new_gen(PyLong_AS_GEN(x))
612
+ raise TypeError("integer_to_gen() needs an int or long "
613
+ "argument, not {}".format(type(x).__name__))
@@ -0,0 +1,30 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ # distutils: libraries = gmp pari
3
+
4
+ #*****************************************************************************
5
+ # Distributed under the terms of the GNU General Public License (GPL)
6
+ # as published by the Free Software Foundation; either version 2 of
7
+ # the License, or (at your option) any later version.
8
+ # http://www.gnu.org/licenses/
9
+ #*****************************************************************************
10
+
11
+ from cysignals.signals cimport add_custom_signals
12
+
13
+ cdef extern from "pari/pari.h":
14
+ int PARI_SIGINT_block, PARI_SIGINT_pending
15
+
16
+ cdef int custom_signal_is_blocked() noexcept:
17
+ return PARI_SIGINT_block
18
+
19
+ cdef void custom_signal_unblock() noexcept:
20
+ global PARI_SIGINT_block
21
+ PARI_SIGINT_block = 0
22
+
23
+ cdef void custom_set_pending_signal(int sig) noexcept:
24
+ global PARI_SIGINT_pending
25
+ PARI_SIGINT_pending = sig
26
+
27
+ def init_custom_block():
28
+ add_custom_signals(&custom_signal_is_blocked,
29
+ &custom_signal_unblock,
30
+ &custom_set_pending_signal)
cypari2/cypari.h ADDED
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Additional macros and fixes for the PARI headers. This is meant to
3
+ * be included after including <pari/pari.h>
4
+ */
5
+
6
+ #undef coeff /* Conflicts with NTL (which is used by SageMath) */
7
+
8
+
9
+ /* Array element assignment */
10
+ #define set_gel(x, n, z) (gel((x), (n)) = (z))
11
+ #define set_gmael(x, i, j, z) (gmael((x), (i), (j)) = (z))
12
+ #define set_gcoeff(x, i, j, z) (gcoeff((x), (i), (j)) = (z))
13
+ #define set_uel(x, n, z) (uel((x), (n)) = (z))