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.
- PARIKernel/__init__.py +2 -0
- PARIKernel/__main__.py +5 -0
- PARIKernel/io.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/io.pxd +7 -0
- PARIKernel/io.pyx +84 -0
- PARIKernel/kernel.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/kernel.pyx +260 -0
- PARIKernel/paridecl.pxd +95 -0
- PARIKernel/svg.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/svg.pyx +52 -0
- cypari2/__init__.py +8 -0
- cypari2/auto_paridecl.pxd +1070 -0
- cypari2/closure.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/closure.pxd +5 -0
- cypari2/closure.pyx +246 -0
- cypari2/convert.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/convert.pxd +80 -0
- cypari2/convert.pyx +613 -0
- cypari2/custom_block.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/custom_block.pyx +30 -0
- cypari2/cypari.h +13 -0
- cypari2/gen.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/gen.pxd +69 -0
- cypari2/gen.pyx +4819 -0
- cypari2/handle_error.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/handle_error.pxd +7 -0
- cypari2/handle_error.pyx +232 -0
- cypari2/pari_instance.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/pari_instance.pxd +27 -0
- cypari2/pari_instance.pyx +1438 -0
- cypari2/paridecl.pxd +5353 -0
- cypari2/paripriv.pxd +34 -0
- cypari2/pycore_long.h +98 -0
- cypari2/pycore_long.pxd +9 -0
- cypari2/stack.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/stack.pxd +27 -0
- cypari2/stack.pyx +278 -0
- cypari2/string_utils.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/string_utils.pxd +29 -0
- cypari2/string_utils.pyx +65 -0
- cypari2/types.pxd +147 -0
- passagemath_pari-10.6.32.data/data/etc/jupyter/nbconfig/notebook.d/gp-mode.json +5 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.js +28 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.json +6 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/logo-64x64.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/kernel.json +13 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-32x32.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-64x64.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-svg.svg +75 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/gp.js +284 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/main.js +15 -0
- passagemath_pari-10.6.32.dist-info/METADATA +209 -0
- passagemath_pari-10.6.32.dist-info/RECORD +331 -0
- passagemath_pari-10.6.32.dist-info/WHEEL +5 -0
- passagemath_pari-10.6.32.dist-info/top_level.txt +4 -0
- passagemath_pari.libs/libcrypto-f04afe95.so.3 +0 -0
- passagemath_pari.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
- passagemath_pari.libs/libgcc_s-0cd532bd.so.1 +0 -0
- passagemath_pari.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
- passagemath_pari.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
- passagemath_pari.libs/libgivaro-9a94c711.so.9.2.1 +0 -0
- passagemath_pari.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
- passagemath_pari.libs/libgmpxx-9e08595c.so.4.7.0 +0 -0
- passagemath_pari.libs/libgsl-42cda06f.so.28.0.0 +0 -0
- passagemath_pari.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
- passagemath_pari.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
- passagemath_pari.libs/libntl-26885ca2.so.44.0.1 +0 -0
- passagemath_pari.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
- passagemath_pari.libs/libpari-gmp-tls-f31f908f.so.2.17.2 +0 -0
- passagemath_pari.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
- passagemath_pari.libs/libreadline-06542304.so.8.2 +0 -0
- passagemath_pari.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
- passagemath_pari.libs/libuuid-f3770415.so.1.3.0 +0 -0
- passagemath_pari.libs/libxeus-735780ff.so.13.1.0 +0 -0
- passagemath_pari.libs/libxeus-zmq-c68577b4.so.6.0.1 +0 -0
- passagemath_pari.libs/libzmq-1ba9a3da.so.5.2.5 +0 -0
- sage/all__sagemath_pari.py +26 -0
- sage/databases/all__sagemath_pari.py +7 -0
- sage/databases/conway.py +274 -0
- sage/ext/all__sagemath_pari.py +1 -0
- sage/ext/memory.cpython-314-x86_64-linux-musl.so +0 -0
- sage/ext/memory.pyx +98 -0
- sage/ext_data/pari/buzzard/DimensionSk.g +286 -0
- sage/ext_data/pari/buzzard/Tpprog.g +179 -0
- sage/ext_data/pari/buzzard/genusn.g +129 -0
- sage/ext_data/pari/dokchitser/computel.gp +740 -0
- sage/ext_data/pari/dokchitser/computel.gp.template +740 -0
- sage/ext_data/pari/dokchitser/ex-bsw +43 -0
- sage/ext_data/pari/dokchitser/ex-chgen +48 -0
- sage/ext_data/pari/dokchitser/ex-chqua +37 -0
- sage/ext_data/pari/dokchitser/ex-delta +35 -0
- sage/ext_data/pari/dokchitser/ex-eisen +30 -0
- sage/ext_data/pari/dokchitser/ex-gen2 +38 -0
- sage/ext_data/pari/dokchitser/ex-gen3 +49 -0
- sage/ext_data/pari/dokchitser/ex-gen4 +54 -0
- sage/ext_data/pari/dokchitser/ex-nf +48 -0
- sage/ext_data/pari/dokchitser/ex-shin +50 -0
- sage/ext_data/pari/dokchitser/ex-tau2 +30 -0
- sage/ext_data/pari/dokchitser/ex-zeta +27 -0
- sage/ext_data/pari/dokchitser/ex-zeta2 +47 -0
- sage/ext_data/pari/dokchitser/testall +13 -0
- sage/ext_data/pari/simon/ell.gp +2129 -0
- sage/ext_data/pari/simon/ellQ.gp +2151 -0
- sage/ext_data/pari/simon/ellcommon.gp +126 -0
- sage/ext_data/pari/simon/qfsolve.gp +722 -0
- sage/ext_data/pari/simon/resultant3.gp +306 -0
- sage/groups/all__sagemath_pari.py +3 -0
- sage/groups/pari_group.py +175 -0
- sage/interfaces/all__sagemath_pari.py +1 -0
- sage/interfaces/genus2reduction.py +464 -0
- sage/interfaces/gp.py +1114 -0
- sage/libs/all__sagemath_pari.py +2 -0
- sage/libs/linkages/__init__.py +1 -0
- sage/libs/linkages/padics/API.pxi +617 -0
- sage/libs/linkages/padics/Polynomial_ram.pxi +388 -0
- sage/libs/linkages/padics/Polynomial_shared.pxi +554 -0
- sage/libs/linkages/padics/__init__.py +1 -0
- sage/libs/linkages/padics/fmpz_poly_unram.pxi +869 -0
- sage/libs/linkages/padics/mpz.pxi +691 -0
- sage/libs/linkages/padics/relaxed/API.pxi +518 -0
- sage/libs/linkages/padics/relaxed/__init__.py +1 -0
- sage/libs/linkages/padics/relaxed/flint.pxi +543 -0
- sage/libs/linkages/padics/unram_shared.pxi +247 -0
- sage/libs/pari/__init__.py +210 -0
- sage/libs/pari/all.py +5 -0
- sage/libs/pari/convert_flint.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_flint.pxd +14 -0
- sage/libs/pari/convert_flint.pyx +159 -0
- sage/libs/pari/convert_gmp.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_gmp.pxd +14 -0
- sage/libs/pari/convert_gmp.pyx +210 -0
- sage/libs/pari/convert_sage.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage.pxd +16 -0
- sage/libs/pari/convert_sage.pyx +588 -0
- sage/libs/pari/convert_sage_complex_double.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_complex_double.pxd +14 -0
- sage/libs/pari/convert_sage_complex_double.pyx +132 -0
- sage/libs/pari/convert_sage_matrix.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_matrix.pyx +106 -0
- sage/libs/pari/convert_sage_real_double.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_real_double.pxd +5 -0
- sage/libs/pari/convert_sage_real_double.pyx +14 -0
- sage/libs/pari/convert_sage_real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_real_mpfr.pxd +7 -0
- sage/libs/pari/convert_sage_real_mpfr.pyx +108 -0
- sage/libs/pari/misc.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/misc.pxd +4 -0
- sage/libs/pari/misc.pyx +26 -0
- sage/libs/pari/tests.py +1848 -0
- sage/matrix/all__sagemath_pari.py +1 -0
- sage/matrix/matrix_integer_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_integer_pari.pyx +187 -0
- sage/matrix/matrix_rational_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_rational_pari.pyx +160 -0
- sage/quadratic_forms/all__sagemath_pari.py +10 -0
- sage/quadratic_forms/genera/all.py +9 -0
- sage/quadratic_forms/genera/genus.py +3506 -0
- sage/quadratic_forms/genera/normal_form.py +1519 -0
- sage/quadratic_forms/genera/spinor_genus.py +243 -0
- sage/quadratic_forms/qfsolve.py +255 -0
- sage/quadratic_forms/quadratic_form__automorphisms.py +427 -0
- sage/quadratic_forms/quadratic_form__genus.py +141 -0
- sage/quadratic_forms/quadratic_form__local_density_interfaces.py +140 -0
- sage/quadratic_forms/quadratic_form__local_normal_form.py +421 -0
- sage/quadratic_forms/quadratic_form__local_representation_conditions.py +889 -0
- sage/quadratic_forms/quadratic_form__mass.py +69 -0
- sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +663 -0
- sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +373 -0
- sage/quadratic_forms/quadratic_form__siegel_product.py +198 -0
- sage/quadratic_forms/special_values.py +323 -0
- sage/rings/all__sagemath_pari.py +15 -0
- sage/rings/factorint_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/factorint_pari.pyx +80 -0
- sage/rings/finite_rings/all__sagemath_pari.py +1 -0
- sage/rings/finite_rings/element_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_givaro.pxd +91 -0
- sage/rings/finite_rings/element_givaro.pyx +1769 -0
- sage/rings/finite_rings/element_ntl_gf2e.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_ntl_gf2e.pxd +22 -0
- sage/rings/finite_rings/element_ntl_gf2e.pyx +1333 -0
- sage/rings/finite_rings/element_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_pari_ffelt.pxd +13 -0
- sage/rings/finite_rings/element_pari_ffelt.pyx +1441 -0
- sage/rings/finite_rings/finite_field_givaro.py +612 -0
- sage/rings/finite_rings/finite_field_pari_ffelt.py +238 -0
- sage/rings/finite_rings/hom_finite_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field_givaro.pxd +28 -0
- sage/rings/finite_rings/hom_finite_field_givaro.pyx +280 -0
- sage/rings/finite_rings/residue_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field_givaro.pyx +133 -0
- sage/rings/finite_rings/residue_field_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field_pari_ffelt.pyx +128 -0
- sage/rings/function_field/all__sagemath_pari.py +1 -0
- sage/rings/function_field/valuation.py +1450 -0
- sage/rings/function_field/valuation_ring.py +212 -0
- sage/rings/number_field/all__sagemath_pari.py +14 -0
- sage/rings/number_field/totallyreal.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/number_field/totallyreal.pyx +509 -0
- sage/rings/number_field/totallyreal_data.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/number_field/totallyreal_data.pxd +26 -0
- sage/rings/number_field/totallyreal_data.pyx +928 -0
- sage/rings/number_field/totallyreal_phc.py +144 -0
- sage/rings/number_field/totallyreal_rel.py +1018 -0
- sage/rings/padics/CA_template.pxi +1847 -0
- sage/rings/padics/CA_template_header.pxi +50 -0
- sage/rings/padics/CR_template.pxi +2563 -0
- sage/rings/padics/CR_template_header.pxi +57 -0
- sage/rings/padics/FM_template.pxi +1575 -0
- sage/rings/padics/FM_template_header.pxi +50 -0
- sage/rings/padics/FP_template.pxi +2176 -0
- sage/rings/padics/FP_template_header.pxi +57 -0
- sage/rings/padics/all.py +3 -0
- sage/rings/padics/all__sagemath_pari.py +11 -0
- sage/rings/padics/common_conversion.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/common_conversion.pxd +15 -0
- sage/rings/padics/common_conversion.pyx +508 -0
- sage/rings/padics/eisenstein_extension_generic.py +232 -0
- sage/rings/padics/factory.py +3623 -0
- sage/rings/padics/generic_nodes.py +1615 -0
- sage/rings/padics/lattice_precision.py +2889 -0
- sage/rings/padics/morphism.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/morphism.pxd +11 -0
- sage/rings/padics/morphism.pyx +366 -0
- sage/rings/padics/padic_base_generic.py +467 -0
- sage/rings/padics/padic_base_leaves.py +1235 -0
- sage/rings/padics/padic_capped_absolute_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_capped_absolute_element.pxd +15 -0
- sage/rings/padics/padic_capped_absolute_element.pyx +520 -0
- sage/rings/padics/padic_capped_relative_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_capped_relative_element.pxd +14 -0
- sage/rings/padics/padic_capped_relative_element.pyx +614 -0
- sage/rings/padics/padic_extension_generic.py +990 -0
- sage/rings/padics/padic_extension_leaves.py +738 -0
- sage/rings/padics/padic_fixed_mod_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_fixed_mod_element.pxd +15 -0
- sage/rings/padics/padic_fixed_mod_element.pyx +584 -0
- sage/rings/padics/padic_floating_point_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_floating_point_element.pxd +14 -0
- sage/rings/padics/padic_floating_point_element.pyx +447 -0
- sage/rings/padics/padic_generic_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_generic_element.pxd +48 -0
- sage/rings/padics/padic_generic_element.pyx +4642 -0
- sage/rings/padics/padic_lattice_element.py +1342 -0
- sage/rings/padics/padic_printing.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_printing.pxd +38 -0
- sage/rings/padics/padic_printing.pyx +1505 -0
- sage/rings/padics/padic_relaxed_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_relaxed_element.pxd +56 -0
- sage/rings/padics/padic_relaxed_element.pyx +18 -0
- sage/rings/padics/padic_relaxed_errors.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_relaxed_errors.pxd +11 -0
- sage/rings/padics/padic_relaxed_errors.pyx +71 -0
- sage/rings/padics/padic_template_element.pxi +1212 -0
- sage/rings/padics/padic_template_element_header.pxi +50 -0
- sage/rings/padics/padic_valuation.py +1423 -0
- sage/rings/padics/pow_computer_flint.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer_flint.pxd +38 -0
- sage/rings/padics/pow_computer_flint.pyx +641 -0
- sage/rings/padics/pow_computer_relative.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer_relative.pxd +29 -0
- sage/rings/padics/pow_computer_relative.pyx +415 -0
- sage/rings/padics/qadic_flint_CA.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_CA.pxd +21 -0
- sage/rings/padics/qadic_flint_CA.pyx +130 -0
- sage/rings/padics/qadic_flint_CR.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_CR.pxd +13 -0
- sage/rings/padics/qadic_flint_CR.pyx +172 -0
- sage/rings/padics/qadic_flint_FM.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_FM.pxd +14 -0
- sage/rings/padics/qadic_flint_FM.pyx +111 -0
- sage/rings/padics/qadic_flint_FP.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_FP.pxd +12 -0
- sage/rings/padics/qadic_flint_FP.pyx +165 -0
- sage/rings/padics/relative_extension_leaves.py +429 -0
- sage/rings/padics/relative_ramified_CA.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_CA.pxd +9 -0
- sage/rings/padics/relative_ramified_CA.pyx +33 -0
- sage/rings/padics/relative_ramified_CR.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_CR.pxd +8 -0
- sage/rings/padics/relative_ramified_CR.pyx +33 -0
- sage/rings/padics/relative_ramified_FM.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_FM.pxd +9 -0
- sage/rings/padics/relative_ramified_FM.pyx +33 -0
- sage/rings/padics/relative_ramified_FP.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_FP.pxd +8 -0
- sage/rings/padics/relative_ramified_FP.pyx +33 -0
- sage/rings/padics/relaxed_template.pxi +4229 -0
- sage/rings/padics/relaxed_template_header.pxi +160 -0
- sage/rings/padics/tests.py +35 -0
- sage/rings/padics/tutorial.py +341 -0
- sage/rings/padics/unramified_extension_generic.py +335 -0
- sage/rings/padics/witt_vector.py +917 -0
- sage/rings/padics/witt_vector_ring.py +934 -0
- sage/rings/pari_ring.py +235 -0
- sage/rings/polynomial/all__sagemath_pari.py +1 -0
- sage/rings/polynomial/padics/all.py +1 -0
- sage/rings/polynomial/padics/polynomial_padic.py +360 -0
- sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +1324 -0
- sage/rings/polynomial/padics/polynomial_padic_flat.py +72 -0
- sage/rings/power_series_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/power_series_pari.pxd +6 -0
- sage/rings/power_series_pari.pyx +934 -0
- sage/rings/tate_algebra.py +1282 -0
- sage/rings/tate_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/tate_algebra_element.pxd +49 -0
- sage/rings/tate_algebra_element.pyx +3464 -0
- sage/rings/tate_algebra_ideal.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/tate_algebra_ideal.pxd +7 -0
- sage/rings/tate_algebra_ideal.pyx +1307 -0
- sage/rings/valuation/all.py +7 -0
- sage/rings/valuation/augmented_valuation.py +2118 -0
- sage/rings/valuation/developing_valuation.py +362 -0
- sage/rings/valuation/gauss_valuation.py +812 -0
- sage/rings/valuation/inductive_valuation.py +1686 -0
- sage/rings/valuation/limit_valuation.py +946 -0
- sage/rings/valuation/mapped_valuation.py +656 -0
- sage/rings/valuation/scaled_valuation.py +322 -0
- sage/rings/valuation/trivial_valuation.py +382 -0
- sage/rings/valuation/valuation.py +1119 -0
- sage/rings/valuation/valuation_space.py +1615 -0
- sage/rings/valuation/valuations_catalog.py +10 -0
- sage/rings/valuation/value_group.py +697 -0
- sage/schemes/all__sagemath_pari.py +1 -0
- sage/schemes/elliptic_curves/all__sagemath_pari.py +1 -0
- sage/schemes/elliptic_curves/descent_two_isogeny_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/schemes/elliptic_curves/descent_two_isogeny_pari.pyx +46 -0
- sage_wheels/bin/gp +0 -0
- sage_wheels/bin/gp2c +0 -0
- sage_wheels/bin/gp2c-run +57 -0
- sage_wheels/bin/xeus-gp +0 -0
- sage_wheels/share/gp2c/func.dsc +18414 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
"""
|
|
3
|
+
This file provides the declaration for ``FPElement`` and the morphisms
|
|
4
|
+
to and from the integers and rationals.
|
|
5
|
+
|
|
6
|
+
It is included in the .pxd files associated to gluing files, such as
|
|
7
|
+
padic_floating_point_element.pxd.
|
|
8
|
+
|
|
9
|
+
AUTHORS:
|
|
10
|
+
|
|
11
|
+
- David Roe (2012-03-01) -- initial version
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
#*****************************************************************************
|
|
15
|
+
# Copyright (C) 2012 David Roe <roed.math@gmail.com>
|
|
16
|
+
# William Stein <wstein@gmail.com>
|
|
17
|
+
#
|
|
18
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
19
|
+
# as published by the Free Software Foundation; either version 2 of
|
|
20
|
+
# the License, or (at your option) any later version.
|
|
21
|
+
#
|
|
22
|
+
# http://www.gnu.org/licenses/
|
|
23
|
+
#*****************************************************************************
|
|
24
|
+
|
|
25
|
+
# includes the header for pAdicTemplateElement
|
|
26
|
+
include "padic_template_element_header.pxi"
|
|
27
|
+
|
|
28
|
+
from sage.categories.morphism cimport Morphism
|
|
29
|
+
from sage.rings.morphism cimport RingHomomorphism, RingMap
|
|
30
|
+
|
|
31
|
+
cdef class FPElement(pAdicTemplateElement):
|
|
32
|
+
cdef celement unit
|
|
33
|
+
cdef long ordp
|
|
34
|
+
|
|
35
|
+
cdef FPElement _new_c(self)
|
|
36
|
+
cdef int _normalize(self) except -1
|
|
37
|
+
cdef int _set_infinity(self) except -1
|
|
38
|
+
cpdef val_unit(self, p=*)
|
|
39
|
+
|
|
40
|
+
cdef class pAdicCoercion_ZZ_FP(RingHomomorphism):
|
|
41
|
+
cdef FPElement _zero
|
|
42
|
+
cdef RingMap _section
|
|
43
|
+
cdef class pAdicConvert_FP_ZZ(RingMap):
|
|
44
|
+
pass
|
|
45
|
+
cdef class pAdicCoercion_QQ_FP(RingHomomorphism):
|
|
46
|
+
cdef FPElement _zero
|
|
47
|
+
cdef RingMap _section
|
|
48
|
+
cdef class pAdicConvert_FP_QQ(RingMap):
|
|
49
|
+
pass
|
|
50
|
+
cdef class pAdicConvert_QQ_FP(Morphism):
|
|
51
|
+
cdef FPElement _zero
|
|
52
|
+
cdef RingMap _section
|
|
53
|
+
cdef class pAdicCoercion_FP_frac_field(RingHomomorphism):
|
|
54
|
+
cdef FPElement _zero
|
|
55
|
+
cdef Morphism _section
|
|
56
|
+
cdef class pAdicConvert_FP_frac_field(Morphism):
|
|
57
|
+
cdef FPElement _zero
|
sage/rings/padics/all.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
|
|
3
|
+
from sage.rings.padics.all__sagemath_categories import *
|
|
4
|
+
|
|
5
|
+
from sage.rings.padics.factory import Zp, Zq, Zp as pAdicRing, ZpCR, ZpCA, ZpFM, ZpFP, ZpLC, ZpLF, ZqCR, ZqCA, ZqFM, ZqFP, ZpER
|
|
6
|
+
from sage.rings.padics.factory import Qp, Qq, Qp as pAdicField, QpCR, QpFP, QpLC, QpLF, QqCR, QqFP, QpER
|
|
7
|
+
from sage.rings.padics.factory import pAdicExtension
|
|
8
|
+
|
|
9
|
+
from sage.rings.padics.padic_printing import _printer_defaults as padic_printing
|
|
10
|
+
|
|
11
|
+
from sage.rings.padics.witt_vector_ring import WittVectorRing
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
from sage.rings.integer cimport Integer
|
|
3
|
+
from sage.rings.padics.pow_computer cimport PowComputer_class
|
|
4
|
+
from sage.libs.gmp.mpz cimport mpz_t, mpq_t
|
|
5
|
+
|
|
6
|
+
cdef long get_ordp(x, PowComputer_class prime_pow) except? -10000
|
|
7
|
+
cdef long get_preccap(x, PowComputer_class prime_pow) except? -10000
|
|
8
|
+
cdef long comb_prec(iprec, long prec) except? -10000
|
|
9
|
+
cdef int _process_args_and_kwds(long *aprec, long *rprec, args, kwds, bint absolute, PowComputer_class prime_pow) except -1
|
|
10
|
+
|
|
11
|
+
cdef long cconv_mpq_t_shared(mpz_t out, mpq_t x, long prec, bint absolute, PowComputer_class prime_pow) except? -10000
|
|
12
|
+
cdef int cconv_mpq_t_out_shared(mpq_t out, mpz_t x, long valshift, long prec, PowComputer_class prime_pow) except -1
|
|
13
|
+
cdef int cconv_shared(mpz_t out, x, long prec, long valshift, PowComputer_class prime_pow) except -2
|
|
14
|
+
cdef long cconv_mpz_t_shared(mpz_t out, mpz_t x, long prec, bint absolute, PowComputer_class prime_pow) except -2
|
|
15
|
+
cdef int cconv_mpz_t_out_shared(mpz_t out, mpz_t x, long valshift, long prec, PowComputer_class prime_pow) except -1
|
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
# sage.doctest: needs sage.rings.padics
|
|
3
|
+
r"""
|
|
4
|
+
Tools for creation of `p`-adic elements
|
|
5
|
+
|
|
6
|
+
The functions in this file are used in creating new `p`-adic elements.
|
|
7
|
+
|
|
8
|
+
When creating a `p`-adic element, the user can specify that the absolute
|
|
9
|
+
precision be bounded and/or that the relative precision be bounded.
|
|
10
|
+
Moreover, different `p`-adic parents impose their own bounds on the
|
|
11
|
+
relative or absolute precision of their elements. The precision
|
|
12
|
+
determines to what power of `p` the defining data will be reduced, but
|
|
13
|
+
the valuation of the resulting element needs to be determined before
|
|
14
|
+
the element is created. Moreover, some defining data can impose their
|
|
15
|
+
own precision bounds on the result.
|
|
16
|
+
|
|
17
|
+
AUTHORS:
|
|
18
|
+
|
|
19
|
+
- David Roe (2012-03-01)
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# ****************************************************************************
|
|
23
|
+
# Copyright (C) 2007-2013 David Roe <roed.math@gmail.com>
|
|
24
|
+
# William Stein <wstein@gmail.com>
|
|
25
|
+
#
|
|
26
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
27
|
+
# as published by the Free Software Foundation; either version 2 of
|
|
28
|
+
# the License, or (at your option) any later version.
|
|
29
|
+
#
|
|
30
|
+
# https://www.gnu.org/licenses/
|
|
31
|
+
# ****************************************************************************
|
|
32
|
+
|
|
33
|
+
from cpython.long cimport *
|
|
34
|
+
from sage.ext.stdsage cimport PY_NEW
|
|
35
|
+
from sage.libs.gmp.all cimport *
|
|
36
|
+
from sage.arith.rational_reconstruction cimport mpq_rational_reconstruction
|
|
37
|
+
from sage.rings.integer cimport Integer
|
|
38
|
+
from sage.rings.rational cimport Rational
|
|
39
|
+
from sage.rings.padics.padic_generic_element cimport pAdicGenericElement
|
|
40
|
+
import sage.rings.finite_rings.integer_mod
|
|
41
|
+
from cypari2.types cimport *
|
|
42
|
+
from cypari2.gen cimport Gen as pari_gen
|
|
43
|
+
from sage.rings.infinity import infinity
|
|
44
|
+
from sage.structure.element cimport parent
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
cdef long maxordp = (1L << (sizeof(long) * 8 - 2)) - 1
|
|
48
|
+
cdef long minusmaxordp = -maxordp
|
|
49
|
+
# The following Integer (resp. Rational) is used so that
|
|
50
|
+
# the functions here don't need to initialize an mpz_t (resp. mpq_t)
|
|
51
|
+
cdef Integer temp = PY_NEW(Integer)
|
|
52
|
+
cdef Rational rat_temp = PY_NEW(Rational)
|
|
53
|
+
|
|
54
|
+
cdef long get_ordp(x, PowComputer_class prime_pow) except? -10000:
|
|
55
|
+
"""
|
|
56
|
+
Determine the valuation of the `p`-adic element
|
|
57
|
+
that will result from the given data ``x``.
|
|
58
|
+
|
|
59
|
+
Note that the valuation can differ depending on the ring: if the
|
|
60
|
+
new `p`-adic element is being created in a ring with ramification
|
|
61
|
+
then the valuation will be larger.
|
|
62
|
+
|
|
63
|
+
Some preprocessing is done in the initialization methods of the element, so
|
|
64
|
+
the type of x is restricted.
|
|
65
|
+
|
|
66
|
+
Also note that for some kinds of elements conversion to and from
|
|
67
|
+
Integers and Rationals is done in a custom morphism rather than
|
|
68
|
+
through this function.
|
|
69
|
+
|
|
70
|
+
INPUT:
|
|
71
|
+
|
|
72
|
+
- ``x`` -- data defining a new `p`-adic element: a Python int, an
|
|
73
|
+
Integer, Rational, an element of Zp or Qp with the same prime, a
|
|
74
|
+
PARI `p`-adic element, a list, a tuple, or an IntegerMod.
|
|
75
|
+
|
|
76
|
+
- a PowComputer associated to a `p`-adic ring, which determines
|
|
77
|
+
the prime and the ramification degree.
|
|
78
|
+
|
|
79
|
+
OUTPUT:
|
|
80
|
+
|
|
81
|
+
- a long, giving the valuation of the resulting `p`-adic element.
|
|
82
|
+
If the input is zero, returns ``maxordp``
|
|
83
|
+
"""
|
|
84
|
+
cdef long k, n, p, curterm, shift, f, ratio, e = prime_pow.e
|
|
85
|
+
cdef Integer value
|
|
86
|
+
cdef GEN pari_tmp
|
|
87
|
+
if isinstance(x, int):
|
|
88
|
+
if x == 0:
|
|
89
|
+
return maxordp
|
|
90
|
+
try:
|
|
91
|
+
n = PyLong_AsLong(x)
|
|
92
|
+
except OverflowError:
|
|
93
|
+
return get_ordp(Integer(x), prime_pow)
|
|
94
|
+
else:
|
|
95
|
+
if mpz_fits_slong_p(prime_pow.prime.value) == 0:
|
|
96
|
+
# x is not divisible by p
|
|
97
|
+
return 0
|
|
98
|
+
p = mpz_get_si(prime_pow.prime.value)
|
|
99
|
+
k = 0
|
|
100
|
+
while n % p == 0:
|
|
101
|
+
k += 1
|
|
102
|
+
n = n / p
|
|
103
|
+
elif isinstance(x, Integer):
|
|
104
|
+
if mpz_sgn((<Integer>x).value) == 0:
|
|
105
|
+
return maxordp
|
|
106
|
+
k = mpz_remove(temp.value, (<Integer>x).value, prime_pow.prime.value)
|
|
107
|
+
elif isinstance(x, Rational):
|
|
108
|
+
if mpq_sgn((<Rational>x).value) == 0:
|
|
109
|
+
return maxordp
|
|
110
|
+
k = mpz_remove(temp.value, mpq_numref((<Rational>x).value), prime_pow.prime.value)
|
|
111
|
+
if k == 0:
|
|
112
|
+
k = -mpz_remove(temp.value, mpq_denref((<Rational>x).value), prime_pow.prime.value)
|
|
113
|
+
elif isinstance(x, (list, tuple)):
|
|
114
|
+
f = prime_pow.f
|
|
115
|
+
if (e == 1 and len(x) > f) or (e != 1 and len(x) > e):
|
|
116
|
+
# could reduce modulo the defining polynomial but that isn't currently supported
|
|
117
|
+
raise ValueError("List too long")
|
|
118
|
+
k = maxordp
|
|
119
|
+
shift = 0
|
|
120
|
+
for a in x:
|
|
121
|
+
if isinstance(a, (list, tuple)):
|
|
122
|
+
if e == 1 or f == 1:
|
|
123
|
+
raise ValueError("nested lists not allowed for unramified and eisenstein extensions")
|
|
124
|
+
for b in a:
|
|
125
|
+
if isinstance(b, (list, tuple)):
|
|
126
|
+
raise ValueError("list nesting too deep")
|
|
127
|
+
curterm = get_ordp(b, prime_pow)
|
|
128
|
+
k = min(k, curterm + shift, maxordp)
|
|
129
|
+
else:
|
|
130
|
+
curterm = get_ordp(a, prime_pow)
|
|
131
|
+
k = min(k, curterm + shift, maxordp)
|
|
132
|
+
if e != 1: shift += 1
|
|
133
|
+
# We don't want to multiply by e again.
|
|
134
|
+
return k
|
|
135
|
+
elif isinstance(x, pAdicGenericElement):
|
|
136
|
+
if x.parent().is_relaxed():
|
|
137
|
+
return x.valuation()
|
|
138
|
+
k = (<pAdicGenericElement>x).valuation_c()
|
|
139
|
+
if not (<pAdicGenericElement>x)._is_base_elt(prime_pow.prime):
|
|
140
|
+
# We have to be careful with overflow
|
|
141
|
+
ratio = e // x.parent().absolute_e()
|
|
142
|
+
if k >= maxordp // ratio:
|
|
143
|
+
return maxordp
|
|
144
|
+
elif k <= minusmaxordp // ratio:
|
|
145
|
+
return minusmaxordp
|
|
146
|
+
else:
|
|
147
|
+
return (k*e) // x.parent().absolute_e()
|
|
148
|
+
return k
|
|
149
|
+
elif isinstance(x, pari_gen):
|
|
150
|
+
pari_tmp = (<pari_gen>x).g
|
|
151
|
+
if typ(pari_tmp) == t_PADIC:
|
|
152
|
+
k = valp(pari_tmp)
|
|
153
|
+
else: # t_INT and t_FRAC were converted before this function
|
|
154
|
+
raise TypeError("unsupported coercion from pari: only p-adics, integers and rationals allowed")
|
|
155
|
+
elif isinstance(x, sage.rings.finite_rings.integer_mod.IntegerMod_abstract):
|
|
156
|
+
value = <Integer>x.lift()
|
|
157
|
+
if mpz_sgn(value.value) == 0:
|
|
158
|
+
return maxordp
|
|
159
|
+
k = mpz_remove(temp.value, value.value, prime_pow.prime.value)
|
|
160
|
+
else:
|
|
161
|
+
raise NotImplementedError("Cannot determine p-adic valuation of an element of %s" % parent(x))
|
|
162
|
+
# Should check for overflow
|
|
163
|
+
return k * e
|
|
164
|
+
|
|
165
|
+
cdef long get_preccap(x, PowComputer_class prime_pow) except? -10000:
|
|
166
|
+
"""
|
|
167
|
+
Determine the maximum absolute precision possible
|
|
168
|
+
for an element created from the given data ``x``.
|
|
169
|
+
|
|
170
|
+
Note that the valuation can differ depending on the ring: if the
|
|
171
|
+
new `p`-adic element is being created in a ring with ramification
|
|
172
|
+
then the precision bound will be larger.
|
|
173
|
+
|
|
174
|
+
Some preprocessing is done in the initialization methods of the element, so
|
|
175
|
+
the type of x is restricted.
|
|
176
|
+
|
|
177
|
+
Also note that for some kinds of elements conversion to and from
|
|
178
|
+
Integers and Rationals is done in a custom morphism rather than
|
|
179
|
+
through this function.
|
|
180
|
+
|
|
181
|
+
INPUT:
|
|
182
|
+
|
|
183
|
+
- ``x`` -- data defining a new `p`-adic element: an Integer,
|
|
184
|
+
Rational, an element of Zp or Qp with the same prime, a PARI
|
|
185
|
+
`p`-adic element, a list, a tuple, or an IntegerMod.
|
|
186
|
+
- ``prime_pow`` -- the PowComputer for the ring into which ``x``
|
|
187
|
+
is being converted. This is used to determine the prime and the
|
|
188
|
+
ramification degree.
|
|
189
|
+
|
|
190
|
+
OUTPUT:
|
|
191
|
+
|
|
192
|
+
- a long, giving the absolute precision modulo which the input is
|
|
193
|
+
defined. If the input is exact, returns ``maxordp``
|
|
194
|
+
"""
|
|
195
|
+
cdef long k, shift, e = prime_pow.e
|
|
196
|
+
cdef Integer prec
|
|
197
|
+
cdef GEN pari_tmp
|
|
198
|
+
if isinstance(x, (int, Integer, Rational)):
|
|
199
|
+
return maxordp
|
|
200
|
+
elif isinstance(x, (list, tuple)):
|
|
201
|
+
k = maxordp
|
|
202
|
+
shift = 0
|
|
203
|
+
for a in x:
|
|
204
|
+
if isinstance(a, (list, tuple)):
|
|
205
|
+
for b in a:
|
|
206
|
+
curterm = get_preccap(b, prime_pow)
|
|
207
|
+
k = min(k, curterm + shift)
|
|
208
|
+
else:
|
|
209
|
+
curterm = get_preccap(a, prime_pow)
|
|
210
|
+
k = min(k, curterm + shift)
|
|
211
|
+
if e != 1: shift += 1
|
|
212
|
+
# We don't want to multiply by e again.
|
|
213
|
+
return k
|
|
214
|
+
elif isinstance(x, pAdicGenericElement):
|
|
215
|
+
if (<pAdicGenericElement>x)._is_exact_zero():
|
|
216
|
+
return maxordp
|
|
217
|
+
prec = <Integer>x.precision_absolute()
|
|
218
|
+
if prec is infinity:
|
|
219
|
+
return maxordp
|
|
220
|
+
k = mpz_get_si(prec.value)
|
|
221
|
+
if not (<pAdicGenericElement>x)._is_base_elt(prime_pow.prime):
|
|
222
|
+
# since x lives in a subfield, the ramification index of x's parent will divide e.
|
|
223
|
+
return (k * e) // x.parent().absolute_e()
|
|
224
|
+
elif isinstance(x, pari_gen):
|
|
225
|
+
pari_tmp = (<pari_gen>x).g
|
|
226
|
+
# since get_ordp has been called typ(x.g) == t_PADIC
|
|
227
|
+
k = valp(pari_tmp) + precp(pari_tmp)
|
|
228
|
+
elif isinstance(x, sage.rings.finite_rings.integer_mod.IntegerMod_abstract):
|
|
229
|
+
k = mpz_remove(temp.value, (<Integer>x.modulus()).value, prime_pow.prime.value)
|
|
230
|
+
if mpz_cmp_ui(temp.value, 1) != 0:
|
|
231
|
+
raise TypeError("cannot coerce from the given integer mod ring (not a power of the same prime)")
|
|
232
|
+
else:
|
|
233
|
+
raise NotImplementedError("Cannot determine p-adic precision of an element of %s" % parent(x))
|
|
234
|
+
return k * e
|
|
235
|
+
|
|
236
|
+
cdef long comb_prec(iprec, long prec) except? -10000:
|
|
237
|
+
"""
|
|
238
|
+
Return the minimum of ``iprec`` and ``prec``.
|
|
239
|
+
|
|
240
|
+
INPUT:
|
|
241
|
+
|
|
242
|
+
- ``iprec`` -- infinity, integer or something that can be converted to an
|
|
243
|
+
integer
|
|
244
|
+
|
|
245
|
+
- ``prec`` -- a long
|
|
246
|
+
"""
|
|
247
|
+
if iprec is infinity: return prec
|
|
248
|
+
cdef Integer intprec
|
|
249
|
+
if isinstance(iprec, Integer):
|
|
250
|
+
intprec = <Integer>iprec
|
|
251
|
+
if mpz_cmp_si(intprec.value, prec) >= 0:
|
|
252
|
+
return prec
|
|
253
|
+
if mpz_fits_slong_p(intprec.value) == 0:
|
|
254
|
+
raise OverflowError("precision overflow")
|
|
255
|
+
return mpz_get_si(intprec.value)
|
|
256
|
+
if isinstance(iprec, int):
|
|
257
|
+
return min(PyLong_AsLong(iprec), prec)
|
|
258
|
+
return comb_prec(Integer(iprec), prec)
|
|
259
|
+
|
|
260
|
+
cdef int _process_args_and_kwds(long *aprec, long *rprec, args, kwds, bint absolute, PowComputer_class prime_pow) except -1:
|
|
261
|
+
"""
|
|
262
|
+
Obtain values for ``absprec`` and ``relprec`` from a
|
|
263
|
+
combination of positional and keyword arguments.
|
|
264
|
+
|
|
265
|
+
When creating a `p`-adic element, the user can pass in two arguments: ``absprec`` and ``relprec``.
|
|
266
|
+
In implementing morphisms to speed up conversion from Integers and Rationals,
|
|
267
|
+
we need to determine ``absprec`` and ``relprec`` from the ``args`` and ``kwds`` arguments of
|
|
268
|
+
``_call_with_args``. This function collects the code to do so.
|
|
269
|
+
|
|
270
|
+
INPUT:
|
|
271
|
+
|
|
272
|
+
- ``args`` -- tuple of positional arguments (at most two)
|
|
273
|
+
|
|
274
|
+
- ``kwds`` -- dictionary of keyword arguments (only
|
|
275
|
+
``'relprec'`` and ``'absprec'`` are used)
|
|
276
|
+
|
|
277
|
+
- ``absolute`` -- boolean; ``True`` if the precision cap of the ring
|
|
278
|
+
is a cap on absolute precision, ``False`` if a cap on relative
|
|
279
|
+
precision
|
|
280
|
+
|
|
281
|
+
- ``prime_pow`` -- a
|
|
282
|
+
:class:`sage.rings.padics.pow_computer.PowComputer_class`
|
|
283
|
+
instance
|
|
284
|
+
|
|
285
|
+
OUTPUT:
|
|
286
|
+
|
|
287
|
+
- ``aprec`` -- (first argument) the maximum absolute precision of
|
|
288
|
+
the resulting element
|
|
289
|
+
|
|
290
|
+
- ``rprec`` -- (second argument) the maximum relative precision of
|
|
291
|
+
the resulting element
|
|
292
|
+
|
|
293
|
+
- error status
|
|
294
|
+
"""
|
|
295
|
+
if "empty" in kwds:
|
|
296
|
+
# For backward compatibility
|
|
297
|
+
aprec[0] = 0
|
|
298
|
+
rprec[0] = 0
|
|
299
|
+
return 0
|
|
300
|
+
if len(args) > 2:
|
|
301
|
+
raise TypeError("too many positional arguments")
|
|
302
|
+
if len(args) == 2:
|
|
303
|
+
if "relprec" in kwds:
|
|
304
|
+
raise TypeError("_call_with_args() got multiple values for keyword argument 'relprec'")
|
|
305
|
+
relprec = args[1]
|
|
306
|
+
else:
|
|
307
|
+
relprec = kwds.get("relprec",infinity)
|
|
308
|
+
if len(args) >= 1:
|
|
309
|
+
if "absprec" in kwds:
|
|
310
|
+
raise TypeError("_call_with_args() got multiple values for keyword argument 'absprec'")
|
|
311
|
+
absprec = args[0]
|
|
312
|
+
else:
|
|
313
|
+
absprec = kwds.get("absprec",infinity)
|
|
314
|
+
if absolute:
|
|
315
|
+
aprec[0] = comb_prec(absprec, prime_pow.ram_prec_cap)
|
|
316
|
+
rprec[0] = comb_prec(relprec, maxordp)
|
|
317
|
+
else:
|
|
318
|
+
rprec[0] = comb_prec(relprec, prime_pow.ram_prec_cap)
|
|
319
|
+
aprec[0] = comb_prec(absprec, maxordp)
|
|
320
|
+
|
|
321
|
+
cdef inline long cconv_mpq_t_shared(mpz_t out, mpq_t x, long prec, bint absolute, PowComputer_class prime_pow) except? -10000:
|
|
322
|
+
"""
|
|
323
|
+
A fast pathway for conversion of rationals that doesn't require
|
|
324
|
+
precomputation of the valuation.
|
|
325
|
+
|
|
326
|
+
INPUT:
|
|
327
|
+
|
|
328
|
+
- ``out`` -- an ``mpz_t`` to store the output
|
|
329
|
+
- ``x`` -- an ``mpq_t`` giving the integer to be converted
|
|
330
|
+
- ``prec`` -- a long, giving the precision desired; absolute or
|
|
331
|
+
relative depending on the ``absolute`` input
|
|
332
|
+
- ``absolute`` -- if ``False`` then extracts the valuation and returns
|
|
333
|
+
it, storing the unit in ``out``; if ``True`` then just reduces ``x``
|
|
334
|
+
modulo the precision
|
|
335
|
+
- ``prime_pow`` -- a PowComputer for the ring
|
|
336
|
+
|
|
337
|
+
OUTPUT:
|
|
338
|
+
|
|
339
|
+
- If ``absolute`` is ``False`` then returns the valuation that was
|
|
340
|
+
extracted (``maxordp`` when `x = 0`).
|
|
341
|
+
"""
|
|
342
|
+
cdef long numval, denval
|
|
343
|
+
cdef bint success
|
|
344
|
+
if prec <= 0:
|
|
345
|
+
raise ValueError
|
|
346
|
+
if absolute:
|
|
347
|
+
success = mpz_invert(out, mpq_denref(x), prime_pow.pow_mpz_t_tmp(prec))
|
|
348
|
+
if not success:
|
|
349
|
+
raise ValueError("p divides denominator")
|
|
350
|
+
mpz_mul(out, out, mpq_numref(x))
|
|
351
|
+
mpz_mod(out, out, prime_pow.pow_mpz_t_tmp(prec))
|
|
352
|
+
elif mpq_sgn(x) == 0:
|
|
353
|
+
mpz_set_ui(out, 0)
|
|
354
|
+
return maxordp
|
|
355
|
+
else:
|
|
356
|
+
denval = mpz_remove(out, mpq_denref(x), prime_pow.prime.value)
|
|
357
|
+
mpz_invert(out, out, prime_pow.pow_mpz_t_tmp(prec))
|
|
358
|
+
if denval == 0:
|
|
359
|
+
numval = mpz_remove(temp.value, mpq_numref(x), prime_pow.prime.value)
|
|
360
|
+
mpz_mul(out, out, temp.value)
|
|
361
|
+
else:
|
|
362
|
+
numval = 0
|
|
363
|
+
mpz_mul(out, out, mpq_numref(x))
|
|
364
|
+
mpz_mod(out, out, prime_pow.pow_mpz_t_tmp(prec))
|
|
365
|
+
return numval - denval
|
|
366
|
+
|
|
367
|
+
cdef inline int cconv_mpq_t_out_shared(mpq_t out, mpz_t x, long valshift, long prec, PowComputer_class prime_pow) except -1:
|
|
368
|
+
"""
|
|
369
|
+
Convert the underlying `p`-adic element into a rational.
|
|
370
|
+
|
|
371
|
+
INPUT:
|
|
372
|
+
|
|
373
|
+
- ``out`` -- gives a rational approximating the input. Currently uses
|
|
374
|
+
rational reconstruction but may change in the future to use a more naive
|
|
375
|
+
method
|
|
376
|
+
- ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element
|
|
377
|
+
- ``valshift`` -- a long giving the power of `p` to shift `x` by
|
|
378
|
+
-` ``prec`` -- a long, the precision of ``x``, used in rational reconstruction
|
|
379
|
+
- ``prime_pow`` -- a PowComputer for the ring
|
|
380
|
+
"""
|
|
381
|
+
try:
|
|
382
|
+
mpq_rational_reconstruction(out, x, prime_pow.pow_mpz_t_tmp(prec))
|
|
383
|
+
except (ArithmeticError, ValueError):
|
|
384
|
+
mpz_set(mpq_numref(out), x)
|
|
385
|
+
mpz_set_ui(mpq_denref(out), 1)
|
|
386
|
+
|
|
387
|
+
# if valshift is nonzero then we start with x as a p-adic unit,
|
|
388
|
+
# so there will be no powers of p in the numerator or denominator
|
|
389
|
+
# and the following operations yield reduced rationals.
|
|
390
|
+
if valshift > 0:
|
|
391
|
+
mpz_mul(mpq_numref(out), mpq_numref(out), prime_pow.pow_mpz_t_tmp(valshift))
|
|
392
|
+
elif valshift < 0:
|
|
393
|
+
mpz_mul(mpq_denref(out), mpq_denref(out), prime_pow.pow_mpz_t_tmp(-valshift))
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
cdef inline int cconv_shared(mpz_t out, x, long prec, long valshift, PowComputer_class prime_pow) except -2:
|
|
397
|
+
"""
|
|
398
|
+
Conversion from other Sage types.
|
|
399
|
+
|
|
400
|
+
INPUT:
|
|
401
|
+
|
|
402
|
+
- ``out`` -- an ``mpz_t`` to store the output
|
|
403
|
+
|
|
404
|
+
- ``x`` -- a Sage element that can be converted to a `p`-adic element
|
|
405
|
+
|
|
406
|
+
- ``prec`` -- a long, giving the precision desired; absolute if
|
|
407
|
+
`valshift = 0`, relative if `valshift != 0`
|
|
408
|
+
|
|
409
|
+
- ``valshift`` -- the power of the uniformizer to divide by before
|
|
410
|
+
storing the result in ``out``
|
|
411
|
+
|
|
412
|
+
- ``prime_pow`` -- a PowComputer for the ring
|
|
413
|
+
"""
|
|
414
|
+
if PyLong_Check(x):
|
|
415
|
+
x = Integer(x)
|
|
416
|
+
elif isinstance(x, pari_gen):
|
|
417
|
+
x = x.sage()
|
|
418
|
+
if isinstance(x, pAdicGenericElement) and x.parent().is_relaxed():
|
|
419
|
+
x = x.lift(valshift + prec)
|
|
420
|
+
elif isinstance(x, pAdicGenericElement) or isinstance(x, sage.rings.finite_rings.integer_mod.IntegerMod_abstract):
|
|
421
|
+
x = x.lift()
|
|
422
|
+
if isinstance(x, Integer):
|
|
423
|
+
if valshift > 0:
|
|
424
|
+
mpz_divexact(out, (<Integer>x).value, prime_pow.pow_mpz_t_tmp(valshift))
|
|
425
|
+
mpz_mod(out, out, prime_pow.pow_mpz_t_tmp(prec))
|
|
426
|
+
elif valshift < 0:
|
|
427
|
+
mpz_mul(out, (<Integer>x).value, prime_pow.pow_mpz_t_tmp(-valshift))
|
|
428
|
+
mpz_mod(out, out, prime_pow.pow_mpz_t_tmp(prec))
|
|
429
|
+
else:
|
|
430
|
+
mpz_mod(out, (<Integer>x).value, prime_pow.pow_mpz_t_tmp(prec))
|
|
431
|
+
elif isinstance(x, Rational):
|
|
432
|
+
if valshift == 0:
|
|
433
|
+
mpz_invert(out, mpq_denref((<Rational>x).value), prime_pow.pow_mpz_t_tmp(prec))
|
|
434
|
+
mpz_mul(out, out, mpq_numref((<Rational>x).value))
|
|
435
|
+
elif valshift < 0:
|
|
436
|
+
mpq_set_z(rat_temp.value, prime_pow.pow_mpz_t_tmp(-valshift))
|
|
437
|
+
mpq_mul(rat_temp.value, rat_temp.value, (<Rational>x).value)
|
|
438
|
+
mpz_invert(out, mpq_denref(rat_temp.value), prime_pow.pow_mpz_t_tmp(prec))
|
|
439
|
+
mpz_mul(out, out, mpq_numref(rat_temp.value))
|
|
440
|
+
else:
|
|
441
|
+
mpz_invert(out, mpq_denref((<Rational>x).value), prime_pow.pow_mpz_t_tmp(prec))
|
|
442
|
+
mpz_divexact(temp.value, mpq_numref((<Rational>x).value), prime_pow.pow_mpz_t_tmp(valshift))
|
|
443
|
+
mpz_mul(out, out, temp.value)
|
|
444
|
+
mpz_mod(out, out, prime_pow.pow_mpz_t_tmp(prec))
|
|
445
|
+
elif isinstance(x, list):
|
|
446
|
+
if valshift == 0:
|
|
447
|
+
if len(x) == 0:
|
|
448
|
+
cconv_shared(out, Integer(0), prec, valshift, prime_pow)
|
|
449
|
+
elif len(x) == 1:
|
|
450
|
+
cconv_shared(out, x[0], prec, valshift, prime_pow)
|
|
451
|
+
else:
|
|
452
|
+
raise NotImplementedError("conversion not implemented from non-prime residue field")
|
|
453
|
+
else:
|
|
454
|
+
raise NotImplementedError
|
|
455
|
+
else:
|
|
456
|
+
raise NotImplementedError("No conversion defined for %s which is a %s in %s" % (x, type(x), x.parent() if hasattr(x, "parent") else "no parent"))
|
|
457
|
+
|
|
458
|
+
cdef inline long cconv_mpz_t_shared(mpz_t out, mpz_t x, long prec, bint absolute, PowComputer_class prime_pow) except -2:
|
|
459
|
+
"""
|
|
460
|
+
A fast pathway for conversion of integers that does not require
|
|
461
|
+
precomputation of the valuation.
|
|
462
|
+
|
|
463
|
+
INPUT:
|
|
464
|
+
|
|
465
|
+
- ``out`` -- an ``mpz_t`` to store the output
|
|
466
|
+
- ``x`` -- an ``mpz_t`` giving the integer to be converted
|
|
467
|
+
- ``prec`` -- a long, giving the precision desired; absolute or
|
|
468
|
+
relative depending on the ``absolute`` input
|
|
469
|
+
- ``absolute`` -- if ``False`` then extracts the valuation and returns
|
|
470
|
+
it, storing the unit in ``out``; if ``True`` then just reduces ``x``
|
|
471
|
+
modulo the precision
|
|
472
|
+
- ``prime_pow`` -- a PowComputer for the ring
|
|
473
|
+
|
|
474
|
+
OUTPUT:
|
|
475
|
+
|
|
476
|
+
- If ``absolute`` is False then returns the valuation that was
|
|
477
|
+
extracted (``maxordp`` when `x = 0`).
|
|
478
|
+
"""
|
|
479
|
+
cdef long val
|
|
480
|
+
if absolute:
|
|
481
|
+
mpz_mod(out, x, prime_pow.pow_mpz_t_tmp(prec))
|
|
482
|
+
elif mpz_sgn(x) == 0:
|
|
483
|
+
mpz_set_ui(out, 0)
|
|
484
|
+
return maxordp
|
|
485
|
+
else:
|
|
486
|
+
val = mpz_remove(out, x, prime_pow.prime.value)
|
|
487
|
+
mpz_mod(out, out, prime_pow.pow_mpz_t_tmp(prec))
|
|
488
|
+
return val
|
|
489
|
+
|
|
490
|
+
cdef inline int cconv_mpz_t_out_shared(mpz_t out, mpz_t x, long valshift, long prec, PowComputer_class prime_pow) except -1:
|
|
491
|
+
"""
|
|
492
|
+
Convert the underlying `p`-adic element into an integer if possible.
|
|
493
|
+
|
|
494
|
+
INPUT:
|
|
495
|
+
|
|
496
|
+
- ``out`` -- stores the resulting integer as an integer between 0
|
|
497
|
+
and `p^{prec + valshift}`
|
|
498
|
+
- ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element
|
|
499
|
+
- ``valshift`` -- a long giving the power of `p` to shift `x` by
|
|
500
|
+
-` ``prec`` -- a long, the precision of ``x``; currently not used
|
|
501
|
+
- ``prime_pow`` -- a PowComputer for the ring
|
|
502
|
+
"""
|
|
503
|
+
if valshift == 0:
|
|
504
|
+
mpz_set(out, x)
|
|
505
|
+
elif valshift < 0:
|
|
506
|
+
raise ValueError("negative valuation")
|
|
507
|
+
else:
|
|
508
|
+
mpz_mul(out, x, prime_pow.pow_mpz_t_tmp(valshift))
|