passagemath-flint 10.6.45__cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_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.
Files changed (366) hide show
  1. passagemath_flint/__init__.py +3 -0
  2. passagemath_flint-10.6.45.dist-info/METADATA +126 -0
  3. passagemath_flint-10.6.45.dist-info/RECORD +366 -0
  4. passagemath_flint-10.6.45.dist-info/WHEEL +6 -0
  5. passagemath_flint-10.6.45.dist-info/sboms/auditwheel.cdx.json +1 -0
  6. passagemath_flint-10.6.45.dist-info/top_level.txt +3 -0
  7. passagemath_flint.libs/libflint-ea9ec694.so.22.0.0 +0 -0
  8. passagemath_flint.libs/libgf2x-a4cdec90.so.3.0.0 +0 -0
  9. passagemath_flint.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
  10. passagemath_flint.libs/libgmp-6e109695.so.10.5.0 +0 -0
  11. passagemath_flint.libs/libgsl-cda90e79.so.28.0.0 +0 -0
  12. passagemath_flint.libs/libmpfi-bcd96d8d.so.0.0.0 +0 -0
  13. passagemath_flint.libs/libmpfr-104d25bb.so.6.2.2 +0 -0
  14. passagemath_flint.libs/libntl-bacfd860.so.45.0.0 +0 -0
  15. passagemath_flint.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
  16. passagemath_flint.libs/libquadmath-2284e583.so.0.0.0 +0 -0
  17. sage/all__sagemath_flint.py +29 -0
  18. sage/combinat/all__sagemath_flint.py +1 -0
  19. sage/combinat/posets/all__sagemath_flint.py +1 -0
  20. sage/combinat/posets/hasse_cython_flint.cpython-314t-x86_64-linux-gnu.so +0 -0
  21. sage/combinat/posets/hasse_cython_flint.pyx +194 -0
  22. sage/data_structures/all__sagemath_flint.py +1 -0
  23. sage/data_structures/bounded_integer_sequences.cpython-314t-x86_64-linux-gnu.so +0 -0
  24. sage/data_structures/bounded_integer_sequences.pxd +62 -0
  25. sage/data_structures/bounded_integer_sequences.pyx +1418 -0
  26. sage/graphs/all__sagemath_flint.py +1 -0
  27. sage/graphs/chrompoly.cpython-314t-x86_64-linux-gnu.so +0 -0
  28. sage/graphs/chrompoly.pyx +555 -0
  29. sage/graphs/matchpoly.cpython-314t-x86_64-linux-gnu.so +0 -0
  30. sage/graphs/matchpoly.pyx +412 -0
  31. sage/libs/all__sagemath_flint.py +17 -0
  32. sage/libs/arb/__init__.py +1 -0
  33. sage/libs/arb/acb.pxd +154 -0
  34. sage/libs/arb/acb_calc.pxd +9 -0
  35. sage/libs/arb/acb_elliptic.pxd +25 -0
  36. sage/libs/arb/acb_hypgeom.pxd +74 -0
  37. sage/libs/arb/acb_mat.pxd +62 -0
  38. sage/libs/arb/acb_modular.pxd +17 -0
  39. sage/libs/arb/acb_poly.pxd +216 -0
  40. sage/libs/arb/arb.pxd +240 -0
  41. sage/libs/arb/arb_fmpz_poly.pxd +21 -0
  42. sage/libs/arb/arb_hypgeom.pxd +83 -0
  43. sage/libs/arb/arb_wrap.h +34 -0
  44. sage/libs/arb/arf.pxd +131 -0
  45. sage/libs/arb/arith.cpython-314t-x86_64-linux-gnu.so +0 -0
  46. sage/libs/arb/arith.pyx +87 -0
  47. sage/libs/arb/bernoulli.pxd +6 -0
  48. sage/libs/arb/mag.pxd +77 -0
  49. sage/libs/arb/types.pxd +37 -0
  50. sage/libs/flint/__init__.py +1 -0
  51. sage/libs/flint/acb.pxd +270 -0
  52. sage/libs/flint/acb_calc.pxd +22 -0
  53. sage/libs/flint/acb_dft.pxd +51 -0
  54. sage/libs/flint/acb_dirichlet.pxd +112 -0
  55. sage/libs/flint/acb_elliptic.pxd +42 -0
  56. sage/libs/flint/acb_hypgeom.pxd +169 -0
  57. sage/libs/flint/acb_macros.pxd +9 -0
  58. sage/libs/flint/acb_mat.pxd +136 -0
  59. sage/libs/flint/acb_mat_macros.pxd +10 -0
  60. sage/libs/flint/acb_modular.pxd +62 -0
  61. sage/libs/flint/acb_poly.pxd +251 -0
  62. sage/libs/flint/acb_poly_macros.pxd +8 -0
  63. sage/libs/flint/acb_theta.pxd +124 -0
  64. sage/libs/flint/acf.pxd +32 -0
  65. sage/libs/flint/aprcl.pxd +84 -0
  66. sage/libs/flint/arb.pxd +382 -0
  67. sage/libs/flint/arb_calc.pxd +31 -0
  68. sage/libs/flint/arb_fmpz_poly.pxd +34 -0
  69. sage/libs/flint/arb_fpwrap.pxd +215 -0
  70. sage/libs/flint/arb_hypgeom.pxd +147 -0
  71. sage/libs/flint/arb_macros.pxd +9 -0
  72. sage/libs/flint/arb_mat.pxd +140 -0
  73. sage/libs/flint/arb_mat_macros.pxd +10 -0
  74. sage/libs/flint/arb_poly.pxd +237 -0
  75. sage/libs/flint/arf.pxd +167 -0
  76. sage/libs/flint/arith.cpython-314t-x86_64-linux-gnu.so +0 -0
  77. sage/libs/flint/arith.pxd +76 -0
  78. sage/libs/flint/arith.pyx +77 -0
  79. sage/libs/flint/arith_sage.cpython-314t-x86_64-linux-gnu.so +0 -0
  80. sage/libs/flint/arith_sage.pyx +308 -0
  81. sage/libs/flint/bernoulli.pxd +28 -0
  82. sage/libs/flint/bool_mat.pxd +52 -0
  83. sage/libs/flint/ca.pxd +203 -0
  84. sage/libs/flint/ca_ext.pxd +34 -0
  85. sage/libs/flint/ca_field.pxd +32 -0
  86. sage/libs/flint/ca_mat.pxd +117 -0
  87. sage/libs/flint/ca_poly.pxd +104 -0
  88. sage/libs/flint/ca_vec.pxd +46 -0
  89. sage/libs/flint/calcium.pxd +27 -0
  90. sage/libs/flint/d_mat.pxd +39 -0
  91. sage/libs/flint/d_vec.pxd +32 -0
  92. sage/libs/flint/dirichlet.pxd +57 -0
  93. sage/libs/flint/dlog.pxd +53 -0
  94. sage/libs/flint/double_extras.pxd +24 -0
  95. sage/libs/flint/double_interval.pxd +36 -0
  96. sage/libs/flint/fexpr.pxd +104 -0
  97. sage/libs/flint/fexpr_builtin.pxd +20 -0
  98. sage/libs/flint/fft.pxd +66 -0
  99. sage/libs/flint/flint.pxd +36 -0
  100. sage/libs/flint/flint_ntl_wrap.h +35 -0
  101. sage/libs/flint/flint_sage.cpython-314t-x86_64-linux-gnu.so +0 -0
  102. sage/libs/flint/flint_sage.pyx +163 -0
  103. sage/libs/flint/flint_wrap.h +192 -0
  104. sage/libs/flint/fmpq.pxd +137 -0
  105. sage/libs/flint/fmpq_mat.pxd +105 -0
  106. sage/libs/flint/fmpq_mat_macros.pxd +10 -0
  107. sage/libs/flint/fmpq_mpoly.pxd +165 -0
  108. sage/libs/flint/fmpq_mpoly_factor.pxd +30 -0
  109. sage/libs/flint/fmpq_poly.pxd +241 -0
  110. sage/libs/flint/fmpq_poly_macros.pxd +9 -0
  111. sage/libs/flint/fmpq_poly_sage.cpython-314t-x86_64-linux-gnu.so +0 -0
  112. sage/libs/flint/fmpq_poly_sage.pxd +31 -0
  113. sage/libs/flint/fmpq_poly_sage.pyx +48 -0
  114. sage/libs/flint/fmpq_vec.pxd +27 -0
  115. sage/libs/flint/fmpz.pxd +256 -0
  116. sage/libs/flint/fmpz_extras.pxd +32 -0
  117. sage/libs/flint/fmpz_factor.pxd +42 -0
  118. sage/libs/flint/fmpz_factor_sage.cpython-314t-x86_64-linux-gnu.so +0 -0
  119. sage/libs/flint/fmpz_factor_sage.pxd +4 -0
  120. sage/libs/flint/fmpz_factor_sage.pyx +29 -0
  121. sage/libs/flint/fmpz_lll.pxd +49 -0
  122. sage/libs/flint/fmpz_macros.pxd +8 -0
  123. sage/libs/flint/fmpz_mat.pxd +184 -0
  124. sage/libs/flint/fmpz_mat_macros.pxd +10 -0
  125. sage/libs/flint/fmpz_mod.pxd +46 -0
  126. sage/libs/flint/fmpz_mod_mat.pxd +71 -0
  127. sage/libs/flint/fmpz_mod_mpoly.pxd +161 -0
  128. sage/libs/flint/fmpz_mod_mpoly_factor.pxd +28 -0
  129. sage/libs/flint/fmpz_mod_poly.pxd +249 -0
  130. sage/libs/flint/fmpz_mod_poly_factor.pxd +46 -0
  131. sage/libs/flint/fmpz_mod_vec.pxd +27 -0
  132. sage/libs/flint/fmpz_mpoly.pxd +224 -0
  133. sage/libs/flint/fmpz_mpoly_factor.pxd +29 -0
  134. sage/libs/flint/fmpz_mpoly_q.pxd +57 -0
  135. sage/libs/flint/fmpz_poly.cpython-314t-x86_64-linux-gnu.so +0 -0
  136. sage/libs/flint/fmpz_poly.pxd +407 -0
  137. sage/libs/flint/fmpz_poly.pyx +19 -0
  138. sage/libs/flint/fmpz_poly_factor.pxd +33 -0
  139. sage/libs/flint/fmpz_poly_macros.pxd +8 -0
  140. sage/libs/flint/fmpz_poly_mat.pxd +71 -0
  141. sage/libs/flint/fmpz_poly_q.pxd +55 -0
  142. sage/libs/flint/fmpz_poly_sage.cpython-314t-x86_64-linux-gnu.so +0 -0
  143. sage/libs/flint/fmpz_poly_sage.pxd +20 -0
  144. sage/libs/flint/fmpz_poly_sage.pyx +500 -0
  145. sage/libs/flint/fmpz_vec.pxd +80 -0
  146. sage/libs/flint/fmpzi.pxd +52 -0
  147. sage/libs/flint/fq.pxd +97 -0
  148. sage/libs/flint/fq_default.pxd +84 -0
  149. sage/libs/flint/fq_default_mat.pxd +70 -0
  150. sage/libs/flint/fq_default_poly.pxd +97 -0
  151. sage/libs/flint/fq_default_poly_factor.pxd +39 -0
  152. sage/libs/flint/fq_embed.pxd +28 -0
  153. sage/libs/flint/fq_mat.pxd +83 -0
  154. sage/libs/flint/fq_nmod.pxd +95 -0
  155. sage/libs/flint/fq_nmod_embed.pxd +28 -0
  156. sage/libs/flint/fq_nmod_mat.pxd +83 -0
  157. sage/libs/flint/fq_nmod_mpoly.pxd +130 -0
  158. sage/libs/flint/fq_nmod_mpoly_factor.pxd +28 -0
  159. sage/libs/flint/fq_nmod_poly.pxd +202 -0
  160. sage/libs/flint/fq_nmod_poly_factor.pxd +47 -0
  161. sage/libs/flint/fq_nmod_vec.pxd +33 -0
  162. sage/libs/flint/fq_poly.pxd +204 -0
  163. sage/libs/flint/fq_poly_factor.pxd +47 -0
  164. sage/libs/flint/fq_vec.pxd +33 -0
  165. sage/libs/flint/fq_zech.pxd +99 -0
  166. sage/libs/flint/fq_zech_embed.pxd +28 -0
  167. sage/libs/flint/fq_zech_mat.pxd +78 -0
  168. sage/libs/flint/fq_zech_poly.pxd +198 -0
  169. sage/libs/flint/fq_zech_poly_factor.pxd +47 -0
  170. sage/libs/flint/fq_zech_vec.pxd +33 -0
  171. sage/libs/flint/gr.pxd +174 -0
  172. sage/libs/flint/gr_generic.pxd +215 -0
  173. sage/libs/flint/gr_mat.pxd +161 -0
  174. sage/libs/flint/gr_mpoly.pxd +68 -0
  175. sage/libs/flint/gr_poly.pxd +276 -0
  176. sage/libs/flint/gr_special.pxd +237 -0
  177. sage/libs/flint/gr_vec.pxd +120 -0
  178. sage/libs/flint/hypgeom.pxd +24 -0
  179. sage/libs/flint/long_extras.pxd +23 -0
  180. sage/libs/flint/mag.pxd +131 -0
  181. sage/libs/flint/mag_macros.pxd +8 -0
  182. sage/libs/flint/mpf_mat.pxd +36 -0
  183. sage/libs/flint/mpf_vec.pxd +34 -0
  184. sage/libs/flint/mpfr_mat.pxd +27 -0
  185. sage/libs/flint/mpfr_vec.pxd +25 -0
  186. sage/libs/flint/mpn_extras.pxd +41 -0
  187. sage/libs/flint/mpoly.pxd +72 -0
  188. sage/libs/flint/nf.pxd +19 -0
  189. sage/libs/flint/nf_elem.pxd +74 -0
  190. sage/libs/flint/nmod.pxd +35 -0
  191. sage/libs/flint/nmod_mat.pxd +104 -0
  192. sage/libs/flint/nmod_mpoly.pxd +144 -0
  193. sage/libs/flint/nmod_mpoly_factor.pxd +28 -0
  194. sage/libs/flint/nmod_poly.pxd +339 -0
  195. sage/libs/flint/nmod_poly_factor.pxd +44 -0
  196. sage/libs/flint/nmod_poly_linkage.pxi +710 -0
  197. sage/libs/flint/nmod_poly_mat.pxd +76 -0
  198. sage/libs/flint/nmod_vec.pxd +40 -0
  199. sage/libs/flint/ntl_interface.pxd +17 -0
  200. sage/libs/flint/padic.pxd +93 -0
  201. sage/libs/flint/padic_mat.pxd +64 -0
  202. sage/libs/flint/padic_poly.pxd +88 -0
  203. sage/libs/flint/partitions.pxd +23 -0
  204. sage/libs/flint/perm.pxd +26 -0
  205. sage/libs/flint/profiler.pxd +24 -0
  206. sage/libs/flint/qadic.pxd +77 -0
  207. sage/libs/flint/qfb.pxd +44 -0
  208. sage/libs/flint/qqbar.pxd +172 -0
  209. sage/libs/flint/qsieve.cpython-314t-x86_64-linux-gnu.so +0 -0
  210. sage/libs/flint/qsieve.pxd +41 -0
  211. sage/libs/flint/qsieve.pyx +21 -0
  212. sage/libs/flint/qsieve_sage.cpython-314t-x86_64-linux-gnu.so +0 -0
  213. sage/libs/flint/qsieve_sage.pyx +67 -0
  214. sage/libs/flint/thread_pool.pxd +25 -0
  215. sage/libs/flint/types.pxd +2076 -0
  216. sage/libs/flint/ulong_extras.cpython-314t-x86_64-linux-gnu.so +0 -0
  217. sage/libs/flint/ulong_extras.pxd +141 -0
  218. sage/libs/flint/ulong_extras.pyx +21 -0
  219. sage/libs/flint/ulong_extras_sage.cpython-314t-x86_64-linux-gnu.so +0 -0
  220. sage/libs/flint/ulong_extras_sage.pyx +21 -0
  221. sage/matrix/all__sagemath_flint.py +1 -0
  222. sage/matrix/change_ring.cpython-314t-x86_64-linux-gnu.so +0 -0
  223. sage/matrix/change_ring.pyx +43 -0
  224. sage/matrix/matrix_complex_ball_dense.cpython-314t-x86_64-linux-gnu.so +0 -0
  225. sage/matrix/matrix_complex_ball_dense.pxd +14 -0
  226. sage/matrix/matrix_complex_ball_dense.pyx +973 -0
  227. sage/matrix/matrix_cyclo_dense.cpython-314t-x86_64-linux-gnu.so +0 -0
  228. sage/matrix/matrix_cyclo_dense.pxd +16 -0
  229. sage/matrix/matrix_cyclo_dense.pyx +1761 -0
  230. sage/matrix/matrix_integer_dense.cpython-314t-x86_64-linux-gnu.so +0 -0
  231. sage/matrix/matrix_integer_dense.pxd +32 -0
  232. sage/matrix/matrix_integer_dense.pyx +5801 -0
  233. sage/matrix/matrix_integer_dense_hnf.py +1294 -0
  234. sage/matrix/matrix_integer_dense_saturation.py +346 -0
  235. sage/matrix/matrix_integer_sparse.cpython-314t-x86_64-linux-gnu.so +0 -0
  236. sage/matrix/matrix_integer_sparse.pxd +9 -0
  237. sage/matrix/matrix_integer_sparse.pyx +1090 -0
  238. sage/matrix/matrix_rational_dense.cpython-314t-x86_64-linux-gnu.so +0 -0
  239. sage/matrix/matrix_rational_dense.pxd +23 -0
  240. sage/matrix/matrix_rational_dense.pyx +2995 -0
  241. sage/matrix/matrix_rational_sparse.cpython-314t-x86_64-linux-gnu.so +0 -0
  242. sage/matrix/matrix_rational_sparse.pxd +11 -0
  243. sage/matrix/matrix_rational_sparse.pyx +789 -0
  244. sage/matrix/misc_flint.cpython-314t-x86_64-linux-gnu.so +0 -0
  245. sage/matrix/misc_flint.pyx +109 -0
  246. sage/modular/all__sagemath_flint.py +1 -0
  247. sage/modular/modform/all__sagemath_flint.py +1 -0
  248. sage/modular/modform/eis_series_cython.cpython-314t-x86_64-linux-gnu.so +0 -0
  249. sage/modular/modform/eis_series_cython.pyx +226 -0
  250. sage/modular/modsym/all__sagemath_flint.py +1 -0
  251. sage/modular/modsym/apply.cpython-314t-x86_64-linux-gnu.so +0 -0
  252. sage/modular/modsym/apply.pxd +6 -0
  253. sage/modular/modsym/apply.pyx +113 -0
  254. sage/modular/modsym/heilbronn.cpython-314t-x86_64-linux-gnu.so +0 -0
  255. sage/modular/modsym/heilbronn.pyx +963 -0
  256. sage/modular/modsym/p1list.cpython-314t-x86_64-linux-gnu.so +0 -0
  257. sage/modular/modsym/p1list.pxd +28 -0
  258. sage/modular/modsym/p1list.pyx +1360 -0
  259. sage/modular/pollack_stevens/all__sagemath_flint.py +1 -0
  260. sage/modular/pollack_stevens/dist.cpython-314t-x86_64-linux-gnu.so +0 -0
  261. sage/modular/pollack_stevens/dist.pxd +38 -0
  262. sage/modular/pollack_stevens/dist.pyx +1439 -0
  263. sage/quivers/algebra.py +691 -0
  264. sage/quivers/algebra_elements.cpython-314t-x86_64-linux-gnu.so +0 -0
  265. sage/quivers/algebra_elements.pxd +97 -0
  266. sage/quivers/algebra_elements.pxi +1324 -0
  267. sage/quivers/algebra_elements.pyx +1424 -0
  268. sage/quivers/all.py +1 -0
  269. sage/quivers/ar_quiver.py +917 -0
  270. sage/quivers/homspace.py +640 -0
  271. sage/quivers/morphism.py +1282 -0
  272. sage/quivers/path_semigroup.py +1155 -0
  273. sage/quivers/paths.cpython-314t-x86_64-linux-gnu.so +0 -0
  274. sage/quivers/paths.pxd +13 -0
  275. sage/quivers/paths.pyx +809 -0
  276. sage/quivers/representation.py +2975 -0
  277. sage/rings/all__sagemath_flint.py +37 -0
  278. sage/rings/cif.py +4 -0
  279. sage/rings/complex_arb.cpython-314t-x86_64-linux-gnu.so +0 -0
  280. sage/rings/complex_arb.pxd +29 -0
  281. sage/rings/complex_arb.pyx +5176 -0
  282. sage/rings/complex_interval.cpython-314t-x86_64-linux-gnu.so +0 -0
  283. sage/rings/complex_interval.pxd +30 -0
  284. sage/rings/complex_interval.pyx +2475 -0
  285. sage/rings/complex_interval_field.py +711 -0
  286. sage/rings/convert/all.py +1 -0
  287. sage/rings/convert/mpfi.cpython-314t-x86_64-linux-gnu.so +0 -0
  288. sage/rings/convert/mpfi.pxd +6 -0
  289. sage/rings/convert/mpfi.pyx +576 -0
  290. sage/rings/factorint_flint.cpython-314t-x86_64-linux-gnu.so +0 -0
  291. sage/rings/factorint_flint.pyx +99 -0
  292. sage/rings/fraction_field_FpT.cpython-314t-x86_64-linux-gnu.so +0 -0
  293. sage/rings/fraction_field_FpT.pxd +28 -0
  294. sage/rings/fraction_field_FpT.pyx +2043 -0
  295. sage/rings/imaginary_unit.py +5 -0
  296. sage/rings/monomials.py +73 -0
  297. sage/rings/number_field/S_unit_solver.py +2870 -0
  298. sage/rings/number_field/all__sagemath_flint.py +7 -0
  299. sage/rings/number_field/bdd_height.py +664 -0
  300. sage/rings/number_field/class_group.py +762 -0
  301. sage/rings/number_field/galois_group.py +1307 -0
  302. sage/rings/number_field/homset.py +612 -0
  303. sage/rings/number_field/maps.py +687 -0
  304. sage/rings/number_field/morphism.py +272 -0
  305. sage/rings/number_field/number_field.py +12820 -0
  306. sage/rings/number_field/number_field_element.cpython-314t-x86_64-linux-gnu.so +0 -0
  307. sage/rings/number_field/number_field_element.pxd +59 -0
  308. sage/rings/number_field/number_field_element.pyx +5735 -0
  309. sage/rings/number_field/number_field_element_quadratic.cpython-314t-x86_64-linux-gnu.so +0 -0
  310. sage/rings/number_field/number_field_element_quadratic.pxd +34 -0
  311. sage/rings/number_field/number_field_element_quadratic.pyx +3203 -0
  312. sage/rings/number_field/number_field_ideal_rel.py +925 -0
  313. sage/rings/number_field/number_field_morphisms.cpython-314t-x86_64-linux-gnu.so +0 -0
  314. sage/rings/number_field/number_field_morphisms.pyx +781 -0
  315. sage/rings/number_field/number_field_rel.py +2734 -0
  316. sage/rings/number_field/order.py +2981 -0
  317. sage/rings/number_field/order_ideal.py +804 -0
  318. sage/rings/number_field/selmer_group.py +715 -0
  319. sage/rings/number_field/small_primes_of_degree_one.py +242 -0
  320. sage/rings/number_field/splitting_field.py +606 -0
  321. sage/rings/number_field/structure.py +380 -0
  322. sage/rings/number_field/unit_group.py +721 -0
  323. sage/rings/padics/all__sagemath_flint.py +3 -0
  324. sage/rings/polynomial/all__sagemath_flint.py +1 -0
  325. sage/rings/polynomial/complex_roots.py +312 -0
  326. sage/rings/polynomial/evaluation_flint.cpython-314t-x86_64-linux-gnu.so +0 -0
  327. sage/rings/polynomial/evaluation_flint.pxd +7 -0
  328. sage/rings/polynomial/evaluation_flint.pyx +68 -0
  329. sage/rings/polynomial/hilbert.cpython-314t-x86_64-linux-gnu.so +0 -0
  330. sage/rings/polynomial/hilbert.pyx +602 -0
  331. sage/rings/polynomial/polynomial_complex_arb.cpython-314t-x86_64-linux-gnu.so +0 -0
  332. sage/rings/polynomial/polynomial_complex_arb.pxd +7 -0
  333. sage/rings/polynomial/polynomial_complex_arb.pyx +963 -0
  334. sage/rings/polynomial/polynomial_integer_dense_flint.cpython-314t-x86_64-linux-gnu.so +0 -0
  335. sage/rings/polynomial/polynomial_integer_dense_flint.pxd +13 -0
  336. sage/rings/polynomial/polynomial_integer_dense_flint.pyx +1881 -0
  337. sage/rings/polynomial/polynomial_number_field.cpython-314t-x86_64-linux-gnu.so +0 -0
  338. sage/rings/polynomial/polynomial_number_field.pyx +345 -0
  339. sage/rings/polynomial/polynomial_rational_flint.cpython-314t-x86_64-linux-gnu.so +0 -0
  340. sage/rings/polynomial/polynomial_rational_flint.pxd +20 -0
  341. sage/rings/polynomial/polynomial_rational_flint.pyx +2598 -0
  342. sage/rings/polynomial/polynomial_zmod_flint.cpython-314t-x86_64-linux-gnu.so +0 -0
  343. sage/rings/polynomial/polynomial_zmod_flint.pxd +20 -0
  344. sage/rings/polynomial/polynomial_zmod_flint.pyx +1063 -0
  345. sage/rings/polynomial/real_roots.cpython-314t-x86_64-linux-gnu.so +0 -0
  346. sage/rings/polynomial/real_roots.pxd +81 -0
  347. sage/rings/polynomial/real_roots.pyx +4704 -0
  348. sage/rings/polynomial/refine_root.cpython-314t-x86_64-linux-gnu.so +0 -0
  349. sage/rings/polynomial/refine_root.pyx +142 -0
  350. sage/rings/polynomial/weil/all.py +4 -0
  351. sage/rings/polynomial/weil/power_sums.h +46 -0
  352. sage/rings/polynomial/weil/weil_polynomials.cpython-314t-x86_64-linux-gnu.so +0 -0
  353. sage/rings/polynomial/weil/weil_polynomials.pyx +596 -0
  354. sage/rings/qqbar.py +9027 -0
  355. sage/rings/real_arb.cpython-314t-x86_64-linux-gnu.so +0 -0
  356. sage/rings/real_arb.pxd +21 -0
  357. sage/rings/real_arb.pyx +4065 -0
  358. sage/rings/real_interval_absolute.cpython-314t-x86_64-linux-gnu.so +0 -0
  359. sage/rings/real_interval_absolute.pyx +1073 -0
  360. sage/rings/real_mpfi.cpython-314t-x86_64-linux-gnu.so +0 -0
  361. sage/rings/real_mpfi.pyx +5430 -0
  362. sage/schemes/all__sagemath_flint.py +1 -0
  363. sage/schemes/elliptic_curves/all__sagemath_flint.py +1 -0
  364. sage/schemes/elliptic_curves/descent_two_isogeny.cpython-314t-x86_64-linux-gnu.so +0 -0
  365. sage/schemes/elliptic_curves/descent_two_isogeny.pyx +1387 -0
  366. sage/schemes/elliptic_curves/descent_two_isogeny_pari.pxd +5 -0
@@ -0,0 +1,1360 @@
1
+ # sage_setup: distribution = sagemath-flint
2
+ # distutils: libraries = gmp
3
+ # distutils: extra_compile_args = -D_XPG6
4
+
5
+ r"""
6
+ Lists of Manin symbols over `\QQ`, elements of `\mathbb{P}^1(\ZZ/N\ZZ)`
7
+ """
8
+
9
+ from cysignals.memory cimport check_allocarray, sig_free
10
+ from cysignals.signals cimport sig_check
11
+
12
+ from sage.misc.search cimport search
13
+ from sage.structure.richcmp cimport rich_to_bool
14
+
15
+ cimport sage.rings.fast_arith
16
+ import sage.rings.fast_arith
17
+ cdef sage.rings.fast_arith.arith_int arith_int
18
+ cdef sage.rings.fast_arith.arith_llong arith_llong
19
+ arith_int = sage.rings.fast_arith.arith_int()
20
+ arith_llong = sage.rings.fast_arith.arith_llong()
21
+
22
+ ctypedef long long llong
23
+
24
+ ###############################################################
25
+ #
26
+ # Int p1_normalize and p1list; a non-int version is below,
27
+ # which should be used for N > 46340
28
+ #
29
+ ################################################################
30
+
31
+ cdef int c_p1_normalize_int(int N, int u, int v,
32
+ int* uu, int* vv, int* ss,
33
+ int compute_s) except -1:
34
+ r"""
35
+ Compute the canonical representative of
36
+ `\mathbb{P}^1(\ZZ/N\ZZ)` equivalent to
37
+ `(u,v)` along with a transforming scalar.
38
+
39
+ INPUT:
40
+
41
+ - ``N`` -- integer
42
+
43
+ - ``u`` -- integer
44
+
45
+ - ``v`` -- integer
46
+
47
+ OUTPUT:
48
+
49
+ If `\gcd(u,v,N) = 1`, then returns
50
+
51
+ - ``uu`` -- integer
52
+
53
+ - ``vv`` -- integer
54
+
55
+ - ``ss`` -- integer such that `(ss*uu, ss*vv)` is congruent to `(u,v)` (mod `N`);
56
+
57
+ If `\gcd(u,v,N) \not= 1`, returns ``0, 0, 0``.
58
+
59
+ If ``compute_s`` is 0, ``s`` is not computed.
60
+ """
61
+ cdef int d, k, g, s, t, min_v, min_t, Ng, vNg
62
+ if N == 1:
63
+ uu[0] = 0
64
+ vv[0] = 0
65
+ ss[0] = 1
66
+ return 0
67
+
68
+ if N <= 0 or 46340 < N:
69
+ raise OverflowError("Modulus is too large (must be <= 46340)")
70
+
71
+ u = u % N
72
+ v = v % N
73
+ if u < 0:
74
+ u += N
75
+ if v < 0:
76
+ v += N
77
+ if u == 0:
78
+ uu[0] = 0
79
+ if arith_int.c_gcd_int(v, N) == 1:
80
+ vv[0] = 1
81
+ else:
82
+ vv[0] = 0
83
+ ss[0] = v
84
+ return 0
85
+
86
+ g = arith_int.c_xgcd_int(u, N, &s, &t)
87
+ s = s % N
88
+ if s < 0:
89
+ s += N
90
+ if arith_int.c_gcd_int(g, v) != 1:
91
+ uu[0] = 0
92
+ vv[0] = 0
93
+ ss[0] = 0
94
+ return 0
95
+
96
+ # Now g = s*u + t*N, so s is a "pseudo-inverse" of u mod N
97
+ # Adjust s modulo N/g so it is coprime to N.
98
+ if g != 1:
99
+ d = N // g
100
+ while arith_int.c_gcd_int(s, N) != 1:
101
+ s = (s+d) % N
102
+
103
+ # Multiply [u,v] by s; then [s*u,s*v] = [g,s*v] (mod N)
104
+ u = g
105
+ v = (s*v) % N
106
+
107
+ min_v = v
108
+ min_t = 1
109
+ if g != 1:
110
+ Ng = N // g
111
+ vNg = (v*Ng) % N
112
+ t = 1
113
+ for k in range(2, g + 1):
114
+ v = (v + vNg) % N
115
+ t = (t + Ng) % N
116
+ if v<min_v and arith_int.c_gcd_int(t, N)==1:
117
+ min_v = v
118
+ min_t = t
119
+ v = min_v
120
+ if u < 0:
121
+ u += N
122
+ if v < 0:
123
+ v += N
124
+ uu[0] = u
125
+ vv[0] = v
126
+ if compute_s:
127
+ ss[0] = arith_int.c_inverse_mod_int(s*min_t, N)
128
+ return 0
129
+
130
+
131
+ def p1_normalize_int(N, u, v):
132
+ r"""
133
+ Compute the canonical representative of
134
+ `\mathbb{P}^1(\ZZ/N\ZZ)` equivalent to
135
+ `(u,v)` along with a transforming scalar.
136
+
137
+ INPUT:
138
+
139
+ - ``N`` -- integer
140
+
141
+ - ``u`` -- integer
142
+
143
+ - ``v`` -- integer
144
+
145
+ OUTPUT:
146
+
147
+ If `\gcd(u,v,N) = 1`, then returns
148
+
149
+ - ``uu`` -- integer
150
+
151
+ - ``vv`` -- integer
152
+
153
+ - ``ss`` -- integer such that `(ss*uu, ss*vv)` is congruent to `(u,v)` (mod `N`);
154
+
155
+ If `\gcd(u,v,N) \not= 1`, returns ``0, 0, 0``.
156
+
157
+ EXAMPLES::
158
+
159
+ sage: from sage.modular.modsym.p1list import p1_normalize_int
160
+ sage: p1_normalize_int(90,7,77)
161
+ (1, 11, 7)
162
+ sage: p1_normalize_int(90,7,78)
163
+ (1, 24, 7)
164
+ sage: (7*24-78*1) % 90
165
+ 0
166
+ sage: (7*24) % 90
167
+ 78
168
+ """
169
+ cdef int uu, vv, ss
170
+ c_p1_normalize_int(N, u % N, v % N, &uu, &vv, &ss, 1)
171
+ return (uu, vv, ss)
172
+
173
+
174
+ def p1list_int(int N):
175
+ r"""
176
+ Return a list of the normalized elements of
177
+ `\mathbb{P}^1(\ZZ/N\ZZ)`.
178
+
179
+ INPUT:
180
+
181
+ - ``N`` -- integer (the level or modulus)
182
+
183
+ EXAMPLES::
184
+
185
+ sage: from sage.modular.modsym.p1list import p1list_int
186
+ sage: p1list_int(6)
187
+ [(0, 1),
188
+ (1, 0),
189
+ (1, 1),
190
+ (1, 2),
191
+ (1, 3),
192
+ (1, 4),
193
+ (1, 5),
194
+ (2, 1),
195
+ (2, 3),
196
+ (2, 5),
197
+ (3, 1),
198
+ (3, 2)]
199
+
200
+ ::
201
+
202
+ sage: p1list_int(120)
203
+ [(0, 1),
204
+ (1, 0),
205
+ (1, 1),
206
+ (1, 2),
207
+ (1, 3),
208
+ ...
209
+ (30, 7),
210
+ (40, 1),
211
+ (40, 3),
212
+ (40, 11),
213
+ (60, 1)]
214
+ """
215
+ cdef int g, u, v, s, c, d, h, d1, cmax
216
+ cdef object lst
217
+
218
+ if N == 1:
219
+ return [(0, 0)]
220
+
221
+ lst = [(0, 1)]
222
+ c = 1
223
+ for d in range(N):
224
+ lst.append((c, d))
225
+
226
+ cmax = N // 2
227
+ if N % 2: # N odd, max divisor is <= N/3
228
+ if N % 3: # N not a multiple of 3 either, max is N/5
229
+ cmax = N // 5
230
+ else:
231
+ cmax = N // 3
232
+
233
+ for c in range(2, cmax + 1):
234
+ if N % c == 0: # c is a proper divisor
235
+ h = N // c
236
+ g = arith_int.c_gcd_int(c, h)
237
+ for d in range(1, h + 1):
238
+ sig_check()
239
+ if arith_int.c_gcd_int(d, g) == 1:
240
+ d1 = d
241
+ while arith_int.c_gcd_int(d1, c) != 1:
242
+ d1 += h
243
+ c_p1_normalize_int(N, c, d1, &u, &v, &s, 0)
244
+ lst.append((u, v))
245
+ lst.sort()
246
+ return lst
247
+
248
+
249
+ ###############################################################
250
+ #
251
+ # The following is a version of the three functions
252
+ #
253
+ # c_p1_normalize_int, p1_normalize_int, and p1list_int
254
+ #
255
+ # but the gcd's are done using GMP, so there are no overflow
256
+ # worries. Also, the one multiplication is done using double
257
+ # precision.
258
+ #
259
+ ################################################################
260
+
261
+ cdef int c_p1_normalize_llong(int N, int u, int v,
262
+ int* uu, int* vv, int* ss,
263
+ int compute_s) except -1:
264
+ r"""
265
+ c_p1_normalize_llong(N, u, v):
266
+
267
+ Computes the canonical representative of
268
+ `\mathbb{P}^1(\ZZ/N\ZZ)` equivalent to `(u,v)` along
269
+ with a transforming scalar 's' (if compute_s is 1).
270
+
271
+ INPUT:
272
+
273
+ - ``N`` -- integer (the modulus or level)
274
+
275
+ - ``u`` -- integer (the first coordinate of (u:v))
276
+
277
+ - ``v`` -- integer (the second coordinate of (u:v))
278
+
279
+ - ``compute_s`` -- boolean (int)
280
+
281
+ OUTPUT:
282
+
283
+ If `\gcd(u,v,N) = 1`, then returns
284
+
285
+ - ``uu`` -- integer
286
+
287
+ - ``vv`` -- integer
288
+
289
+ - ``ss`` -- integer such that `(ss*uu, ss*vv)` is equivalent to `(u,v)` mod `N`
290
+
291
+ If `\gcd(u,v,N) \not= 1`, returns ``0, 0, 0``.
292
+
293
+ EXAMPLES::
294
+
295
+ sage: from sage.modular.modsym.p1list import p1_normalize_int
296
+ sage: p1_normalize_int(90,7,77)
297
+ (1, 11, 7)
298
+ sage: p1_normalize_int(90,7,78)
299
+ (1, 24, 7)
300
+ sage: (7*24-78*1) % 90
301
+ 0
302
+ sage: (7*24) % 90
303
+ 78
304
+
305
+ TESTS:
306
+
307
+ This test reflects :issue:`20932`::
308
+
309
+ sage: N = 3*61379
310
+ sage: import sage.modular.modsym.p1list as p1list
311
+ sage: p1 = p1list.P1List(N) # not tested -- too long
312
+ sage: p1.normalize_with_scalar(21, -1) # not tested -- too long
313
+ (3, 105221, 7)
314
+ """
315
+ cdef int d, k, g, s, t, min_v, min_t, Ng, vNg
316
+ cdef llong ll_s, ll_t, ll_N
317
+ if N == 1:
318
+ uu[0] = 0
319
+ vv[0] = 0
320
+ ss[0] = 1
321
+ return 0
322
+
323
+ ll_N = <long> N
324
+
325
+ # if N <= 0 or N >= 2**31:
326
+ # raise OverflowError("Modulus is too large (must be < 46340)")
327
+ # return -1
328
+
329
+ u = u % N
330
+ v = v % N
331
+ if u < 0:
332
+ u += N
333
+ if v < 0:
334
+ v += N
335
+ if u == 0:
336
+ uu[0] = 0
337
+ if arith_int.c_gcd_int(v, N) == 1:
338
+ vv[0] = 1
339
+ else:
340
+ vv[0] = 0
341
+ ss[0] = v
342
+ return 0
343
+
344
+ # g = xgcd_int_llong(u, N, &s, &t)
345
+ g = <int> arith_llong.c_xgcd_longlong(u, N, &ll_s, &ll_t)
346
+ s = <int>(ll_s % ll_N)
347
+ t = <int>(ll_t % ll_N)
348
+ s = s % N
349
+ if s < 0:
350
+ s += N
351
+ if arith_int.c_gcd_int(g, v) != 1:
352
+ uu[0] = 0
353
+ vv[0] = 0
354
+ ss[0] = 0
355
+ return 0
356
+
357
+ # Now g = s*u + t*N, so s is a "pseudo-inverse" of u mod N
358
+ # Adjust s modulo N/g so it is coprime to N.
359
+ if g != 1:
360
+ d = N // g
361
+ while arith_int.c_gcd_int(s, N) != 1:
362
+ s = (s+d) % N
363
+
364
+ # Multiply [u,v] by s; then [s*u,s*v] = [g,s*v] (mod N)
365
+ u = g
366
+ # v = (s*v) % N
367
+ v = <int> (((<llong>s) * (<llong>v)) % ll_N)
368
+
369
+ min_v = v
370
+ min_t = 1
371
+ if g != 1:
372
+ Ng = N // g
373
+ vNg = <int> ((<llong>v * <llong> Ng) % ll_N)
374
+ t = 1
375
+ for k in range(2, g + 1):
376
+ v = (v + vNg) % N
377
+ t = (t + Ng) % N
378
+ if v < min_v and arith_int.c_gcd_int(t, N) == 1:
379
+ min_v = v
380
+ min_t = t
381
+ v = min_v
382
+ if u < 0:
383
+ u += N
384
+ if v < 0:
385
+ v += N
386
+ uu[0] = u
387
+ vv[0] = v
388
+ if compute_s:
389
+ ss[0] = <int> (arith_llong.c_inverse_mod_longlong((<llong> s)*(<llong> min_t), N) % ll_N)
390
+ return 0
391
+
392
+
393
+ def p1_normalize_llong(N, u, v):
394
+ r"""
395
+ Compute the canonical representative of
396
+ `\mathbb{P}^1(\ZZ/N\ZZ)` equivalent to
397
+ `(u,v)` along with a transforming scalar.
398
+
399
+ INPUT:
400
+
401
+ - ``N`` -- integer
402
+
403
+ - ``u`` -- integer
404
+
405
+ - ``v`` -- integer
406
+
407
+ OUTPUT:
408
+
409
+ If `\gcd(u,v,N) = 1`, then returns
410
+
411
+ - ``uu`` -- integer
412
+
413
+ - ``vv`` -- integer
414
+
415
+ - ``ss`` -- integer such that `(ss*uu, ss*vv)` is equivalent to `(u,v)` mod `N`
416
+
417
+ If `\gcd(u,v,N) \not= 1`, returns ``0, 0, 0``.
418
+
419
+ EXAMPLES::
420
+
421
+ sage: from sage.modular.modsym.p1list import p1_normalize_llong
422
+ sage: p1_normalize_llong(90000,7,77)
423
+ (1, 11, 7)
424
+ sage: p1_normalize_llong(90000,7,78)
425
+ (1, 77154, 7)
426
+ sage: (7*77154-78*1) % 90000
427
+ 0
428
+ sage: (7*77154) % 90000
429
+ 78
430
+ """
431
+ cdef int uu, vv, ss
432
+ c_p1_normalize_llong(N, u % N, v % N, &uu, &vv, &ss, 1)
433
+ return (uu, vv, ss)
434
+
435
+
436
+ def p1list_llong(int N):
437
+ r"""
438
+ Return a list of the normalized elements of
439
+ `\mathbb{P}^1(\ZZ/N\ZZ)`, as a plain list of
440
+ 2-tuples.
441
+
442
+ INPUT:
443
+
444
+ - ``N`` -- integer (the level or modulus)
445
+
446
+ EXAMPLES::
447
+
448
+ sage: from sage.modular.modsym.p1list import p1list_llong
449
+ sage: N = 50000
450
+ sage: L = p1list_llong(50000)
451
+ sage: len(L) == N*prod([1+1/p for p,e in N.factor()])
452
+ True
453
+ sage: L[0]
454
+ (0, 1)
455
+ sage: L[len(L)-1]
456
+ (25000, 1)
457
+
458
+ TESTS:
459
+
460
+ This test shows that :issue:`20932` has been resolved::
461
+
462
+ sage: import sage.modular.modsym.p1list as p1list
463
+ sage: [(i,j) for (i,j) in p1list.P1List(103809) if i != 1 and i != 3] # not tested -- too long
464
+ [(0, 1), (34603, 1), (34603, 2), (34603, 3)]
465
+ """
466
+ cdef int g, u, v, s, c, d, h, d1, cmax
467
+ if N == 1:
468
+ return [(0, 0)]
469
+
470
+ lst = [(0, 1)]
471
+ c = 1
472
+ for d in range(N):
473
+ lst.append((c, d))
474
+
475
+ cmax = N // 2
476
+ if N % 2: # N odd, max divisor is <= N/3
477
+ if N % 3: # N not a multiple of 3 either, max is N/5
478
+ cmax = N // 5
479
+ else:
480
+ cmax = N // 3
481
+
482
+ for c in range(2, cmax + 1):
483
+ if N % c == 0: # c is a proper divisor
484
+ h = N // c
485
+ g = arith_int.c_gcd_int(c, h)
486
+ for d in range(1, h + 1):
487
+ if arith_int.c_gcd_int(d, g) == 1:
488
+ sig_check()
489
+ d1 = d
490
+ while arith_int.c_gcd_int(d1, c) != 1:
491
+ d1 += h
492
+ c_p1_normalize_llong(N, c, d1, &u, &v, &s, 0)
493
+ lst.append((u, v))
494
+ lst.sort()
495
+ return lst
496
+
497
+
498
+ def p1list(N):
499
+ r"""
500
+ Return the elements of the projective line modulo `N`,
501
+ `\mathbb{P}^1(\ZZ/N\ZZ)`, as a plain list of 2-tuples.
502
+
503
+ INPUT:
504
+
505
+ - ``N`` -- integer; a positive integer (less than 2^31)
506
+
507
+ OUTPUT:
508
+
509
+ A list of the elements of the projective line
510
+ `\mathbb{P}^1(\ZZ/N\ZZ)`, as plain 2-tuples.
511
+
512
+ EXAMPLES::
513
+
514
+ sage: from sage.modular.modsym.p1list import p1list
515
+ sage: list(p1list(7))
516
+ [(0, 1), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6)]
517
+ sage: N = 23456
518
+ sage: len(p1list(N)) == N*prod([1+1/p for p,e in N.factor()])
519
+ True
520
+ """
521
+ if N <= 0:
522
+ raise ValueError("N must be a positive integer")
523
+ if N <= 46340:
524
+ return p1list_int(N)
525
+ if N <= 2147483647:
526
+ return p1list_llong(N)
527
+ raise OverflowError("p1list not defined for such large N")
528
+
529
+
530
+ def p1_normalize(int N, int u, int v):
531
+ r"""
532
+ Compute the canonical representative of
533
+ `\mathbb{P}^1(\ZZ/N\ZZ)` equivalent to
534
+ `(u,v)` along with a transforming scalar.
535
+
536
+ INPUT:
537
+
538
+ - ``N`` -- integer
539
+
540
+ - ``u`` -- integer
541
+
542
+ - ``v`` -- integer
543
+
544
+ OUTPUT:
545
+
546
+ If `\gcd(u,v,N) = 1`, then returns
547
+
548
+ - ``uu`` -- integer
549
+
550
+ - ``vv`` -- integer
551
+
552
+ - ``ss`` -- integer such that `(ss*uu, ss*vv)` is equivalent to `(u,v)` mod `N`
553
+
554
+ If `\gcd(u,v,N) \not= 1`, returns ``0, 0, 0``.
555
+
556
+ EXAMPLES::
557
+
558
+ sage: from sage.modular.modsym.p1list import p1_normalize
559
+ sage: p1_normalize(90,7,77)
560
+ (1, 11, 7)
561
+ sage: p1_normalize(90,7,78)
562
+ (1, 24, 7)
563
+ sage: (7*24-78*1) % 90
564
+ 0
565
+ sage: (7*24) % 90
566
+ 78
567
+
568
+ ::
569
+
570
+ sage: from sage.modular.modsym.p1list import p1_normalize
571
+ sage: p1_normalize(50001,12345,54322)
572
+ (3, 4667, 4115)
573
+ sage: (12345*4667-54321*3) % 50001
574
+ 3
575
+ sage: 4115*3 % 50001
576
+ 12345
577
+ sage: 4115*4667 % 50001 == 54322 % 50001
578
+ True
579
+ """
580
+ if N <= 46340:
581
+ return p1_normalize_int(N, u, v)
582
+ if N <= 2147483647:
583
+ return p1_normalize_llong(N, u, v)
584
+ else:
585
+ raise OverflowError
586
+
587
+
588
+ cdef int p1_normalize_xgcdtable(int N, int u, int v,
589
+ int compute_s,
590
+ int *t_g, int *t_a, int *t_b,
591
+ int* uu, int* vv, int* ss) except -1:
592
+ """
593
+ INPUT:
594
+
595
+ - ``N``, ``u``, ``v`` -- integers
596
+
597
+ - ``compute_s`` -- do not compute s if ``compute_s == 0``
598
+
599
+ - ``t_g``, ``t_a``, ``t_b`` -- integer arrays
600
+
601
+ OUTPUT: ``uu, vv, ss`` -- reduced representative and normalizing
602
+ scalar
603
+ """
604
+ cdef int d, k, g, s, t, min_v, min_t, Ng, vNg
605
+ if N == 1:
606
+ uu[0] = 0
607
+ vv[0] = 0
608
+ ss[0] = 1
609
+ return 0
610
+
611
+ if N <= 0 or 46340 < N:
612
+ raise OverflowError("Modulus is too large (must be <= 46340)")
613
+
614
+ u = u % N
615
+ v = v % N
616
+ if u < 0:
617
+ u += N
618
+ if v < 0:
619
+ v += N
620
+ if u == 0:
621
+ uu[0] = 0
622
+ if t_g[v] == 1: # "if arith_int.c_gcd_int(v,N) == 1"
623
+ vv[0] = 1
624
+ else:
625
+ vv[0] = 0
626
+ ss[0] = v
627
+ return 0
628
+
629
+ # WAS: "g = arith_int.c_xgcd_int(u, N, &s, &t)"
630
+ g = t_g[u]
631
+ s = t_a[u]
632
+ t = t_b[u]
633
+ s = s % N
634
+ if s < 0:
635
+ s += N
636
+ if g != 1 and arith_int.c_gcd_int(g, v) != 1:
637
+ uu[0] = 0
638
+ vv[0] = 0
639
+ ss[0] = 0
640
+ return 0
641
+
642
+ # Now g = s*u + t*N, so s is a "pseudo-inverse" of u mod N
643
+ # Adjust s modulo N/g so it is coprime to N.
644
+ if g != 1:
645
+ d = N // g
646
+ while t_g[s] != 1: # while arith_int.c_gcd_int(s,N) != 1:
647
+ s = (s+d) % N
648
+
649
+ # Multiply [u,v] by s; then [s*u,s*v] = [g,s*v] (mod N)
650
+ u = g
651
+ v = (s*v) % N
652
+
653
+ min_v = v
654
+ min_t = 1
655
+ if g != 1:
656
+ Ng = N // g
657
+ vNg = (v*Ng) % N
658
+ t = 1
659
+ for k in range(2, g + 1):
660
+ v = (v + vNg) % N
661
+ t = (t + Ng) % N
662
+ if v < min_v and t_g[t] == 1: # arith_int.c_gcd_int(t,N)==1:
663
+ min_v = v
664
+ min_t = t
665
+ v = min_v
666
+ if u < 0:
667
+ u += N
668
+ if v < 0:
669
+ v += N
670
+ uu[0] = u
671
+ vv[0] = v
672
+ if compute_s:
673
+ # ss[0] = arith_int.c_inverse_mod_int(s*min_t, N);
674
+ ss[0] = t_a[(s*min_t) % N]
675
+ return 0
676
+
677
+
678
+ cdef class P1List():
679
+ r"""
680
+ The class for `\mathbb{P}^1(\ZZ/N\ZZ)`, the projective line modulo `N`.
681
+
682
+ EXAMPLES::
683
+
684
+ sage: P = P1List(12); P
685
+ The projective line over the integers modulo 12
686
+ sage: list(P)
687
+ [(0, 1), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (1, 11), (2, 1), (2, 3), (2, 5), (3, 1), (3, 2), (3, 4), (3, 7), (4, 1), (4, 3), (4, 5), (6, 1)]
688
+
689
+ Saving and loading works.
690
+
691
+ ::
692
+
693
+ sage: loads(dumps(P)) == P
694
+ True
695
+ """
696
+ def __init__(self, int N):
697
+ r"""
698
+ The constructor for the class P1List.
699
+
700
+ INPUT:
701
+
702
+ - ``N`` -- positive integer (the modulus or level)
703
+
704
+ OUTPUT: a P1List object representing `\mathbb{P}^1(\ZZ/N\ZZ)`
705
+
706
+ EXAMPLES::
707
+
708
+ sage: L = P1List(120) # indirect doctest
709
+ sage: L
710
+ The projective line over the integers modulo 120
711
+ """
712
+ cdef int i
713
+
714
+ self.__N = N
715
+ if N <= 46340:
716
+ self.__list = p1list_int(N)
717
+ self._normalize = c_p1_normalize_int
718
+ elif N <= 2147483647:
719
+ self.__list = p1list_llong(N)
720
+ self._normalize = c_p1_normalize_llong
721
+ else:
722
+ raise OverflowError("p1list not defined for such large N.")
723
+ self.__list.sort()
724
+ self.__end_hash = {x: i for i, x in enumerate(self.__list[N+1:])}
725
+
726
+ # Allocate memory for xgcd table.
727
+ self.g = NULL
728
+ self.s = NULL
729
+ self.t = NULL
730
+ self.g = <int*>check_allocarray(N, sizeof(int))
731
+ self.s = <int*>check_allocarray(N, sizeof(int))
732
+ self.t = <int*>check_allocarray(N, sizeof(int))
733
+
734
+ # Initialize xgcd table
735
+ cdef llong ll_s, ll_t, ll_N = N
736
+
737
+ if N <= 46340:
738
+ for i in range(N):
739
+ self.g[i] = arith_int.c_xgcd_int(i, N, &self.s[i], &self.t[i])
740
+ else:
741
+ for i in range(N):
742
+ self.g[i] = arith_llong.c_xgcd_longlong(i, N, &ll_s, &ll_t)
743
+ self.s[i] = <int>(ll_s % ll_N)
744
+ self.t[i] = <int>(ll_t % ll_N)
745
+
746
+ def __dealloc__(self):
747
+ """
748
+ Deallocate memory for an object of the class P1List.
749
+ """
750
+ sig_free(self.g)
751
+ sig_free(self.s)
752
+ sig_free(self.t)
753
+
754
+ def __richcmp__(self, other, int op):
755
+ """
756
+ Comparison function for objects of the class P1List.
757
+
758
+ The order is the same as for the underlying modulus.
759
+
760
+ EXAMPLES::
761
+
762
+ sage: P1List(10) < P1List(11)
763
+ True
764
+ sage: P1List(12) > P1List(11)
765
+ True
766
+ sage: P1List(11) == P1List(11)
767
+ True
768
+
769
+ sage: t = [P1List(N) for N in [100,23,45]]
770
+ sage: [L.N() for L in t]
771
+ [100, 23, 45]
772
+ sage: t.sort()
773
+ sage: [L.N() for L in t]
774
+ [23, 45, 100]
775
+ """
776
+ if not isinstance(other, P1List):
777
+ return NotImplemented
778
+ cdef P1List S = <P1List> self
779
+ cdef P1List O = <P1List> other
780
+ if S.__N < O.__N:
781
+ return rich_to_bool(op, -1)
782
+ elif S.__N > O.__N:
783
+ return rich_to_bool(op, 1)
784
+ return rich_to_bool(op, 0)
785
+
786
+ def __reduce__(self):
787
+ """
788
+ Helper function used in pickling.
789
+
790
+ EXAMPLES::
791
+
792
+ sage: L = P1List(8)
793
+ sage: L.__reduce__()
794
+ (<... 'sage.modular.modsym.p1list.P1List'>, (8,))
795
+ """
796
+ return type(self), (self.__N, )
797
+
798
+ def __getitem__(self, n):
799
+ r"""
800
+ Standard indexing/slicing function for the class ``P1List``.
801
+
802
+ EXAMPLES::
803
+
804
+ sage: L = P1List(8)
805
+ sage: list(L) # indirect doctest
806
+ [(0, 1),
807
+ (1, 0),
808
+ ...
809
+ (2, 3),
810
+ (4, 1)]
811
+ sage: L[4:8] # indirect doctest
812
+ [(1, 3), (1, 4), (1, 5), (1, 6)]
813
+ """
814
+ if isinstance(n, slice):
815
+ start, stop, step = n.indices(len(self))
816
+ return self.__list[start:stop:step]
817
+ else:
818
+ return self.__list[n]
819
+
820
+ def __len__(self):
821
+ """
822
+ Return the length of this P1List.
823
+
824
+ EXAMPLES::
825
+
826
+ sage: L = P1List(8)
827
+ sage: len(L) # indirect doctest
828
+ 12
829
+ """
830
+ return len(self.__list)
831
+
832
+ def __repr__(self) -> str:
833
+ """
834
+ Return the string representation of this P1List.
835
+
836
+ EXAMPLES::
837
+
838
+ sage: L = P1List(8)
839
+ sage: str(L) # indirect doctest
840
+ 'The projective line over the integers modulo 8'
841
+ """
842
+ return f"The projective line over the integers modulo {self.__N}"
843
+
844
+ def lift_to_sl2z(self, int i):
845
+ r"""
846
+ Lift the `i`-th element of this P1list to an element of
847
+ `SL(2,\ZZ)`.
848
+
849
+ If the `i`-th element is `(c,d)`, this function computes and
850
+ returns a list `[a,b, c',d']` that defines a 2x2 matrix
851
+ with determinant 1 and integer entries, such that `c=c'` (mod
852
+ `N`) and `d=d'` (mod `N`).
853
+
854
+ INPUT:
855
+
856
+ - ``i`` -- integer (the index of the element to lift)
857
+
858
+ EXAMPLES::
859
+
860
+ sage: p = P1List(11)
861
+ sage: p.list()[3]
862
+ (1, 2)
863
+
864
+ sage: p.lift_to_sl2z(3)
865
+ [0, -1, 1, 2]
866
+
867
+ AUTHORS:
868
+
869
+ - Justin Walker
870
+ """
871
+ cdef int c, d, N
872
+
873
+ if self.__N == 1:
874
+ return [1, 0, 0, 1]
875
+
876
+ c, d = self.__list[i]
877
+ N = self.__N
878
+ # No overflow: This was adjudicated during init...
879
+ if N <= 46340:
880
+ return lift_to_sl2z_int(c, d, self.__N)
881
+ elif N <= 2147483647:
882
+ return lift_to_sl2z_llong(c, d, self.__N)
883
+ else:
884
+ raise OverflowError("N too large")
885
+
886
+ def apply_I(self, int i):
887
+ r"""
888
+ Return the index of the result of applying the matrix
889
+ `I=[-1,0;0,1]` to the `i`-th element of this P1List.
890
+
891
+ INPUT:
892
+
893
+ - ``i`` -- integer (the index of the element to act on)
894
+
895
+ EXAMPLES::
896
+
897
+ sage: L = P1List(120)
898
+ sage: L[10]
899
+ (1, 9)
900
+ sage: L.apply_I(10)
901
+ 112
902
+ sage: L[112]
903
+ (1, 111)
904
+ sage: L.normalize(-1,9)
905
+ (1, 111)
906
+
907
+ This operation is an involution::
908
+
909
+ sage: all(L.apply_I(L.apply_I(i)) == i for i in range(len(L)))
910
+ True
911
+ """
912
+ cdef int u, v, uu, vv, ss
913
+ u, v = self.__list[i]
914
+ self._normalize(self.__N, -u, v, &uu, &vv, &ss, 0)
915
+ _, j = search(self.__list, (uu, vv))
916
+ return j
917
+
918
+ def apply_S(self, int i):
919
+ r"""
920
+ Return the index of the result of applying the matrix
921
+ `S=[0,-1;1,0]` to the `i`-th element of this P1List.
922
+
923
+ INPUT:
924
+
925
+ - ``i`` -- integer (the index of the element to act on)
926
+
927
+ EXAMPLES::
928
+
929
+ sage: L = P1List(120)
930
+ sage: L[10]
931
+ (1, 9)
932
+ sage: L.apply_S(10)
933
+ 159
934
+ sage: L[159]
935
+ (3, 13)
936
+ sage: L.normalize(-9,1)
937
+ (3, 13)
938
+
939
+ This operation is an involution::
940
+
941
+ sage: all(L.apply_S(L.apply_S(i)) == i for i in range(len(L)))
942
+ True
943
+ """
944
+ cdef int u, v, uu, vv, ss
945
+ u, v = self.__list[i]
946
+ self._normalize(self.__N, -v, u, &uu, &vv, &ss, 0)
947
+ _, j = search(self.__list, (uu, vv))
948
+ return j
949
+
950
+ def apply_T(self, int i):
951
+ r"""
952
+ Return the index of the result of applying the matrix
953
+ `T=[0,1;-1,-1]` to the `i`-th element of this P1List.
954
+
955
+ INPUT:
956
+
957
+ - ``i`` -- integer (the index of the element to act on)
958
+
959
+ EXAMPLES::
960
+
961
+ sage: L = P1List(120)
962
+ sage: L[10]
963
+ (1, 9)
964
+ sage: L.apply_T(10)
965
+ 157
966
+ sage: L[157]
967
+ (3, 10)
968
+ sage: L.normalize(9,-10)
969
+ (3, 10)
970
+
971
+ This operation has order three::
972
+
973
+ sage: all(L.apply_T(L.apply_T(L.apply_T(i))) == i for i in range(len(L)))
974
+ True
975
+ """
976
+ cdef int u, v, uu, vv, ss
977
+ u, v = self.__list[i]
978
+ self._normalize(self.__N, v, -u-v, &uu, &vv, &ss, 0)
979
+ _, j = search(self.__list, (uu, vv))
980
+ return j
981
+
982
+ cpdef index(self, int u, int v):
983
+ r"""
984
+ Return the index of the class of `(u,v)` in the fixed list
985
+ of representatives of
986
+ `\mathbb{P}^1(\ZZ/N\ZZ)`.
987
+
988
+ INPUT:
989
+
990
+ - ``u``, ``v`` -- integers with `\gcd(u,v,N)=1`
991
+
992
+ OUTPUT:
993
+
994
+ - ``i`` -- the index of `u`, `v`, in the P1list
995
+
996
+ EXAMPLES::
997
+
998
+ sage: L = P1List(120)
999
+ sage: L[100]
1000
+ (1, 99)
1001
+ sage: L.index(1,99)
1002
+ 100
1003
+ sage: all(L.index(L[i][0],L[i][1])==i for i in range(len(L)))
1004
+ True
1005
+ """
1006
+ if self.__N == 1:
1007
+ # there is exactly 1 class [(0,0)].
1008
+ return 0
1009
+ cdef int uu, vv, ss
1010
+ p1_normalize_xgcdtable(self.__N, u, v, 0, self.g, self.s, self.t, &uu, &vv, &ss)
1011
+ if uu == 1:
1012
+ return vv + 1
1013
+ elif uu == 0:
1014
+ if vv == 0:
1015
+ return -1
1016
+ return 0
1017
+ try:
1018
+ return self.__end_hash[(uu, vv)] + self.__N + 1
1019
+ except KeyError:
1020
+ return -1
1021
+
1022
+ cdef index_and_scalar(self, int u, int v, int* i, int* s):
1023
+ r"""
1024
+ Compute the index of the class of `(u,v)` in the fixed list
1025
+ of representatives of `\mathbb{P}^1(\ZZ/N\ZZ)` and scalar s
1026
+ such that (s*a,s*b) = (u,v), with (a,b) the normalized
1027
+ representative.
1028
+
1029
+ INPUT:
1030
+
1031
+ - ``u``, ``v`` -- integers with `\gcd(u,v,N)=1`
1032
+
1033
+ OUTPUT:
1034
+
1035
+ - ``i`` -- the index of `u`, `v`, in the P1list
1036
+
1037
+ - ``s`` -- normalizing scalar.
1038
+ """
1039
+ if self.__N == 1:
1040
+ # there is exactly 1 class [(0,0)].
1041
+ i[0] = 0
1042
+ s[0] = 1
1043
+ return
1044
+
1045
+ cdef int uu, vv
1046
+ p1_normalize_xgcdtable(self.__N, u, v, 1, self.g, self.s, self.t, &uu, &vv, s)
1047
+ if uu == 1:
1048
+ i[0] = vv + 1
1049
+ return
1050
+ elif uu == 0:
1051
+ if vv == 0:
1052
+ i[0] = -1
1053
+ return
1054
+ i[0] = 0
1055
+ return
1056
+ try:
1057
+ i[0] = self.__end_hash[(uu, vv)] + self.__N + 1
1058
+ return
1059
+ except KeyError:
1060
+ i[0] = -1
1061
+ return
1062
+
1063
+ def index_of_normalized_pair(self, int u, int v):
1064
+ r"""
1065
+ Return the index of the class of `(u,v)` in the fixed list
1066
+ of representatives of
1067
+ `\mathbb{P}^1(\ZZ/N\ZZ)`.
1068
+
1069
+ INPUT:
1070
+
1071
+ - ``u``, ``v`` -- integers with `\gcd(u,v,N)=1`, normalized so they lie
1072
+ in the list
1073
+
1074
+ OUTPUT:
1075
+
1076
+ - ``i`` -- the index of `(u:v)`, in the P1list
1077
+
1078
+ EXAMPLES::
1079
+
1080
+ sage: L = P1List(120)
1081
+ sage: L[100]
1082
+ (1, 99)
1083
+ sage: L.index_of_normalized_pair(1,99)
1084
+ 100
1085
+ sage: all(L.index_of_normalized_pair(L[i][0],L[i][1])==i for i in range(len(L)))
1086
+ True
1087
+ """
1088
+ t, i = search(self.__list, (u, v))
1089
+ if t:
1090
+ return i
1091
+ return -1
1092
+
1093
+ def list(self):
1094
+ r"""
1095
+ Return the underlying list of this :class:`P1List` object.
1096
+
1097
+ EXAMPLES::
1098
+
1099
+ sage: L = P1List(8)
1100
+ sage: type(L)
1101
+ <... 'sage.modular.modsym.p1list.P1List'>
1102
+ sage: type(L.list())
1103
+ <... 'list'>
1104
+ """
1105
+ return self.__list
1106
+
1107
+ def normalize(self, int u, int v):
1108
+ r"""
1109
+ Return a normalised element of `\mathbb{P}^1(\ZZ/N\ZZ)`.
1110
+
1111
+ INPUT:
1112
+
1113
+ - ``u``, ``v`` -- integers with `\gcd(u,v,N)=1`
1114
+
1115
+ OUTPUT: a 2-tuple ``(uu,vv)`` where `(uu:vv)` is a *normalized*
1116
+ representative of `(u:v)`
1117
+
1118
+ NOTE: See also normalize_with_scalar() which also returns the
1119
+ normalizing scalar.
1120
+
1121
+ EXAMPLES::
1122
+
1123
+ sage: L = P1List(120)
1124
+ sage: (u,v) = (555555555,7777)
1125
+ sage: uu,vv = L.normalize(555555555,7777)
1126
+ sage: (uu,vv)
1127
+ (15, 13)
1128
+ sage: (uu*v-vv*u) % L.N() == 0
1129
+ True
1130
+ """
1131
+ cdef int uu, vv, ss
1132
+ self._normalize(self.__N, u, v, &uu, &vv, &ss, 0)
1133
+ return (uu, vv)
1134
+
1135
+ def normalize_with_scalar(self, int u, int v):
1136
+ r"""
1137
+ Return a normalised element of `\mathbb{P}^1(\ZZ/N\ZZ)`, together with
1138
+ the normalizing scalar.
1139
+
1140
+ INPUT:
1141
+
1142
+ - ``u``, ``v`` -- integers with `\gcd(u,v,N)=1`
1143
+
1144
+ OUTPUT:
1145
+
1146
+ - a 3-tuple ``(uu,vv,ss)`` where `(uu:vv)` is a *normalized*
1147
+ representative of `(u:v)`, and `ss` is a scalar such that
1148
+ `(ss*uu, ss*vv) = (u,v)` (mod `N`).
1149
+
1150
+ EXAMPLES::
1151
+
1152
+ sage: L = P1List(120)
1153
+ sage: (u,v) = (555555555,7777)
1154
+ sage: uu,vv,ss = L.normalize_with_scalar(555555555,7777)
1155
+ sage: (uu,vv)
1156
+ (15, 13)
1157
+ sage: ((ss*uu-u)%L.N(), (ss*vv-v)%L.N())
1158
+ (0, 0)
1159
+ sage: (uu*v-vv*u) % L.N() == 0
1160
+ True
1161
+ """
1162
+ cdef int uu, vv, ss
1163
+ self._normalize(self.__N, u, v, &uu, &vv, &ss, 1)
1164
+ return (uu, vv, ss)
1165
+
1166
+ def N(self):
1167
+ """
1168
+ Return the level or modulus of this P1List.
1169
+
1170
+ EXAMPLES::
1171
+
1172
+ sage: L = P1List(120)
1173
+ sage: L.N()
1174
+ 120
1175
+ """
1176
+ return self.__N
1177
+
1178
+
1179
+ def lift_to_sl2z_int(int c, int d, int N):
1180
+ r"""
1181
+ Lift a pair `(c, d)` to an element of `SL(2, \ZZ)`.
1182
+
1183
+ `(c,d)` is assumed to be an element of
1184
+ `\mathbb{P}^1(\ZZ/N\ZZ)`. This function computes
1185
+ and returns a list `[a, b, c', d']` that defines a 2x2
1186
+ matrix, with determinant 1 and integer entries, such that
1187
+ `c=c'` (mod `N`) and `d=d'` (mod `N`).
1188
+
1189
+ INPUT:
1190
+
1191
+ - ``c``, ``d``, ``N`` -- integers such that `\gcd(c,d,N)=1`
1192
+
1193
+ EXAMPLES::
1194
+
1195
+ sage: from sage.modular.modsym.p1list import lift_to_sl2z_int
1196
+ sage: lift_to_sl2z_int(2,6,11)
1197
+ [1, 8, 2, 17]
1198
+ sage: m = Matrix(Integers(),2,2,lift_to_sl2z_int(2,6,11)); m
1199
+ [ 1 8]
1200
+ [ 2 17]
1201
+
1202
+ AUTHOR:
1203
+
1204
+ - Justin Walker
1205
+ """
1206
+ cdef int z1, z2, g, m
1207
+
1208
+ if N == 1:
1209
+ return [1, 0, 0, 1]
1210
+
1211
+ if c == 0:
1212
+ if d == 1:
1213
+ return [1, 0, 0, 1]
1214
+ if d == N - 1:
1215
+ return [-1, 0, 0, -1]
1216
+ c = N
1217
+
1218
+ g = arith_int.c_xgcd_int(c, d, &z1, &z2)
1219
+
1220
+ # We're lucky: z1*c + z2*d = 1.
1221
+ if g==1:
1222
+ return [z2, -z1, c, d]
1223
+
1224
+ # Have to try harder.
1225
+ m = c
1226
+
1227
+ # compute prime-to-d part of m.
1228
+ while True:
1229
+ g = arith_int.c_gcd_int(m, d)
1230
+ if g == 1:
1231
+ break
1232
+ m = m // g
1233
+
1234
+ # compute prime-to-N part of m.
1235
+ while True:
1236
+ g = arith_int.c_gcd_int(m, N)
1237
+ if g == 1:
1238
+ break
1239
+ m = m // g
1240
+ d += N * m
1241
+ g = arith_int.c_xgcd_int(c, d, &z1, &z2)
1242
+
1243
+ if g != 1:
1244
+ raise ValueError("input must have gcd 1")
1245
+
1246
+ return [z2, -z1, c, d]
1247
+
1248
+
1249
+ def lift_to_sl2z_llong(llong c, llong d, int N):
1250
+ r"""
1251
+ Lift a pair `(c, d)` (modulo `N`) to an element of `SL(2, \ZZ)`.
1252
+
1253
+ `(c,d)` is assumed to be an element of
1254
+ `\mathbb{P}^1(\ZZ/N\ZZ)`. This function computes and
1255
+ returns a list `[a, b, c', d']` that defines a 2x2 matrix,
1256
+ with determinant 1 and integer entries, such that `c=c'` (mod `N`)
1257
+ and `d=d'` (mod `N`).
1258
+
1259
+ INPUT:
1260
+
1261
+ - ``c``, ``d``, ``N`` -- integers such that `\gcd(c,d,N)=1`
1262
+
1263
+ EXAMPLES::
1264
+
1265
+ sage: from sage.modular.modsym.p1list import lift_to_sl2z_llong
1266
+ sage: lift_to_sl2z_llong(2,6,11)
1267
+ [1, 8, 2, 17]
1268
+ sage: m = Matrix(Integers(),2,2,lift_to_sl2z_llong(2,6,11)); m
1269
+ [ 1 8]
1270
+ [ 2 17]
1271
+
1272
+ AUTHOR:
1273
+
1274
+ - Justin Walker
1275
+ """
1276
+ cdef llong z1, z2, g, m
1277
+
1278
+ if N == 1:
1279
+ return [1, 0, 0, 1]
1280
+
1281
+ if c == 0:
1282
+ if d == 1:
1283
+ return [1, 0, 0, 1]
1284
+ if d == N - 1:
1285
+ return [-1, 0, 0, -1]
1286
+ c = N
1287
+
1288
+ g = arith_llong.c_xgcd_longlong(c, d, &z1, &z2)
1289
+
1290
+ # We're lucky: z1*c + z2*d = 1.
1291
+ if g == 1:
1292
+ return [z2, -z1, c, d]
1293
+
1294
+ # Have to try harder.
1295
+ m = c
1296
+
1297
+ # compute prime-to-d part of m.
1298
+ while True:
1299
+ g = arith_llong.c_gcd_longlong(m, d)
1300
+ if g == 1:
1301
+ break
1302
+ m = m // g
1303
+
1304
+ # compute prime-to-N part of m.
1305
+ while True:
1306
+ g = arith_llong.c_gcd_longlong(m, N)
1307
+ if g == 1:
1308
+ break
1309
+ m = m // g
1310
+ d += N * m
1311
+ g = arith_llong.c_xgcd_longlong(c, d, &z1, &z2)
1312
+
1313
+ if g != 1:
1314
+ raise ValueError("input must have gcd 1")
1315
+
1316
+ return [z2, -z1, c, d]
1317
+
1318
+
1319
+ def lift_to_sl2z(c, d, N):
1320
+ r"""
1321
+ Return a list of Python ints `[a,b,c',d']` that are the entries of a
1322
+ 2x2 matrix with determinant 1 and lower two entries congruent to
1323
+ `c,d` modulo `N`.
1324
+
1325
+ INPUT:
1326
+
1327
+ - ``c``, ``d``, ``N`` -- python ints or longs such that `\gcd(c,d,N)=1`
1328
+
1329
+ EXAMPLES::
1330
+
1331
+ sage: lift_to_sl2z(2,3,6)
1332
+ [1, 1, 2, 3]
1333
+ sage: lift_to_sl2z(2,3,6000000)
1334
+ [1, 1, 2, 3]
1335
+
1336
+ You will get a :exc:`ValueError` exception if the input is invalid.
1337
+ Note that here gcd(15,6,24)=3::
1338
+
1339
+ sage: lift_to_sl2z(15,6,24)
1340
+ Traceback (most recent call last):
1341
+ ...
1342
+ ValueError: input must have gcd 1
1343
+
1344
+ This function is not implemented except for N at most 2**31::
1345
+
1346
+ sage: lift_to_sl2z(1,1,2^32)
1347
+ Traceback (most recent call last):
1348
+ ...
1349
+ NotImplementedError: N too large
1350
+
1351
+ TESTS::
1352
+
1353
+ sage: lift_to_sl2z(0, 0, 1)
1354
+ [1, 0, 0, 1]
1355
+ """
1356
+ if N <= 46340:
1357
+ return lift_to_sl2z_int(c, d, N)
1358
+ if N <= 2147483647:
1359
+ return lift_to_sl2z_llong(c, d, N)
1360
+ raise NotImplementedError("N too large")