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,554 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
r"""
|
|
3
|
+
This linkage file implements the padics API using Sage Polynomials.
|
|
4
|
+
|
|
5
|
+
It is included into Polynomial_ram.pxi and Polynomial_unram.pxi,
|
|
6
|
+
where functions that depend on the ramification of the defining polynomial are placed.
|
|
7
|
+
|
|
8
|
+
.. NOTE::
|
|
9
|
+
|
|
10
|
+
There are no doctests in this file since the functions here cannot be
|
|
11
|
+
called directly from Python. Testing of this function is necessarily
|
|
12
|
+
indirect and mostly done through arithmetic black-box tests that are part
|
|
13
|
+
of the test suites of the `p`-adic parents.
|
|
14
|
+
|
|
15
|
+
AUTHORS:
|
|
16
|
+
|
|
17
|
+
- David Roe, Julian Rüth (2017-06-11): initial version
|
|
18
|
+
"""
|
|
19
|
+
#*****************************************************************************
|
|
20
|
+
# Copyright (C) 2017 David Roe <roed.math@gmail.com>
|
|
21
|
+
# 2017 Julian Rüth <julian.rueth@fsfe.org>
|
|
22
|
+
#
|
|
23
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
24
|
+
# as published by the Free Software Foundation; either version 2 of
|
|
25
|
+
# the License, or (at your option) any later version.
|
|
26
|
+
#
|
|
27
|
+
# http://www.gnu.org/licenses/
|
|
28
|
+
#*****************************************************************************
|
|
29
|
+
from cpython.list cimport *
|
|
30
|
+
from sage.rings.integer cimport Integer
|
|
31
|
+
from sage.rings.rational cimport Rational
|
|
32
|
+
from sage.rings.integer_ring import ZZ
|
|
33
|
+
from sage.rings.rational_field import QQ
|
|
34
|
+
from sage.ext.stdsage cimport PY_NEW
|
|
35
|
+
from copy import copy
|
|
36
|
+
from sage.rings.padics.common_conversion cimport cconv_mpz_t_out_shared, cconv_mpz_t_shared, cconv_mpq_t_out_shared, cconv_mpq_t_shared, cconv_shared
|
|
37
|
+
|
|
38
|
+
DEF CELEMENT_IS_PY_OBJECT = True
|
|
39
|
+
|
|
40
|
+
cdef inline int cconstruct(celement value, PowComputer_ prime_pow) except -1:
|
|
41
|
+
r"""
|
|
42
|
+
Construct a new element.
|
|
43
|
+
|
|
44
|
+
INPUT:
|
|
45
|
+
|
|
46
|
+
- ``value`` -- a ``celement`` to be initialized
|
|
47
|
+
|
|
48
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
49
|
+
|
|
50
|
+
.. NOTE::
|
|
51
|
+
|
|
52
|
+
For Polynomial elements, this function calls the ``__init__`` method of
|
|
53
|
+
``celement``. When creating ``celement`` instances, we use ``__new__`` which
|
|
54
|
+
does not call ``__init__``, because of the metaclass that we are using.
|
|
55
|
+
"""
|
|
56
|
+
value.__init__(prime_pow.poly_ring)
|
|
57
|
+
|
|
58
|
+
cdef inline int cdestruct(celement value, PowComputer_ prime_pow) except -1:
|
|
59
|
+
r"""
|
|
60
|
+
Deallocate ``value``.
|
|
61
|
+
|
|
62
|
+
INPUT:
|
|
63
|
+
|
|
64
|
+
- ``value`` -- a ``celement`` to be cleared
|
|
65
|
+
|
|
66
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
67
|
+
|
|
68
|
+
.. NOTE::
|
|
69
|
+
|
|
70
|
+
This function has no effect for polynomials. There is no manual garbage
|
|
71
|
+
collection necessary, as ``celement`` is a managed Python type.
|
|
72
|
+
"""
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
cdef inline int ccmp(celement a, celement b, long prec, bint reduce_a, bint reduce_b, PowComputer_ prime_pow) except -2:
|
|
76
|
+
r"""
|
|
77
|
+
Return the comparison of ``a`` and ``b``.
|
|
78
|
+
|
|
79
|
+
This function returns -1, 0, or 1 for use with ``cmp`` of Python 2. In
|
|
80
|
+
particular, this function return 0 if ``a`` and ``b`` differ by an element
|
|
81
|
+
of valuation at least ``prec``.
|
|
82
|
+
|
|
83
|
+
.. NOTE::
|
|
84
|
+
|
|
85
|
+
You should not rely on whether this function returns -1 or 1 as this
|
|
86
|
+
might not be consistent.
|
|
87
|
+
|
|
88
|
+
INPUT:
|
|
89
|
+
|
|
90
|
+
- ``a`` -- a ``celement``
|
|
91
|
+
|
|
92
|
+
- ``b`` -- a ``celement``
|
|
93
|
+
|
|
94
|
+
- ``prec`` -- a ``long``, the precision to which the comparison should be
|
|
95
|
+
performed
|
|
96
|
+
|
|
97
|
+
- ``reduce_a`` -- whether ``a`` is already reduced with respect to ``prec``
|
|
98
|
+
|
|
99
|
+
- ``reduce_b`` -- whether ``b`` is already reduced with respect to ``prec``
|
|
100
|
+
|
|
101
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
102
|
+
"""
|
|
103
|
+
if not (reduce_a or reduce_b):
|
|
104
|
+
return 0 if a == b else 1
|
|
105
|
+
csub(prime_pow.tmp_ccmp_a, a, b, prec, prime_pow)
|
|
106
|
+
coeffs = prime_pow.tmp_ccmp_a._coeffs
|
|
107
|
+
cdef long i, coeff_prec, break_pt
|
|
108
|
+
if prime_pow.e == 1:
|
|
109
|
+
for i in range(prime_pow.tmp_ccmp_a.degree()+1):
|
|
110
|
+
if coeffs[i] and coeffs[i].valuation() < prec:
|
|
111
|
+
return 1
|
|
112
|
+
else:
|
|
113
|
+
coeff_prec = prec / prime_pow.e + 1
|
|
114
|
+
break_pt = prec % prime_pow.e
|
|
115
|
+
for i in range(len(coeffs)):
|
|
116
|
+
if coeffs[i] and (i < break_pt and coeffs[i].valuation() < coeff_prec or
|
|
117
|
+
i >= break_pt and coeffs[i].valuation() < coeff_prec - 1):
|
|
118
|
+
return 1
|
|
119
|
+
return 0
|
|
120
|
+
|
|
121
|
+
cdef inline long cremove(celement out, celement a, long prec, PowComputer_ prime_pow, bint reduce_relative=False) except -1:
|
|
122
|
+
"""
|
|
123
|
+
Extract the maximum power of the uniformizer dividing this element.
|
|
124
|
+
|
|
125
|
+
INPUT:
|
|
126
|
+
|
|
127
|
+
- ``out`` -- a ``celement`` to store the unit part
|
|
128
|
+
|
|
129
|
+
- ``a`` -- the ``celement`` whose valuation and unit are desired
|
|
130
|
+
|
|
131
|
+
- ``prec`` -- a ``long``, the return value if ``a`` is zero
|
|
132
|
+
|
|
133
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
134
|
+
|
|
135
|
+
- ``reduce_relative`` -- a bint: whether the final result
|
|
136
|
+
should be reduced at precision ``prec`` (case ``False``)
|
|
137
|
+
or ``prec - valuation`` (case ``True``)
|
|
138
|
+
|
|
139
|
+
OUTPUT:
|
|
140
|
+
|
|
141
|
+
The number of times the uniformizer divides ``a``, or ``prec`` if ``a`` is
|
|
142
|
+
zero.
|
|
143
|
+
"""
|
|
144
|
+
if a == 0:
|
|
145
|
+
return prec
|
|
146
|
+
cdef long v = cvaluation(a, prec, prime_pow)
|
|
147
|
+
if reduce_relative:
|
|
148
|
+
cshift_notrunc(out, a, -v, prec-v, prime_pow, True)
|
|
149
|
+
else:
|
|
150
|
+
cshift_notrunc(out, a, -v, prec, prime_pow, True)
|
|
151
|
+
return v
|
|
152
|
+
|
|
153
|
+
cdef inline bint cisunit(celement a, PowComputer_ prime_pow) except -1:
|
|
154
|
+
r"""
|
|
155
|
+
Return whether ``a`` has valuation zero.
|
|
156
|
+
|
|
157
|
+
INPUT:
|
|
158
|
+
|
|
159
|
+
- ``a`` -- the ``celement`` to test
|
|
160
|
+
|
|
161
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
162
|
+
"""
|
|
163
|
+
return cvaluation(a, 1, prime_pow) == 0
|
|
164
|
+
|
|
165
|
+
cdef inline int cneg(celement out, celement a, long prec, PowComputer_ prime_pow) except -1:
|
|
166
|
+
r"""
|
|
167
|
+
Set ``out`` to the negative of ``a``.
|
|
168
|
+
|
|
169
|
+
Note that no reduction is performed.
|
|
170
|
+
|
|
171
|
+
INPUT:
|
|
172
|
+
|
|
173
|
+
- ``out`` -- a ``celement`` to store the negation
|
|
174
|
+
|
|
175
|
+
- ``a`` -- a ``celement`` to be negated
|
|
176
|
+
|
|
177
|
+
- ``prec`` -- a ``long``, the precision
|
|
178
|
+
|
|
179
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
180
|
+
"""
|
|
181
|
+
cdef celement ma = -a
|
|
182
|
+
if ma is a:
|
|
183
|
+
out._coeffs = ma._coeffs[:]
|
|
184
|
+
else:
|
|
185
|
+
out._coeffs = ma._coeffs
|
|
186
|
+
|
|
187
|
+
cdef inline int cadd(celement out, celement a, celement b, long prec, PowComputer_ prime_pow) except -1:
|
|
188
|
+
r"""
|
|
189
|
+
Set ``out`` to the sum of ``a + b``.
|
|
190
|
+
|
|
191
|
+
Note that no reduction is performed.
|
|
192
|
+
|
|
193
|
+
INPUT:
|
|
194
|
+
|
|
195
|
+
- ``out`` -- a ``celement`` to store the sum
|
|
196
|
+
|
|
197
|
+
- ``a`` -- a ``celement``, the first summand
|
|
198
|
+
|
|
199
|
+
- ``b`` -- a ``celement``, the second summand
|
|
200
|
+
|
|
201
|
+
- ``prec`` -- a ``long``, the precision
|
|
202
|
+
|
|
203
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
204
|
+
"""
|
|
205
|
+
cdef celement sm = a + b
|
|
206
|
+
if sm is a or sm is b:
|
|
207
|
+
out._coeffs = sm._coeffs[:]
|
|
208
|
+
else:
|
|
209
|
+
out._coeffs = sm._coeffs
|
|
210
|
+
|
|
211
|
+
cdef inline int csub(celement out, celement a, celement b, long prec, PowComputer_ prime_pow) except -1:
|
|
212
|
+
r"""
|
|
213
|
+
Set ``out`` to the difference of ``a - b``.
|
|
214
|
+
|
|
215
|
+
Note that no reduction is performed.
|
|
216
|
+
|
|
217
|
+
INPUT:
|
|
218
|
+
|
|
219
|
+
- ``out`` -- a ``celement`` to store the difference
|
|
220
|
+
|
|
221
|
+
- ``a`` -- a ``celement``, the first input
|
|
222
|
+
|
|
223
|
+
- ``b`` -- a ``celement``, the second input
|
|
224
|
+
|
|
225
|
+
- ``prec`` -- a ``long``, the precision
|
|
226
|
+
|
|
227
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
228
|
+
"""
|
|
229
|
+
cdef celement df = a - b
|
|
230
|
+
if df is a or df is b:
|
|
231
|
+
out._coeffs = df._coeffs[:]
|
|
232
|
+
else:
|
|
233
|
+
out._coeffs = df._coeffs
|
|
234
|
+
|
|
235
|
+
cdef inline int cmul(celement out, celement a, celement b, long prec, PowComputer_ prime_pow) except -1:
|
|
236
|
+
r"""
|
|
237
|
+
Set ``out`` to the product of ``a*b``.
|
|
238
|
+
|
|
239
|
+
Note that no reduction is performed.
|
|
240
|
+
|
|
241
|
+
INPUT:
|
|
242
|
+
|
|
243
|
+
- ``out`` -- a ``celement`` to store the product
|
|
244
|
+
|
|
245
|
+
- ``a`` -- a ``celement``, the first input
|
|
246
|
+
|
|
247
|
+
- ``b`` -- a ``celement``, the second input
|
|
248
|
+
|
|
249
|
+
- ``prec`` -- a ``long``, the precision
|
|
250
|
+
|
|
251
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
252
|
+
"""
|
|
253
|
+
cdef celement pd = a*b
|
|
254
|
+
if pd is a or pd is b:
|
|
255
|
+
out._coeffs = pd._coeffs[:]
|
|
256
|
+
else:
|
|
257
|
+
out._coeffs = pd._coeffs
|
|
258
|
+
|
|
259
|
+
cdef inline int csetone(celement out, PowComputer_ prime_pow) except -1:
|
|
260
|
+
r"""
|
|
261
|
+
Set ``out`` to 1.
|
|
262
|
+
|
|
263
|
+
INPUT:
|
|
264
|
+
|
|
265
|
+
- ``out`` -- the ``celement`` in which to store 1
|
|
266
|
+
|
|
267
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
268
|
+
"""
|
|
269
|
+
out._coeffs = [prime_pow.base_ring(1)]
|
|
270
|
+
|
|
271
|
+
cdef inline int csetzero(celement out, PowComputer_ prime_pow) except -1:
|
|
272
|
+
r"""
|
|
273
|
+
Set ``out`` to 0.
|
|
274
|
+
|
|
275
|
+
INPUT:
|
|
276
|
+
|
|
277
|
+
- ``out`` -- the ``celement`` in which to store 0
|
|
278
|
+
|
|
279
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
280
|
+
"""
|
|
281
|
+
out._coeffs = []
|
|
282
|
+
|
|
283
|
+
cdef inline bint cisone(celement a, PowComputer_ prime_pow) except -1:
|
|
284
|
+
r"""
|
|
285
|
+
Return whether ``a`` is equal to 1.
|
|
286
|
+
|
|
287
|
+
INPUT:
|
|
288
|
+
|
|
289
|
+
- ``a`` -- the element to test
|
|
290
|
+
|
|
291
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
292
|
+
"""
|
|
293
|
+
return a.is_one()
|
|
294
|
+
|
|
295
|
+
cdef inline bint ciszero(celement a, PowComputer_ prime_pow) except -1:
|
|
296
|
+
r"""
|
|
297
|
+
Return whether ``a`` is equal to 0.
|
|
298
|
+
|
|
299
|
+
INPUT:
|
|
300
|
+
|
|
301
|
+
- ``a`` -- the element to test
|
|
302
|
+
|
|
303
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
304
|
+
"""
|
|
305
|
+
return a.is_zero()
|
|
306
|
+
|
|
307
|
+
cdef inline int ccopy(celement out, celement a, PowComputer_ prime_pow) except -1:
|
|
308
|
+
r"""
|
|
309
|
+
Copy ``a`` into ``out``.
|
|
310
|
+
|
|
311
|
+
INPUT:
|
|
312
|
+
|
|
313
|
+
- ``out`` -- the ``celement`` to store the result
|
|
314
|
+
|
|
315
|
+
- ``a`` -- the element from which to copy
|
|
316
|
+
|
|
317
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
318
|
+
"""
|
|
319
|
+
out._coeffs = a._coeffs[:]
|
|
320
|
+
|
|
321
|
+
cdef inline cpickle(celement a, PowComputer_ prime_pow):
|
|
322
|
+
r"""
|
|
323
|
+
Return a representation of ``a`` for pickling.
|
|
324
|
+
|
|
325
|
+
INPUT:
|
|
326
|
+
|
|
327
|
+
- ``a`` -- the element to pickle
|
|
328
|
+
|
|
329
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
330
|
+
"""
|
|
331
|
+
return a._coeffs
|
|
332
|
+
|
|
333
|
+
cdef inline int cunpickle(celement out, x, PowComputer_ prime_pow) except -1:
|
|
334
|
+
r"""
|
|
335
|
+
Reconstruct from the output of :meth:`cpickle`.
|
|
336
|
+
|
|
337
|
+
INPUT:
|
|
338
|
+
|
|
339
|
+
- ``out`` -- the ``celement`` in which to store the result
|
|
340
|
+
|
|
341
|
+
- ``x`` -- the result of `meth`:cpickle
|
|
342
|
+
|
|
343
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
344
|
+
"""
|
|
345
|
+
out._coeffs = x
|
|
346
|
+
|
|
347
|
+
cdef inline long chash(celement a, long ordp, long prec, PowComputer_ prime_pow) except -1:
|
|
348
|
+
r"""
|
|
349
|
+
Return a hash value for ``a``.
|
|
350
|
+
|
|
351
|
+
INPUT:
|
|
352
|
+
|
|
353
|
+
- ``a`` -- the element to hash
|
|
354
|
+
|
|
355
|
+
- ``ordp`` -- the valuation as a ``long``
|
|
356
|
+
|
|
357
|
+
- ``prec`` -- the precision as a ``long``
|
|
358
|
+
|
|
359
|
+
- ``prime_pow`` -- the ``PowComputer`` for the ring
|
|
360
|
+
"""
|
|
361
|
+
if ciszero(a, prime_pow):
|
|
362
|
+
return 0
|
|
363
|
+
|
|
364
|
+
return hash((a._cache_key(), ordp, prec))
|
|
365
|
+
|
|
366
|
+
cdef int cconv(celement out, x, long prec, long valshift, PowComputer_ prime_pow) except -2:
|
|
367
|
+
r"""
|
|
368
|
+
Convert ``x`` to a `p`-adic element and store it in ``out``.
|
|
369
|
+
|
|
370
|
+
INPUT:
|
|
371
|
+
|
|
372
|
+
- ``out`` -- a ``celement`` to store the output
|
|
373
|
+
|
|
374
|
+
- ``x`` -- a Sage element that can be converted to a `p`-adic element
|
|
375
|
+
|
|
376
|
+
- ``prec`` -- a ``long``, giving the precision desired: absolute if `valshift =
|
|
377
|
+
0`, relative if `valshift > 0`
|
|
378
|
+
|
|
379
|
+
- ``valshift`` -- the power of the uniformizer to divide by before storing
|
|
380
|
+
the result in ``out``
|
|
381
|
+
|
|
382
|
+
- ``prime_pow`` -- a ``PowComputer`` for the ring
|
|
383
|
+
"""
|
|
384
|
+
cdef celement xx, shift
|
|
385
|
+
if valshift < 0:
|
|
386
|
+
if not isinstance(x, list):
|
|
387
|
+
raise NotImplementedError
|
|
388
|
+
# Since our polynomials are stored with ring coefficients, we need to shift the entries of x
|
|
389
|
+
baseshift = -valshift // prime_pow.e
|
|
390
|
+
shifted_x = [c << baseshift for c in x]
|
|
391
|
+
R = prime_pow.poly_ring
|
|
392
|
+
xx = R(shifted_x)
|
|
393
|
+
shift = R([R.base_ring().uniformizer_pow(baseshift)])
|
|
394
|
+
cshift_notrunc(shift, shift, valshift, prec, prime_pow, False)
|
|
395
|
+
else:
|
|
396
|
+
xx = prime_pow.poly_ring(x)
|
|
397
|
+
if xx is x:
|
|
398
|
+
out._coeffs = xx._coeffs[:]
|
|
399
|
+
else:
|
|
400
|
+
out._coeffs = xx._coeffs
|
|
401
|
+
if valshift > 0:
|
|
402
|
+
cshift_notrunc(out, out, -valshift, prec, prime_pow, True)
|
|
403
|
+
elif valshift == 0:
|
|
404
|
+
creduce(out, out, prec, prime_pow)
|
|
405
|
+
elif valshift < 0:
|
|
406
|
+
cdivunit(out, out, shift, prec, prime_pow)
|
|
407
|
+
creduce(out, out, prec, prime_pow)
|
|
408
|
+
|
|
409
|
+
cdef inline long cconv_mpz_t(celement out, mpz_t x, long prec, bint absolute, PowComputer_ prime_pow) except -2:
|
|
410
|
+
r"""
|
|
411
|
+
Set ``out`` to the integer ``x``.
|
|
412
|
+
|
|
413
|
+
This function provides a fast pathway for conversion of integers that
|
|
414
|
+
doesn't require precomputation of the valuation.
|
|
415
|
+
|
|
416
|
+
INPUT:
|
|
417
|
+
|
|
418
|
+
- ``out`` -- a ``celement`` to store the output
|
|
419
|
+
|
|
420
|
+
- ``x`` -- n ``mpz_t`` giving the integer to be converted
|
|
421
|
+
|
|
422
|
+
- ``prec`` -- a ``long``, giving the precision desired: absolute or relative
|
|
423
|
+
depending on the ``absolute`` input
|
|
424
|
+
|
|
425
|
+
- ``absolute`` -- if ``False`` then extracts the valuation and returns it,
|
|
426
|
+
storing the unit in ``out``; if ``True`` then just reduces ``x`` modulo
|
|
427
|
+
the precision.
|
|
428
|
+
|
|
429
|
+
- ``prime_pow`` -- a ``PowComputer`` for the ring
|
|
430
|
+
|
|
431
|
+
OUTPUT:
|
|
432
|
+
|
|
433
|
+
If ``absolute`` is ``False``, the valuation that was extracted (``maxordp``
|
|
434
|
+
when `x = 0`).
|
|
435
|
+
"""
|
|
436
|
+
cdef long valuation = maxordp
|
|
437
|
+
|
|
438
|
+
cdef Integer n = PY_NEW(Integer)
|
|
439
|
+
mpz_set(n.value, x)
|
|
440
|
+
|
|
441
|
+
if n:
|
|
442
|
+
out._coeffs = [prime_pow.base_ring(n)]
|
|
443
|
+
if not absolute:
|
|
444
|
+
valuation = cremove(out, out, prec, prime_pow)
|
|
445
|
+
creduce(out, out, prec, prime_pow)
|
|
446
|
+
else:
|
|
447
|
+
out._coeffs = []
|
|
448
|
+
|
|
449
|
+
return valuation
|
|
450
|
+
|
|
451
|
+
cdef inline int cconv_mpz_t_out(mpz_t out, celement x, long valshift, long prec, PowComputer_ prime_pow) except -1:
|
|
452
|
+
r"""
|
|
453
|
+
Set ``out`` to the integer approximated by ``x``.
|
|
454
|
+
|
|
455
|
+
INPUT:
|
|
456
|
+
|
|
457
|
+
- ``out`` -- stores the resulting integer as an integer between 0 and
|
|
458
|
+
`p^{\mathrm{prec} + \mathrm{valshift}}`
|
|
459
|
+
|
|
460
|
+
- ``x`` -- a ``celement`` giving the underlying `p`-adic element
|
|
461
|
+
|
|
462
|
+
- ``valshift`` -- a ``long`` giving the power of the uniformizer to shift ``x`` by
|
|
463
|
+
|
|
464
|
+
-` ``prec`` -- a ``long``, the precision of ``x`` and ``out``
|
|
465
|
+
|
|
466
|
+
- ``prime_pow`` -- a ``PowComputer`` for the ring
|
|
467
|
+
"""
|
|
468
|
+
cdef Integer n
|
|
469
|
+
|
|
470
|
+
if valshift:
|
|
471
|
+
cshift_notrunc(prime_pow.powhelper_cconv_out, x, -valshift, prec, prime_pow, True)
|
|
472
|
+
else:
|
|
473
|
+
prime_pow.powhelper_cconv_out = x
|
|
474
|
+
|
|
475
|
+
if len(prime_pow.powhelper_cconv_out._coeffs) == 0:
|
|
476
|
+
mpz_set_ui(out, 0)
|
|
477
|
+
elif len(prime_pow.powhelper_cconv_out._coeffs) == 1:
|
|
478
|
+
# recursively let the underlying polynomial convert the constant
|
|
479
|
+
# coefficient to an integer (if possible)
|
|
480
|
+
n = ZZ(prime_pow.powhelper_cconv_out._coeffs[0])
|
|
481
|
+
mpz_set(out, n.value)
|
|
482
|
+
else:
|
|
483
|
+
raise ValueError("cannot convert to integer")
|
|
484
|
+
|
|
485
|
+
cdef inline long cconv_mpq_t(celement out, mpq_t x, long prec, bint absolute, PowComputer_ prime_pow) except? -10000:
|
|
486
|
+
r"""
|
|
487
|
+
Set ``out`` to the rational ``x``.
|
|
488
|
+
|
|
489
|
+
A fast pathway for conversion of rationals that doesn't require
|
|
490
|
+
precomputation of the valuation.
|
|
491
|
+
|
|
492
|
+
INPUT:
|
|
493
|
+
|
|
494
|
+
- ``out`` -- a ``celement`` to store the output
|
|
495
|
+
|
|
496
|
+
- ``x`` -- an ``mpq_t`` giving the rational to be converted
|
|
497
|
+
|
|
498
|
+
- ``prec`` -- a ``long``, giving the precision desired: absolute or relative
|
|
499
|
+
depending on ``absolute``
|
|
500
|
+
|
|
501
|
+
- ``absolute`` -- if ``False`` then extracts the valuation and returns it,
|
|
502
|
+
storing the unit in ``out``; if ``True`` then just reduces ``x`` modulo the
|
|
503
|
+
precision.
|
|
504
|
+
|
|
505
|
+
- ``prime_pow`` -- a ``PowComputer`` for the ring
|
|
506
|
+
|
|
507
|
+
OUTPUT:
|
|
508
|
+
|
|
509
|
+
If ``absolute`` is ``False``, the valuation that was extracted (``maxordp``
|
|
510
|
+
when `x = 0`)
|
|
511
|
+
"""
|
|
512
|
+
cdef Rational r = PY_NEW(Rational)
|
|
513
|
+
mpq_set(r.value, x)
|
|
514
|
+
out._coeffs = [prime_pow.base_ring(r)]
|
|
515
|
+
|
|
516
|
+
if not absolute:
|
|
517
|
+
return cremove(out, out, prec, prime_pow)
|
|
518
|
+
creduce(out, out, prec, prime_pow)
|
|
519
|
+
|
|
520
|
+
cdef inline int cconv_mpq_t_out(mpq_t out, celement x, long valshift, long prec, PowComputer_ prime_pow) except -1:
|
|
521
|
+
r"""
|
|
522
|
+
Set ``out`` to the rational approximated by ``x``.
|
|
523
|
+
|
|
524
|
+
INPUT:
|
|
525
|
+
|
|
526
|
+
- ``out`` -- set to a rational approximating the input. Currently uses
|
|
527
|
+
rational reconstruction but may change in the future to use a more naive
|
|
528
|
+
method.
|
|
529
|
+
|
|
530
|
+
- ``x`` -- a ``celement``, the element to convert
|
|
531
|
+
|
|
532
|
+
- ``valshift`` -- a ``long`` giving the power of the uniformizer to shift `x`
|
|
533
|
+
by before converting
|
|
534
|
+
|
|
535
|
+
- ``prec`` -- a long, the precision of ``x``; ignored
|
|
536
|
+
|
|
537
|
+
- ``prime_pow`` -- a ``PowComputer`` for the ring
|
|
538
|
+
"""
|
|
539
|
+
cdef Rational c
|
|
540
|
+
|
|
541
|
+
if valshift:
|
|
542
|
+
cshift_notrunc(prime_pow.powhelper_cconv_out, x, -valshift, prec, prime_pow, True)
|
|
543
|
+
else:
|
|
544
|
+
prime_pow.powhelper_cconv_out = x
|
|
545
|
+
|
|
546
|
+
if len(prime_pow.powhelper_cconv_out._coeffs) == 0:
|
|
547
|
+
mpq_set_ui(out, 0, 1)
|
|
548
|
+
elif len(prime_pow.powhelper_cconv_out._coeffs) == 1:
|
|
549
|
+
# recursively let the underlying polynomial convert the constant
|
|
550
|
+
# coefficient to a rational (if possible)
|
|
551
|
+
c = QQ(prime_pow.powhelper_cconv_out._coeffs[0])
|
|
552
|
+
mpq_set(out, c.value)
|
|
553
|
+
else:
|
|
554
|
+
raise ValueError("cannot convert to rational")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|