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,235 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ """
3
+ Ring of pari objects
4
+
5
+ AUTHORS:
6
+
7
+ - William Stein (2004): Initial version.
8
+ - Simon King (2011-08-24): Use UniqueRepresentation, element_class and
9
+ proper initialisation of elements.
10
+ """
11
+ # ****************************************************************************
12
+ # Copyright (C) 2004 William Stein <wstein@gmail.com>
13
+ #
14
+ # Distributed under the terms of the GNU General Public License (GPL)
15
+ #
16
+ # The full text of the GPL is available at:
17
+ #
18
+ # https://www.gnu.org/licenses/
19
+ # ****************************************************************************
20
+ from sage.categories.rings import Rings
21
+ from sage.libs.pari import pari
22
+ from sage.misc.fast_methods import Singleton
23
+ from sage.structure.element import RingElement
24
+ from sage.structure.parent import Parent
25
+ from sage.structure.richcmp import richcmp
26
+
27
+
28
+ class Pari(RingElement):
29
+ """
30
+ Element of Pari pseudo-ring.
31
+ """
32
+ def __init__(self, x, parent=None) -> None:
33
+ """
34
+ EXAMPLES::
35
+
36
+ sage: R = PariRing()
37
+ sage: f = R('x^3 + 1/2')
38
+ sage: f
39
+ x^3 + 1/2
40
+ sage: type(f)
41
+ <class 'sage.rings.pari_ring.PariRing_with_category.element_class'>
42
+ sage: loads(f.dumps()) == f
43
+ True
44
+ """
45
+ if parent is None:
46
+ parent = _inst
47
+ RingElement.__init__(self, parent)
48
+ self.__x = pari(x)
49
+
50
+ def __repr__(self) -> str:
51
+ """
52
+ EXAMPLES::
53
+
54
+ sage: R = PariRing()
55
+ sage: a = R(3); a
56
+ 3
57
+ """
58
+ return str(self.__x)
59
+
60
+ def _add_(self, other):
61
+ """
62
+ EXAMPLES::
63
+
64
+ sage: R = PariRing()
65
+ sage: b = R(11)
66
+ sage: a = R(3)
67
+ sage: a + b
68
+ 14
69
+ """
70
+ return self.__class__(self.__x + other.__x, parent=_inst)
71
+
72
+ def _sub_(self, other):
73
+ """
74
+ EXAMPLES::
75
+
76
+ sage: R = PariRing()
77
+ sage: a = R(3)
78
+ sage: b = R(11)
79
+ sage: b - a
80
+ 8
81
+ """
82
+ return self.__class__(self.__x - other.__x, parent=_inst)
83
+
84
+ def _mul_(self, other):
85
+ """
86
+ EXAMPLES::
87
+
88
+ sage: R = PariRing()
89
+ sage: a = R(3)
90
+ sage: b = R(11)
91
+ sage: b * a
92
+ 33
93
+ """
94
+ return self.__class__(self.__x * other.__x, parent=_inst)
95
+
96
+ def _div_(self, other):
97
+ """
98
+ EXAMPLES::
99
+
100
+ sage: R = PariRing()
101
+ sage: a = R(3)
102
+ sage: b = R(11)
103
+ sage: b / a
104
+ 11/3
105
+ """
106
+ return self.__x * (~other.__x)
107
+
108
+ def __neg__(self):
109
+ """
110
+ EXAMPLES::
111
+
112
+ sage: R = PariRing()
113
+ sage: a = R(3)
114
+ sage: -a
115
+ -3
116
+ """
117
+ return self.__class__(-self.__x, parent=_inst)
118
+
119
+ def __pow__(self, other):
120
+ """
121
+ EXAMPLES::
122
+
123
+ sage: R = PariRing()
124
+ sage: a = R(3)
125
+ sage: a^2
126
+ 9
127
+ """
128
+ if other not in PariRing():
129
+ other = Pari(other)
130
+ return self.__class__(self.__x ** other.__x, parent=_inst)
131
+
132
+ def __invert__(self):
133
+ """
134
+ EXAMPLES::
135
+
136
+ sage: R = PariRing()
137
+ sage: a = R(3)
138
+ sage: ~a
139
+ 1/3
140
+ """
141
+ return self.__class__(~self.__x, parent=_inst)
142
+
143
+ def _richcmp_(self, other, op) -> bool:
144
+ """
145
+ EXAMPLES::
146
+
147
+ sage: R = PariRing()
148
+ sage: a = R(3)
149
+ sage: b = R(11)
150
+ sage: a < b
151
+ True
152
+ sage: a == b
153
+ False
154
+ sage: a > b
155
+ False
156
+ """
157
+ return richcmp(self.__x, other.__x, op)
158
+
159
+ def __int__(self) -> int:
160
+ return int(self.__x)
161
+
162
+
163
+ class PariRing(Singleton, Parent):
164
+ """
165
+ EXAMPLES::
166
+
167
+ sage: R = PariRing(); R
168
+ Pseudoring of all PARI objects.
169
+ sage: loads(R.dumps()) is R
170
+ True
171
+ """
172
+ Element = Pari
173
+
174
+ def __init__(self):
175
+ Parent.__init__(self, self, category=Rings())
176
+
177
+ def __repr__(self) -> str:
178
+ return 'Pseudoring of all PARI objects.'
179
+
180
+ def _element_constructor_(self, x):
181
+ if isinstance(x, Pari):
182
+ return x
183
+ return self.element_class(x, parent=self)
184
+
185
+ def is_field(self, proof=True) -> bool:
186
+ return False
187
+
188
+ def characteristic(self):
189
+ raise RuntimeError("Not defined.")
190
+
191
+ def random_element(self, x=None, y=None, distribution=None):
192
+ """
193
+ Return a random integer in Pari.
194
+
195
+ .. NOTE::
196
+
197
+ The given arguments are passed to ``ZZ.random_element(...)``.
198
+
199
+ INPUT:
200
+
201
+ - `x`, `y` -- optional integers, that are lower and upper bound
202
+ for the result. If only `x` is provided, then the result is
203
+ between 0 and `x-1`, inclusive. If both are provided, then the
204
+ result is between `x` and `y-1`, inclusive.
205
+
206
+ - ``distribution`` -- (optional) string, so that ``ZZ`` can make sense
207
+ of it as a probability distribution
208
+
209
+ EXAMPLES::
210
+
211
+ sage: R = PariRing()
212
+ sage: R.random_element().parent() is R
213
+ True
214
+ sage: R(5) <= R.random_element(5,13) < R(13)
215
+ True
216
+ sage: R.random_element(distribution='1/n').parent() is R
217
+ True
218
+ """
219
+ from sage.rings.integer_ring import ZZ
220
+ return self(ZZ.random_element(x, y, distribution))
221
+
222
+ def zeta(self):
223
+ """
224
+ Return -1.
225
+
226
+ EXAMPLES::
227
+
228
+ sage: R = PariRing()
229
+ sage: R.zeta()
230
+ -1
231
+ """
232
+ return self(-1)
233
+
234
+
235
+ _inst = PariRing()
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-pari
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-pari
@@ -0,0 +1,360 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ """
3
+ Base class for generic `p`-adic polynomials
4
+
5
+ This provides common functionality for all `p`-adic polynomials, such
6
+ as printing and factoring.
7
+
8
+ AUTHORS:
9
+
10
+ - Jeroen Demeyer (2013-11-22): initial version, split off from other
11
+ files, made Polynomial_padic the common base class for all p-adic
12
+ polynomials.
13
+ """
14
+
15
+ #*****************************************************************************
16
+ # Copyright (C) 2007 David Roe <roed.math@gmail.com>
17
+ # Copyright (C) 2013 Jeroen Demeyer <jdemeyer@cage.ugent.be>
18
+ #
19
+ # Distributed under the terms of the GNU General Public License (GPL)
20
+ # as published by the Free Software Foundation; either version 2 of
21
+ # the License, or (at your option) any later version.
22
+ # http://www.gnu.org/licenses/
23
+ #*****************************************************************************
24
+ import re
25
+
26
+ from sage.rings.padics.precision_error import PrecisionError
27
+ from sage.rings.polynomial.polynomial_element import Polynomial
28
+ from sage.structure.factorization import Factorization
29
+
30
+
31
+ class Polynomial_padic(Polynomial):
32
+ def __init__(self, parent, x=None, check=True, is_gen=False, construct=False):
33
+ Polynomial.__init__(self, parent, is_gen, construct)
34
+
35
+ def _repr(self, name=None):
36
+ r"""
37
+ EXAMPLES::
38
+
39
+ sage: R.<w> = PolynomialRing(Zp(5, prec=5, type='capped-abs', print_mode='val-unit'))
40
+ sage: f = 24 + R(4/3)*w + w^4
41
+ sage: f._repr()
42
+ '(1 + O(5^5))*w^4 + O(5^5)*w^3 + O(5^5)*w^2 + (1043 + O(5^5))*w + 24 + O(5^5)'
43
+ sage: f._repr(name='z')
44
+ '(1 + O(5^5))*z^4 + O(5^5)*z^3 + O(5^5)*z^2 + (1043 + O(5^5))*z + 24 + O(5^5)'
45
+
46
+ TESTS::
47
+
48
+ sage: # needs sage.libs.ntl
49
+ sage: k = Qp(5,10)
50
+ sage: R.<x> = k[]
51
+ sage: f = R([k(0,-3), 0, k(0,-1)]); f
52
+ O(5^-1)*x^2 + O(5^-3)
53
+ sage: f + f
54
+ O(5^-1)*x^2 + O(5^-3)
55
+
56
+ AUTHOR:
57
+
58
+ - David Roe (2007-03-03), based on Polynomial_generic_dense._repr()
59
+ """
60
+ s = " "
61
+ coeffs = self.list(copy=False)
62
+ m = len(coeffs)
63
+ if name is None:
64
+ name = self.parent().variable_name()
65
+ for n in reversed(range(m)):
66
+ x = y = str(coeffs[n])
67
+ if n == m-1 or x != "0":
68
+ if n != m-1:
69
+ s += " + "
70
+ if y.find("-") == 0:
71
+ y = y[1:]
72
+ if n > 0 and ("+" in y or ("-" in y and y[0] != "O")):
73
+ x = "(%s)" % x
74
+ if n > 1:
75
+ var = "*%s^%s" % (name, n)
76
+ elif n == 1:
77
+ var = "*%s" % name
78
+ else:
79
+ var = ""
80
+ s += x + var
81
+ s = s.replace(" + -", " - ")
82
+ s = re.sub(r' 1\*',' ', s)
83
+ s = re.sub(r' -1\*',' -', s)
84
+ if s == " ":
85
+ return "0"
86
+ return s[1:]
87
+
88
+ def content(self):
89
+ r"""
90
+ Compute the content of this polynomial.
91
+
92
+ OUTPUT:
93
+
94
+ If this is the zero polynomial, return the constant coefficient.
95
+ Otherwise, since the content is only defined up to a unit, return the
96
+ content as `\pi^k` with maximal precision where `k` is the minimal
97
+ valuation of any of the coefficients.
98
+
99
+ EXAMPLES::
100
+
101
+ sage: # needs sage.libs.ntl
102
+ sage: K = Zp(13,7)
103
+ sage: R.<t> = K[]
104
+ sage: f = 13^7*t^3 + K(169,4)*t - 13^4
105
+ sage: f.content()
106
+ 13^2 + O(13^9)
107
+ sage: R(0).content()
108
+ 0
109
+ sage: f = R(K(0,3)); f
110
+ O(13^3)
111
+ sage: f.content()
112
+ O(13^3)
113
+
114
+ sage: # needs sage.libs.ntl
115
+ sage: P.<x> = ZZ[]
116
+ sage: f = x + 2
117
+ sage: f.content()
118
+ 1
119
+ sage: fp = f.change_ring(pAdicRing(2, 10))
120
+ sage: fp
121
+ (1 + O(2^10))*x + 2 + O(2^11)
122
+ sage: fp.content()
123
+ 1 + O(2^10)
124
+ sage: (2*fp).content()
125
+ 2 + O(2^11)
126
+
127
+ Over a field it would be sufficient to return only zero or one, as the
128
+ content is only defined up to multiplication with a unit. However, we
129
+ return `\pi^k` where `k` is the minimal valuation of any coefficient::
130
+
131
+ sage: # needs sage.libs.ntl
132
+ sage: K = Qp(13,7)
133
+ sage: R.<t> = K[]
134
+ sage: f = 13^7*t^3 + K(169,4)*t - 13^-4
135
+ sage: f.content()
136
+ 13^-4 + O(13^3)
137
+ sage: f = R.zero()
138
+ sage: f.content()
139
+ 0
140
+ sage: f = R(K(0,3))
141
+ sage: f.content()
142
+ O(13^3)
143
+ sage: f = 13*t^3 + K(0,1)*t
144
+ sage: f.content()
145
+ 13 + O(13^8)
146
+ """
147
+ if self.is_zero():
148
+ return self[0]
149
+ else:
150
+ return self.base_ring()(self.base_ring().prime_pow(min([x.valuation() for x in self.coefficients(sparse=False)])))
151
+
152
+ def factor(self):
153
+ r"""
154
+ Return the factorization of this polynomial.
155
+
156
+ EXAMPLES::
157
+
158
+ sage: # needs sage.libs.ntl
159
+ sage: R.<t> = PolynomialRing(Qp(3, 3, print_mode='terse', print_pos=False))
160
+ sage: pol = t^8 - 1
161
+ sage: for p,e in pol.factor():
162
+ ....: print("{} {}".format(e, p))
163
+ 1 (1 + O(3^3))*t + 1 + O(3^3)
164
+ 1 (1 + O(3^3))*t - 1 + O(3^3)
165
+ 1 (1 + O(3^3))*t^2 + (5 + O(3^3))*t - 1 + O(3^3)
166
+ 1 (1 + O(3^3))*t^2 + (-5 + O(3^3))*t - 1 + O(3^3)
167
+ 1 (1 + O(3^3))*t^2 + O(3^3)*t + 1 + O(3^3)
168
+ sage: R.<t> = PolynomialRing(Qp(5, 6, print_mode='terse', print_pos=False))
169
+ sage: pol = 100 * (5*t - 1) * (t - 5); pol
170
+ (500 + O(5^9))*t^2 + (-2600 + O(5^8))*t + 500 + O(5^9)
171
+ sage: pol.factor()
172
+ (500 + O(5^9)) * ((1 + O(5^5))*t - 1/5 + O(5^5)) * ((1 + O(5^6))*t - 5 + O(5^6))
173
+ sage: pol.factor().value()
174
+ (500 + O(5^8))*t^2 + (-2600 + O(5^8))*t + 500 + O(5^8)
175
+
176
+ The same factorization over `\ZZ_p`. In this case, the "unit"
177
+ part is a `p`-adic unit and the power of `p` is considered to be
178
+ a factor::
179
+
180
+ sage: # needs sage.libs.ntl
181
+ sage: R.<t> = PolynomialRing(Zp(5, 6, print_mode='terse', print_pos=False))
182
+ sage: pol = 100 * (5*t - 1) * (t - 5); pol
183
+ (500 + O(5^9))*t^2 + (-2600 + O(5^8))*t + 500 + O(5^9)
184
+ sage: pol.factor()
185
+ (4 + O(5^6)) * (5 + O(5^7))^2 * ((1 + O(5^6))*t - 5 + O(5^6)) * ((5 + O(5^6))*t - 1 + O(5^6))
186
+ sage: pol.factor().value()
187
+ (500 + O(5^8))*t^2 + (-2600 + O(5^8))*t + 500 + O(5^8)
188
+
189
+ In the following example, the discriminant is zero, so the `p`-adic
190
+ factorization is not well defined::
191
+
192
+ sage: factor(t^2) # needs sage.libs.ntl
193
+ Traceback (most recent call last):
194
+ ...
195
+ PrecisionError: p-adic factorization not well-defined since
196
+ the discriminant is zero up to the requestion p-adic precision
197
+
198
+ An example of factoring a constant polynomial (see :issue:`26669`)::
199
+
200
+ sage: R.<x> = Qp(5)[] # needs sage.libs.ntl
201
+ sage: R(2).factor() # needs sage.libs.ntl
202
+ 2 + O(5^20)
203
+
204
+ More examples over `\ZZ_p`::
205
+
206
+ sage: R.<w> = PolynomialRing(Zp(5, prec=6, type='capped-abs', print_mode='val-unit'))
207
+ sage: f = w^5 - 1
208
+ sage: f.factor() # needs sage.libs.ntl
209
+ ((1 + O(5^6))*w + 3124 + O(5^6))
210
+ * ((1 + O(5^6))*w^4 + (12501 + O(5^6))*w^3 + (9376 + O(5^6))*w^2
211
+ + (6251 + O(5^6))*w + 3126 + O(5^6))
212
+
213
+ See :issue:`4038`::
214
+
215
+ sage: # needs database_cremona_mini_ellcurve sage.libs.ntl sage.schemes
216
+ sage: E = EllipticCurve('37a1')
217
+ sage: K = Qp(7,10)
218
+ sage: EK = E.base_extend(K)
219
+ sage: g = EK.division_polynomial_0(3)
220
+ sage: g.factor()
221
+ (3 + O(7^10))
222
+ * ((1 + O(7^10))*x
223
+ + 1 + 2*7 + 4*7^2 + 2*7^3 + 5*7^4 + 7^5 + 5*7^6 + 3*7^7 + 5*7^8 + 3*7^9 + O(7^10))
224
+ * ((1 + O(7^10))*x^3
225
+ + (6 + 4*7 + 2*7^2 + 4*7^3 + 7^4 + 5*7^5
226
+ + 7^6 + 3*7^7 + 7^8 + 3*7^9 + O(7^10))*x^2
227
+ + (6 + 3*7 + 5*7^2 + 2*7^4 + 7^5 + 7^6 + 2*7^8 + 3*7^9 + O(7^10))*x
228
+ + 2 + 5*7 + 4*7^2 + 2*7^3 + 6*7^4 + 3*7^5 + 7^6 + 4*7^7 + O(7^10))
229
+
230
+ TESTS:
231
+
232
+ Check that :issue:`13293` is fixed::
233
+
234
+ sage: R.<T> = Qp(3)[] # needs sage.libs.ntl
235
+ sage: f = 1926*T^2 + 312*T + 387 # needs sage.libs.ntl
236
+ sage: f.factor() # needs sage.libs.ntl
237
+ (3^2 + 2*3^3 + 2*3^4 + 3^5 + 2*3^6 + O(3^22)) * ((1 + O(3^19))*T + 2*3^-1 + 3 + 3^2 + 2*3^5 + 2*3^6 + 2*3^7 + 3^8 + 3^9 + 2*3^11 + 3^15 + 3^17 + O(3^19)) * ((1 + O(3^20))*T + 2*3 + 3^2 + 3^3 + 3^5 + 2*3^6 + 2*3^7 + 3^8 + 3^10 + 3^11 + 2*3^12 + 2*3^14 + 2*3^15 + 2*3^17 + 2*3^18 + O(3^20))
238
+
239
+ Check that :issue:`24065` is fixed::
240
+
241
+ sage: R = Zp(2, type='fixed-mod', prec=3)
242
+ sage: P.<x> = R[]
243
+ sage: ((1 + 2)*x + (1 + 2)*x^2).factor()
244
+ (1 + 2) * (x + 1) * x
245
+ """
246
+ if self == 0:
247
+ raise ArithmeticError("factorization of {!r} is not defined".format(self))
248
+ elif self.is_constant():
249
+ return Factorization((), self.constant_coefficient())
250
+
251
+ # Scale self such that 0 is the lowest valuation
252
+ # amongst the coefficients
253
+ try:
254
+ val = self.valuation(val_of_var=0)
255
+ except TypeError:
256
+ val = min([c.valuation() for c in self])
257
+ self_normal = self / self.base_ring().uniformizer_pow(val)
258
+
259
+ absprec = min([x.precision_absolute() for x in self_normal])
260
+ if self_normal.discriminant().valuation() >= absprec:
261
+ raise PrecisionError(
262
+ "p-adic factorization not well-defined since the discriminant is zero up to the requestion p-adic precision")
263
+ G = self_normal.__pari__().factorpadic(self.base_ring().prime(), absprec)
264
+ return _pari_padic_factorization_to_sage(G, self.parent(), self.leading_coefficient())
265
+
266
+ def root_field(self, names, check_irreducible=True, **kwds):
267
+ """
268
+ Return the `p`-adic extension field generated by the roots of the irreducible
269
+ polynomial ``self``.
270
+
271
+ INPUT:
272
+
273
+ - ``names`` -- name of the generator of the extension
274
+
275
+ - ``check_irreducible`` -- check whether the polynomial is irreducible
276
+
277
+ - ``kwds`` -- see :meth:`sage.rings.padics.padic_generic.pAdicGeneric.extension`
278
+
279
+ EXAMPLES::
280
+
281
+ sage: R.<x> = Qp(3,5,print_mode='digits')[] # needs sage.libs.ntl
282
+ sage: f = x^2 - 3 # needs sage.libs.ntl
283
+ sage: f.root_field('x') # needs sage.libs.ntl
284
+ 3-adic Eisenstein Extension Field in x defined by x^2 - 3
285
+
286
+ ::
287
+
288
+ sage: R.<x> = Qp(5,5,print_mode='digits')[] # needs sage.libs.ntl
289
+ sage: f = x^2 - 3 # needs sage.libs.ntl
290
+ sage: f.root_field('x', print_mode='bars') # needs sage.libs.ntl
291
+ 5-adic Unramified Extension Field in x defined by x^2 - 3
292
+
293
+ ::
294
+
295
+ sage: R.<x> = Qp(11,5,print_mode='digits')[] # needs sage.libs.ntl
296
+ sage: f = x^2 - 3 # needs sage.libs.ntl
297
+ sage: f.root_field('x', print_mode='bars') # needs sage.libs.ntl
298
+ Traceback (most recent call last):
299
+ ...
300
+ ValueError: polynomial must be irreducible
301
+ """
302
+
303
+ if check_irreducible and not self.is_irreducible():
304
+ raise ValueError("polynomial must be irreducible")
305
+
306
+ return self.base_ring().extension(self, names=names, **kwds)
307
+
308
+
309
+ def _pari_padic_factorization_to_sage(G, R, leading_coeff):
310
+ """
311
+ Given a PARI factorization matrix `G` representing a factorization
312
+ of some polynomial in the `p`-adic polynomial ring `R`,
313
+ return the corresponding Sage factorization. All factors in `G`
314
+ are assumed to have content 1 (this is how PARI returns its
315
+ factorizations).
316
+
317
+ INPUT:
318
+
319
+ - ``G`` -- PARI factorization matrix, returned by ``factorpadic``
320
+
321
+ - ``R`` -- polynomial ring to be used as parent ring of the factors
322
+
323
+ - ``leading_coeff`` -- leading coefficient of the polynomial which
324
+ was factored. This can belong to any ring which can be coerced
325
+ into ``R.base_ring()``.
326
+
327
+ OUTPUT: a Sage :class:`Factorization`
328
+ """
329
+ B = R.base_ring()
330
+ p = B.prime()
331
+ leading_coeff = B(leading_coeff)
332
+
333
+ pols = [R(f, absprec=f.padicprec(p)) for f in G[0]]
334
+ exps = [int(e) for e in G[1]]
335
+
336
+ # Determine unit part (which is discarded by PARI)
337
+ if B.is_field():
338
+ # When the base ring is a field, we normalize
339
+ # the irreducible factors so they have leading
340
+ # coefficient 1.
341
+ for i in range(len(pols)):
342
+ lc = pols[i].leading_coefficient()
343
+ lc = lc.lift_to_precision() # Ensure we don't lose precision
344
+ pols[i] *= ~lc
345
+ else:
346
+ # When the base ring is not a field, we normalize
347
+ # the irreducible factors so that the leading term
348
+ # is a power of p.
349
+ c, leading_coeff = leading_coeff.val_unit()
350
+ for i in range(len(pols)):
351
+ v, upart = pols[i].leading_coefficient().val_unit()
352
+ upart = upart.lift_to_precision() # Ensure we don't lose precision
353
+ pols[i] *= ~upart
354
+ c -= exps[i] * v
355
+ if c:
356
+ # Add factor p^c
357
+ pols.append(R(p))
358
+ exps.append(c)
359
+
360
+ return Factorization(zip(pols, exps), leading_coeff)