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
@@ -0,0 +1,247 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ # sage.doctest: needs sage.libs.ntl
3
+ cimport cython
4
+
5
+
6
+ @cython.binding(True)
7
+ def frobenius_unram(self, arithmetic=True):
8
+ """
9
+ Return the image of this element under the Frobenius automorphism
10
+ applied to its parent.
11
+
12
+ INPUT:
13
+
14
+ - ``self`` -- an element of an unramified extension
15
+ - ``arithmetic`` -- whether to apply the arithmetic Frobenius (acting
16
+ by raising to the `p`-th power on the residue field). If ``False`` is
17
+ provided, the image of geometric Frobenius (raising to the `(1/p)`-th
18
+ power on the residue field) will be returned instead.
19
+
20
+ EXAMPLES::
21
+
22
+ sage: R.<a> = Zq(5^4,3)
23
+ sage: a.frobenius()
24
+ (a^3 + a^2 + 3*a) + (3*a + 1)*5 + (2*a^3 + 2*a^2 + 2*a)*5^2 + O(5^3)
25
+ sage: f = R.defining_polynomial()
26
+ sage: f(a)
27
+ O(5^3)
28
+ sage: f(a.frobenius())
29
+ O(5^3)
30
+ sage: for i in range(4): a = a.frobenius()
31
+ sage: a
32
+ a + O(5^3)
33
+
34
+ sage: R.<a> = Zq(5^4,3)
35
+ sage: a.frobenius(arithmetic=False)
36
+ (3*a^3 + 3*a^2 + a) + (a^3 + 4*a^2 + a + 4)*5 + (3*a^2 + 2*a + 3)*5^2 + O(5^3)
37
+
38
+ sage: K.<a> = Qq(7^3,4)
39
+ sage: b = (a+1)/7
40
+ sage: c = b.frobenius(); c
41
+ (3*a^2 + 5*a + 1)*7^-1 + (6*a^2 + 6*a + 6) + (4*a^2 + 3*a + 4)*7 + (6*a^2 + a + 6)*7^2 + O(7^3)
42
+ sage: c.frobenius().frobenius()
43
+ (a + 1)*7^-1 + O(7^3)
44
+
45
+ An error will be raised if the parent of ``self`` is a ramified extension::
46
+
47
+ sage: x = polygen(ZZ, 'x')
48
+ sage: K.<a> = Qp(5).extension(x^2 - 5)
49
+ sage: a.frobenius()
50
+ Traceback (most recent call last):
51
+ ...
52
+ NotImplementedError: Frobenius automorphism only implemented for unramified extensions
53
+
54
+ TESTS:
55
+
56
+ We check that :issue:`23575` is resolved::
57
+
58
+ sage: x = R.random_element()
59
+ sage: x.frobenius(arithmetic=false).frobenius() == x
60
+ True
61
+ """
62
+ if self == 0:
63
+ return self
64
+ R = self.parent()
65
+ p = R.prime()
66
+ a = R.gen()
67
+ frob_a = R._frob_gen(arithmetic)
68
+ ppow = self.valuation()
69
+ unit = self.unit_part()
70
+ coefs = unit.expansion()
71
+ ans = 0
72
+
73
+ # Xavier's implementation based on Horner scheme
74
+ for i in range(R.f()-1, -1, -1):
75
+ update = 0
76
+ for j in range(len(coefs)-1, -1, -1):
77
+ update *= p
78
+ try:
79
+ update += coefs[j][i]
80
+ except IndexError:
81
+ pass
82
+ ans *= frob_a
83
+ ans += update
84
+ return ans << ppow
85
+
86
+
87
+ @cython.binding(True)
88
+ def norm_unram(self, base=None):
89
+ r"""
90
+ Return the absolute or relative norm of this element.
91
+
92
+ .. WARNING::
93
+
94
+ This is not the `p`-adic absolute value. This is a
95
+ field theoretic norm down to a ground ring. If you want the
96
+ `p`-adic absolute value, use the ``abs()`` function instead.
97
+
98
+ INPUT:
99
+
100
+ - ``base`` -- a subfield of the parent `L` of this element; the norm is the
101
+ relative norm from ``L`` to ``base``. Defaults to the absolute norm down
102
+ to `\QQ_p` or `\ZZ_p`.
103
+
104
+ EXAMPLES::
105
+
106
+ sage: R = ZpCR(5,5)
107
+ sage: S.<x> = R[]
108
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
109
+ sage: W.<w> = R.ext(f)
110
+ sage: ((1+2*w)^5).norm()
111
+ 1 + 5^2 + O(5^5)
112
+ sage: ((1+2*w)).norm()^5
113
+ 1 + 5^2 + O(5^5)
114
+
115
+ TESTS::
116
+
117
+ sage: R = ZpCA(5,5)
118
+ sage: S.<x> = ZZ[]
119
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
120
+ sage: W.<w> = R.ext(f)
121
+ sage: ((1+2*w)^5).norm()
122
+ 1 + 5^2 + O(5^5)
123
+ sage: ((1+2*w)).norm()^5
124
+ 1 + 5^2 + O(5^5)
125
+ sage: R = ZpFM(5,5)
126
+ sage: S.<x> = ZZ[]
127
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
128
+ sage: W.<w> = R.ext(f)
129
+ sage: ((1+2*w)^5).norm()
130
+ 1 + 5^2
131
+ sage: ((1+2*w)).norm()^5
132
+ 1 + 5^2
133
+
134
+ TESTS:
135
+
136
+ Check that :issue:`11586` has been resolved::
137
+
138
+ sage: R.<x> = QQ[]
139
+ sage: f = x^2 + 3*x + 1
140
+ sage: M.<a> = Qp(7).extension(f)
141
+ sage: M(7).norm()
142
+ 7^2 + O(7^22)
143
+ sage: b = 7*a + 35
144
+ sage: b.norm()
145
+ 4*7^2 + 7^3 + O(7^22)
146
+ sage: b*b.frobenius()
147
+ 4*7^2 + 7^3 + O(7^22)
148
+
149
+ Check that :issue:`31845` is fixed::
150
+
151
+ sage: R.<a> = Zq(4)
152
+ sage: (a - a).norm()
153
+ O(2^20)
154
+ """
155
+ if base is not None:
156
+ if base is self.parent():
157
+ return self
158
+ else:
159
+ raise NotImplementedError
160
+ if self._is_exact_zero():
161
+ return self.parent().ground_ring()(0)
162
+ elif self._is_inexact_zero():
163
+ return self.parent().ground_ring()(0, self.valuation())
164
+ if self.valuation() == 0:
165
+ return self.parent().ground_ring()(self.matrix_mod_pn().det())
166
+ else:
167
+ if self.parent().e() == 1:
168
+ norm_of_uniformizer = self.parent().ground_ring().uniformizer_pow(self.parent().degree())
169
+ else:
170
+ norm_of_uniformizer = (-1)**self.parent().degree() * self.parent().defining_polynomial()[0]
171
+ return self.parent().ground_ring()(self.unit_part().matrix_mod_pn().det()) * norm_of_uniformizer**self.valuation()
172
+
173
+
174
+ @cython.binding(True)
175
+ def trace_unram(self, base=None):
176
+ r"""
177
+ Return the absolute or relative trace of this element.
178
+
179
+ If ``base`` is given then ``base`` must be a subfield of the
180
+ parent `L` of ``self``, in which case the trace is the relative
181
+ trace from `L` to ``base``.
182
+
183
+ In all other cases, the trace is the absolute trace down to
184
+ `\QQ_p` or `\ZZ_p`.
185
+
186
+ EXAMPLES::
187
+
188
+ sage: R = ZpCR(5,5)
189
+ sage: S.<x> = R[]
190
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
191
+ sage: W.<w> = R.ext(f)
192
+ sage: a = (2+3*w)^7
193
+ sage: b = (6+w^3)^5
194
+ sage: a.trace()
195
+ 3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5)
196
+ sage: a.trace() + b.trace()
197
+ 4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)
198
+ sage: (a+b).trace()
199
+ 4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)
200
+
201
+ TESTS::
202
+
203
+ sage: R = ZpCA(5,5)
204
+ sage: S.<x> = ZZ[]
205
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
206
+ sage: W.<w> = R.ext(f)
207
+ sage: a = (2+3*w)^7
208
+ sage: b = (6+w^3)^5
209
+ sage: a.trace()
210
+ 3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5)
211
+ sage: a.trace() + b.trace()
212
+ 4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)
213
+ sage: (a+b).trace()
214
+ 4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)
215
+ sage: R = ZpFM(5,5)
216
+ sage: S.<x> = R[]
217
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
218
+ sage: W.<w> = R.ext(f)
219
+ sage: a = (2+3*w)^7
220
+ sage: b = (6+w^3)^5
221
+ sage: a.trace()
222
+ 3*5 + 2*5^2 + 3*5^3 + 2*5^4
223
+ sage: a.trace() + b.trace()
224
+ 4*5 + 5^2 + 5^3 + 2*5^4
225
+ sage: (a+b).trace()
226
+ 4*5 + 5^2 + 5^3 + 2*5^4
227
+
228
+ Check that :issue:`31845` is fixed::
229
+
230
+ sage: R.<a> = Zq(4)
231
+ sage: (a - a).trace()
232
+ O(2^20)
233
+ """
234
+ if base is not None:
235
+ if base is self.parent():
236
+ return self
237
+ else:
238
+ raise NotImplementedError
239
+ if self._is_exact_zero():
240
+ return self.parent().ground_ring()(0)
241
+ elif self._is_inexact_zero():
242
+ return self.parent().ground_ring()(0, self.precision_absolute())
243
+ if self.valuation() >= 0:
244
+ return self.parent().ground_ring()(self.matrix_mod_pn().trace())
245
+ else:
246
+ shift = -self.valuation()
247
+ return self.parent().ground_ring()((self * self.parent().prime() ** shift).matrix_mod_pn().trace()) / self.parent().prime()**shift
@@ -0,0 +1,210 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ # sage.doctest: needs sage.rings.real_mpfr
3
+ """
4
+ Interface between Sage and PARI
5
+
6
+ Guide to real precision in the PARI interface
7
+ =============================================
8
+
9
+ In the PARI interface, "real precision" refers to the precision of real
10
+ numbers, so it is the floating-point precision. This is a non-trivial
11
+ issue, since there are various interfaces for different things.
12
+
13
+ Internal representation and conversion between Sage and PARI
14
+ ------------------------------------------------------------
15
+
16
+ Real numbers in PARI have a precision associated to them, which is
17
+ always a multiple of the CPU wordsize. So, it is a multiple of 32
18
+ of 64 bits. When converting from Sage to PARI, the precision is rounded
19
+ up to the nearest multiple of the wordsize::
20
+
21
+ sage: x = 1.0
22
+ sage: x.precision()
23
+ 53
24
+ sage: pari(x)
25
+ 1.00000000000000
26
+ sage: pari(x).bitprecision()
27
+ 64
28
+
29
+ With a higher precision::
30
+
31
+ sage: x = RealField(100).pi()
32
+ sage: x.precision()
33
+ 100
34
+ sage: pari(x).bitprecision()
35
+ 128
36
+
37
+ When converting back to Sage, the precision from PARI is taken::
38
+
39
+ sage: x = RealField(100).pi()
40
+ sage: y = pari(x).sage()
41
+ sage: y
42
+ 3.1415926535897932384626433832793333156
43
+ sage: parent(y)
44
+ Real Field with 128 bits of precision
45
+
46
+ So ``pari(x).sage()`` is definitely not equal to ``x`` since it has
47
+ 28 bogus bits.
48
+
49
+ Therefore, some care must be taken when juggling reals back and forth
50
+ between Sage and PARI. The correct way of avoiding this is to convert
51
+ ``pari(x).sage()`` back into a domain with the right precision. This has
52
+ to be done by the user (or by Sage functions that use PARI library
53
+ functions). For instance, if we want to use the PARI library to compute
54
+ ``sqrt(pi)`` with a precision of 100 bits::
55
+
56
+ sage: # needs sage.symbolic
57
+ sage: R = RealField(100)
58
+ sage: s = R(pi); s
59
+ 3.1415926535897932384626433833
60
+ sage: p = pari(s).sqrt()
61
+ sage: x = p.sage(); x # wow, more digits than I expected!
62
+ 1.7724538509055160272981674833410973484
63
+ sage: x.prec() # has precision 'improved' from 100 to 128?
64
+ 128
65
+ sage: x == RealField(128)(pi).sqrt() # sadly, no!
66
+ False
67
+ sage: R(x) # x should be brought back to precision 100
68
+ 1.7724538509055160272981674833
69
+ sage: R(x) == s.sqrt()
70
+ True
71
+
72
+ Output precision for printing
73
+ -----------------------------
74
+
75
+ Even though PARI reals have a precision, not all significant bits are
76
+ printed by default. The maximum number of digits when printing a PARI
77
+ real can be set using the methods
78
+ :meth:`Pari.set_real_precision_bits` or
79
+ :meth:`Pari.set_real_precision`.
80
+
81
+ We create a very precise approximation of pi and see how it is printed
82
+ in PARI::
83
+
84
+ sage: pi = pari(RealField(1000).pi())
85
+
86
+ The default precision is 15 digits::
87
+
88
+ sage: pi
89
+ 3.14159265358979
90
+
91
+ With a different precision::
92
+
93
+ sage: _ = pari.set_real_precision(50)
94
+ sage: pi
95
+ 3.1415926535897932384626433832795028841971693993751
96
+
97
+ Back to the default::
98
+
99
+ sage: _ = pari.set_real_precision(15)
100
+ sage: pi
101
+ 3.14159265358979
102
+
103
+ Input precision for function calls
104
+ ----------------------------------
105
+
106
+ When we talk about precision for PARI functions, we need to distinguish
107
+ three kinds of calls:
108
+
109
+ 1. Using the string interface, for example ``pari("sin(1)")``.
110
+
111
+ 2. Using the library interface with exact inputs, for example
112
+ ``pari(1).sin()``.
113
+
114
+ 3. Using the library interface with inexact inputs, for example
115
+ ``pari(1.0).sin()``.
116
+
117
+ In the first case, the relevant precision is the one set by the methods
118
+ :meth:`Pari.set_real_precision_bits` or
119
+ :meth:`Pari.set_real_precision`::
120
+
121
+ sage: pari.set_real_precision_bits(150)
122
+ sage: pari("sin(1)")
123
+ 0.841470984807896506652502321630298999622563061
124
+ sage: pari.set_real_precision_bits(53)
125
+ sage: pari("sin(1)")
126
+ 0.841470984807897
127
+
128
+ In the second case, the precision can be given as the argument
129
+ ``precision`` in the function call, with a default of 53 bits.
130
+ The real precision set by
131
+ :meth:`Pari.set_real_precision_bits` or
132
+ :meth:`Pari.set_real_precision` is irrelevant.
133
+
134
+ In these examples, we convert to Sage to ensure that PARI's real
135
+ precision is not used when printing the numbers. As explained before,
136
+ this artificially increases the precision to a multiple of the
137
+ wordsize. ::
138
+
139
+ sage: s = pari(1).sin(precision=180).sage(); print(s); print(parent(s))
140
+ 0.841470984807896506652502321630298999622563060798371065673
141
+ Real Field with 192 bits of precision
142
+ sage: s = pari(1).sin(precision=40).sage(); print(s); print(parent(s))
143
+ 0.841470984807896507
144
+ Real Field with 64 bits of precision
145
+ sage: s = pari(1).sin().sage(); print(s); print(parent(s))
146
+ 0.841470984807896507
147
+ Real Field with 64 bits of precision
148
+
149
+ In the third case, the precision is determined only by the inexact
150
+ inputs and the ``precision`` argument is ignored::
151
+
152
+ sage: pari(1.0).sin(precision=180).sage()
153
+ 0.841470984807896507
154
+ sage: pari(1.0).sin(precision=40).sage()
155
+ 0.841470984807896507
156
+ sage: pari(RealField(100).one()).sin().sage()
157
+ 0.84147098480789650665250232163029899962
158
+
159
+ Elliptic curve functions
160
+ ------------------------
161
+
162
+ An elliptic curve given with exact `a`-invariants is considered an
163
+ exact object. Therefore, you should set the precision for each method
164
+ call individually::
165
+
166
+ sage: e = pari([0,0,0,-82,0]).ellinit()
167
+ sage: eta1 = e.elleta(precision=50)[0]
168
+ sage: eta1.sage()
169
+ 3.6054636014326520859158205642077267748
170
+ sage: eta1 = e.elleta(precision=150)[0]
171
+ sage: eta1.sage()
172
+ 3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit
173
+ 3.605463601432652085915820564207726774810268996598024745444380641430 # 32-bit
174
+ """
175
+
176
+ from cypari2 import Pari
177
+
178
+ from sage.ext.memory import init_memory_functions
179
+
180
+
181
+ def _get_pari_instance():
182
+ """
183
+ TESTS::
184
+
185
+ sage: pari # indirect doctest
186
+ Interface to the PARI C library
187
+ """
188
+ stack_initial = 1024 * 1024
189
+ stack_max = 1024 * stack_initial
190
+ P = Pari(stack_initial, stack_max)
191
+
192
+ # pari_init_opts() overrides MPIR's memory allocation functions,
193
+ # so we need to reset them.
194
+ init_memory_functions()
195
+
196
+ # PARI sets debugmem=1 by default but we do not want those warning
197
+ # messages in Sage.
198
+ P.default("debugmem", 0)
199
+
200
+ # Make sure pari doesn't use threads, regardless of how it was compiled.
201
+ # Threads cause some doctest failures (memory issues). Those could probably
202
+ # be solved without disabling threads. But that would require figuring out
203
+ # some sensible values for `threadsizemax`. See
204
+ # https://pari.math.u-bordeaux.fr/dochtml/html/GP_defaults.html
205
+ P.default("nbthreads", 1)
206
+
207
+ return P
208
+
209
+
210
+ pari = _get_pari_instance()
sage/libs/pari/all.py ADDED
@@ -0,0 +1,5 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ from cypari2 import PariError
3
+ from cypari2.gen import Gen as pari_gen
4
+
5
+ from sage.libs.pari import pari
@@ -0,0 +1,14 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ from cypari2.types cimport GEN
3
+ from cypari2.gen cimport Gen
4
+ from sage.libs.flint.types cimport fmpz_t, fmpz_mat_t, fmpq_t, fmpq_mat_t
5
+
6
+ cdef GEN _new_GEN_from_fmpz_t(fmpz_t value) noexcept
7
+ cdef GEN _new_GEN_from_fmpz_mat_t(fmpz_mat_t B) noexcept
8
+ cdef GEN _new_GEN_from_fmpz_mat_t_rotate90(fmpz_mat_t B) noexcept
9
+ cdef Gen integer_matrix(fmpz_mat_t B, bint rotate)
10
+
11
+ cdef GEN _new_GEN_from_fmpq_t(fmpq_t value) noexcept
12
+ cdef GEN _new_GEN_from_fmpq_mat_t(fmpq_mat_t B) noexcept
13
+ cdef GEN _new_GEN_from_fmpq_mat_t_rotate90(fmpq_mat_t B) noexcept
14
+ cdef Gen rational_matrix(fmpq_mat_t B, bint rotate)
@@ -0,0 +1,159 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ """
3
+ Convert PARI objects to/from Flint objects
4
+
5
+ Utility function to convert PARI ``GEN``s to/from flint types.
6
+
7
+ AUTHORS:
8
+
9
+ - Luca De Feo (2016-09-06): Separate Sage-specific components from
10
+ generic C-interface in ``Pari`` (:issue:`20241`)
11
+ """
12
+
13
+ # ****************************************************************************
14
+ # Copyright (C) 2016 Luca De Feo <luca.defeo@polytechnique.edu>
15
+ #
16
+ # This program is free software: you can redistribute it and/or modify
17
+ # it under the terms of the GNU General Public License as published by
18
+ # the Free Software Foundation, either version 2 of the License, or
19
+ # (at your option) any later version.
20
+ # https://www.gnu.org/licenses/
21
+ # ****************************************************************************
22
+
23
+ from cysignals.signals cimport sig_on
24
+
25
+ from sage.libs.flint.fmpz cimport COEFF_IS_MPZ, COEFF_TO_PTR, fmpz_is_one
26
+ from sage.libs.flint.fmpq cimport fmpq_numref, fmpq_denref
27
+ from sage.libs.flint.fmpz_mat cimport fmpz_mat_nrows, fmpz_mat_ncols, fmpz_mat_entry
28
+ from sage.libs.flint.fmpq_mat cimport fmpq_mat_nrows, fmpq_mat_ncols, fmpq_mat_entry
29
+
30
+ from cypari2.paridecl cimport *
31
+ from cypari2.stack cimport new_gen
32
+ from sage.libs.pari.convert_gmp cimport _new_GEN_from_mpz_t
33
+
34
+
35
+ cdef inline GEN _new_GEN_from_fmpz_t(fmpz_t value) noexcept:
36
+ r"""
37
+ Create a new PARI ``t_INT`` from a ``fmpz_t``.
38
+
39
+ For internal use only; this directly uses the PARI stack.
40
+ One should call ``sig_on()`` before and ``sig_off()`` after.
41
+ """
42
+ if COEFF_IS_MPZ(value[0]):
43
+ return _new_GEN_from_mpz_t(COEFF_TO_PTR(value[0]))
44
+ else:
45
+ return stoi(value[0])
46
+
47
+
48
+ cdef inline GEN _new_GEN_from_fmpq_t(fmpq_t value) noexcept:
49
+ r"""
50
+ Create a new PARI ``t_RAT`` from a ``fmpq_t``.
51
+
52
+ For internal use only; this directly uses the PARI stack.
53
+ One should call ``sig_on()`` before and ``sig_off()`` after.
54
+ """
55
+ cdef GEN num = _new_GEN_from_fmpz_t(fmpq_numref(value))
56
+ if fmpz_is_one(fmpq_denref(value)):
57
+ return num
58
+ cdef GEN denom = _new_GEN_from_fmpz_t(fmpq_denref(value))
59
+ return mkfrac(num, denom)
60
+
61
+
62
+ cdef GEN _new_GEN_from_fmpz_mat_t(fmpz_mat_t B) noexcept:
63
+ r"""
64
+ Create a new PARI ``t_MAT`` with ``nr`` rows and ``nc`` columns
65
+ from a ``fmpz_mat_t``.
66
+
67
+ For internal use only; this directly uses the PARI stack.
68
+ One should call ``sig_on()`` before and ``sig_off()`` after.
69
+ """
70
+ cdef GEN x
71
+ cdef GEN A = zeromatcopy(fmpz_mat_nrows(B), fmpz_mat_ncols(B))
72
+ cdef Py_ssize_t i, j
73
+ for i in range(fmpz_mat_nrows(B)):
74
+ for j in range(fmpz_mat_ncols(B)):
75
+ x = _new_GEN_from_fmpz_t(fmpz_mat_entry(B, i, j))
76
+ set_gcoeff(A, i+1, j+1, x) # A[i+1, j+1] = x (using 1-based indexing)
77
+ return A
78
+
79
+
80
+ cdef GEN _new_GEN_from_fmpq_mat_t(fmpq_mat_t B) noexcept:
81
+ cdef GEN x
82
+ cdef GEN A = zeromatcopy(fmpq_mat_nrows(B), fmpq_mat_ncols(B))
83
+ cdef Py_ssize_t i, j
84
+ for i in range(fmpq_mat_nrows(B)):
85
+ for j in range(fmpq_mat_ncols(B)):
86
+ x = _new_GEN_from_fmpq_t(fmpq_mat_entry(B, i, j))
87
+ set_gcoeff(A, i+1, j+1, x) # A[i+1, j+1] = x (using 1-based indexing)
88
+ return A
89
+
90
+ cdef GEN _new_GEN_from_fmpz_mat_t_rotate90(fmpz_mat_t B) noexcept:
91
+ r"""
92
+ Create a new PARI ``t_MAT`` with ``nr`` rows and ``nc`` columns
93
+ from a ``fmpz_mat_t`` and rotate the matrix 90 degrees
94
+ counterclockwise. So the resulting matrix will have ``nc`` rows
95
+ and ``nr`` columns.
96
+
97
+ For internal use only; this directly uses the PARI stack.
98
+ One should call ``sig_on()`` before and ``sig_off()`` after.
99
+ """
100
+ cdef GEN x
101
+ cdef GEN A = zeromatcopy(fmpz_mat_ncols(B), fmpz_mat_nrows(B))
102
+ cdef Py_ssize_t i, j
103
+ for i in range(fmpz_mat_nrows(B)):
104
+ for j in range(fmpz_mat_ncols(B)):
105
+ x = _new_GEN_from_fmpz_t(fmpz_mat_entry(B, i, fmpz_mat_ncols(B) - j - 1))
106
+ set_gcoeff(A, j+1, i+1, x) # A[j+1, i+1] = x (using 1-based indexing)
107
+ return A
108
+
109
+
110
+ cdef GEN _new_GEN_from_fmpq_mat_t_rotate90(fmpq_mat_t B) noexcept:
111
+ r"""
112
+ Create a new PARI ``t_MAT`` with ``nr`` rows and ``nc`` columns
113
+ from a ``fmpq_mat_t`` and rotate the matrix 90 degrees
114
+ counterclockwise. So the resulting matrix will have ``nc`` rows
115
+ and ``nr`` columns.
116
+
117
+ For internal use only; this directly uses the PARI stack.
118
+ One should call ``sig_on()`` before and ``sig_off()`` after.
119
+ """
120
+ cdef GEN x
121
+ cdef GEN A = zeromatcopy(fmpq_mat_ncols(B), fmpq_mat_nrows(B))
122
+ cdef Py_ssize_t i, j
123
+ for i in range(fmpq_mat_nrows(B)):
124
+ for j in range(fmpq_mat_ncols(B)):
125
+ x = _new_GEN_from_fmpq_t(fmpq_mat_entry(B, i, fmpq_mat_ncols(B) - j - 1))
126
+ set_gcoeff(A, j+1, i+1, x) # A[j+1, i+1] = x (using 1-based indexing)
127
+ return A
128
+
129
+
130
+ cdef Gen integer_matrix(fmpz_mat_t B, bint rotate):
131
+ """
132
+ EXAMPLES::
133
+
134
+ sage: matrix(ZZ,2,[1..6]).__pari__() # indirect doctest # needs sage.libs.pari sage.modules
135
+ [1, 2, 3; 4, 5, 6]
136
+ """
137
+ cdef GEN g
138
+ sig_on()
139
+ if rotate:
140
+ g = _new_GEN_from_fmpz_mat_t_rotate90(B)
141
+ else:
142
+ g = _new_GEN_from_fmpz_mat_t(B)
143
+ return new_gen(g)
144
+
145
+
146
+ cdef Gen rational_matrix(fmpq_mat_t B, bint rotate):
147
+ """
148
+ EXAMPLES::
149
+
150
+ sage: matrix(QQ, 2, [1/2, 2/3, 3/4, 4/5]).__pari__() # indirect doctest # needs sage.libs.pari sage.modules
151
+ [1/2, 2/3; 3/4, 4/5]
152
+ """
153
+ cdef GEN g
154
+ sig_on()
155
+ if rotate:
156
+ g = _new_GEN_from_fmpq_mat_t_rotate90(B)
157
+ else:
158
+ g = _new_GEN_from_fmpq_mat_t(B)
159
+ return new_gen(g)
@@ -0,0 +1,14 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ from cypari2.types cimport GEN
3
+ from cypari2.gen cimport Gen
4
+ from sage.libs.gmp.types cimport mpz_t, mpq_t, mpz_ptr, mpq_ptr
5
+
6
+ cdef Gen new_gen_from_mpz_t(mpz_t value)
7
+ cdef GEN _new_GEN_from_mpz_t(mpz_t value) noexcept
8
+ cdef Gen new_gen_from_mpq_t(mpq_t value)
9
+ cdef GEN _new_GEN_from_mpq_t(mpq_t value) noexcept
10
+ cdef Gen new_gen_from_padic(long ordp, long relprec, mpz_t prime, mpz_t p_pow, mpz_t unit)
11
+ cdef GEN _new_GEN_from_mpq_t_matrix(mpq_t** B, long nr, long nc) noexcept
12
+ cdef Gen rational_matrix(mpq_t** B, long nr, long nc)
13
+ cdef void INT_to_mpz(mpz_ptr value, GEN g) noexcept
14
+ cdef void INTFRAC_to_mpq(mpq_ptr value, GEN g) noexcept