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,691 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ """
3
+ This linkage file implements the padics API using MPIR mpz_t
4
+ multiprecision integers.
5
+
6
+ AUTHORS:
7
+
8
+ - David Roe (2012-3-1) -- initial version
9
+ """
10
+
11
+ #*****************************************************************************
12
+ # Copyright (C) 2007-2012 David Roe <roed.math@gmail.com>
13
+ # William Stein <wstein@gmail.com>
14
+ #
15
+ # Distributed under the terms of the GNU General Public License (GPL)
16
+ #
17
+ # http://www.gnu.org/licenses/
18
+ #*****************************************************************************
19
+
20
+ from cysignals.signals cimport sig_on, sig_off
21
+ from cpython.list cimport *
22
+
23
+ from sage.ext.stdsage cimport PY_NEW
24
+ from sage.libs.gmp.mpz cimport *
25
+ from sage.libs.gmp.pylong cimport mpz_pythonhash
26
+ from sage.arith.rational_reconstruction cimport mpq_rational_reconstruction
27
+ from sage.rings.integer cimport Integer
28
+ from sage.rings.rational cimport Rational
29
+ from sage.rings.padics.padic_generic_element cimport pAdicGenericElement
30
+ from sage.rings.padics.common_conversion cimport cconv_mpz_t_out_shared, cconv_mpz_t_shared, cconv_mpq_t_out_shared, cconv_mpq_t_shared, cconv_shared
31
+ import sage.rings.finite_rings.integer_mod
32
+
33
+ DEF CELEMENT_IS_PY_OBJECT = False
34
+
35
+ cdef Integer holder = PY_NEW(Integer)
36
+ cdef Integer holder2 = PY_NEW(Integer)
37
+
38
+ cdef inline int cconstruct(mpz_t value, PowComputer_ prime_pow) except -1:
39
+ """
40
+ Construct a new element.
41
+
42
+ INPUT:
43
+
44
+ - ``unit`` -- an ``mpz_t`` to be initialized
45
+ - ``prime_pow`` -- the PowComputer for the ring
46
+ """
47
+ mpz_init(value)
48
+
49
+ cdef inline int cdestruct(mpz_t value, PowComputer_ prime_pow) except -1:
50
+ """
51
+ Deallocate an element.
52
+
53
+ INPUT:
54
+
55
+ - ``unit`` -- an ``mpz_t`` to be cleared
56
+ - ``prime_pow`` -- the PowComputer for the ring
57
+ """
58
+ mpz_clear(value)
59
+
60
+ cdef inline int ccmp(mpz_t a, mpz_t b, long prec, bint reduce_a, bint reduce_b, PowComputer_ prime_pow) except -2:
61
+ """
62
+ Comparison of two elements.
63
+
64
+ INPUT:
65
+
66
+ - ``a`` -- an ``mpz_t``
67
+ - ``b`` -- an ``mpz_t``
68
+ - ``prec`` -- a long, the precision of the comparison
69
+ - ``reduce_a`` -- a bint, whether a needs to be reduced
70
+ - ``reduce_b`` -- a bint, whether b needs to be reduced
71
+ - ``prime_pow`` -- the PowComputer for the ring
72
+
73
+ OUTPUT:
74
+
75
+ - If neither a nor be needs to be reduced, returns
76
+ -1 (`a < b`), 0 (`a = b`) or 1 (`a > b`)
77
+ - If at least one needs to be reduced, returns
78
+ 0 (``a == b mod p^prec``) or 1 (otherwise)
79
+ """
80
+ cdef int ans
81
+ if reduce_a or reduce_b:
82
+ mpz_sub(holder.value, a, b)
83
+ mpz_mod(holder.value, holder.value, prime_pow.pow_mpz_t_tmp(prec))
84
+ return mpz_sgn(holder.value)
85
+ else:
86
+ ans = mpz_cmp(a,b)
87
+ if ans > 0:
88
+ return 1
89
+ elif ans < 0:
90
+ return -1
91
+ return 0
92
+
93
+ cdef inline int cneg(mpz_t out, mpz_t a, long prec, PowComputer_ prime_pow) except -1:
94
+ """
95
+ Negation.
96
+
97
+ Note that no reduction is performed.
98
+
99
+ INPUT:
100
+
101
+ - ``out`` -- an ``mpz_t`` to store the negation
102
+ - ``a`` -- an ``mpz_t`` to be negated
103
+ - ``prec`` -- a long, the precision: ignored
104
+ - ``prime_pow`` -- the PowComputer for the ring
105
+ """
106
+ mpz_neg(out, a)
107
+
108
+ cdef inline int cadd(mpz_t out, mpz_t a, mpz_t b, long prec, PowComputer_ prime_pow) except -1:
109
+ """
110
+ Addition.
111
+
112
+ Note that no reduction is performed.
113
+
114
+ INPUT:
115
+
116
+ - ``out`` -- an ``mpz_t`` to store the sum
117
+ - ``a`` -- an ``mpz_t``, the first summand
118
+ - ``b`` -- an ``mpz_t``, the second summand
119
+ - ``prec`` -- a long, the precision: ignored
120
+ - ``prime_pow`` -- the PowComputer for the ring
121
+ """
122
+ mpz_add(out, a, b)
123
+
124
+ cdef inline bint creduce(mpz_t out, mpz_t a, long prec, PowComputer_ prime_pow) except -1:
125
+ """
126
+ Reduce modulo a power of the maximal ideal.
127
+
128
+ INPUT:
129
+
130
+ - ``out`` -- an ``mpz_t`` to store the reduction
131
+ - ``a`` -- the element to be reduced
132
+ - ``prec`` -- a long, the precision to reduce modulo
133
+ - ``prime_pow`` -- the PowComputer for the ring
134
+
135
+ OUTPUT: ``True`` if the reduction is zero; ``False`` otherwise
136
+ """
137
+ # The following could fail if the value returned by
138
+ # prime_pow.pow_mpz_t_tmp(prec) is zero. We could add a sig_on()/sig_off()
139
+ # to keep sage from crashing. This comes at a performance penalty, however.
140
+ # A correct implementation of prime_pow should never return zero.
141
+ mpz_mod(out, a, prime_pow.pow_mpz_t_tmp(prec))
142
+ return mpz_sgn(out) == 0
143
+
144
+ cdef inline bint creduce_small(mpz_t out, mpz_t a, long prec, PowComputer_ prime_pow) except -1:
145
+ """
146
+ Reduce modulo a power of the maximal ideal.
147
+
148
+ This function assumes that the input satisfies `-p <= a < 2p`, so
149
+ that it doesn't need any divisions.
150
+
151
+ INPUT:
152
+
153
+ - ``out`` -- an ``mpz_t`` to store the reduction
154
+ - ``a`` -- the element to be reduced
155
+ - ``prec`` -- a long, the precision to reduce modulo
156
+ - ``prime_pow`` -- the PowComputer for the ring
157
+
158
+ OUTPUT: ``True`` if the reduction is zero; ``False`` otherwise
159
+ """
160
+ if mpz_sgn(a) < 0:
161
+ mpz_add(out, a, prime_pow.pow_mpz_t_tmp(prec))
162
+ elif mpz_cmp(a, prime_pow.pow_mpz_t_tmp(prec)) >= 0:
163
+ mpz_sub(out, a, prime_pow.pow_mpz_t_tmp(prec))
164
+ else:
165
+ mpz_set(out, a)
166
+ return mpz_sgn(out) == 0
167
+
168
+ cdef inline long cremove(celement out, celement a, long prec, PowComputer_ prime_pow, bint reduce_relative=False) except -1:
169
+ """
170
+ Extract the maximum power of the uniformizer dividing this
171
+ element.
172
+
173
+ INPUT:
174
+
175
+ - ``out`` -- an ``mpz_t`` to store the unit
176
+ - ``a`` -- the element whose valuation and unit are desired
177
+ - ``prec`` -- a long, used if `a = 0`
178
+ - ``prime_pow`` -- the PowComputer for the ring
179
+ - ``reduce_relative`` -- a bint: whether the final result
180
+ should be reduced at precision ``prec`` (case ``False``)
181
+ or ``prec - valuation`` (case ``True``)
182
+
183
+ OUTPUT:
184
+
185
+ - if `a = 0`, returns prec. Otherwise, returns the number of
186
+ times p divides a.
187
+ """
188
+ if mpz_sgn(a) == 0:
189
+ mpz_set_ui(out, 0)
190
+ return prec
191
+ return mpz_remove(out, a, prime_pow.prime.value)
192
+
193
+ cdef inline long cvaluation(mpz_t a, long prec, PowComputer_ prime_pow) except -1:
194
+ """
195
+ Return the maximum power of the uniformizer dividing this
196
+ element.
197
+
198
+ This function differs from :meth:`cremove` in that the unit is
199
+ discarded.
200
+
201
+ INPUT:
202
+
203
+ - ``a`` -- the element whose valuation is desired
204
+ - ``prec`` -- a long, used if `a = 0`
205
+ - ``prime_pow`` -- the PowComputer for the ring
206
+
207
+ OUTPUT:
208
+
209
+ - if `a = 0`, returns prec. Otherwise, returns the number of
210
+ times p divides a.
211
+ """
212
+ if mpz_sgn(a) == 0:
213
+ return prec
214
+ return mpz_remove(holder.value, a, prime_pow.prime.value)
215
+
216
+ cdef inline bint cisunit(mpz_t a, PowComputer_ prime_pow) except -1:
217
+ """
218
+ Return whether this element has valuation zero.
219
+
220
+ INPUT:
221
+
222
+ - ``a`` -- the element to test
223
+ - ``prime_pow`` -- the PowComputer for the ring
224
+
225
+ OUTPUT: ``True`` if `a` has valuation 0, and ``False`` otherwise
226
+ """
227
+ return mpz_divisible_p(a, prime_pow.prime.value) == 0
228
+
229
+ cdef inline int cshift(mpz_t out, mpz_t rem, mpz_t a, long n, long prec, PowComputer_ prime_pow, bint reduce_afterward) except -1:
230
+ """
231
+ Multiply by a power of the uniformizer.
232
+
233
+ INPUT:
234
+
235
+ - ``out`` -- an ``mpz_t`` to store the result. If `n >= 0` then
236
+ out will be set to `a * p^n`. If `n < 0`, out will be set to `a // p^n`.
237
+ - ``rem`` -- an ``mpz_t`` to store the remainder, when `n < 0`
238
+ - ``a`` -- the element to shift
239
+ - ``n`` -- long, the amount to shift by
240
+ - ``prec`` -- long, a precision modulo which to reduce
241
+ - ``prime_pow`` -- the PowComputer for the ring
242
+ - ``reduce_afterward`` -- whether to reduce afterward
243
+ """
244
+ if n > 0:
245
+ mpz_mul(out, a, prime_pow.pow_mpz_t_tmp(n))
246
+ elif n < 0:
247
+ sig_on()
248
+ mpz_fdiv_qr(out, rem, a, prime_pow.pow_mpz_t_tmp(-n))
249
+ sig_off()
250
+ else: # elif a != out:
251
+ mpz_set(out, a)
252
+ if reduce_afterward:
253
+ creduce(out, out, prec, prime_pow)
254
+
255
+ cdef inline int cshift_notrunc(mpz_t out, mpz_t a, long n, long prec, PowComputer_ prime_pow, bint reduce_afterward) except -1:
256
+ """
257
+ Multiply by a power of the uniformizer, assuming that the
258
+ valuation of a is at least -n.
259
+
260
+ INPUT:
261
+
262
+ - ``out`` -- an ``mpz_t`` to store the result. If `n >= 0` then
263
+ out will be set to `a * p^n`. If `n < 0`, out will be set to `a // p^n`.
264
+ - ``a`` -- the element to shift. Assumes that the valuation of a
265
+ is at least -n.
266
+ - ``n`` -- long, the amount to shift by
267
+ - ``prec`` -- long, a precision modulo which to reduce
268
+ - ``prime_pow`` -- the PowComputer for the ring
269
+ - ``reduce_afterward`` -- whether to reduce afterward
270
+ """
271
+ if n > 0:
272
+ mpz_mul(out, a, prime_pow.pow_mpz_t_tmp(n))
273
+ elif n < 0:
274
+ sig_on()
275
+ mpz_divexact(out, a, prime_pow.pow_mpz_t_tmp(-n))
276
+ sig_off()
277
+ else:
278
+ mpz_set(out, a)
279
+ if reduce_afterward:
280
+ creduce(out, out, prec, prime_pow)
281
+
282
+ cdef inline int csub(mpz_t out, mpz_t a, mpz_t b, long prec, PowComputer_ prime_pow) except -1:
283
+ """
284
+ Subtraction.
285
+
286
+ Note that no reduction is performed.
287
+
288
+ INPUT:
289
+
290
+ - ``out`` -- an ``mpz_t`` to store the difference
291
+ - ``a`` -- an ``mpz_t``, the first input
292
+ - ``b`` -- an ``mpz_t``, the second input
293
+ - ``prec`` -- a long, the precision: ignored
294
+ - ``prime_pow`` -- the PowComputer for the ring
295
+ """
296
+ mpz_sub(out, a, b)
297
+
298
+ cdef inline int cinvert(mpz_t out, mpz_t a, long prec, PowComputer_ prime_pow) except -1:
299
+ """
300
+ Inversion.
301
+
302
+ The result will be reduced modulo p^prec.
303
+
304
+ INPUT:
305
+
306
+ - ``out`` -- an ``mpz_t`` to store the inverse
307
+ - ``a`` -- an ``mpz_t``, the element to be inverted
308
+ - ``prec`` -- a long, the precision
309
+ - ``prime_pow`` -- the PowComputer for the ring
310
+ """
311
+ cdef bint success
312
+ success = mpz_invert(out, a, prime_pow.pow_mpz_t_tmp(prec))
313
+ if not success:
314
+ raise ZeroDivisionError
315
+
316
+ cdef inline int cmul(mpz_t out, mpz_t a, mpz_t b, long prec, PowComputer_ prime_pow) except -1:
317
+ """
318
+ Multiplication.
319
+
320
+ Note that no reduction is performed.
321
+
322
+ INPUT:
323
+
324
+ - ``out`` -- an ``mpz_t`` to store the product
325
+ - ``a`` -- an ``mpz_t``, the first input
326
+ - ``b`` -- an ``mpz_t``, the second input
327
+ - ``prec`` -- a long, the precision: ignored
328
+ - ``prime_pow`` -- the PowComputer for the ring
329
+ """
330
+ mpz_mul(out, a, b)
331
+
332
+ cdef inline int cdivunit(mpz_t out, mpz_t a, mpz_t b, long prec, PowComputer_ prime_pow) except -1:
333
+ """
334
+ Division.
335
+
336
+ The inversion is performed modulo p^prec. Note that no reduction
337
+ is performed after the product.
338
+
339
+ INPUT:
340
+
341
+ - ``out`` -- an ``mpz_t`` to store the quotient
342
+ - ``a`` -- an ``mpz_t``, the first input
343
+ - ``b`` -- an ``mpz_t``, the second input
344
+ - ``prec`` -- a long, the precision
345
+ - ``prime_pow`` -- the PowComputer for the ring
346
+ """
347
+ cdef bint success
348
+ success = mpz_invert(prime_pow.aliasing, b, prime_pow.pow_mpz_t_tmp(prec))
349
+ if not success:
350
+ raise ZeroDivisionError
351
+ mpz_mul(out, a, prime_pow.aliasing)
352
+
353
+ cdef inline int csetone(mpz_t out, PowComputer_ prime_pow) except -1:
354
+ """
355
+ Set to 1.
356
+
357
+ INPUT:
358
+
359
+ - ``out`` -- the ``mpz_t`` in which to store 1
360
+ - ``prime_pow`` -- the PowComputer for the ring
361
+ """
362
+ mpz_set_ui(out, 1)
363
+
364
+ cdef inline int csetzero(mpz_t out, PowComputer_ prime_pow) except -1:
365
+ """
366
+ Set to 0.
367
+
368
+ INPUT:
369
+
370
+ - ``out`` -- the ``mpz_t`` in which to store 0
371
+ - ``prime_pow`` -- the PowComputer for the ring
372
+ """
373
+ mpz_set_ui(out, 0)
374
+
375
+ cdef inline bint cisone(mpz_t out, PowComputer_ prime_pow) except -1:
376
+ """
377
+ Return whether this element is equal to 1.
378
+
379
+ INPUT:
380
+
381
+ - ``a`` -- the element to test
382
+ - ``prime_pow`` -- the PowComputer for the ring
383
+
384
+ OUTPUT: ``True`` if `a = 1`, and ``False`` otherwise
385
+ """
386
+ return mpz_cmp_ui(out, 1) == 0
387
+
388
+ cdef inline bint ciszero(mpz_t out, PowComputer_ prime_pow) except -1:
389
+ """
390
+ Return whether this element is equal to 0.
391
+
392
+ INPUT:
393
+
394
+ - ``a`` -- the element to test
395
+ - ``prime_pow`` -- the PowComputer for the ring
396
+
397
+ OUTPUT: ``True`` if `a = 0`, and ``False`` otherwise
398
+ """
399
+ return mpz_cmp_ui(out, 0) == 0
400
+
401
+ cdef inline int cpow(mpz_t out, mpz_t a, mpz_t n, long prec, PowComputer_ prime_pow) except -1:
402
+ """
403
+ Exponentiation.
404
+
405
+ INPUT:
406
+
407
+ - ``out`` -- the ``mpz_t`` in which to store the result
408
+ - ``a`` -- the base
409
+ - ``n`` -- an ``mpz_t``, the exponent
410
+ - ``prec`` -- a long, the working absolute precision
411
+ - ``prime_pow`` -- the PowComputer for the ring
412
+ """
413
+ mpz_powm(out, a, n, prime_pow.pow_mpz_t_tmp(prec))
414
+
415
+ cdef inline int ccopy(mpz_t out, mpz_t a, PowComputer_ prime_pow) except -1:
416
+ """
417
+ Copying.
418
+
419
+ INPUT:
420
+
421
+ - ``out`` -- the ``mpz_t`` to store the result
422
+ - ``a`` -- the element to copy
423
+ - ``prime_pow`` -- the PowComputer for the ring
424
+ """
425
+ mpz_set(out, a)
426
+
427
+ cdef inline cpickle(mpz_t a, PowComputer_ prime_pow):
428
+ """
429
+ Serialization into objects that Sage knows how to pickle.
430
+
431
+ INPUT:
432
+
433
+ - ``a`` -- the element to pickle
434
+ - ``prime_pow`` -- the PowComputer for the ring
435
+
436
+ OUTPUT: an Integer storing ``a``
437
+ """
438
+ cdef Integer pic = PY_NEW(Integer)
439
+ mpz_set(pic.value, a)
440
+ return pic
441
+
442
+ cdef inline int cunpickle(mpz_t out, x, PowComputer_ prime_pow) except -1:
443
+ """
444
+ Reconstruction from the output of :meth:`cpickle`.
445
+
446
+ INPUT:
447
+
448
+ - ``out`` -- the ``mpz_t`` in which to store the result
449
+ - ``x`` -- the result of :meth:`cpickle`
450
+ - ``prime_pow`` -- the PowComputer for the ring
451
+ """
452
+ mpz_set(out, (<Integer?>x).value)
453
+
454
+ cdef inline long chash(mpz_t a, long ordp, long prec, PowComputer_ prime_pow) except -1:
455
+ """
456
+ Hashing.
457
+
458
+ INPUT:
459
+
460
+ - ``a`` -- an ``mpz_t`` storing the underlying element to hash
461
+ - ``ordp`` -- a long storing the valuation
462
+ - ``prec`` -- a long storing the precision
463
+ - ``prime_pow`` -- a PowComputer for the ring
464
+ """
465
+ # This implementation is for backward compatibility and may be changed in the future
466
+ cdef long n, d
467
+ if ordp == 0:
468
+ return mpz_pythonhash(a)
469
+ elif ordp > 0:
470
+ mpz_mul(holder.value, a, prime_pow.pow_mpz_t_tmp(ordp))
471
+ return mpz_pythonhash(holder.value)
472
+ else:
473
+ n = mpz_pythonhash(a)
474
+ d = mpz_pythonhash(prime_pow.pow_mpz_t_tmp(-ordp))
475
+ if d == 1:
476
+ return n
477
+ n = n ^ d
478
+ if n == -1:
479
+ return -2
480
+ return n
481
+
482
+ # the expansion_mode enum is defined in padic_template_element_header.pxi
483
+ cdef inline cexpansion_next(mpz_t value, expansion_mode mode, long curpower, PowComputer_ prime_pow):
484
+ """
485
+ Return the next digit in a `p`-adic expansion of ``value``.
486
+
487
+ INPUT:
488
+
489
+ - ``value`` -- the `p`-adic element whose expansion is desired
490
+ - ``mode`` -- either ``simple_mode`` or ``smallest_mode``
491
+ - ``curpower`` -- the current power of `p` for which the coefficient
492
+ is being found. Only used in ``smallest_mode``.
493
+ - ``prime_pow`` -- a ``PowComputer`` holding `p`-adic data
494
+ """
495
+ if mode == teichmuller_mode:
496
+ raise NotImplementedError
497
+ cdef Integer ans = PY_NEW(Integer)
498
+ cdef bint neg
499
+ mpz_mod(ans.value, value, prime_pow.prime.value)
500
+ if mode == smallest_mode:
501
+ if mpz_cmp(ans.value, prime_pow.p2.value) > 0:
502
+ mpz_sub(ans.value, ans.value, prime_pow.prime.value)
503
+ neg = True
504
+ else:
505
+ neg = False
506
+ mpz_sub(value, value, ans.value)
507
+ mpz_divexact(value, value, prime_pow.prime.value)
508
+ if (mode == smallest_mode and neg and
509
+ mpz_cmp(value, prime_pow.pow_mpz_t_tmp(curpower)) >= 0):
510
+ mpz_sub(value, value, prime_pow.pow_mpz_t_tmp(curpower))
511
+ return ans
512
+
513
+ cdef inline cexpansion_getitem(mpz_t value, long m, PowComputer_ prime_pow):
514
+ """
515
+ Return the `m`-th `p`-adic digit in the ``simple_mode`` expansion.
516
+
517
+ INPUT:
518
+
519
+ - ``value`` -- the `p`-adic element whose expansion is desired
520
+ - ``m`` -- nonnegative integer; which entry in the `p`-adic expansion to return
521
+ - ``prime_pow`` -- a ``PowComputer`` holding `p`-adic data
522
+ """
523
+ cdef Integer ans = PY_NEW(Integer)
524
+ if m > 0:
525
+ mpz_fdiv_q(ans.value, value, prime_pow.pow_mpz_t_tmp(m))
526
+ mpz_mod(ans.value, ans.value, prime_pow.prime.value)
527
+ else:
528
+ mpz_mod(ans.value, value, prime_pow.prime.value)
529
+ return ans
530
+
531
+ # The element is filled in for zero in the p-adic expansion if necessary.
532
+ # It could be [] for some other linkages.
533
+ _expansion_zero = Integer(0)
534
+
535
+ cdef list ccoefficients(mpz_t x, long valshift, long prec, PowComputer_ prime_pow):
536
+ """
537
+ Return a list of coefficients, as elements that can be converted into the base ring.
538
+
539
+ INPUT:
540
+
541
+ - ``x`` -- a ``celement`` giving the underlying `p`-adic element, or possibly its unit part
542
+ - ``valshift`` -- a long giving the power of the uniformizer to shift `x` by
543
+ - ``prec`` -- a long, the (relative) precision desired, used in rational reconstruction
544
+ - ``prime_pow`` -- the ``PowComputer`` of the ring
545
+ """
546
+ cdef Integer ansz
547
+ cdef Rational ansq
548
+ if valshift >= 0:
549
+ ansz = PY_NEW(Integer)
550
+ cconv_mpz_t_out_shared(ansz.value, x, valshift, prec, prime_pow)
551
+ return [ansz]
552
+ else:
553
+ ansq = Rational.__new__(Rational)
554
+ cconv_mpq_t_out_shared(ansq.value, x, valshift, prec, prime_pow)
555
+ return [ansq]
556
+
557
+ cdef int cteichmuller(mpz_t out, mpz_t value, long prec, PowComputer_ prime_pow) except -1:
558
+ r"""
559
+ Teichmuller lifting.
560
+
561
+ INPUT:
562
+
563
+ - ``out`` -- an ``mpz_t`` which is set to a `p-1` root of unity
564
+ congruent to `value` mod `p`; or 0 if `a \equiv 0 \pmod{p}`
565
+ - ``value`` -- an ``mpz_t``, the element mod `p` to lift
566
+ - ``prec`` -- a long, the precision to which to lift
567
+ - ``prime_pow`` -- the ``PowComputer`` of the ring
568
+ """
569
+ if mpz_divisible_p(value, prime_pow.prime.value) != 0:
570
+ mpz_set_ui(out, 0)
571
+ return 0
572
+ if prec <= 0:
573
+ raise ValueError
574
+ if mpz_sgn(value) < 0 or mpz_cmp(value, prime_pow.pow_mpz_t_tmp(prec)) >= 0:
575
+ mpz_mod(out, value, prime_pow.pow_mpz_t_tmp(prec))
576
+ else:
577
+ mpz_set(out, value)
578
+ # holder.value = 1 / Mod(1 - p, prime_pow.pow_mpz_t_tmp(prec))
579
+ mpz_sub(holder.value, prime_pow.pow_mpz_t_tmp(prec), prime_pow.prime.value)
580
+ mpz_add_ui(holder.value, holder.value, 1)
581
+ mpz_invert(holder.value, holder.value, prime_pow.pow_mpz_t_tmp(prec))
582
+ # Consider x as Mod(value, prime_pow.pow_mpz_t_tmp(prec))
583
+ # holder2.value = x + holder.value*(x^p - x)
584
+ mpz_powm(holder2.value, out, prime_pow.prime.value, prime_pow.pow_mpz_t_tmp(prec))
585
+ mpz_sub(holder2.value, holder2.value, out)
586
+ mpz_mul(holder2.value, holder2.value, holder.value)
587
+ mpz_add(holder2.value, holder2.value, out)
588
+ mpz_mod(holder2.value, holder2.value, prime_pow.pow_mpz_t_tmp(prec))
589
+ # while x != holder2.value:
590
+ # x = holder2.value
591
+ # holder2.value = x + holder.value*(x^p - x)
592
+ while mpz_cmp(out, holder2.value) != 0:
593
+ mpz_set(out, holder2.value)
594
+ mpz_powm(holder2.value, out, prime_pow.prime.value, prime_pow.pow_mpz_t_tmp(prec))
595
+ mpz_sub(holder2.value, holder2.value, out)
596
+ mpz_mul(holder2.value, holder2.value, holder.value)
597
+ mpz_add(holder2.value, holder2.value, out)
598
+ mpz_mod(holder2.value, holder2.value, prime_pow.pow_mpz_t_tmp(prec))
599
+
600
+ cdef int cconv(mpz_t out, x, long prec, long valshift, PowComputer_ prime_pow) except -2:
601
+ """
602
+ Conversion from other Sage types.
603
+
604
+ INPUT:
605
+
606
+ - ``out`` -- an ``mpz_t`` to store the output
607
+
608
+ - ``x`` -- a Sage element that can be converted to a `p`-adic element
609
+
610
+ - ``prec`` -- a long, giving the precision desired: absolute if
611
+ `valshift = 0`, relative if `valshift != 0`
612
+
613
+ - ``valshift`` -- the power of the uniformizer to divide by before
614
+ storing the result in ``out``
615
+
616
+ - ``prime_pow`` -- a PowComputer for the ring
617
+ """
618
+ return cconv_shared(out, x, prec, valshift, prime_pow)
619
+
620
+ cdef inline long cconv_mpq_t(mpz_t out, mpq_t x, long prec, bint absolute, PowComputer_ prime_pow) except? -10000:
621
+ """
622
+ A fast pathway for conversion of rationals that doesn't require
623
+ precomputation of the valuation.
624
+
625
+ INPUT:
626
+
627
+ - ``out`` -- an ``mpz_t`` to store the output
628
+ - ``x`` -- an ``mpq_t`` giving the integer to be converted
629
+ - ``prec`` -- a long, giving the precision desired: absolute or
630
+ relative depending on the ``absolute`` input
631
+ - ``absolute`` -- if False then extracts the valuation and returns
632
+ it, storing the unit in ``out``; if ``True`` then just reduces ``x``
633
+ modulo the precision
634
+ - ``prime_pow`` -- a PowComputer for the ring
635
+
636
+ OUTPUT:
637
+
638
+ - If ``absolute`` is False then returns the valuation that was
639
+ extracted (``maxordp`` when `x = 0`).
640
+ """
641
+ return cconv_mpq_t_shared(out, x, prec, absolute, prime_pow)
642
+
643
+ cdef inline int cconv_mpq_t_out(mpq_t out, mpz_t x, long valshift, long prec, PowComputer_ prime_pow) except -1:
644
+ """
645
+ Convert the underlying `p`-adic element into a rational.
646
+
647
+ - ``out`` -- gives a rational approximating the input. Currently uses rational reconstruction but
648
+ may change in the future to use a more naive method
649
+ - ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element
650
+ - ``valshift`` -- a long giving the power of `p` to shift `x` by
651
+ -` ``prec`` -- a long, the precision of ``x``, used in rational reconstruction
652
+ - ``prime_pow`` -- a PowComputer for the ring
653
+ """
654
+ return cconv_mpq_t_out_shared(out, x, valshift, prec, prime_pow)
655
+
656
+ cdef inline long cconv_mpz_t(mpz_t out, mpz_t x, long prec, bint absolute, PowComputer_ prime_pow) except -2:
657
+ """
658
+ A fast pathway for conversion of integers that doesn't require
659
+ precomputation of the valuation.
660
+
661
+ INPUT:
662
+
663
+ - ``out`` -- an ``mpz_t`` to store the output
664
+ - ``x`` -- an ``mpz_t`` giving the integer to be converted
665
+ - ``prec`` -- a long, giving the precision desired: absolute or
666
+ relative depending on the ``absolute`` input
667
+ - ``absolute`` -- if False then extracts the valuation and returns
668
+ it, storing the unit in ``out``; if ``True`` then just reduces ``x``
669
+ modulo the precision
670
+ - ``prime_pow`` -- a PowComputer for the ring
671
+
672
+ OUTPUT:
673
+
674
+ - If ``absolute`` is False then returns the valuation that was
675
+ extracted (``maxordp`` when `x = 0`).
676
+ """
677
+ return cconv_mpz_t_shared(out, x, prec, absolute, prime_pow)
678
+
679
+ cdef inline int cconv_mpz_t_out(mpz_t out, mpz_t x, long valshift, long prec, PowComputer_ prime_pow) except -1:
680
+ """
681
+ Convert the underlying `p`-adic element into an integer if
682
+ possible.
683
+
684
+ - ``out`` -- stores the resulting integer as an integer between 0
685
+ and `p^{prec + valshift}`
686
+ - ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element
687
+ - ``valshift`` -- a long giving the power of `p` to shift `x` by
688
+ -` ``prec`` -- a long, the precision of ``x``: currently not used
689
+ - ``prime_pow`` -- a PowComputer for the ring
690
+ """
691
+ return cconv_mpz_t_out_shared(out, x, valshift, prec, prime_pow)