passagemath-pari 10.6.32__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-pari might be problematic. Click here for more details.

Files changed (331) hide show
  1. PARIKernel/__init__.py +2 -0
  2. PARIKernel/__main__.py +5 -0
  3. PARIKernel/io.cpython-314-x86_64-linux-musl.so +0 -0
  4. PARIKernel/io.pxd +7 -0
  5. PARIKernel/io.pyx +84 -0
  6. PARIKernel/kernel.cpython-314-x86_64-linux-musl.so +0 -0
  7. PARIKernel/kernel.pyx +260 -0
  8. PARIKernel/paridecl.pxd +95 -0
  9. PARIKernel/svg.cpython-314-x86_64-linux-musl.so +0 -0
  10. PARIKernel/svg.pyx +52 -0
  11. cypari2/__init__.py +8 -0
  12. cypari2/auto_paridecl.pxd +1070 -0
  13. cypari2/closure.cpython-314-x86_64-linux-musl.so +0 -0
  14. cypari2/closure.pxd +5 -0
  15. cypari2/closure.pyx +246 -0
  16. cypari2/convert.cpython-314-x86_64-linux-musl.so +0 -0
  17. cypari2/convert.pxd +80 -0
  18. cypari2/convert.pyx +613 -0
  19. cypari2/custom_block.cpython-314-x86_64-linux-musl.so +0 -0
  20. cypari2/custom_block.pyx +30 -0
  21. cypari2/cypari.h +13 -0
  22. cypari2/gen.cpython-314-x86_64-linux-musl.so +0 -0
  23. cypari2/gen.pxd +69 -0
  24. cypari2/gen.pyx +4819 -0
  25. cypari2/handle_error.cpython-314-x86_64-linux-musl.so +0 -0
  26. cypari2/handle_error.pxd +7 -0
  27. cypari2/handle_error.pyx +232 -0
  28. cypari2/pari_instance.cpython-314-x86_64-linux-musl.so +0 -0
  29. cypari2/pari_instance.pxd +27 -0
  30. cypari2/pari_instance.pyx +1438 -0
  31. cypari2/paridecl.pxd +5353 -0
  32. cypari2/paripriv.pxd +34 -0
  33. cypari2/pycore_long.h +98 -0
  34. cypari2/pycore_long.pxd +9 -0
  35. cypari2/stack.cpython-314-x86_64-linux-musl.so +0 -0
  36. cypari2/stack.pxd +27 -0
  37. cypari2/stack.pyx +278 -0
  38. cypari2/string_utils.cpython-314-x86_64-linux-musl.so +0 -0
  39. cypari2/string_utils.pxd +29 -0
  40. cypari2/string_utils.pyx +65 -0
  41. cypari2/types.pxd +147 -0
  42. passagemath_pari-10.6.32.data/data/etc/jupyter/nbconfig/notebook.d/gp-mode.json +5 -0
  43. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.js +28 -0
  44. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.json +6 -0
  45. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/logo-64x64.png +0 -0
  46. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/kernel.json +13 -0
  47. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-32x32.png +0 -0
  48. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-64x64.png +0 -0
  49. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-svg.svg +75 -0
  50. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/gp.js +284 -0
  51. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/main.js +15 -0
  52. passagemath_pari-10.6.32.dist-info/METADATA +209 -0
  53. passagemath_pari-10.6.32.dist-info/RECORD +331 -0
  54. passagemath_pari-10.6.32.dist-info/WHEEL +5 -0
  55. passagemath_pari-10.6.32.dist-info/top_level.txt +4 -0
  56. passagemath_pari.libs/libcrypto-f04afe95.so.3 +0 -0
  57. passagemath_pari.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
  58. passagemath_pari.libs/libgcc_s-0cd532bd.so.1 +0 -0
  59. passagemath_pari.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
  60. passagemath_pari.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
  61. passagemath_pari.libs/libgivaro-9a94c711.so.9.2.1 +0 -0
  62. passagemath_pari.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  63. passagemath_pari.libs/libgmpxx-9e08595c.so.4.7.0 +0 -0
  64. passagemath_pari.libs/libgsl-42cda06f.so.28.0.0 +0 -0
  65. passagemath_pari.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
  66. passagemath_pari.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
  67. passagemath_pari.libs/libntl-26885ca2.so.44.0.1 +0 -0
  68. passagemath_pari.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
  69. passagemath_pari.libs/libpari-gmp-tls-f31f908f.so.2.17.2 +0 -0
  70. passagemath_pari.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
  71. passagemath_pari.libs/libreadline-06542304.so.8.2 +0 -0
  72. passagemath_pari.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  73. passagemath_pari.libs/libuuid-f3770415.so.1.3.0 +0 -0
  74. passagemath_pari.libs/libxeus-735780ff.so.13.1.0 +0 -0
  75. passagemath_pari.libs/libxeus-zmq-c68577b4.so.6.0.1 +0 -0
  76. passagemath_pari.libs/libzmq-1ba9a3da.so.5.2.5 +0 -0
  77. sage/all__sagemath_pari.py +26 -0
  78. sage/databases/all__sagemath_pari.py +7 -0
  79. sage/databases/conway.py +274 -0
  80. sage/ext/all__sagemath_pari.py +1 -0
  81. sage/ext/memory.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/ext/memory.pyx +98 -0
  83. sage/ext_data/pari/buzzard/DimensionSk.g +286 -0
  84. sage/ext_data/pari/buzzard/Tpprog.g +179 -0
  85. sage/ext_data/pari/buzzard/genusn.g +129 -0
  86. sage/ext_data/pari/dokchitser/computel.gp +740 -0
  87. sage/ext_data/pari/dokchitser/computel.gp.template +740 -0
  88. sage/ext_data/pari/dokchitser/ex-bsw +43 -0
  89. sage/ext_data/pari/dokchitser/ex-chgen +48 -0
  90. sage/ext_data/pari/dokchitser/ex-chqua +37 -0
  91. sage/ext_data/pari/dokchitser/ex-delta +35 -0
  92. sage/ext_data/pari/dokchitser/ex-eisen +30 -0
  93. sage/ext_data/pari/dokchitser/ex-gen2 +38 -0
  94. sage/ext_data/pari/dokchitser/ex-gen3 +49 -0
  95. sage/ext_data/pari/dokchitser/ex-gen4 +54 -0
  96. sage/ext_data/pari/dokchitser/ex-nf +48 -0
  97. sage/ext_data/pari/dokchitser/ex-shin +50 -0
  98. sage/ext_data/pari/dokchitser/ex-tau2 +30 -0
  99. sage/ext_data/pari/dokchitser/ex-zeta +27 -0
  100. sage/ext_data/pari/dokchitser/ex-zeta2 +47 -0
  101. sage/ext_data/pari/dokchitser/testall +13 -0
  102. sage/ext_data/pari/simon/ell.gp +2129 -0
  103. sage/ext_data/pari/simon/ellQ.gp +2151 -0
  104. sage/ext_data/pari/simon/ellcommon.gp +126 -0
  105. sage/ext_data/pari/simon/qfsolve.gp +722 -0
  106. sage/ext_data/pari/simon/resultant3.gp +306 -0
  107. sage/groups/all__sagemath_pari.py +3 -0
  108. sage/groups/pari_group.py +175 -0
  109. sage/interfaces/all__sagemath_pari.py +1 -0
  110. sage/interfaces/genus2reduction.py +464 -0
  111. sage/interfaces/gp.py +1114 -0
  112. sage/libs/all__sagemath_pari.py +2 -0
  113. sage/libs/linkages/__init__.py +1 -0
  114. sage/libs/linkages/padics/API.pxi +617 -0
  115. sage/libs/linkages/padics/Polynomial_ram.pxi +388 -0
  116. sage/libs/linkages/padics/Polynomial_shared.pxi +554 -0
  117. sage/libs/linkages/padics/__init__.py +1 -0
  118. sage/libs/linkages/padics/fmpz_poly_unram.pxi +869 -0
  119. sage/libs/linkages/padics/mpz.pxi +691 -0
  120. sage/libs/linkages/padics/relaxed/API.pxi +518 -0
  121. sage/libs/linkages/padics/relaxed/__init__.py +1 -0
  122. sage/libs/linkages/padics/relaxed/flint.pxi +543 -0
  123. sage/libs/linkages/padics/unram_shared.pxi +247 -0
  124. sage/libs/pari/__init__.py +210 -0
  125. sage/libs/pari/all.py +5 -0
  126. sage/libs/pari/convert_flint.cpython-314-x86_64-linux-musl.so +0 -0
  127. sage/libs/pari/convert_flint.pxd +14 -0
  128. sage/libs/pari/convert_flint.pyx +159 -0
  129. sage/libs/pari/convert_gmp.cpython-314-x86_64-linux-musl.so +0 -0
  130. sage/libs/pari/convert_gmp.pxd +14 -0
  131. sage/libs/pari/convert_gmp.pyx +210 -0
  132. sage/libs/pari/convert_sage.cpython-314-x86_64-linux-musl.so +0 -0
  133. sage/libs/pari/convert_sage.pxd +16 -0
  134. sage/libs/pari/convert_sage.pyx +588 -0
  135. sage/libs/pari/convert_sage_complex_double.cpython-314-x86_64-linux-musl.so +0 -0
  136. sage/libs/pari/convert_sage_complex_double.pxd +14 -0
  137. sage/libs/pari/convert_sage_complex_double.pyx +132 -0
  138. sage/libs/pari/convert_sage_matrix.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/libs/pari/convert_sage_matrix.pyx +106 -0
  140. sage/libs/pari/convert_sage_real_double.cpython-314-x86_64-linux-musl.so +0 -0
  141. sage/libs/pari/convert_sage_real_double.pxd +5 -0
  142. sage/libs/pari/convert_sage_real_double.pyx +14 -0
  143. sage/libs/pari/convert_sage_real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
  144. sage/libs/pari/convert_sage_real_mpfr.pxd +7 -0
  145. sage/libs/pari/convert_sage_real_mpfr.pyx +108 -0
  146. sage/libs/pari/misc.cpython-314-x86_64-linux-musl.so +0 -0
  147. sage/libs/pari/misc.pxd +4 -0
  148. sage/libs/pari/misc.pyx +26 -0
  149. sage/libs/pari/tests.py +1848 -0
  150. sage/matrix/all__sagemath_pari.py +1 -0
  151. sage/matrix/matrix_integer_pari.cpython-314-x86_64-linux-musl.so +0 -0
  152. sage/matrix/matrix_integer_pari.pyx +187 -0
  153. sage/matrix/matrix_rational_pari.cpython-314-x86_64-linux-musl.so +0 -0
  154. sage/matrix/matrix_rational_pari.pyx +160 -0
  155. sage/quadratic_forms/all__sagemath_pari.py +10 -0
  156. sage/quadratic_forms/genera/all.py +9 -0
  157. sage/quadratic_forms/genera/genus.py +3506 -0
  158. sage/quadratic_forms/genera/normal_form.py +1519 -0
  159. sage/quadratic_forms/genera/spinor_genus.py +243 -0
  160. sage/quadratic_forms/qfsolve.py +255 -0
  161. sage/quadratic_forms/quadratic_form__automorphisms.py +427 -0
  162. sage/quadratic_forms/quadratic_form__genus.py +141 -0
  163. sage/quadratic_forms/quadratic_form__local_density_interfaces.py +140 -0
  164. sage/quadratic_forms/quadratic_form__local_normal_form.py +421 -0
  165. sage/quadratic_forms/quadratic_form__local_representation_conditions.py +889 -0
  166. sage/quadratic_forms/quadratic_form__mass.py +69 -0
  167. sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +663 -0
  168. sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +373 -0
  169. sage/quadratic_forms/quadratic_form__siegel_product.py +198 -0
  170. sage/quadratic_forms/special_values.py +323 -0
  171. sage/rings/all__sagemath_pari.py +15 -0
  172. sage/rings/factorint_pari.cpython-314-x86_64-linux-musl.so +0 -0
  173. sage/rings/factorint_pari.pyx +80 -0
  174. sage/rings/finite_rings/all__sagemath_pari.py +1 -0
  175. sage/rings/finite_rings/element_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  176. sage/rings/finite_rings/element_givaro.pxd +91 -0
  177. sage/rings/finite_rings/element_givaro.pyx +1769 -0
  178. sage/rings/finite_rings/element_ntl_gf2e.cpython-314-x86_64-linux-musl.so +0 -0
  179. sage/rings/finite_rings/element_ntl_gf2e.pxd +22 -0
  180. sage/rings/finite_rings/element_ntl_gf2e.pyx +1333 -0
  181. sage/rings/finite_rings/element_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  182. sage/rings/finite_rings/element_pari_ffelt.pxd +13 -0
  183. sage/rings/finite_rings/element_pari_ffelt.pyx +1441 -0
  184. sage/rings/finite_rings/finite_field_givaro.py +612 -0
  185. sage/rings/finite_rings/finite_field_pari_ffelt.py +238 -0
  186. sage/rings/finite_rings/hom_finite_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  187. sage/rings/finite_rings/hom_finite_field_givaro.pxd +28 -0
  188. sage/rings/finite_rings/hom_finite_field_givaro.pyx +280 -0
  189. sage/rings/finite_rings/residue_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  190. sage/rings/finite_rings/residue_field_givaro.pyx +133 -0
  191. sage/rings/finite_rings/residue_field_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  192. sage/rings/finite_rings/residue_field_pari_ffelt.pyx +128 -0
  193. sage/rings/function_field/all__sagemath_pari.py +1 -0
  194. sage/rings/function_field/valuation.py +1450 -0
  195. sage/rings/function_field/valuation_ring.py +212 -0
  196. sage/rings/number_field/all__sagemath_pari.py +14 -0
  197. sage/rings/number_field/totallyreal.cpython-314-x86_64-linux-musl.so +0 -0
  198. sage/rings/number_field/totallyreal.pyx +509 -0
  199. sage/rings/number_field/totallyreal_data.cpython-314-x86_64-linux-musl.so +0 -0
  200. sage/rings/number_field/totallyreal_data.pxd +26 -0
  201. sage/rings/number_field/totallyreal_data.pyx +928 -0
  202. sage/rings/number_field/totallyreal_phc.py +144 -0
  203. sage/rings/number_field/totallyreal_rel.py +1018 -0
  204. sage/rings/padics/CA_template.pxi +1847 -0
  205. sage/rings/padics/CA_template_header.pxi +50 -0
  206. sage/rings/padics/CR_template.pxi +2563 -0
  207. sage/rings/padics/CR_template_header.pxi +57 -0
  208. sage/rings/padics/FM_template.pxi +1575 -0
  209. sage/rings/padics/FM_template_header.pxi +50 -0
  210. sage/rings/padics/FP_template.pxi +2176 -0
  211. sage/rings/padics/FP_template_header.pxi +57 -0
  212. sage/rings/padics/all.py +3 -0
  213. sage/rings/padics/all__sagemath_pari.py +11 -0
  214. sage/rings/padics/common_conversion.cpython-314-x86_64-linux-musl.so +0 -0
  215. sage/rings/padics/common_conversion.pxd +15 -0
  216. sage/rings/padics/common_conversion.pyx +508 -0
  217. sage/rings/padics/eisenstein_extension_generic.py +232 -0
  218. sage/rings/padics/factory.py +3623 -0
  219. sage/rings/padics/generic_nodes.py +1615 -0
  220. sage/rings/padics/lattice_precision.py +2889 -0
  221. sage/rings/padics/morphism.cpython-314-x86_64-linux-musl.so +0 -0
  222. sage/rings/padics/morphism.pxd +11 -0
  223. sage/rings/padics/morphism.pyx +366 -0
  224. sage/rings/padics/padic_base_generic.py +467 -0
  225. sage/rings/padics/padic_base_leaves.py +1235 -0
  226. sage/rings/padics/padic_capped_absolute_element.cpython-314-x86_64-linux-musl.so +0 -0
  227. sage/rings/padics/padic_capped_absolute_element.pxd +15 -0
  228. sage/rings/padics/padic_capped_absolute_element.pyx +520 -0
  229. sage/rings/padics/padic_capped_relative_element.cpython-314-x86_64-linux-musl.so +0 -0
  230. sage/rings/padics/padic_capped_relative_element.pxd +14 -0
  231. sage/rings/padics/padic_capped_relative_element.pyx +614 -0
  232. sage/rings/padics/padic_extension_generic.py +990 -0
  233. sage/rings/padics/padic_extension_leaves.py +738 -0
  234. sage/rings/padics/padic_fixed_mod_element.cpython-314-x86_64-linux-musl.so +0 -0
  235. sage/rings/padics/padic_fixed_mod_element.pxd +15 -0
  236. sage/rings/padics/padic_fixed_mod_element.pyx +584 -0
  237. sage/rings/padics/padic_floating_point_element.cpython-314-x86_64-linux-musl.so +0 -0
  238. sage/rings/padics/padic_floating_point_element.pxd +14 -0
  239. sage/rings/padics/padic_floating_point_element.pyx +447 -0
  240. sage/rings/padics/padic_generic_element.cpython-314-x86_64-linux-musl.so +0 -0
  241. sage/rings/padics/padic_generic_element.pxd +48 -0
  242. sage/rings/padics/padic_generic_element.pyx +4642 -0
  243. sage/rings/padics/padic_lattice_element.py +1342 -0
  244. sage/rings/padics/padic_printing.cpython-314-x86_64-linux-musl.so +0 -0
  245. sage/rings/padics/padic_printing.pxd +38 -0
  246. sage/rings/padics/padic_printing.pyx +1505 -0
  247. sage/rings/padics/padic_relaxed_element.cpython-314-x86_64-linux-musl.so +0 -0
  248. sage/rings/padics/padic_relaxed_element.pxd +56 -0
  249. sage/rings/padics/padic_relaxed_element.pyx +18 -0
  250. sage/rings/padics/padic_relaxed_errors.cpython-314-x86_64-linux-musl.so +0 -0
  251. sage/rings/padics/padic_relaxed_errors.pxd +11 -0
  252. sage/rings/padics/padic_relaxed_errors.pyx +71 -0
  253. sage/rings/padics/padic_template_element.pxi +1212 -0
  254. sage/rings/padics/padic_template_element_header.pxi +50 -0
  255. sage/rings/padics/padic_valuation.py +1423 -0
  256. sage/rings/padics/pow_computer_flint.cpython-314-x86_64-linux-musl.so +0 -0
  257. sage/rings/padics/pow_computer_flint.pxd +38 -0
  258. sage/rings/padics/pow_computer_flint.pyx +641 -0
  259. sage/rings/padics/pow_computer_relative.cpython-314-x86_64-linux-musl.so +0 -0
  260. sage/rings/padics/pow_computer_relative.pxd +29 -0
  261. sage/rings/padics/pow_computer_relative.pyx +415 -0
  262. sage/rings/padics/qadic_flint_CA.cpython-314-x86_64-linux-musl.so +0 -0
  263. sage/rings/padics/qadic_flint_CA.pxd +21 -0
  264. sage/rings/padics/qadic_flint_CA.pyx +130 -0
  265. sage/rings/padics/qadic_flint_CR.cpython-314-x86_64-linux-musl.so +0 -0
  266. sage/rings/padics/qadic_flint_CR.pxd +13 -0
  267. sage/rings/padics/qadic_flint_CR.pyx +172 -0
  268. sage/rings/padics/qadic_flint_FM.cpython-314-x86_64-linux-musl.so +0 -0
  269. sage/rings/padics/qadic_flint_FM.pxd +14 -0
  270. sage/rings/padics/qadic_flint_FM.pyx +111 -0
  271. sage/rings/padics/qadic_flint_FP.cpython-314-x86_64-linux-musl.so +0 -0
  272. sage/rings/padics/qadic_flint_FP.pxd +12 -0
  273. sage/rings/padics/qadic_flint_FP.pyx +165 -0
  274. sage/rings/padics/relative_extension_leaves.py +429 -0
  275. sage/rings/padics/relative_ramified_CA.cpython-314-x86_64-linux-musl.so +0 -0
  276. sage/rings/padics/relative_ramified_CA.pxd +9 -0
  277. sage/rings/padics/relative_ramified_CA.pyx +33 -0
  278. sage/rings/padics/relative_ramified_CR.cpython-314-x86_64-linux-musl.so +0 -0
  279. sage/rings/padics/relative_ramified_CR.pxd +8 -0
  280. sage/rings/padics/relative_ramified_CR.pyx +33 -0
  281. sage/rings/padics/relative_ramified_FM.cpython-314-x86_64-linux-musl.so +0 -0
  282. sage/rings/padics/relative_ramified_FM.pxd +9 -0
  283. sage/rings/padics/relative_ramified_FM.pyx +33 -0
  284. sage/rings/padics/relative_ramified_FP.cpython-314-x86_64-linux-musl.so +0 -0
  285. sage/rings/padics/relative_ramified_FP.pxd +8 -0
  286. sage/rings/padics/relative_ramified_FP.pyx +33 -0
  287. sage/rings/padics/relaxed_template.pxi +4229 -0
  288. sage/rings/padics/relaxed_template_header.pxi +160 -0
  289. sage/rings/padics/tests.py +35 -0
  290. sage/rings/padics/tutorial.py +341 -0
  291. sage/rings/padics/unramified_extension_generic.py +335 -0
  292. sage/rings/padics/witt_vector.py +917 -0
  293. sage/rings/padics/witt_vector_ring.py +934 -0
  294. sage/rings/pari_ring.py +235 -0
  295. sage/rings/polynomial/all__sagemath_pari.py +1 -0
  296. sage/rings/polynomial/padics/all.py +1 -0
  297. sage/rings/polynomial/padics/polynomial_padic.py +360 -0
  298. sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +1324 -0
  299. sage/rings/polynomial/padics/polynomial_padic_flat.py +72 -0
  300. sage/rings/power_series_pari.cpython-314-x86_64-linux-musl.so +0 -0
  301. sage/rings/power_series_pari.pxd +6 -0
  302. sage/rings/power_series_pari.pyx +934 -0
  303. sage/rings/tate_algebra.py +1282 -0
  304. sage/rings/tate_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  305. sage/rings/tate_algebra_element.pxd +49 -0
  306. sage/rings/tate_algebra_element.pyx +3464 -0
  307. sage/rings/tate_algebra_ideal.cpython-314-x86_64-linux-musl.so +0 -0
  308. sage/rings/tate_algebra_ideal.pxd +7 -0
  309. sage/rings/tate_algebra_ideal.pyx +1307 -0
  310. sage/rings/valuation/all.py +7 -0
  311. sage/rings/valuation/augmented_valuation.py +2118 -0
  312. sage/rings/valuation/developing_valuation.py +362 -0
  313. sage/rings/valuation/gauss_valuation.py +812 -0
  314. sage/rings/valuation/inductive_valuation.py +1686 -0
  315. sage/rings/valuation/limit_valuation.py +946 -0
  316. sage/rings/valuation/mapped_valuation.py +656 -0
  317. sage/rings/valuation/scaled_valuation.py +322 -0
  318. sage/rings/valuation/trivial_valuation.py +382 -0
  319. sage/rings/valuation/valuation.py +1119 -0
  320. sage/rings/valuation/valuation_space.py +1615 -0
  321. sage/rings/valuation/valuations_catalog.py +10 -0
  322. sage/rings/valuation/value_group.py +697 -0
  323. sage/schemes/all__sagemath_pari.py +1 -0
  324. sage/schemes/elliptic_curves/all__sagemath_pari.py +1 -0
  325. sage/schemes/elliptic_curves/descent_two_isogeny_pari.cpython-314-x86_64-linux-musl.so +0 -0
  326. sage/schemes/elliptic_curves/descent_two_isogeny_pari.pyx +46 -0
  327. sage_wheels/bin/gp +0 -0
  328. sage_wheels/bin/gp2c +0 -0
  329. sage_wheels/bin/gp2c-run +57 -0
  330. sage_wheels/bin/xeus-gp +0 -0
  331. sage_wheels/share/gp2c/func.dsc +18414 -0
@@ -0,0 +1,889 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ # sage.doctest: needs sage.libs.pari sage.rings.number_field
3
+ """
4
+ Local Representation Conditions
5
+ """
6
+ ########################################################################
7
+ # Class for keeping track of the local conditions for representability #
8
+ # of numbers by a quadratic form over ZZ (and eventually QQ also). #
9
+ ########################################################################
10
+ from __future__ import annotations
11
+ from copy import deepcopy
12
+
13
+ from sage.arith.misc import is_square, prime_divisors, valuation
14
+ from sage.misc.functional import numerator, denominator
15
+ from sage.quadratic_forms.extras import least_quadratic_nonresidue
16
+ from sage.rings.infinity import infinity
17
+ from sage.rings.integer_ring import ZZ
18
+ from sage.rings.rational_field import QQ
19
+
20
+
21
+ class QuadraticFormLocalRepresentationConditions:
22
+ """
23
+ A class for dealing with the local conditions of a
24
+ quadratic form, and checking local representability of numbers.
25
+
26
+ EXAMPLES::
27
+
28
+ sage: Q4 = DiagonalQuadraticForm(ZZ, [1,1,1,1])
29
+ sage: Q4.local_representation_conditions()
30
+ This form represents the p-adic integers Z_p for all primes p except
31
+ []. For these and the reals, we have:
32
+ Reals: [0, +Infinity]
33
+ sage: Q4.is_locally_represented_number(1)
34
+ True
35
+ sage: Q4.is_locally_universal_at_all_primes()
36
+ True
37
+ sage: Q4.is_locally_universal_at_all_places()
38
+ False
39
+ sage: L = [m for m in range(-5, 100) if Q4.is_locally_represented_number(m)]
40
+ sage: L == list(range(100))
41
+ True
42
+
43
+ ::
44
+
45
+ sage: Q3 = DiagonalQuadraticForm(ZZ, [1,1,1])
46
+ sage: Q3.local_representation_conditions()
47
+ This form represents the p-adic integers Z_p for all primes p except
48
+ [2]. For these and the reals, we have:
49
+ Reals: [0, +Infinity]
50
+ p = 2: [0, 0, 0, +Infinity, 0, 0, 0, 0]
51
+ sage: E = [m for m in range(100) if not Q3.is_locally_represented_number(m)]
52
+ sage: E1 = [m for m in range(1,100) if m / 2**(2 * (valuation(m,2) // 2)) % 8 == 7]
53
+ sage: E == E1
54
+ True
55
+ sage: E
56
+ [7, 15, 23, 28, 31, 39, 47, 55, 60, 63, 71, 79, 87, 92, 95]
57
+
58
+ ::
59
+
60
+ sage: Q2 = DiagonalQuadraticForm(ZZ, [1,1])
61
+ sage: Q2.local_representation_conditions()
62
+ This 2-dimensional form represents the p-adic integers of even
63
+ valuation for all primes p except [2].
64
+ For these and the reals, we have:
65
+ Reals: [0, +Infinity]
66
+ p = 2: [0, +Infinity, 0, +Infinity, 0, +Infinity, 0, +Infinity]
67
+ sage: Q2.is_locally_universal_at_all_places()
68
+ False
69
+ sage: Q2.is_locally_universal_at_all_primes()
70
+ False
71
+ sage: L = [m for m in range(-5, 25) if Q2.is_locally_represented_number(m)]
72
+ sage: L1 = [0] + [m for m in range(1, 25)
73
+ ....: if len([p for p in prime_factors(squarefree_part(ZZ(m)))
74
+ ....: if (p % 4) == 3]) % 2 == 0]
75
+ sage: L == L1
76
+ True
77
+ sage: L
78
+ [0, 1, 2, 4, 5, 8, 9, 10, 13, 16, 17, 18, 20, 21]
79
+
80
+ ::
81
+
82
+ sage: Q1 = DiagonalQuadraticForm(ZZ, [1])
83
+ sage: Q1.local_representation_conditions()
84
+ This 1-dimensional form only represents square multiples of 1.
85
+ sage: L = [m for m in range(100) if Q1.is_locally_represented_number(m)]
86
+ sage: L
87
+ [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
88
+
89
+ ::
90
+
91
+ sage: Q0 = DiagonalQuadraticForm(ZZ, [])
92
+ sage: Q0.local_representation_conditions()
93
+ This 0-dimensional form only represents zero.
94
+ sage: L = [m for m in range(100) if Q0.is_locally_represented_number(m)]
95
+ sage: L
96
+ [0]
97
+ """
98
+ def __init__(self, Q):
99
+ r"""
100
+ Take a :class:`QuadraticForm` and computes its local conditions (if
101
+ they do not already exist). The ``recompute_flag`` overrides the
102
+ previously computed conditions if they exist, and stores the
103
+ new conditions.
104
+
105
+ INPUT:
106
+
107
+ - ``Q`` -- Quadratic form over `\ZZ`
108
+
109
+ OUTPUT: a :class:`QuadraticFormLocalRepresentationConditions` object
110
+
111
+ EXAMPLES::
112
+
113
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1])
114
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
115
+ sage: QuadraticFormLocalRepresentationConditions(Q)
116
+ This form represents the p-adic integers Z_p for all primes p except
117
+ []. For these and the reals, we have:
118
+ Reals: [0, +Infinity]
119
+ """
120
+ # Check that the form Q is integer-valued (we can relax this later)
121
+ if Q.base_ring() != ZZ:
122
+ raise TypeError("We require that the quadratic form be defined over ZZ (integer-values) for now.")
123
+
124
+ # Basic structure initialization
125
+ self.local_repn_array = [] # List of all local conditions
126
+ self.dim = Q.dim() # We allow this to be any nonnegative integer.
127
+ self.exceptional_primes = [infinity]
128
+
129
+ # Deal with the special cases of 0 and 1-dimensional forms
130
+ if self.dim == 0:
131
+ self.coeff = None
132
+ return
133
+ if self.dim == 1:
134
+ self.coeff = Q[0, 0]
135
+ return
136
+
137
+ self.coeff = None
138
+
139
+ # Compute the local conditions at the real numbers (i.e. "p = infinity")
140
+ # ----------------------------------------------------------------------
141
+ M = Q.matrix()
142
+ E = M.eigenspaces_left()
143
+ M_eigenvalues = [E[i][0] for i in range(len(E))]
144
+
145
+ pos_flag = infinity
146
+ neg_flag = infinity
147
+
148
+ for e in M_eigenvalues:
149
+ if e > 0:
150
+ pos_flag = 0
151
+ elif e < 0:
152
+ neg_flag = 0
153
+
154
+ real_vec = [infinity, pos_flag, neg_flag, None, None, None, None, None, None]
155
+ self.local_repn_array.append(real_vec)
156
+
157
+ # Compute the local conditions for representability:
158
+ # --------------------------------------------------
159
+ N = Q.level()
160
+ level_primes = prime_divisors(N)
161
+
162
+ # Make a table of local normal forms for each p | N
163
+ local_normal_forms = [Q.local_normal_form(p) for p in level_primes]
164
+
165
+ # Check local representability conditions for each prime
166
+ for i, p in enumerate(level_primes):
167
+ tmp_local_repn_vec = [p, None, None, None, None, None, None, None, None]
168
+ sqclass = self.squareclass_vector(p)
169
+
170
+ # Check the representability in each Z_p squareclass
171
+ for j, m in enumerate(sqclass):
172
+ k = 0
173
+ repn_flag = False
174
+
175
+ while ((not repn_flag) and (m < 4 * N * p * p)):
176
+ if local_normal_forms[i].local_density(p, m) > 0:
177
+ tmp_local_repn_vec[j + 1] = k
178
+ repn_flag = True
179
+ k = k + 1
180
+ m = m * p * p
181
+
182
+ # If we're not represented, write "infinity" to signify
183
+ # that this squareclass is fully obstructed
184
+ if not repn_flag:
185
+ tmp_local_repn_vec[j + 1] = infinity
186
+
187
+ # Test if the conditions at p give exactly Z_p when dim >=3, or
188
+ # if we represent the elements of even valuation >= 2 when dim = 2.
189
+ omit_flag = True
190
+ if self.dim >= 2:
191
+ # Check that all entries are zero or 'None'
192
+ for x in tmp_local_repn_vec[1:]:
193
+ if not ((x == 0) or (x is None)):
194
+ omit_flag = False
195
+
196
+ # Add the results for this prime if there is a congruence obstruction
197
+ if not omit_flag:
198
+ self.local_repn_array.append(tmp_local_repn_vec)
199
+ self.exceptional_primes.append(p)
200
+
201
+ def __repr__(self) -> str:
202
+ r"""
203
+ Print the local conditions.
204
+
205
+ OUTPUT: string
206
+
207
+ .. TODO::
208
+
209
+ Improve the output for the real numbers, and special output for locally universality.
210
+ Also give names to the squareclasses, so it's clear what the output means! =)
211
+
212
+ EXAMPLES::
213
+
214
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1])
215
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
216
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
217
+ sage: C.__repr__()
218
+ 'This 2-dimensional form represents the p-adic integers of even\nvaluation for all primes p except [2].\nFor these and the reals, we have:\n Reals: [0, +Infinity]\n p = 2: [0, +Infinity, 0, +Infinity, 0, +Infinity, 0, +Infinity]\n'
219
+ """
220
+ if self.dim == 0:
221
+ out_str = "This 0-dimensional form only represents zero."
222
+ elif self.dim == 1:
223
+ out_str = "This 1-dimensional form only represents square multiples of " + str(self.coeff) + "."
224
+ elif self.dim == 2:
225
+ out_str = "This 2-dimensional form represents the p-adic integers of even\n"
226
+ out_str += "valuation for all primes p except " + str(self.exceptional_primes[1:]) + ".\n"
227
+ out_str += "For these and the reals, we have:\n"
228
+ else:
229
+ out_str = "This form represents the p-adic integers Z_p for all primes p except \n"
230
+ out_str += str(self.exceptional_primes[1:]) + ". For these and the reals, we have:\n"
231
+
232
+ for v in self.local_repn_array:
233
+ if v[0] == infinity:
234
+ out_str += " " + "Reals: " + str(v[1:3]) + "\n"
235
+ elif v[0] == 2:
236
+ out_str += " " + "p = 2: " + str(v[1:]) + "\n"
237
+ else:
238
+ out_str += " " + "p = " + str(v[0]) + ": " + str(v[1:5]) + "\n"
239
+
240
+ return out_str
241
+
242
+ def __eq__(self, right) -> bool:
243
+ """
244
+ Determine if two sets of local conditions are equal.
245
+
246
+ INPUT:
247
+
248
+ - ``right`` -- a QuadraticFormLocalRepresentationConditions object
249
+
250
+ OUTPUT: boolean
251
+
252
+ EXAMPLES::
253
+
254
+ sage: Q1 = DiagonalQuadraticForm(ZZ, [1,1])
255
+ sage: Q2 = DiagonalQuadraticForm(ZZ, [1,1,1])
256
+ sage: Q3 = DiagonalQuadraticForm(ZZ, [1,3,5,7])
257
+ sage: Q4 = DiagonalQuadraticForm(ZZ, [1,1,1,1])
258
+
259
+ sage: Q1.local_representation_conditions() == Q2.local_representation_conditions()
260
+ False
261
+ sage: Q1.local_representation_conditions() == Q3.local_representation_conditions()
262
+ False
263
+ sage: Q1.local_representation_conditions() == Q4.local_representation_conditions()
264
+ False
265
+ sage: Q2.local_representation_conditions() == Q3.local_representation_conditions()
266
+ False
267
+ sage: Q3.local_representation_conditions() == Q4.local_representation_conditions()
268
+ True
269
+ """
270
+ if not isinstance(right, QuadraticFormLocalRepresentationConditions):
271
+ return False
272
+
273
+ # Check the dimensions agree when they affect the kind of representation conditions.
274
+ if ((self.dim <= 2) or (right.dim <= 2)) and self.dim != right.dim:
275
+ return False
276
+
277
+ # Check equality by dimension
278
+ if self.dim == 0:
279
+ return True
280
+ if self.dim == 1:
281
+ return self.coeff == right.coeff # Compare coefficients in dimension 1 (since ZZ has only one unit square)
282
+ return ((self.exceptional_primes == right.exceptional_primes)
283
+ and (self.local_repn_array == right.local_repn_array))
284
+
285
+ def squareclass_vector(self, p) -> list:
286
+ """
287
+ Return a list of integers which are normalized
288
+ representatives for the `p`-adic rational squareclasses
289
+ (or the real squareclasses) at the prime `p`.
290
+
291
+ INPUT:
292
+
293
+ - ``p`` -- a positive prime number or "infinity"
294
+
295
+ OUTPUT: list of integers
296
+
297
+ EXAMPLES::
298
+
299
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
300
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
301
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
302
+ sage: C.squareclass_vector(5)
303
+ [1, 2, 5, 10]
304
+ """
305
+ if p == infinity:
306
+ return [1, -1]
307
+ if p == 2:
308
+ return [1, 3, 5, 7, 2, 6, 10, 14]
309
+ r = least_quadratic_nonresidue(p)
310
+ return [1, r, p, p * r]
311
+
312
+ def local_conditions_vector_for_prime(self, p) -> list:
313
+ """
314
+ Return a local representation vector for the (possibly infinite) prime `p`.
315
+
316
+ INPUT:
317
+
318
+ - ``p`` -- a positive prime number. (Is 'infinity' allowed here?)
319
+
320
+ OUTPUT: list of integers
321
+
322
+ EXAMPLES::
323
+
324
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
325
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
326
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
327
+ sage: C.local_conditions_vector_for_prime(2)
328
+ [2, 0, 0, 0, +Infinity, 0, 0, 0, 0]
329
+ sage: C.local_conditions_vector_for_prime(3)
330
+ [3, 0, 0, 0, 0, None, None, None, None]
331
+ """
332
+ # Check if p is non-generic
333
+ if p in self.exceptional_primes:
334
+ return deepcopy(self.local_repn_array[self.exceptional_primes.index(p)])
335
+
336
+ # Otherwise, generate a vector at this (finite) prime
337
+ if self.dim >= 3:
338
+ if p == 2:
339
+ return [2, 0, 0, 0, 0, 0, 0, 0, 0]
340
+ else:
341
+ return [p, 0, 0, 0, 0, None, None, None, None]
342
+
343
+ elif self.dim == 2:
344
+ if p == 2:
345
+ return [2, 0, 0, 0, 0, infinity, infinity, infinity, infinity]
346
+ else:
347
+ return [p, 0, 0, infinity, infinity, None, None, None, None]
348
+
349
+ elif self.dim == 1:
350
+ v = [p, None, None, None, None, None, None, None, None]
351
+ sqclass = self.squareclass_vector(p)
352
+
353
+ for i, sqi in enumerate(sqclass):
354
+ if QQ(self.coeff / sqi).is_padic_square(p): # Note:This should happen only once!
355
+ nu = valuation(self.coeff / sqi, p) / 2 # UNUSED VARIABLE !
356
+ else:
357
+ v[i + 1] = infinity
358
+
359
+ elif self.dim == 0:
360
+ if p == 2:
361
+ return [2, infinity, infinity, infinity, infinity, infinity, infinity, infinity, infinity]
362
+ return [p, infinity, infinity, infinity, infinity, None, None, None, None]
363
+
364
+ raise RuntimeError("the stored dimension should be a nonnegative integer")
365
+
366
+ def is_universal_at_prime(self, p) -> bool:
367
+ r"""
368
+ Determine if the (integer-valued/rational) quadratic form represents all of `\ZZ_p`.
369
+
370
+ INPUT:
371
+
372
+ - ``p`` -- a positive prime number or "infinity"
373
+
374
+ OUTPUT: boolean
375
+
376
+ EXAMPLES::
377
+
378
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
379
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
380
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
381
+ sage: C.is_universal_at_prime(2)
382
+ False
383
+ sage: C.is_universal_at_prime(3)
384
+ True
385
+ sage: C.is_universal_at_prime(infinity)
386
+ False
387
+ """
388
+ # Check if the prime behaves generically for n >= 3.
389
+ if self.dim >= 3 and p not in self.exceptional_primes:
390
+ return True
391
+
392
+ # Check if the prime behaves generically for n <= 2.
393
+ if self.dim <= 2 and p not in self.exceptional_primes:
394
+ return False
395
+
396
+ # Check if the prime is "infinity" (for the reals)
397
+ if p == infinity:
398
+ v = self.local_repn_array[0]
399
+ if p != v[0]:
400
+ raise RuntimeError("Error... The first vector should be for the real numbers!")
401
+ return (v[1:3] == [0, 0]) # True iff the form is indefinite
402
+
403
+ # Check non-generic "finite" primes
404
+ v = self.local_conditions_vector_for_prime(p)
405
+ Zp_univ_flag = True
406
+ for nu in v[1:]:
407
+ if (nu is not None) and ((nu != 0) or (nu == infinity)):
408
+ Zp_univ_flag = False
409
+ return Zp_univ_flag
410
+
411
+ def is_universal_at_all_finite_primes(self) -> bool:
412
+ r"""
413
+ Determine if the quadratic form represents `\ZZ_p` for all finite/non-archimedean primes.
414
+
415
+ OUTPUT: boolean
416
+
417
+ EXAMPLES::
418
+
419
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
420
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
421
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
422
+ sage: C.is_universal_at_all_finite_primes()
423
+ False
424
+
425
+ ::
426
+
427
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1])
428
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
429
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
430
+ sage: C.is_universal_at_all_finite_primes()
431
+ True
432
+ """
433
+ # Check if dim <= 2.
434
+ if self.dim <= 2:
435
+ return False
436
+
437
+ # Check that all non-generic finite primes are universal
438
+ # Omit p = "infinity" here
439
+ return all(self.is_universal_at_prime(p)
440
+ for p in self.exceptional_primes[1:])
441
+
442
+ def is_universal_at_all_places(self) -> bool:
443
+ r"""
444
+ Determine if the quadratic form represents `\ZZ_p` for all
445
+ finite/non-archimedean primes, and represents all real numbers.
446
+
447
+ OUTPUT: boolean
448
+
449
+ EXAMPLES::
450
+
451
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
452
+
453
+ ::
454
+
455
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
456
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
457
+ sage: C.is_universal_at_all_places()
458
+ False
459
+
460
+ ::
461
+
462
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1])
463
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
464
+ sage: C.is_universal_at_all_places()
465
+ False
466
+
467
+ ::
468
+
469
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1,-1])
470
+ sage: C = QuadraticFormLocalRepresentationConditions(Q) # long time (8.5 s)
471
+ sage: C.is_universal_at_all_places() # long time
472
+ True
473
+ """
474
+ # Check if dim <= 2.
475
+ if self.dim <= 2:
476
+ return False
477
+
478
+ # Check that all non-generic finite primes are universal
479
+ return all(self.is_universal_at_prime(p)
480
+ for p in self.exceptional_primes)
481
+
482
+ def is_locally_represented_at_place(self, m, p) -> bool:
483
+ """
484
+ Determine if the rational number `m` is locally represented by the
485
+ quadratic form at the (possibly infinite) prime `p`.
486
+
487
+ INPUT:
488
+
489
+ - ``m`` -- integer
490
+
491
+ - ``p`` -- a positive prime number or "infinity"
492
+
493
+ OUTPUT: boolean
494
+
495
+ EXAMPLES::
496
+
497
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
498
+
499
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
500
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
501
+ sage: C.is_locally_represented_at_place(7, 2)
502
+ False
503
+ sage: C.is_locally_represented_at_place(1, 3)
504
+ True
505
+ sage: C.is_locally_represented_at_place(-1, infinity)
506
+ False
507
+ sage: C.is_locally_represented_at_place(1, infinity)
508
+ True
509
+ sage: C.is_locally_represented_at_place(0, infinity)
510
+ True
511
+ """
512
+ # Sanity Check
513
+ if m not in QQ:
514
+ raise TypeError(f"m = {m} is not a rational number")
515
+
516
+ # Representing zero
517
+ if m == 0:
518
+ return True
519
+
520
+ # 0-dim'l forms
521
+ if self.dim == 0: # Here m != 0
522
+ return False
523
+
524
+ # 1-dim'l forms
525
+ if self.dim == 1:
526
+ m1 = QQ(m) / self.coeff
527
+ if p == infinity:
528
+ return m1 > 0
529
+ return (valuation(m1, p) >= 0) and m1.is_padic_square(p)
530
+
531
+ # >= 2-dim'l forms
532
+ local_vec = self.local_conditions_vector_for_prime(p)
533
+
534
+ # Check the real place
535
+ if p == infinity:
536
+ if m > 0:
537
+ return local_vec[1] == 0
538
+ if m < 0:
539
+ return local_vec[2] == 0
540
+ # m == 0
541
+ return True
542
+
543
+ # Check at a finite place
544
+ sqclass = self.squareclass_vector(p)
545
+ for s in sqclass:
546
+ if (QQ(m) / s).is_padic_square(p):
547
+ nu = valuation(m // s, p)
548
+ return local_vec[sqclass.index(s) + 1] <= (nu / 2)
549
+
550
+ def is_locally_represented(self, m) -> bool:
551
+ r"""
552
+ Determine if the rational number `m` is locally represented by
553
+ the quadratic form (allowing vectors with coefficients in `\ZZ_p` at all
554
+ places).
555
+
556
+ INPUT:
557
+
558
+ - ``m`` -- integer
559
+
560
+ OUTPUT: boolean
561
+
562
+ EXAMPLES::
563
+
564
+ sage: from sage.quadratic_forms.quadratic_form__local_representation_conditions import QuadraticFormLocalRepresentationConditions
565
+
566
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
567
+ sage: C = QuadraticFormLocalRepresentationConditions(Q)
568
+ sage: C.is_locally_represented(7)
569
+ False
570
+ sage: C.is_locally_represented(28)
571
+ False
572
+ sage: C.is_locally_represented(11)
573
+ True
574
+ sage: C.is_locally_represented(QQ(1)/QQ(2))
575
+ False
576
+ """
577
+ # Representing zero
578
+ if m == 0:
579
+ return True
580
+
581
+ # 0-dim'l forms
582
+ if self.dim == 0: # Here m != 0
583
+ return False
584
+
585
+ # 1-dim'l forms
586
+ if self.dim == 1:
587
+ m1 = m / self.coeff
588
+ return (m1 in ZZ) and is_square(m1)
589
+
590
+ # Check the generic primes (when n = 2 or n >= 3)
591
+ m_primes = prime_divisors(numerator(m) * denominator(m))
592
+ for p in m_primes:
593
+ if p not in self.exceptional_primes:
594
+ val = valuation(m, p)
595
+ if val < 0:
596
+ return False
597
+
598
+ # Check the non-generic primes (when n = 2 or n >= 3)
599
+ for p in self.exceptional_primes:
600
+ if not self.is_locally_represented_at_place(m, p):
601
+ return False
602
+
603
+ # If we got here, we're locally represented!
604
+ return True
605
+
606
+ # --- End of QuadraticFormLocalRepresentationConditions Class ---
607
+
608
+
609
+ def local_representation_conditions(self, recompute_flag=False, silent_flag=False):
610
+ r"""
611
+ .. WARNING::
612
+
613
+ This only works correctly for forms in >=3 variables,
614
+ which are locally universal at almost all primes!
615
+
616
+ This class finds the local conditions for a number to be integrally
617
+ represented by an integer-valued quadratic form. These conditions
618
+ are stored in ``self.__local_representability_conditions`` and
619
+ consist of a list of 9 element vectors, with one for each prime
620
+ with a local obstruction (though only the first 5 are meaningful
621
+ unless `p=2`). The first element is always the prime `p` where the
622
+ local obstruction occurs, and the next 8 (or 4) entries represent
623
+ square-classes in the `p`-adic integers `\ZZ_p`, and are labeled by the
624
+ `\QQ_p` square-classes `t\cdot (\QQ_p)^2` with `t` given as follows:
625
+
626
+ - for `p > 2`, ``[ * 1 u p u p * * * * ]``,
627
+
628
+ - for `p = 2`, ``[ * 1 3 5 7 2 6 10 14 ]``.
629
+
630
+ The integer appearing in each place tells us how `p`-divisible a
631
+ number needs to be in that square-class in order to be locally
632
+ represented by `Q`. A negative number indicates that the entire `\QQ_p`
633
+ square-class is not represented, while a positive number `x` indicates
634
+ that `t\cdot p^{(2\cdot x)} (\ZZ_p)^2` is locally represented but `t\cdot p^{(2\cdot (x-1))}`
635
+ `(\ZZ_p)^2` is not.
636
+
637
+ As an example, the vector ``[2 3 0 0 0 0 2 0 infinity]``
638
+ tells us that all positive integers are locally represented at `p=2`
639
+ except those of the forms:
640
+
641
+ - `2^6\cdot u\cdot r^2` with `u = 1` (mod 8)
642
+
643
+ - `2^5\cdot u\cdot r^2` with `u = 3` (mod 8)
644
+
645
+ - `2\cdot u\cdot r^2` with `u = 7` (mod 8)
646
+
647
+ At the real numbers, the vector which looks like ``[infinity, 0, infinity, None, None, None, None, None, None]``
648
+ means that `Q` is negative definite (i.e., the 0 tells us all
649
+ positive reals are represented). The real vector always appears,
650
+ and is listed before the other ones.
651
+
652
+ OUTPUT:
653
+
654
+ A list of 9-element vectors describing the representation
655
+ obstructions at primes dividing the level.
656
+
657
+ EXAMPLES::
658
+
659
+ sage: Q = DiagonalQuadraticForm(ZZ, [])
660
+ sage: Q.local_representation_conditions()
661
+ This 0-dimensional form only represents zero.
662
+
663
+ sage: Q = DiagonalQuadraticForm(ZZ, [5])
664
+ sage: Q.local_representation_conditions()
665
+ This 1-dimensional form only represents square multiples of 5.
666
+
667
+ sage: Q1 = DiagonalQuadraticForm(ZZ, [1,1])
668
+ sage: Q1.local_representation_conditions()
669
+ This 2-dimensional form represents the p-adic integers of even
670
+ valuation for all primes p except [2].
671
+ For these and the reals, we have:
672
+ Reals: [0, +Infinity]
673
+ p = 2: [0, +Infinity, 0, +Infinity, 0, +Infinity, 0, +Infinity]
674
+
675
+ sage: Q1 = DiagonalQuadraticForm(ZZ, [1,1,1])
676
+ sage: Q1.local_representation_conditions()
677
+ This form represents the p-adic integers Z_p for all primes p except
678
+ [2]. For these and the reals, we have:
679
+ Reals: [0, +Infinity]
680
+ p = 2: [0, 0, 0, +Infinity, 0, 0, 0, 0]
681
+
682
+ sage: Q1 = DiagonalQuadraticForm(ZZ, [1,1,1,1])
683
+ sage: Q1.local_representation_conditions()
684
+ This form represents the p-adic integers Z_p for all primes p except
685
+ []. For these and the reals, we have:
686
+ Reals: [0, +Infinity]
687
+
688
+ sage: Q1 = DiagonalQuadraticForm(ZZ, [1,3,3,3])
689
+ sage: Q1.local_representation_conditions()
690
+ This form represents the p-adic integers Z_p for all primes p except
691
+ [3]. For these and the reals, we have:
692
+ Reals: [0, +Infinity]
693
+ p = 3: [0, 1, 0, 0]
694
+
695
+ sage: Q2 = DiagonalQuadraticForm(ZZ, [2,3,3,3])
696
+ sage: Q2.local_representation_conditions()
697
+ This form represents the p-adic integers Z_p for all primes p except
698
+ [3]. For these and the reals, we have:
699
+ Reals: [0, +Infinity]
700
+ p = 3: [1, 0, 0, 0]
701
+
702
+ sage: Q3 = DiagonalQuadraticForm(ZZ, [1,3,5,7])
703
+ sage: Q3.local_representation_conditions()
704
+ This form represents the p-adic integers Z_p for all primes p except
705
+ []. For these and the reals, we have:
706
+ Reals: [0, +Infinity]
707
+ """
708
+ # Recompute the local conditions if they do not exist or the recompute_flag is set.
709
+ if not hasattr(self, "__local_representability_conditions") or recompute_flag:
710
+ self.__local_representability_conditions = QuadraticFormLocalRepresentationConditions(self)
711
+
712
+ # Return the local conditions if the silent_flag is not set.
713
+ if not silent_flag:
714
+ return self.__local_representability_conditions
715
+
716
+
717
+ def is_locally_universal_at_prime(self, p) -> bool:
718
+ r"""
719
+ Determine if the (integer-valued/rational) quadratic form represents all of `\ZZ_p`.
720
+
721
+ INPUT:
722
+
723
+ - ``p`` -- a positive prime number or "infinity"
724
+
725
+ OUTPUT: boolean
726
+
727
+ EXAMPLES::
728
+
729
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7])
730
+ sage: Q.is_locally_universal_at_prime(2)
731
+ True
732
+ sage: Q.is_locally_universal_at_prime(3)
733
+ True
734
+ sage: Q.is_locally_universal_at_prime(5)
735
+ True
736
+ sage: Q.is_locally_universal_at_prime(infinity)
737
+ False
738
+
739
+ ::
740
+
741
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
742
+ sage: Q.is_locally_universal_at_prime(2)
743
+ False
744
+ sage: Q.is_locally_universal_at_prime(3)
745
+ True
746
+ sage: Q.is_locally_universal_at_prime(5)
747
+ True
748
+ sage: Q.is_locally_universal_at_prime(infinity)
749
+ False
750
+
751
+ ::
752
+
753
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,-1])
754
+ sage: Q.is_locally_universal_at_prime(infinity)
755
+ True
756
+ """
757
+ self.local_representation_conditions(silent_flag=True)
758
+ return self.__local_representability_conditions.is_universal_at_prime(p)
759
+
760
+
761
+ def is_locally_universal_at_all_primes(self) -> bool:
762
+ r"""
763
+ Determine if the quadratic form represents `\ZZ_p` for all finite/non-archimedean primes.
764
+
765
+ OUTPUT: boolean
766
+
767
+ EXAMPLES::
768
+
769
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7])
770
+ sage: Q.is_locally_universal_at_all_primes()
771
+ True
772
+
773
+ ::
774
+
775
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1])
776
+ sage: Q.is_locally_universal_at_all_primes()
777
+ True
778
+
779
+ ::
780
+
781
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
782
+ sage: Q.is_locally_universal_at_all_primes()
783
+ False
784
+ """
785
+ self.local_representation_conditions(silent_flag=True)
786
+ return self.__local_representability_conditions.is_universal_at_all_finite_primes()
787
+
788
+
789
+ def is_locally_universal_at_all_places(self) -> bool:
790
+ r"""
791
+ Determine if the quadratic form represents `\ZZ_p` for all
792
+ finite/non-archimedean primes, and represents all real numbers.
793
+
794
+ OUTPUT: boolean
795
+
796
+ EXAMPLES::
797
+
798
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,3,5,7])
799
+ sage: Q.is_locally_universal_at_all_places()
800
+ False
801
+
802
+ ::
803
+
804
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1])
805
+ sage: Q.is_locally_universal_at_all_places()
806
+ False
807
+
808
+ ::
809
+
810
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1,-1])
811
+ sage: Q.is_locally_universal_at_all_places() # long time (8.5 s)
812
+ True
813
+ """
814
+ self.local_representation_conditions(silent_flag=True)
815
+ return self.__local_representability_conditions.is_universal_at_all_places()
816
+
817
+
818
+ def is_locally_represented_number_at_place(self, m, p) -> bool:
819
+ """
820
+ Determine if the rational number `m` is locally represented by the
821
+ quadratic form at the (possibly infinite) prime `p`.
822
+
823
+ INPUT:
824
+
825
+ - ``m`` -- integer
826
+
827
+ - ``p`` -- a prime number > 0 or 'infinity'
828
+
829
+ OUTPUT: boolean
830
+
831
+ EXAMPLES::
832
+
833
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
834
+ sage: Q.is_locally_represented_number_at_place(7, infinity)
835
+ True
836
+ sage: Q.is_locally_represented_number_at_place(7, 2)
837
+ False
838
+ sage: Q.is_locally_represented_number_at_place(7, 3)
839
+ True
840
+ sage: Q.is_locally_represented_number_at_place(7, 5)
841
+ True
842
+ sage: Q.is_locally_represented_number_at_place(-1, infinity)
843
+ False
844
+ sage: Q.is_locally_represented_number_at_place(-1, 2)
845
+ False
846
+
847
+ ::
848
+
849
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1,1,-1])
850
+ sage: Q.is_locally_represented_number_at_place(7, infinity) # long time (8.5 s)
851
+ True
852
+ sage: Q.is_locally_represented_number_at_place(7, 2) # long time
853
+ True
854
+ sage: Q.is_locally_represented_number_at_place(7, 3) # long time
855
+ True
856
+ sage: Q.is_locally_represented_number_at_place(7, 5) # long time
857
+ True
858
+ """
859
+ self.local_representation_conditions(silent_flag=True)
860
+ return self.__local_representability_conditions.is_locally_represented_at_place(m, p)
861
+
862
+
863
+ def is_locally_represented_number(self, m) -> bool:
864
+ """
865
+ Determine if the rational number `m` is locally represented
866
+ by the quadratic form.
867
+
868
+ INPUT:
869
+
870
+ - ``m`` -- integer
871
+
872
+ OUTPUT: boolean
873
+
874
+ EXAMPLES::
875
+
876
+ sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
877
+ sage: Q.is_locally_represented_number(2)
878
+ True
879
+ sage: Q.is_locally_represented_number(7)
880
+ False
881
+ sage: Q.is_locally_represented_number(-1)
882
+ False
883
+ sage: Q.is_locally_represented_number(28)
884
+ False
885
+ sage: Q.is_locally_represented_number(0)
886
+ True
887
+ """
888
+ self.local_representation_conditions(silent_flag=True)
889
+ return self.__local_representability_conditions.is_locally_represented(m)