passagemath-flint 10.6.1rc10__cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.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.
Files changed (360) hide show
  1. passagemath_flint-10.6.1rc10.dist-info/METADATA +122 -0
  2. passagemath_flint-10.6.1rc10.dist-info/RECORD +360 -0
  3. passagemath_flint-10.6.1rc10.dist-info/WHEEL +6 -0
  4. passagemath_flint-10.6.1rc10.dist-info/top_level.txt +2 -0
  5. passagemath_flint.libs/libflint-3701249d.so.21.0.0 +0 -0
  6. passagemath_flint.libs/libgf2x-fbd36f80.so.3.0.0 +0 -0
  7. passagemath_flint.libs/libgfortran-8a9a71bc.so.5.0.0 +0 -0
  8. passagemath_flint.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
  9. passagemath_flint.libs/libgsl-e3525837.so.28.0.0 +0 -0
  10. passagemath_flint.libs/libmpfi-ad12a86d.so.0.0.0 +0 -0
  11. passagemath_flint.libs/libmpfr-e0f11cf3.so.6.2.1 +0 -0
  12. passagemath_flint.libs/libntl-1004113e.so.44.0.1 +0 -0
  13. passagemath_flint.libs/libopenblasp-r0-4c5b64b1.3.29.so +0 -0
  14. sage/all__sagemath_flint.py +29 -0
  15. sage/combinat/all__sagemath_flint.py +1 -0
  16. sage/combinat/posets/all__sagemath_flint.py +1 -0
  17. sage/combinat/posets/hasse_cython_flint.cpython-312-aarch64-linux-gnu.so +0 -0
  18. sage/combinat/posets/hasse_cython_flint.pyx +194 -0
  19. sage/data_structures/all__sagemath_flint.py +1 -0
  20. sage/data_structures/bounded_integer_sequences.cpython-312-aarch64-linux-gnu.so +0 -0
  21. sage/data_structures/bounded_integer_sequences.pxd +62 -0
  22. sage/data_structures/bounded_integer_sequences.pyx +1418 -0
  23. sage/graphs/all__sagemath_flint.py +1 -0
  24. sage/graphs/chrompoly.cpython-312-aarch64-linux-gnu.so +0 -0
  25. sage/graphs/chrompoly.pyx +555 -0
  26. sage/graphs/matchpoly.cpython-312-aarch64-linux-gnu.so +0 -0
  27. sage/graphs/matchpoly.pyx +412 -0
  28. sage/libs/all__sagemath_flint.py +17 -0
  29. sage/libs/arb/__init__.py +1 -0
  30. sage/libs/arb/acb.pxd +154 -0
  31. sage/libs/arb/acb_calc.pxd +9 -0
  32. sage/libs/arb/acb_elliptic.pxd +25 -0
  33. sage/libs/arb/acb_hypgeom.pxd +74 -0
  34. sage/libs/arb/acb_mat.pxd +62 -0
  35. sage/libs/arb/acb_modular.pxd +17 -0
  36. sage/libs/arb/acb_poly.pxd +216 -0
  37. sage/libs/arb/arb.pxd +240 -0
  38. sage/libs/arb/arb_fmpz_poly.pxd +21 -0
  39. sage/libs/arb/arb_hypgeom.pxd +83 -0
  40. sage/libs/arb/arb_wrap.h +34 -0
  41. sage/libs/arb/arf.pxd +131 -0
  42. sage/libs/arb/arith.cpython-312-aarch64-linux-gnu.so +0 -0
  43. sage/libs/arb/arith.pyx +87 -0
  44. sage/libs/arb/bernoulli.pxd +6 -0
  45. sage/libs/arb/mag.pxd +77 -0
  46. sage/libs/arb/types.pxd +37 -0
  47. sage/libs/flint/__init__.py +1 -0
  48. sage/libs/flint/acb.pxd +270 -0
  49. sage/libs/flint/acb_calc.pxd +22 -0
  50. sage/libs/flint/acb_dft.pxd +51 -0
  51. sage/libs/flint/acb_dirichlet.pxd +112 -0
  52. sage/libs/flint/acb_elliptic.pxd +42 -0
  53. sage/libs/flint/acb_hypgeom.pxd +169 -0
  54. sage/libs/flint/acb_macros.pxd +9 -0
  55. sage/libs/flint/acb_mat.pxd +136 -0
  56. sage/libs/flint/acb_mat_macros.pxd +10 -0
  57. sage/libs/flint/acb_modular.pxd +62 -0
  58. sage/libs/flint/acb_poly.pxd +251 -0
  59. sage/libs/flint/acb_poly_macros.pxd +8 -0
  60. sage/libs/flint/acb_theta.pxd +124 -0
  61. sage/libs/flint/acf.pxd +32 -0
  62. sage/libs/flint/aprcl.pxd +84 -0
  63. sage/libs/flint/arb.pxd +382 -0
  64. sage/libs/flint/arb_calc.pxd +31 -0
  65. sage/libs/flint/arb_fmpz_poly.pxd +34 -0
  66. sage/libs/flint/arb_fpwrap.pxd +215 -0
  67. sage/libs/flint/arb_hypgeom.pxd +147 -0
  68. sage/libs/flint/arb_macros.pxd +9 -0
  69. sage/libs/flint/arb_mat.pxd +140 -0
  70. sage/libs/flint/arb_mat_macros.pxd +10 -0
  71. sage/libs/flint/arb_poly.pxd +237 -0
  72. sage/libs/flint/arf.pxd +167 -0
  73. sage/libs/flint/arith.cpython-312-aarch64-linux-gnu.so +0 -0
  74. sage/libs/flint/arith.pxd +76 -0
  75. sage/libs/flint/arith.pyx +77 -0
  76. sage/libs/flint/arith_sage.cpython-312-aarch64-linux-gnu.so +0 -0
  77. sage/libs/flint/arith_sage.pyx +308 -0
  78. sage/libs/flint/bernoulli.pxd +28 -0
  79. sage/libs/flint/bool_mat.pxd +52 -0
  80. sage/libs/flint/ca.pxd +203 -0
  81. sage/libs/flint/ca_ext.pxd +34 -0
  82. sage/libs/flint/ca_field.pxd +32 -0
  83. sage/libs/flint/ca_mat.pxd +117 -0
  84. sage/libs/flint/ca_poly.pxd +104 -0
  85. sage/libs/flint/ca_vec.pxd +46 -0
  86. sage/libs/flint/calcium.pxd +27 -0
  87. sage/libs/flint/d_mat.pxd +39 -0
  88. sage/libs/flint/d_vec.pxd +32 -0
  89. sage/libs/flint/dirichlet.pxd +57 -0
  90. sage/libs/flint/dlog.pxd +53 -0
  91. sage/libs/flint/double_extras.pxd +24 -0
  92. sage/libs/flint/double_interval.pxd +36 -0
  93. sage/libs/flint/fexpr.pxd +104 -0
  94. sage/libs/flint/fexpr_builtin.pxd +20 -0
  95. sage/libs/flint/fft.pxd +66 -0
  96. sage/libs/flint/flint.pxd +36 -0
  97. sage/libs/flint/flint_ntl_wrap.h +35 -0
  98. sage/libs/flint/flint_sage.cpython-312-aarch64-linux-gnu.so +0 -0
  99. sage/libs/flint/flint_sage.pyx +163 -0
  100. sage/libs/flint/flint_wrap.h +190 -0
  101. sage/libs/flint/fmpq.pxd +137 -0
  102. sage/libs/flint/fmpq_mat.pxd +105 -0
  103. sage/libs/flint/fmpq_mat_macros.pxd +10 -0
  104. sage/libs/flint/fmpq_mpoly.pxd +165 -0
  105. sage/libs/flint/fmpq_mpoly_factor.pxd +30 -0
  106. sage/libs/flint/fmpq_poly.pxd +241 -0
  107. sage/libs/flint/fmpq_poly_macros.pxd +9 -0
  108. sage/libs/flint/fmpq_poly_sage.cpython-312-aarch64-linux-gnu.so +0 -0
  109. sage/libs/flint/fmpq_poly_sage.pxd +31 -0
  110. sage/libs/flint/fmpq_poly_sage.pyx +48 -0
  111. sage/libs/flint/fmpq_vec.pxd +27 -0
  112. sage/libs/flint/fmpz.pxd +256 -0
  113. sage/libs/flint/fmpz_extras.pxd +32 -0
  114. sage/libs/flint/fmpz_factor.pxd +42 -0
  115. sage/libs/flint/fmpz_factor_sage.cpython-312-aarch64-linux-gnu.so +0 -0
  116. sage/libs/flint/fmpz_factor_sage.pxd +4 -0
  117. sage/libs/flint/fmpz_factor_sage.pyx +29 -0
  118. sage/libs/flint/fmpz_lll.pxd +49 -0
  119. sage/libs/flint/fmpz_macros.pxd +8 -0
  120. sage/libs/flint/fmpz_mat.pxd +184 -0
  121. sage/libs/flint/fmpz_mat_macros.pxd +10 -0
  122. sage/libs/flint/fmpz_mod.pxd +46 -0
  123. sage/libs/flint/fmpz_mod_mat.pxd +71 -0
  124. sage/libs/flint/fmpz_mod_mpoly.pxd +161 -0
  125. sage/libs/flint/fmpz_mod_mpoly_factor.pxd +28 -0
  126. sage/libs/flint/fmpz_mod_poly.pxd +249 -0
  127. sage/libs/flint/fmpz_mod_poly_factor.pxd +46 -0
  128. sage/libs/flint/fmpz_mod_vec.pxd +27 -0
  129. sage/libs/flint/fmpz_mpoly.pxd +224 -0
  130. sage/libs/flint/fmpz_mpoly_factor.pxd +29 -0
  131. sage/libs/flint/fmpz_mpoly_q.pxd +57 -0
  132. sage/libs/flint/fmpz_poly.cpython-312-aarch64-linux-gnu.so +0 -0
  133. sage/libs/flint/fmpz_poly.pxd +407 -0
  134. sage/libs/flint/fmpz_poly.pyx +19 -0
  135. sage/libs/flint/fmpz_poly_factor.pxd +33 -0
  136. sage/libs/flint/fmpz_poly_macros.pxd +8 -0
  137. sage/libs/flint/fmpz_poly_mat.pxd +71 -0
  138. sage/libs/flint/fmpz_poly_q.pxd +55 -0
  139. sage/libs/flint/fmpz_poly_sage.cpython-312-aarch64-linux-gnu.so +0 -0
  140. sage/libs/flint/fmpz_poly_sage.pxd +20 -0
  141. sage/libs/flint/fmpz_poly_sage.pyx +500 -0
  142. sage/libs/flint/fmpz_vec.pxd +80 -0
  143. sage/libs/flint/fmpzi.pxd +52 -0
  144. sage/libs/flint/fq.pxd +97 -0
  145. sage/libs/flint/fq_default.pxd +84 -0
  146. sage/libs/flint/fq_default_mat.pxd +70 -0
  147. sage/libs/flint/fq_default_poly.pxd +97 -0
  148. sage/libs/flint/fq_default_poly_factor.pxd +39 -0
  149. sage/libs/flint/fq_embed.pxd +28 -0
  150. sage/libs/flint/fq_mat.pxd +83 -0
  151. sage/libs/flint/fq_nmod.pxd +95 -0
  152. sage/libs/flint/fq_nmod_embed.pxd +28 -0
  153. sage/libs/flint/fq_nmod_mat.pxd +83 -0
  154. sage/libs/flint/fq_nmod_mpoly.pxd +130 -0
  155. sage/libs/flint/fq_nmod_mpoly_factor.pxd +28 -0
  156. sage/libs/flint/fq_nmod_poly.pxd +202 -0
  157. sage/libs/flint/fq_nmod_poly_factor.pxd +47 -0
  158. sage/libs/flint/fq_nmod_vec.pxd +33 -0
  159. sage/libs/flint/fq_poly.pxd +204 -0
  160. sage/libs/flint/fq_poly_factor.pxd +47 -0
  161. sage/libs/flint/fq_vec.pxd +33 -0
  162. sage/libs/flint/fq_zech.pxd +99 -0
  163. sage/libs/flint/fq_zech_embed.pxd +28 -0
  164. sage/libs/flint/fq_zech_mat.pxd +78 -0
  165. sage/libs/flint/fq_zech_poly.pxd +198 -0
  166. sage/libs/flint/fq_zech_poly_factor.pxd +47 -0
  167. sage/libs/flint/fq_zech_vec.pxd +33 -0
  168. sage/libs/flint/gr.pxd +174 -0
  169. sage/libs/flint/gr_generic.pxd +215 -0
  170. sage/libs/flint/gr_mat.pxd +161 -0
  171. sage/libs/flint/gr_mpoly.pxd +68 -0
  172. sage/libs/flint/gr_poly.pxd +276 -0
  173. sage/libs/flint/gr_special.pxd +237 -0
  174. sage/libs/flint/gr_vec.pxd +120 -0
  175. sage/libs/flint/hypgeom.pxd +24 -0
  176. sage/libs/flint/long_extras.pxd +23 -0
  177. sage/libs/flint/mag.pxd +131 -0
  178. sage/libs/flint/mag_macros.pxd +8 -0
  179. sage/libs/flint/mpf_mat.pxd +36 -0
  180. sage/libs/flint/mpf_vec.pxd +34 -0
  181. sage/libs/flint/mpfr_mat.pxd +27 -0
  182. sage/libs/flint/mpfr_vec.pxd +25 -0
  183. sage/libs/flint/mpn_extras.pxd +41 -0
  184. sage/libs/flint/mpoly.pxd +72 -0
  185. sage/libs/flint/nf.pxd +19 -0
  186. sage/libs/flint/nf_elem.pxd +74 -0
  187. sage/libs/flint/nmod.pxd +35 -0
  188. sage/libs/flint/nmod_mat.pxd +104 -0
  189. sage/libs/flint/nmod_mpoly.pxd +144 -0
  190. sage/libs/flint/nmod_mpoly_factor.pxd +28 -0
  191. sage/libs/flint/nmod_poly.pxd +339 -0
  192. sage/libs/flint/nmod_poly_factor.pxd +44 -0
  193. sage/libs/flint/nmod_poly_linkage.pxi +710 -0
  194. sage/libs/flint/nmod_poly_mat.pxd +76 -0
  195. sage/libs/flint/nmod_vec.pxd +40 -0
  196. sage/libs/flint/ntl_interface.pxd +17 -0
  197. sage/libs/flint/padic.pxd +93 -0
  198. sage/libs/flint/padic_mat.pxd +64 -0
  199. sage/libs/flint/padic_poly.pxd +88 -0
  200. sage/libs/flint/partitions.pxd +23 -0
  201. sage/libs/flint/perm.pxd +26 -0
  202. sage/libs/flint/profiler.pxd +24 -0
  203. sage/libs/flint/qadic.pxd +77 -0
  204. sage/libs/flint/qfb.pxd +44 -0
  205. sage/libs/flint/qqbar.pxd +172 -0
  206. sage/libs/flint/qsieve.cpython-312-aarch64-linux-gnu.so +0 -0
  207. sage/libs/flint/qsieve.pxd +41 -0
  208. sage/libs/flint/qsieve.pyx +21 -0
  209. sage/libs/flint/qsieve_sage.cpython-312-aarch64-linux-gnu.so +0 -0
  210. sage/libs/flint/qsieve_sage.pyx +67 -0
  211. sage/libs/flint/thread_pool.pxd +25 -0
  212. sage/libs/flint/types.pxd +2076 -0
  213. sage/libs/flint/ulong_extras.cpython-312-aarch64-linux-gnu.so +0 -0
  214. sage/libs/flint/ulong_extras.pxd +141 -0
  215. sage/libs/flint/ulong_extras.pyx +21 -0
  216. sage/libs/flint/ulong_extras_sage.cpython-312-aarch64-linux-gnu.so +0 -0
  217. sage/libs/flint/ulong_extras_sage.pyx +21 -0
  218. sage/matrix/all__sagemath_flint.py +1 -0
  219. sage/matrix/change_ring.cpython-312-aarch64-linux-gnu.so +0 -0
  220. sage/matrix/change_ring.pyx +43 -0
  221. sage/matrix/matrix_complex_ball_dense.cpython-312-aarch64-linux-gnu.so +0 -0
  222. sage/matrix/matrix_complex_ball_dense.pxd +14 -0
  223. sage/matrix/matrix_complex_ball_dense.pyx +973 -0
  224. sage/matrix/matrix_cyclo_dense.cpython-312-aarch64-linux-gnu.so +0 -0
  225. sage/matrix/matrix_cyclo_dense.pxd +16 -0
  226. sage/matrix/matrix_cyclo_dense.pyx +1761 -0
  227. sage/matrix/matrix_integer_dense.cpython-312-aarch64-linux-gnu.so +0 -0
  228. sage/matrix/matrix_integer_dense.pxd +32 -0
  229. sage/matrix/matrix_integer_dense.pyx +5801 -0
  230. sage/matrix/matrix_integer_dense_hnf.py +1294 -0
  231. sage/matrix/matrix_integer_dense_saturation.py +346 -0
  232. sage/matrix/matrix_integer_sparse.cpython-312-aarch64-linux-gnu.so +0 -0
  233. sage/matrix/matrix_integer_sparse.pxd +9 -0
  234. sage/matrix/matrix_integer_sparse.pyx +1090 -0
  235. sage/matrix/matrix_rational_dense.cpython-312-aarch64-linux-gnu.so +0 -0
  236. sage/matrix/matrix_rational_dense.pxd +23 -0
  237. sage/matrix/matrix_rational_dense.pyx +2995 -0
  238. sage/matrix/matrix_rational_sparse.cpython-312-aarch64-linux-gnu.so +0 -0
  239. sage/matrix/matrix_rational_sparse.pxd +11 -0
  240. sage/matrix/matrix_rational_sparse.pyx +789 -0
  241. sage/matrix/misc_flint.cpython-312-aarch64-linux-gnu.so +0 -0
  242. sage/matrix/misc_flint.pyx +109 -0
  243. sage/modular/all__sagemath_flint.py +1 -0
  244. sage/modular/modform/all__sagemath_flint.py +1 -0
  245. sage/modular/modform/eis_series_cython.cpython-312-aarch64-linux-gnu.so +0 -0
  246. sage/modular/modform/eis_series_cython.pyx +226 -0
  247. sage/modular/modsym/all__sagemath_flint.py +1 -0
  248. sage/modular/modsym/apply.cpython-312-aarch64-linux-gnu.so +0 -0
  249. sage/modular/modsym/apply.pxd +6 -0
  250. sage/modular/modsym/apply.pyx +113 -0
  251. sage/modular/modsym/heilbronn.cpython-312-aarch64-linux-gnu.so +0 -0
  252. sage/modular/modsym/heilbronn.pyx +966 -0
  253. sage/modular/pollack_stevens/all__sagemath_flint.py +1 -0
  254. sage/modular/pollack_stevens/dist.cpython-312-aarch64-linux-gnu.so +0 -0
  255. sage/modular/pollack_stevens/dist.pxd +38 -0
  256. sage/modular/pollack_stevens/dist.pyx +1439 -0
  257. sage/quivers/algebra.py +691 -0
  258. sage/quivers/algebra_elements.cpython-312-aarch64-linux-gnu.so +0 -0
  259. sage/quivers/algebra_elements.pxd +97 -0
  260. sage/quivers/algebra_elements.pxi +1324 -0
  261. sage/quivers/algebra_elements.pyx +1424 -0
  262. sage/quivers/all.py +1 -0
  263. sage/quivers/ar_quiver.py +917 -0
  264. sage/quivers/homspace.py +640 -0
  265. sage/quivers/morphism.py +1282 -0
  266. sage/quivers/path_semigroup.py +1155 -0
  267. sage/quivers/paths.cpython-312-aarch64-linux-gnu.so +0 -0
  268. sage/quivers/paths.pxd +13 -0
  269. sage/quivers/paths.pyx +809 -0
  270. sage/quivers/representation.py +2975 -0
  271. sage/rings/all__sagemath_flint.py +37 -0
  272. sage/rings/cif.py +4 -0
  273. sage/rings/complex_arb.cpython-312-aarch64-linux-gnu.so +0 -0
  274. sage/rings/complex_arb.pxd +29 -0
  275. sage/rings/complex_arb.pyx +5176 -0
  276. sage/rings/complex_interval.cpython-312-aarch64-linux-gnu.so +0 -0
  277. sage/rings/complex_interval.pxd +30 -0
  278. sage/rings/complex_interval.pyx +2475 -0
  279. sage/rings/complex_interval_field.py +711 -0
  280. sage/rings/convert/all.py +1 -0
  281. sage/rings/convert/mpfi.cpython-312-aarch64-linux-gnu.so +0 -0
  282. sage/rings/convert/mpfi.pxd +6 -0
  283. sage/rings/convert/mpfi.pyx +576 -0
  284. sage/rings/factorint_flint.cpython-312-aarch64-linux-gnu.so +0 -0
  285. sage/rings/factorint_flint.pyx +99 -0
  286. sage/rings/fraction_field_FpT.cpython-312-aarch64-linux-gnu.so +0 -0
  287. sage/rings/fraction_field_FpT.pxd +28 -0
  288. sage/rings/fraction_field_FpT.pyx +2043 -0
  289. sage/rings/imaginary_unit.py +5 -0
  290. sage/rings/monomials.py +73 -0
  291. sage/rings/number_field/S_unit_solver.py +2870 -0
  292. sage/rings/number_field/all__sagemath_flint.py +7 -0
  293. sage/rings/number_field/bdd_height.py +664 -0
  294. sage/rings/number_field/class_group.py +762 -0
  295. sage/rings/number_field/galois_group.py +1307 -0
  296. sage/rings/number_field/homset.py +612 -0
  297. sage/rings/number_field/maps.py +687 -0
  298. sage/rings/number_field/morphism.py +272 -0
  299. sage/rings/number_field/number_field.py +12820 -0
  300. sage/rings/number_field/number_field_element.cpython-312-aarch64-linux-gnu.so +0 -0
  301. sage/rings/number_field/number_field_element.pxd +59 -0
  302. sage/rings/number_field/number_field_element.pyx +5735 -0
  303. sage/rings/number_field/number_field_element_quadratic.cpython-312-aarch64-linux-gnu.so +0 -0
  304. sage/rings/number_field/number_field_element_quadratic.pxd +34 -0
  305. sage/rings/number_field/number_field_element_quadratic.pyx +3185 -0
  306. sage/rings/number_field/number_field_ideal_rel.py +925 -0
  307. sage/rings/number_field/number_field_morphisms.cpython-312-aarch64-linux-gnu.so +0 -0
  308. sage/rings/number_field/number_field_morphisms.pyx +781 -0
  309. sage/rings/number_field/number_field_rel.py +2734 -0
  310. sage/rings/number_field/order.py +2981 -0
  311. sage/rings/number_field/order_ideal.py +804 -0
  312. sage/rings/number_field/selmer_group.py +715 -0
  313. sage/rings/number_field/small_primes_of_degree_one.py +242 -0
  314. sage/rings/number_field/splitting_field.py +606 -0
  315. sage/rings/number_field/structure.py +380 -0
  316. sage/rings/number_field/unit_group.py +721 -0
  317. sage/rings/padics/all__sagemath_flint.py +3 -0
  318. sage/rings/polynomial/all__sagemath_flint.py +1 -0
  319. sage/rings/polynomial/complex_roots.py +312 -0
  320. sage/rings/polynomial/evaluation_flint.cpython-312-aarch64-linux-gnu.so +0 -0
  321. sage/rings/polynomial/evaluation_flint.pxd +7 -0
  322. sage/rings/polynomial/evaluation_flint.pyx +68 -0
  323. sage/rings/polynomial/hilbert.cpython-312-aarch64-linux-gnu.so +0 -0
  324. sage/rings/polynomial/hilbert.pyx +602 -0
  325. sage/rings/polynomial/polynomial_complex_arb.cpython-312-aarch64-linux-gnu.so +0 -0
  326. sage/rings/polynomial/polynomial_complex_arb.pxd +7 -0
  327. sage/rings/polynomial/polynomial_complex_arb.pyx +963 -0
  328. sage/rings/polynomial/polynomial_integer_dense_flint.cpython-312-aarch64-linux-gnu.so +0 -0
  329. sage/rings/polynomial/polynomial_integer_dense_flint.pxd +13 -0
  330. sage/rings/polynomial/polynomial_integer_dense_flint.pyx +1881 -0
  331. sage/rings/polynomial/polynomial_number_field.cpython-312-aarch64-linux-gnu.so +0 -0
  332. sage/rings/polynomial/polynomial_number_field.pyx +345 -0
  333. sage/rings/polynomial/polynomial_rational_flint.cpython-312-aarch64-linux-gnu.so +0 -0
  334. sage/rings/polynomial/polynomial_rational_flint.pxd +20 -0
  335. sage/rings/polynomial/polynomial_rational_flint.pyx +2598 -0
  336. sage/rings/polynomial/polynomial_zmod_flint.cpython-312-aarch64-linux-gnu.so +0 -0
  337. sage/rings/polynomial/polynomial_zmod_flint.pxd +20 -0
  338. sage/rings/polynomial/polynomial_zmod_flint.pyx +1063 -0
  339. sage/rings/polynomial/real_roots.cpython-312-aarch64-linux-gnu.so +0 -0
  340. sage/rings/polynomial/real_roots.pxd +81 -0
  341. sage/rings/polynomial/real_roots.pyx +4704 -0
  342. sage/rings/polynomial/refine_root.cpython-312-aarch64-linux-gnu.so +0 -0
  343. sage/rings/polynomial/refine_root.pyx +142 -0
  344. sage/rings/polynomial/weil/all.py +4 -0
  345. sage/rings/polynomial/weil/power_sums.h +46 -0
  346. sage/rings/polynomial/weil/weil_polynomials.cpython-312-aarch64-linux-gnu.so +0 -0
  347. sage/rings/polynomial/weil/weil_polynomials.pyx +596 -0
  348. sage/rings/qqbar.py +9025 -0
  349. sage/rings/real_arb.cpython-312-aarch64-linux-gnu.so +0 -0
  350. sage/rings/real_arb.pxd +21 -0
  351. sage/rings/real_arb.pyx +4065 -0
  352. sage/rings/real_interval_absolute.cpython-312-aarch64-linux-gnu.so +0 -0
  353. sage/rings/real_interval_absolute.pyx +1073 -0
  354. sage/rings/real_mpfi.cpython-312-aarch64-linux-gnu.so +0 -0
  355. sage/rings/real_mpfi.pyx +5428 -0
  356. sage/schemes/all__sagemath_flint.py +1 -0
  357. sage/schemes/elliptic_curves/all__sagemath_flint.py +1 -0
  358. sage/schemes/elliptic_curves/descent_two_isogeny.cpython-312-aarch64-linux-gnu.so +0 -0
  359. sage/schemes/elliptic_curves/descent_two_isogeny.pyx +1387 -0
  360. sage/schemes/elliptic_curves/descent_two_isogeny_pari.pxd +5 -0
@@ -0,0 +1,710 @@
1
+ # sage_setup: distribution = sagemath-flint
2
+ r"""
3
+ Linkage for arithmetic with FLINT's nmod_poly_t elements.
4
+
5
+ This file provides the backend for \class{Polynomial_zmod_flint} via
6
+ templating.
7
+
8
+ AUTHOR:
9
+
10
+ - Martin Albrecht (2009-01) another initial implementation
11
+ - Burcin Erocal (2008-11) initial implementation
12
+ """
13
+ #*****************************************************************************
14
+ # Copyright (C) 2008-2009 Burcin Erocal <burcin@erocal.org>
15
+ # Copyright (C) 2009 Martin Albrecht <M.R.Albrecht@rhul.ac.uk>
16
+ #
17
+ # Distributed under the terms of the GNU General Public License (GPL),
18
+ # version 2 or any later version. The full text of the GPL is available at:
19
+ # https://www.gnu.org/licenses/
20
+ #*****************************************************************************
21
+
22
+ from cysignals.signals cimport sig_on, sig_off
23
+ from cysignals.memory cimport sig_malloc, sig_free
24
+
25
+ from sage.libs.flint.types cimport *
26
+ from sage.libs.flint.nmod_poly cimport *
27
+ from sage.libs.flint.nmod_poly_factor cimport *
28
+ from sage.libs.flint.ulong_extras cimport *
29
+ from sage.structure.factorization import Factorization
30
+
31
+ cdef inline celement *celement_new(unsigned long n) noexcept:
32
+ cdef celement *g = <celement *>sig_malloc(sizeof(nmod_poly_t))
33
+ nmod_poly_init(g, n)
34
+ return g
35
+
36
+ cdef inline int celement_delete(nmod_poly_t e, unsigned long n) noexcept:
37
+ nmod_poly_clear(e)
38
+ sig_free(e)
39
+
40
+ cdef inline int celement_construct(nmod_poly_t e, unsigned long n) noexcept:
41
+ """
42
+ EXAMPLES::
43
+
44
+ sage: P.<x> = GF(32003)[] # needs sage.rings.finite_rings
45
+
46
+ sage: Q.<x> = GF(7)[]
47
+ """
48
+ nmod_poly_init(e, n)
49
+
50
+ cdef inline int celement_destruct(nmod_poly_t e, unsigned long n) noexcept:
51
+ """
52
+ EXAMPLES::
53
+
54
+ sage: P.<x> = GF(32003)[] # needs sage.rings.finite_rings
55
+ sage: del x # needs sage.rings.finite_rings
56
+
57
+ sage: Q.<x> = GF(7)[]
58
+ sage: del x
59
+ """
60
+ nmod_poly_clear(e)
61
+
62
+ cdef inline int celement_gen(nmod_poly_t e, long i, unsigned long n) except -2:
63
+ """
64
+ EXAMPLES::
65
+
66
+ sage: P.<x> = GF(32003)[] # needs sage.rings.finite_rings
67
+
68
+ sage: Q.<x> = GF(7)[]
69
+ """
70
+ nmod_poly_zero(e)
71
+ nmod_poly_set_coeff_ui(e, 1, 1)
72
+
73
+ cdef object celement_repr(nmod_poly_t e, unsigned long n):
74
+ raise NotImplementedError
75
+
76
+ cdef inline int celement_set(nmod_poly_t res, nmod_poly_t a, unsigned long n) except -2:
77
+ """
78
+ EXAMPLES::
79
+
80
+ sage: # needs sage.rings.finite_rings
81
+ sage: P.<x> = GF(32003)[]
82
+ sage: y = copy(x)
83
+ sage: y is x
84
+ False
85
+ sage: y == x
86
+ True
87
+
88
+ sage: Q.<x> = GF(7)[]
89
+ sage: y = copy(x)
90
+ sage: y is x
91
+ False
92
+ sage: y == x
93
+ True
94
+
95
+ sage: R.<x> = PolynomialRing(Integers(121))
96
+ sage: S.<y> = PolynomialRing(Integers(11))
97
+ sage: S(50*x)
98
+ 6*y
99
+ sage: R(S(50*x))
100
+ 6*x
101
+ """
102
+ cdef unsigned long i
103
+ if a.mod.n <= n:
104
+ nmod_poly_set(res, a)
105
+ else:
106
+ nmod_poly_zero(res)
107
+ for i from 0 <= i < a.length:
108
+ nmod_poly_set_coeff_ui(res, i, nmod_poly_get_coeff_ui(a, i) % n)
109
+
110
+ cdef inline int celement_set_si(nmod_poly_t res, long i, unsigned long n) except -2:
111
+ """
112
+ EXAMPLES::
113
+
114
+ sage: # needs sage.rings.finite_rings
115
+ sage: P.<x> = GF(32003)[]
116
+ sage: P(32003)
117
+ 0
118
+ sage: P(1)
119
+ 1
120
+ sage: P(32004)
121
+ 1
122
+
123
+ sage: Q.<x> = GF(7)[]
124
+ sage: Q(7)
125
+ 0
126
+ sage: Q(1)
127
+ 1
128
+ sage: Q(8)
129
+ 1
130
+ """
131
+ while i < 0:
132
+ i += n
133
+ nmod_poly_zero(res)
134
+ if i:
135
+ nmod_poly_set_coeff_ui(res, 0, <unsigned long>i)
136
+
137
+ cdef inline long celement_get_si(nmod_poly_t res, unsigned long n) except -2:
138
+ raise NotImplementedError
139
+
140
+ cdef inline bint celement_is_zero(nmod_poly_t a, unsigned long n) except -2:
141
+ """
142
+ EXAMPLES::
143
+
144
+ sage: # needs sage.rings.finite_rings
145
+ sage: P.<x> = GF(32003)[]
146
+ sage: P(1).is_zero()
147
+ False
148
+ sage: P(0).is_zero()
149
+ True
150
+
151
+ sage: Q.<x> = GF(7)[]
152
+ sage: Q(1).is_zero()
153
+ False
154
+ sage: Q(0).is_zero()
155
+ True
156
+ """
157
+ return nmod_poly_is_zero(a)
158
+
159
+ cdef inline bint celement_is_one(nmod_poly_t a, unsigned long n) except -2:
160
+ """
161
+ EXAMPLES::
162
+
163
+ sage: # needs sage.rings.finite_rings
164
+ sage: P.<x> = GF(32003)[]
165
+ sage: P(1).is_one()
166
+ True
167
+ sage: P(0).is_one()
168
+ False
169
+
170
+ sage: Q.<x> = GF(7)[]
171
+ sage: Q(1).is_one()
172
+ True
173
+ sage: Q(0).is_one()
174
+ False
175
+ """
176
+
177
+ return nmod_poly_is_one(a)
178
+
179
+ cdef inline bint celement_equal(nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
180
+ """
181
+ EXAMPLES::
182
+
183
+ sage: # needs sage.rings.finite_rings
184
+ sage: P.<x> = GF(32003)[]
185
+ sage: (3*2)*x == 3*(2*x)
186
+ True
187
+ sage: (3*2)*x + 2 == 3*(2*x) + 1 + 1
188
+ True
189
+ sage: (3*2)*x + 7 == 3*(2*x) + 1 + 1
190
+ False
191
+
192
+ sage: Q.<x> = GF(7)[]
193
+ sage: (3*2)*x == 3*(2*x)
194
+ True
195
+ sage: (3*2)*x + 2 == 3*(2*x) + 1 + 1
196
+ True
197
+ sage: (3*2)*x + 7 == 3*(2*x) + 1 + 1
198
+ False
199
+ """
200
+ return nmod_poly_equal(a, b)
201
+
202
+ cdef inline int celement_cmp(nmod_poly_t l, nmod_poly_t r, unsigned long n) except -2:
203
+ """
204
+ EXAMPLES::
205
+
206
+ sage: # needs sage.rings.finite_rings
207
+ sage: P.<x> = GF(32003)[]
208
+ sage: x > x
209
+ False
210
+ sage: x^2 > x
211
+ True
212
+ sage: 3*x > x
213
+ True
214
+
215
+ sage: Q.<x> = GF(7)[]
216
+ sage: x > x
217
+ False
218
+ sage: x^2 > x
219
+ True
220
+ sage: 3*x > x
221
+ True
222
+
223
+ sage: f = x^64 + x^20 + 1
224
+ sage: g = x^63 + x^20 + 1
225
+ sage: f > g
226
+ True
227
+
228
+ sage: f = x^64 + x^10 + 1
229
+ sage: g = x^64 + x^20 + 1
230
+ sage: f < g
231
+ True
232
+
233
+ sage: f = x^64 + x^20
234
+ sage: g = x^64 + x^20 + 1
235
+ sage: f < g
236
+ True
237
+ """
238
+ cdef int deg_right = nmod_poly_degree(r)
239
+ cdef int degdiff = deg_right - nmod_poly_degree(l)
240
+ cdef int i
241
+ cdef unsigned long rcoeff, lcoeff
242
+ if degdiff > 0:
243
+ return -1
244
+ elif degdiff < 0:
245
+ return 1
246
+ else:
247
+ if nmod_poly_equal(l, r):
248
+ return 0
249
+ i = deg_right
250
+ while i >= 0:
251
+ rcoeff = nmod_poly_get_coeff_ui(r, i)
252
+ lcoeff = nmod_poly_get_coeff_ui(l, i)
253
+ if lcoeff < rcoeff:
254
+ return -1
255
+ if lcoeff > rcoeff:
256
+ return 1
257
+ i -= 1
258
+ return 0
259
+
260
+ cdef long celement_len(nmod_poly_t a, unsigned long n) except -2:
261
+ """
262
+ EXAMPLES::
263
+
264
+ sage: # needs sage.rings.finite_rings
265
+ sage: P.<x> = GF(32003)[]
266
+ sage: (x + 1).degree()
267
+ 1
268
+ sage: (x).degree()
269
+ 1
270
+ sage: P(0).degree()
271
+ -1
272
+
273
+ sage: Q.<x> = GF(7)[]
274
+ sage: (x + 1).degree()
275
+ 1
276
+ sage: (x).degree()
277
+ 1
278
+ sage: Q(0).degree()
279
+ -1
280
+ """
281
+ return <long>nmod_poly_length(a)
282
+
283
+ cdef inline int celement_add(nmod_poly_t res, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
284
+ """
285
+ EXAMPLES::
286
+
287
+ sage: # needs sage.rings.finite_rings
288
+ sage: P.<x> = GF(32003)[]
289
+ sage: x + 1
290
+ x + 1
291
+
292
+ sage: Q.<x> = GF(7)[]
293
+ sage: x + 1
294
+ x + 1
295
+ """
296
+ nmod_poly_add(res, a, b)
297
+
298
+ cdef inline int celement_sub(nmod_poly_t res, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
299
+ """
300
+ EXAMPLES::
301
+
302
+ sage: # needs sage.rings.finite_rings
303
+ sage: P.<x> = GF(32003)[]
304
+ sage: x - 1
305
+ x + 32002
306
+
307
+ sage: Q.<x> = GF(7)[]
308
+ sage: x - 1
309
+ x + 6
310
+ """
311
+ nmod_poly_sub(res, a, b)
312
+
313
+ cdef inline int celement_neg(nmod_poly_t res, nmod_poly_t a, unsigned long n) except -2:
314
+ """
315
+ EXAMPLES::
316
+
317
+ sage: # needs sage.rings.finite_rings
318
+ sage: P.<x> = GF(32003)[]
319
+ sage: -(x + 2)
320
+ 32002*x + 32001
321
+
322
+ sage: Q.<x> = GF(7)[]
323
+ sage: -(x + 2)
324
+ 6*x + 5
325
+ """
326
+ nmod_poly_neg(res, a)
327
+
328
+ cdef inline int celement_mul_scalar(nmod_poly_t res, nmod_poly_t p,
329
+ object c, unsigned long n) except -2:
330
+ """
331
+ TESTS::
332
+
333
+ sage: # needs sage.rings.finite_rings
334
+ sage: P.<x> = GF(32003)[]
335
+ sage: p = P.random_element(degree=2)
336
+ sage: (389*p).coefficients() == [389*x for x in p.coefficients()]
337
+ True
338
+ sage: p = P.random_element(degree=8)
339
+ sage: (p*9836).coefficients() == [x*9836 for x in p.coefficients()]
340
+ True
341
+ """
342
+ nmod_poly_scalar_mul_nmod(res, p, (<unsigned long>c) % n)
343
+
344
+ cdef inline int celement_mul(nmod_poly_t res, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
345
+ """
346
+ EXAMPLES::
347
+
348
+ sage: # needs sage.rings.finite_rings
349
+ sage: P.<x> = GF(32003)[]
350
+ sage: (x + 1) * (x + 2)
351
+ x^2 + 3*x + 2
352
+
353
+ sage: Q.<x> = GF(7)[]
354
+ sage: (x + 1) * (x + 2)
355
+ x^2 + 3*x + 2
356
+ """
357
+ nmod_poly_mul(res, a, b)
358
+
359
+ cdef inline int celement_div(nmod_poly_t res, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
360
+ raise NotImplementedError
361
+
362
+ cdef inline int celement_truncate(nmod_poly_t res, nmod_poly_t a, long len, unsigned long n) except -2:
363
+ """
364
+ EXAMPLES::
365
+
366
+ sage: P.<x> = GF(7)[]
367
+ sage: p = 4*x^4 + 3*x^3 + 2*x^2 + x
368
+ sage: p.truncate(3)
369
+ 2*x^2 + x
370
+
371
+ sage: # needs sage.rings.finite_rings
372
+ sage: Q.<x> = GF(32003)[]
373
+ sage: q = 1 + x + x^2 * Q.random_element()
374
+ sage: q.truncate(2)
375
+ x + 1
376
+ """
377
+ nmod_poly_set(res, a)
378
+ nmod_poly_truncate(res, len)
379
+
380
+ cdef inline int celement_floordiv(nmod_poly_t res, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
381
+ """
382
+ EXAMPLES::
383
+
384
+ sage: # needs sage.rings.finite_rings
385
+ sage: P.<x> = GF(32003)[]
386
+ sage: (x + 1) // (x + 2)
387
+ 1
388
+ sage: (3*x^2 + 1) // (x + 2)
389
+ 3*x + 31997
390
+ sage: (x^2 + 3*x + 2)//(x + 1)
391
+ x + 2
392
+ sage: (x^2 + 3*x + 2)//(x + 2)
393
+ x + 1
394
+
395
+ sage: Q.<x> = GF(7)[]
396
+ sage: (x + 1) // (x + 2)
397
+ 1
398
+ sage: (3*x^2 + 1) // (x + 2)
399
+ 3*x + 1
400
+ sage: (x^2 + 3*x + 2)//(x + 1)
401
+ x + 2
402
+ sage: (x^2 + 3*x + 2)//(x + 2)
403
+ x + 1
404
+ """
405
+ nmod_poly_div(res, a, b)
406
+
407
+ cdef inline int celement_mod(nmod_poly_t res, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
408
+ """
409
+ EXAMPLES::
410
+
411
+ sage: # needs sage.rings.finite_rings
412
+ sage: P.<x> = GF(32003)[]
413
+ sage: f = 24998*x^2 + 29761*x + 2252
414
+ sage: g = 20778*x^2 + 15346*x + 12697
415
+ sage: f % g
416
+ 5815*x + 10280
417
+ sage: f^5 % g
418
+ 7231*x + 17274
419
+
420
+ sage: R.<x> = Integers(81)[]
421
+ sage: f = x^7 + x + 1; g = x^3
422
+ sage: r = f % g; r
423
+ x + 1
424
+ sage: g * x^4 + r
425
+ x^7 + x + 1
426
+ sage: f = x^3 + 1
427
+ sage: f % 3
428
+ Traceback (most recent call last):
429
+ ...
430
+ ValueError: Leading coefficient of a must be invertible.
431
+ sage: f % 0
432
+ Traceback (most recent call last):
433
+ ...
434
+ ZeroDivisionError
435
+ """
436
+ cdef nmod_poly_t q
437
+ cdef unsigned long leadcoeff, modulus
438
+
439
+ nmod_poly_init(q, n)
440
+ leadcoeff = nmod_poly_get_coeff_ui(b, nmod_poly_degree(b))
441
+ modulus = nmod_poly_modulus(b)
442
+ if (leadcoeff > 1 and n_gcd(modulus,leadcoeff) != 1):
443
+ raise ValueError("Leading coefficient of a must be invertible.")
444
+
445
+ nmod_poly_divrem(q, res, a, b)
446
+ nmod_poly_clear(q)
447
+
448
+ cdef inline int celement_quorem(nmod_poly_t q, nmod_poly_t r, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
449
+ """
450
+ EXAMPLES::
451
+
452
+ sage: R.<x> = Integers(125)[]
453
+ sage: f = x^5+1; g = (x+1)^2
454
+ sage: q, r = f.quo_rem(g)
455
+ sage: q
456
+ x^3 + 123*x^2 + 3*x + 121
457
+ sage: r
458
+ 5*x + 5
459
+ sage: q*g + r
460
+ x^5 + 1
461
+
462
+ sage: x.quo_rem(5*x)
463
+ Traceback (most recent call last):
464
+ ...
465
+ ValueError: Leading coefficient of a must be invertible.
466
+
467
+ sage: x.quo_rem(0)
468
+ Traceback (most recent call last):
469
+ ...
470
+ ZeroDivisionError
471
+ """
472
+ cdef unsigned long leadcoeff, modulus
473
+
474
+ leadcoeff = nmod_poly_get_coeff_ui(b, nmod_poly_degree(b))
475
+ modulus = nmod_poly_modulus(b)
476
+ if (leadcoeff > 1 and n_gcd(modulus,leadcoeff) != 1):
477
+ raise ValueError("Leading coefficient of a must be invertible.")
478
+
479
+ nmod_poly_divrem(q, r, a, b)
480
+
481
+ cdef inline int celement_inv(nmod_poly_t res, nmod_poly_t a, unsigned long n) except -2:
482
+ raise NotImplementedError
483
+
484
+ cdef inline int celement_pow(nmod_poly_t res, nmod_poly_t x, long e, nmod_poly_t modulus, unsigned long n) except -2:
485
+ """
486
+ Compute `x^e`, possibly modulo ``modulus``.
487
+
488
+ INPUT:
489
+
490
+ - ``x`` -- polynomial; the base
491
+
492
+ - ``e`` -- integer; the exponent
493
+
494
+ - ``modulus`` -- polynomial or NULL; if not NULL, then perform a modular exponentiation
495
+
496
+ - ``n`` -- integer; not used, but all polynomials' coefficients are understood modulo ``n``
497
+
498
+ EXAMPLES::
499
+
500
+ sage: # needs sage.rings.finite_rings
501
+ sage: P.<x> = GF(32003)[]
502
+ sage: f = 24998*x^2 + 29761*x + 2252
503
+ sage: f*f
504
+ 9426*x^4 + 15477*x^3 + 6531*x^2 + 14980*x + 15030
505
+ sage: f^2
506
+ 9426*x^4 + 15477*x^3 + 6531*x^2 + 14980*x + 15030
507
+ sage: f*f*f
508
+ 25062*x^6 + 30670*x^5 + 15816*x^4 + 20746*x^3 + 9142*x^2 + 5697*x + 20389
509
+ sage: f^3
510
+ 25062*x^6 + 30670*x^5 + 15816*x^4 + 20746*x^3 + 9142*x^2 + 5697*x + 20389
511
+ sage: f*f*f*f*f
512
+ 20269*x^10 + 20535*x^9 + 7313*x^8 + 7311*x^7 + 16853*x^6 + 142*x^5 + 23853*x^4 + 12065*x^3 + 516*x^2 + 8473*x + 17945
513
+ sage: f^5
514
+ 20269*x^10 + 20535*x^9 + 7313*x^8 + 7311*x^7 + 16853*x^6 + 142*x^5 + 23853*x^4 + 12065*x^3 + 516*x^2 + 8473*x + 17945
515
+ sage: f^0
516
+ 1
517
+ sage: f^1
518
+ 24998*x^2 + 29761*x + 2252
519
+ sage: f^-1
520
+ 18649/(x^2 + 16863*x + 9612)
521
+ sage: f^-5
522
+ 24620/(x^10 + 20309*x^9 + 29185*x^8 + 11948*x^7 + 1965*x^6 + 7713*x^5 + 5810*x^4 + 20457*x^3 + 30732*x^2 + 9706*x + 4485)
523
+
524
+ Testing the modulus::
525
+
526
+ sage: # needs sage.rings.finite_rings
527
+ sage: g = 20778*x^2 + 15346*x + 12697
528
+ sage: pow(f, 2, g)
529
+ 15328*x + 6968
530
+ sage: f^2 % g
531
+ 15328*x + 6968
532
+ sage: pow(f, -2, g)
533
+ 16346/(x + 251)
534
+ sage: (f^2 % g)^-1
535
+ 16346/(x + 251)
536
+ sage: pow(f, 5, g)
537
+ 7231*x + 17274
538
+ sage: f^5 % g
539
+ 7231*x + 17274
540
+
541
+ Make sure that exponentiation can be interrupted, see :issue:`17470`::
542
+
543
+ sage: # needs sage.rings.finite_rings
544
+ sage: n = 2^23
545
+ sage: from sage.doctest.util import ensure_interruptible_after
546
+ sage: with ensure_interruptible_after(0.2): (x^n).degree()
547
+ """
548
+ if modulus != NULL:
549
+ sig_on()
550
+ nmod_poly_powmod_ui_binexp(res, x, e, modulus)
551
+ sig_off()
552
+ else:
553
+ sig_on()
554
+ nmod_poly_pow(res, x, e)
555
+ sig_off()
556
+
557
+ cdef inline int celement_gcd(nmod_poly_t res, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
558
+ """
559
+ EXAMPLES::
560
+
561
+ sage: # needs sage.rings.finite_rings
562
+ sage: P.<x> = GF(32003)[]
563
+ sage: f = P.random_element(degree=4)
564
+ sage: g = P.random_element(degree=3)
565
+ sage: h = P.random_element(degree=2)
566
+ sage: F = f*g
567
+ sage: G = f*h
568
+ sage: d = (F).gcd(G)
569
+ sage: (F//d)*d == F
570
+ True
571
+ sage: (G//d)*d == G
572
+ True
573
+
574
+ sage: Q.<x> = GF(7)[]
575
+ sage: f = Q.random_element(degree=4)
576
+ sage: g = Q.random_element(degree=3)
577
+ sage: h = Q.random_element(degree=2)
578
+ sage: F = f*g
579
+ sage: G = f*h
580
+ sage: d = (F).gcd(G)
581
+ sage: (F//d)*d == F
582
+ True
583
+ sage: (G//d)*d == G
584
+ True
585
+
586
+ Check that we catch a case where FLINT fails. These generate the unit
587
+ ideal, so their GCD should be 1 (or another unit)::
588
+
589
+ sage: R.<x> = Integers(121)[]
590
+ sage: f = 11*x^2 + 1
591
+ sage: f - 61*x*f.derivative()
592
+ 1
593
+ sage: gcd(f, f.derivative())
594
+ Traceback (most recent call last):
595
+ ...
596
+ RuntimeError: FLINT gcd calculation failed
597
+ """
598
+ if celement_is_zero(b, n):
599
+ nmod_poly_set(res, a)
600
+ return 0
601
+
602
+ # FLINT provides no interface for detecting errors here
603
+ try:
604
+ sig_on()
605
+ try:
606
+ nmod_poly_gcd(res, a, b)
607
+ finally:
608
+ sig_off()
609
+ except RuntimeError:
610
+ raise RuntimeError("FLINT gcd calculation failed")
611
+
612
+ cdef unsigned long leadcoeff = nmod_poly_get_coeff_ui(res, nmod_poly_degree(res))
613
+ cdef unsigned long modulus = nmod_poly_modulus(res)
614
+ if n_gcd(modulus, leadcoeff) == 1:
615
+ nmod_poly_make_monic(res, res)
616
+
617
+ cdef inline int celement_xgcd(nmod_poly_t res, nmod_poly_t s, nmod_poly_t t, nmod_poly_t a, nmod_poly_t b, unsigned long n) except -2:
618
+ """
619
+ EXAMPLES::
620
+
621
+ sage: # needs sage.rings.finite_rings
622
+ sage: P.<x> = GF(32003)[]
623
+ sage: f = P.random_element(degree=4)
624
+ sage: g = P.random_element(degree=3)
625
+ sage: h = P.random_element(degree=2)
626
+ sage: F = f*g
627
+ sage: G = f*h
628
+ sage: d,s,t = (F).xgcd(G)
629
+ sage: (F//d)*d == F
630
+ True
631
+ sage: (G//d)*d == G
632
+ True
633
+
634
+ sage: Q.<x> = GF(7)[]
635
+ sage: f = Q.random_element(degree=4)
636
+ sage: g = Q.random_element(degree=3)
637
+ sage: h = Q.random_element(degree=2)
638
+ sage: F = f*g
639
+ sage: G = f*h
640
+ sage: d,s,t = (F).xgcd(G)
641
+ sage: (F//d)*d == F
642
+ True
643
+ sage: (G//d)*d == G
644
+ True
645
+
646
+ TESTS:
647
+
648
+ Ensure that :issue:`38537` is fixed::
649
+
650
+ sage: k = Zmod(2**16)
651
+ sage: R.<x> = k[]
652
+ sage: u = x + 10161
653
+ sage: v = x + 10681
654
+ sage: u.xgcd(v)
655
+ Traceback (most recent call last):
656
+ ...
657
+ ValueError: non-invertible elements encountered during XGCD
658
+ """
659
+ try:
660
+ sig_on()
661
+ nmod_poly_xgcd(res, s, t, a, b)
662
+ sig_off()
663
+ except RuntimeError:
664
+ raise ValueError("non-invertible elements encountered during XGCD")
665
+
666
+
667
+ cdef factor_helper(Polynomial_zmod_flint poly, bint squarefree=False):
668
+ """
669
+ EXAMPLES::
670
+
671
+ sage: # needs sage.rings.finite_rings
672
+ sage: P.<x> = GF(1009)[]
673
+ sage: factors = (prod(P.random_element(degree=2) for i in range(5))).factor()
674
+ sage: all(factor.is_irreducible() for factor, mult in factors)
675
+ True
676
+ sage: def nonzero_random(P):
677
+ ....: r = P.random_element()
678
+ ....: while r == 0:
679
+ ....: r = P.random_element()
680
+ ....: return r
681
+ sage: p = (prod(nonzero_random(P)^i for i in range(5)))
682
+ sage: decomp = p.squarefree_decomposition()
683
+ sage: any(factor.is_square() for factor, mult in decomp)
684
+ False
685
+ sage: start = 0
686
+ sage: for factor, mult in decomp:
687
+ ....: assert mult > start
688
+ ....: start = mult
689
+ """
690
+ cdef nmod_poly_factor_t factors_c
691
+ nmod_poly_factor_init(factors_c)
692
+
693
+ sig_on()
694
+ if squarefree:
695
+ nmod_poly_factor_squarefree(factors_c, &poly.x)
696
+ else:
697
+ nmod_poly_factor(factors_c, &poly.x)
698
+ sig_off()
699
+
700
+ factor_list = []
701
+ cdef Polynomial_zmod_flint t
702
+ for i in range(factors_c.num):
703
+ t = poly._new()
704
+ nmod_poly_swap(&t.x, &factors_c.p[i])
705
+ factor_list.append((t, factors_c.exp[i]))
706
+
707
+ nmod_poly_factor_clear(factors_c)
708
+
709
+ return Factorization(factor_list, unit=poly.leading_coefficient(),
710
+ sort=(not squarefree))