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,614 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
# sage.doctest: needs sage.rings.padics
|
|
3
|
+
"""
|
|
4
|
+
`p`-adic Capped Relative Elements
|
|
5
|
+
|
|
6
|
+
Elements of `p`-adic Rings with Capped Relative Precision
|
|
7
|
+
|
|
8
|
+
AUTHORS:
|
|
9
|
+
|
|
10
|
+
- David Roe: initial version, rewriting to use templates (2012-3-1)
|
|
11
|
+
- Genya Zaytman: documentation
|
|
12
|
+
- David Harvey: doctests
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
#*****************************************************************************
|
|
16
|
+
# Copyright (C) 2007-2013 David Roe <roed.math@gmail.com>
|
|
17
|
+
# William Stein <wstein@gmail.com>
|
|
18
|
+
#
|
|
19
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
20
|
+
# as published by the Free Software Foundation; either version 2 of
|
|
21
|
+
# the License, or (at your option) any later version.
|
|
22
|
+
#
|
|
23
|
+
# http://www.gnu.org/licenses/
|
|
24
|
+
#*****************************************************************************
|
|
25
|
+
|
|
26
|
+
include "sage/libs/linkages/padics/mpz.pxi"
|
|
27
|
+
include "CR_template.pxi"
|
|
28
|
+
|
|
29
|
+
from sage.libs.pari import pari
|
|
30
|
+
from sage.libs.pari.convert_gmp cimport new_gen_from_padic
|
|
31
|
+
from sage.rings.finite_rings.integer_mod import Mod
|
|
32
|
+
from sage.rings.padics.pow_computer cimport PowComputer_class
|
|
33
|
+
|
|
34
|
+
cdef extern from "transcendantal.c":
|
|
35
|
+
cdef void padiclog(mpz_t ans, const mpz_t a, unsigned long p, unsigned long prec, const mpz_t modulo)
|
|
36
|
+
cdef void padicexp(mpz_t ans, const mpz_t a, unsigned long p, unsigned long prec, const mpz_t modulo)
|
|
37
|
+
cdef void padicexp_Newton(mpz_t ans, const mpz_t a, unsigned long p, unsigned long prec, unsigned long precinit, const mpz_t modulo)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
cdef class PowComputer_(PowComputer_base):
|
|
41
|
+
"""
|
|
42
|
+
A PowComputer for a capped-relative `p`-adic ring or field.
|
|
43
|
+
"""
|
|
44
|
+
def __init__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field):
|
|
45
|
+
"""
|
|
46
|
+
Initialization.
|
|
47
|
+
|
|
48
|
+
EXAMPLES::
|
|
49
|
+
|
|
50
|
+
sage: R = ZpCR(5)
|
|
51
|
+
sage: type(R.prime_pow)
|
|
52
|
+
<class 'sage.rings.padics.padic_capped_relative_element.PowComputer_'>
|
|
53
|
+
sage: R.prime_pow._prec_type
|
|
54
|
+
'capped-rel'
|
|
55
|
+
"""
|
|
56
|
+
self._prec_type = 'capped-rel'
|
|
57
|
+
PowComputer_base.__init__(self, prime, cache_limit, prec_cap, ram_prec_cap, in_field)
|
|
58
|
+
|
|
59
|
+
cdef class pAdicCappedRelativeElement(CRElement):
|
|
60
|
+
"""
|
|
61
|
+
Construct new element with given parent and value.
|
|
62
|
+
|
|
63
|
+
INPUT:
|
|
64
|
+
|
|
65
|
+
- ``x`` -- value to coerce into a capped relative ring or field
|
|
66
|
+
|
|
67
|
+
- ``absprec`` -- maximum number of digits of absolute precision
|
|
68
|
+
|
|
69
|
+
- ``relprec`` -- maximum number of digits of relative precision
|
|
70
|
+
|
|
71
|
+
EXAMPLES::
|
|
72
|
+
|
|
73
|
+
sage: R = Zp(5, 10, 'capped-rel')
|
|
74
|
+
|
|
75
|
+
Construct from integers::
|
|
76
|
+
|
|
77
|
+
sage: R(3)
|
|
78
|
+
3 + O(5^10)
|
|
79
|
+
sage: R(75)
|
|
80
|
+
3*5^2 + O(5^12)
|
|
81
|
+
sage: R(0)
|
|
82
|
+
0
|
|
83
|
+
sage: R(-1)
|
|
84
|
+
4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)
|
|
85
|
+
sage: R(-5)
|
|
86
|
+
4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + 4*5^10 + O(5^11)
|
|
87
|
+
sage: R(-7*25)
|
|
88
|
+
3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + 4*5^10 + 4*5^11 + O(5^12)
|
|
89
|
+
|
|
90
|
+
Construct from rationals::
|
|
91
|
+
|
|
92
|
+
sage: R(1/2)
|
|
93
|
+
3 + 2*5 + 2*5^2 + 2*5^3 + 2*5^4 + 2*5^5 + 2*5^6 + 2*5^7 + 2*5^8 + 2*5^9 + O(5^10)
|
|
94
|
+
sage: R(-7875/874)
|
|
95
|
+
3*5^3 + 2*5^4 + 2*5^5 + 5^6 + 3*5^7 + 2*5^8 + 3*5^10 + 3*5^11 + 3*5^12 + O(5^13)
|
|
96
|
+
sage: R(15/425)
|
|
97
|
+
Traceback (most recent call last):
|
|
98
|
+
...
|
|
99
|
+
ValueError: p divides the denominator
|
|
100
|
+
|
|
101
|
+
Construct from IntegerMod::
|
|
102
|
+
|
|
103
|
+
sage: R(Integers(125)(3))
|
|
104
|
+
3 + O(5^3)
|
|
105
|
+
sage: R(Integers(5)(3))
|
|
106
|
+
3 + O(5)
|
|
107
|
+
sage: R(Integers(5^30)(3))
|
|
108
|
+
3 + O(5^10)
|
|
109
|
+
sage: R(Integers(5^30)(1+5^23))
|
|
110
|
+
1 + O(5^10)
|
|
111
|
+
sage: R(Integers(49)(3))
|
|
112
|
+
Traceback (most recent call last):
|
|
113
|
+
...
|
|
114
|
+
TypeError: p does not divide modulus 49
|
|
115
|
+
|
|
116
|
+
::
|
|
117
|
+
|
|
118
|
+
sage: R(Integers(48)(3))
|
|
119
|
+
Traceback (most recent call last):
|
|
120
|
+
...
|
|
121
|
+
TypeError: p does not divide modulus 48
|
|
122
|
+
|
|
123
|
+
Some other conversions::
|
|
124
|
+
|
|
125
|
+
sage: R(R(5))
|
|
126
|
+
5 + O(5^11)
|
|
127
|
+
|
|
128
|
+
Construct from Pari objects::
|
|
129
|
+
|
|
130
|
+
sage: R = Zp(5)
|
|
131
|
+
sage: x = pari(123123) ; R(x) # needs sage.libs.pari
|
|
132
|
+
3 + 4*5 + 4*5^2 + 4*5^3 + 5^4 + 4*5^5 + 2*5^6 + 5^7 + O(5^20)
|
|
133
|
+
sage: R(pari(R(5252)))
|
|
134
|
+
2 + 2*5^3 + 3*5^4 + 5^5 + O(5^20)
|
|
135
|
+
sage: R = Zp(5,prec=5)
|
|
136
|
+
sage: R(pari(-1))
|
|
137
|
+
4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + O(5^5)
|
|
138
|
+
sage: pari(R(-1)) # needs sage.libs.pari
|
|
139
|
+
4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + O(5^5)
|
|
140
|
+
sage: pari(R(0)) # needs sage.libs.pari
|
|
141
|
+
0
|
|
142
|
+
sage: R(pari(R(0,5)))
|
|
143
|
+
O(5^5)
|
|
144
|
+
|
|
145
|
+
.. TODO:: doctests for converting from other types of `p`-adic rings
|
|
146
|
+
"""
|
|
147
|
+
def lift(self):
|
|
148
|
+
r"""
|
|
149
|
+
Return an integer or rational congruent to ``self`` modulo ``self``'s
|
|
150
|
+
precision. If a rational is returned, its denominator will equal
|
|
151
|
+
``p^ordp(self)``.
|
|
152
|
+
|
|
153
|
+
EXAMPLES::
|
|
154
|
+
|
|
155
|
+
sage: R = Zp(7,4,'capped-rel'); a = R(8); a.lift()
|
|
156
|
+
8
|
|
157
|
+
sage: R = Qp(7,4); a = R(8); a.lift()
|
|
158
|
+
8
|
|
159
|
+
sage: R = Qp(7,4); a = R(8/7); a.lift()
|
|
160
|
+
8/7
|
|
161
|
+
"""
|
|
162
|
+
return self.lift_c()
|
|
163
|
+
|
|
164
|
+
cdef lift_c(self):
|
|
165
|
+
"""
|
|
166
|
+
Implementation of lift.
|
|
167
|
+
|
|
168
|
+
TESTS::
|
|
169
|
+
|
|
170
|
+
sage: O(5^5).lift() # indirect doctest
|
|
171
|
+
0
|
|
172
|
+
sage: R = Qp(5); R(0).lift()
|
|
173
|
+
0
|
|
174
|
+
sage: R(5/9).lift()
|
|
175
|
+
264909532335070
|
|
176
|
+
sage: R(9/5).lift()
|
|
177
|
+
9/5
|
|
178
|
+
"""
|
|
179
|
+
cdef Integer ans
|
|
180
|
+
cdef Rational ansr
|
|
181
|
+
if self.ordp >= 0:
|
|
182
|
+
ans = PY_NEW(Integer)
|
|
183
|
+
if self.relprec == 0:
|
|
184
|
+
mpz_set_ui(ans.value, 0)
|
|
185
|
+
else:
|
|
186
|
+
mpz_set(ans.value, self.unit)
|
|
187
|
+
mpz_mul(ans.value, ans.value, self.prime_pow.pow_mpz_t_tmp(self.ordp))
|
|
188
|
+
return ans
|
|
189
|
+
else:
|
|
190
|
+
ansr = Rational.__new__(Rational)
|
|
191
|
+
if self.relprec == 0:
|
|
192
|
+
mpq_set_si(ansr.value, 0, 1)
|
|
193
|
+
return self
|
|
194
|
+
else:
|
|
195
|
+
mpz_set(mpq_numref(ansr.value), self.unit)
|
|
196
|
+
mpz_set(mpq_denref(ansr.value), self.prime_pow.pow_mpz_t_tmp(-self.ordp))
|
|
197
|
+
return ansr
|
|
198
|
+
|
|
199
|
+
def __pari__(self):
|
|
200
|
+
"""
|
|
201
|
+
Convert this element to an equivalent pari element.
|
|
202
|
+
|
|
203
|
+
EXAMPLES::
|
|
204
|
+
|
|
205
|
+
sage: R = Zp(17, 10); a = ~R(14); pari(a) # indirect doctest
|
|
206
|
+
11 + 3*17 + 17^2 + 6*17^3 + 13*17^4 + 15*17^5 + 10*17^6 + 3*17^7 + 17^8 + 6*17^9 + O(17^10)
|
|
207
|
+
sage: pari(R(0)) # needs sage.libs.pari
|
|
208
|
+
0
|
|
209
|
+
sage: pari(R(0,5)) # needs sage.libs.pari
|
|
210
|
+
O(17^5)
|
|
211
|
+
"""
|
|
212
|
+
return self._to_gen()
|
|
213
|
+
|
|
214
|
+
cdef pari_gen _to_gen(self):
|
|
215
|
+
"""
|
|
216
|
+
Convert this element to an equivalent pari element.
|
|
217
|
+
|
|
218
|
+
EXAMPLES::
|
|
219
|
+
|
|
220
|
+
sage: R = Zp(5, 10); a = R(17); pari(a) # indirect doctest
|
|
221
|
+
2 + 3*5 + O(5^10)
|
|
222
|
+
sage: pari(R(0)) # needs sage.libs.pari
|
|
223
|
+
0
|
|
224
|
+
sage: pari(R(0,5)) # needs sage.libs.pari
|
|
225
|
+
O(5^5)
|
|
226
|
+
sage: pari(R(0,5)).debug() # needs sage.libs.pari
|
|
227
|
+
[&=...] PADIC(lg=5):... (precp=0,valp=5):... ... ... ...
|
|
228
|
+
p : [&=...] INT(lg=3):... (+,lgefint=3):... ...
|
|
229
|
+
p^l : [&=...] INT(lg=3):... (+,lgefint=3):... ...
|
|
230
|
+
I : gen_0
|
|
231
|
+
"""
|
|
232
|
+
if exactzero(self.ordp):
|
|
233
|
+
return pari.zero()
|
|
234
|
+
else:
|
|
235
|
+
return new_gen_from_padic(self.ordp, self.relprec,
|
|
236
|
+
self.prime_pow.prime.value,
|
|
237
|
+
self.prime_pow.pow_mpz_t_tmp(self.relprec),
|
|
238
|
+
self.unit)
|
|
239
|
+
|
|
240
|
+
def _integer_(self, Z=None):
|
|
241
|
+
r"""
|
|
242
|
+
Return an integer congruent to this element modulo
|
|
243
|
+
``p^self.absolute_precision()``.
|
|
244
|
+
|
|
245
|
+
EXAMPLES::
|
|
246
|
+
|
|
247
|
+
sage: R = Zp(5); a = R(-1); a._integer_()
|
|
248
|
+
95367431640624
|
|
249
|
+
"""
|
|
250
|
+
if self.ordp < 0:
|
|
251
|
+
raise ValueError("cannot form an integer out of a p-adic field element with negative valuation")
|
|
252
|
+
return self.lift_c()
|
|
253
|
+
|
|
254
|
+
def residue(self, absprec=1, field=None, check_prec=True):
|
|
255
|
+
r"""
|
|
256
|
+
Reduce this element modulo `p^{\mathrm{absprec}}`.
|
|
257
|
+
|
|
258
|
+
INPUT:
|
|
259
|
+
|
|
260
|
+
- ``absprec`` -- nonnegative integer (default: 1)
|
|
261
|
+
|
|
262
|
+
- ``field`` -- boolean (default: ``None``); whether to return an element
|
|
263
|
+
of `\GF{p}` or `\ZZ / p\ZZ`
|
|
264
|
+
|
|
265
|
+
- ``check_prec`` -- boolean (default: ``True``); whether to raise
|
|
266
|
+
an error if this element has insufficient precision to determine
|
|
267
|
+
the reduction
|
|
268
|
+
|
|
269
|
+
OUTPUT:
|
|
270
|
+
|
|
271
|
+
This element reduced modulo `p^\mathrm{absprec}` as an element of
|
|
272
|
+
`\ZZ/p^\mathrm{absprec}\ZZ`.
|
|
273
|
+
|
|
274
|
+
EXAMPLES::
|
|
275
|
+
|
|
276
|
+
sage: R = Zp(7,4)
|
|
277
|
+
sage: a = R(8)
|
|
278
|
+
sage: a.residue(1)
|
|
279
|
+
1
|
|
280
|
+
|
|
281
|
+
This is different from applying ``% p^n`` which returns an element in
|
|
282
|
+
the same ring::
|
|
283
|
+
|
|
284
|
+
sage: b = a.residue(2); b
|
|
285
|
+
8
|
|
286
|
+
sage: b.parent()
|
|
287
|
+
Ring of integers modulo 49
|
|
288
|
+
sage: c = a % 7^2; c
|
|
289
|
+
1 + 7 + O(7^4)
|
|
290
|
+
sage: c.parent()
|
|
291
|
+
7-adic Ring with capped relative precision 4
|
|
292
|
+
|
|
293
|
+
For elements in a field, application of ``% p^n`` always returns
|
|
294
|
+
zero, the remainder of the division by ``p^n``::
|
|
295
|
+
|
|
296
|
+
sage: K = Qp(7,4)
|
|
297
|
+
sage: a = K(8)
|
|
298
|
+
sage: a.residue(2)
|
|
299
|
+
8
|
|
300
|
+
sage: a % 7^2
|
|
301
|
+
1 + 7 + O(7^4)
|
|
302
|
+
|
|
303
|
+
sage: b = K(1/7)
|
|
304
|
+
sage: b.residue()
|
|
305
|
+
Traceback (most recent call last):
|
|
306
|
+
...
|
|
307
|
+
ValueError: element must have nonnegative valuation in order to compute residue
|
|
308
|
+
|
|
309
|
+
TESTS::
|
|
310
|
+
|
|
311
|
+
sage: R = Zp(7,4)
|
|
312
|
+
sage: a = R(8)
|
|
313
|
+
sage: a.residue(0)
|
|
314
|
+
0
|
|
315
|
+
sage: a.residue(-1)
|
|
316
|
+
Traceback (most recent call last):
|
|
317
|
+
...
|
|
318
|
+
ValueError: cannot reduce modulo a negative power of p
|
|
319
|
+
sage: a.residue(5)
|
|
320
|
+
Traceback (most recent call last):
|
|
321
|
+
...
|
|
322
|
+
PrecisionError: not enough precision known in order to compute residue
|
|
323
|
+
sage: a.residue(5, check_prec=False)
|
|
324
|
+
8
|
|
325
|
+
|
|
326
|
+
sage: a.residue(field=True).parent()
|
|
327
|
+
Finite Field of size 7
|
|
328
|
+
|
|
329
|
+
.. SEEALSO::
|
|
330
|
+
|
|
331
|
+
:meth:`_mod_`
|
|
332
|
+
"""
|
|
333
|
+
cdef Integer selfvalue, modulus
|
|
334
|
+
cdef long aprec
|
|
335
|
+
if not isinstance(absprec, Integer):
|
|
336
|
+
absprec = Integer(absprec)
|
|
337
|
+
if check_prec and absprec > self.precision_absolute():
|
|
338
|
+
raise PrecisionError("not enough precision known in order to compute residue")
|
|
339
|
+
elif absprec < 0:
|
|
340
|
+
raise ValueError("cannot reduce modulo a negative power of p")
|
|
341
|
+
if self.ordp < 0:
|
|
342
|
+
raise ValueError("element must have nonnegative valuation in order to compute residue")
|
|
343
|
+
if field is None:
|
|
344
|
+
field = (absprec == 1)
|
|
345
|
+
elif field and absprec != 1:
|
|
346
|
+
raise ValueError("field keyword may only be set at precision 1")
|
|
347
|
+
modulus = PY_NEW(Integer)
|
|
348
|
+
aprec = mpz_get_ui((<Integer>absprec).value)
|
|
349
|
+
mpz_set(modulus.value, self.prime_pow.pow_mpz_t_tmp(aprec))
|
|
350
|
+
selfvalue = PY_NEW(Integer)
|
|
351
|
+
if self.relprec == 0:
|
|
352
|
+
mpz_set_ui(selfvalue.value, 0)
|
|
353
|
+
else:
|
|
354
|
+
# Need to do this better.
|
|
355
|
+
mpz_mul(selfvalue.value, self.prime_pow.pow_mpz_t_tmp(self.ordp), self.unit)
|
|
356
|
+
if field:
|
|
357
|
+
from sage.rings.finite_rings.finite_field_constructor import GF
|
|
358
|
+
return GF(self.parent().prime())(selfvalue)
|
|
359
|
+
else:
|
|
360
|
+
return Mod(selfvalue, modulus)
|
|
361
|
+
|
|
362
|
+
def _log_binary_splitting(self, aprec, mina=0):
|
|
363
|
+
r"""
|
|
364
|
+
Return ``\log(self)`` for ``self`` equal to 1 in the residue field.
|
|
365
|
+
|
|
366
|
+
This is a helper method for :meth:`log`.
|
|
367
|
+
It uses a fast binary splitting algorithm.
|
|
368
|
+
|
|
369
|
+
INPUT:
|
|
370
|
+
|
|
371
|
+
- ``aprec`` -- integer; the precision to which the result is
|
|
372
|
+
correct; ``aprec`` must not exceed the precision cap of the ring over
|
|
373
|
+
which this element is defined
|
|
374
|
+
- ``mina`` -- integer (default: 0); the series will check `n` up to
|
|
375
|
+
this valuation (and beyond) to see if they can contribute to the
|
|
376
|
+
series
|
|
377
|
+
|
|
378
|
+
.. NOTE::
|
|
379
|
+
|
|
380
|
+
The function does not check that its argument ``self`` is
|
|
381
|
+
1 in the residue field. If this assumption is not fulfilled
|
|
382
|
+
the behaviour of the function is not specified.
|
|
383
|
+
|
|
384
|
+
ALGORITHM:
|
|
385
|
+
|
|
386
|
+
1. Raise `u` to the power `p^v` for a suitable `v` in order
|
|
387
|
+
to make it closer to 1. (`v` is chosen such that `p^v` is
|
|
388
|
+
close to the precision.)
|
|
389
|
+
|
|
390
|
+
2. Write
|
|
391
|
+
|
|
392
|
+
.. MATH::
|
|
393
|
+
|
|
394
|
+
u^{p-1} = \prod_{i=1}^\infty (1 - a_i p^{(v+1)*2^i})
|
|
395
|
+
|
|
396
|
+
with `0 \leq a_i < p^{(v+1)*2^i}` and compute
|
|
397
|
+
`\log(1 - a_i p^{(v+1)*2^i})` using the standard Taylor expansion
|
|
398
|
+
|
|
399
|
+
.. MATH::
|
|
400
|
+
|
|
401
|
+
\log(1 - x) = -x - 1/2 x^2 - 1/3 x^3 - 1/4 x^4 - 1/5 x^5 - \cdots
|
|
402
|
+
|
|
403
|
+
together with a binary splitting method.
|
|
404
|
+
|
|
405
|
+
3. Divide the result by `p^v`
|
|
406
|
+
|
|
407
|
+
The complexity of this algorithm is quasi-linear.
|
|
408
|
+
|
|
409
|
+
EXAMPLES::
|
|
410
|
+
|
|
411
|
+
sage: r = Qp(5,prec=4)(6)
|
|
412
|
+
sage: r._log_binary_splitting(2)
|
|
413
|
+
5 + O(5^2)
|
|
414
|
+
sage: r._log_binary_splitting(4)
|
|
415
|
+
5 + 2*5^2 + 4*5^3 + O(5^4)
|
|
416
|
+
sage: r._log_binary_splitting(100)
|
|
417
|
+
5 + 2*5^2 + 4*5^3 + O(5^4)
|
|
418
|
+
|
|
419
|
+
sage: r = Zp(5,prec=4,type='fixed-mod')(6)
|
|
420
|
+
sage: r._log_binary_splitting(5)
|
|
421
|
+
5 + 2*5^2 + 4*5^3
|
|
422
|
+
"""
|
|
423
|
+
cdef unsigned long p
|
|
424
|
+
cdef unsigned long prec = min(aprec, self.relprec)
|
|
425
|
+
cdef pAdicCappedRelativeElement ans
|
|
426
|
+
|
|
427
|
+
if mpz_fits_slong_p(self.prime_pow.prime.value) == 0:
|
|
428
|
+
raise NotImplementedError("the prime %s does not fit in a long" % self.prime_pow.prime)
|
|
429
|
+
p = self.prime_pow.prime
|
|
430
|
+
|
|
431
|
+
ans = self._new_c()
|
|
432
|
+
ans.ordp = 0
|
|
433
|
+
ans.relprec = prec
|
|
434
|
+
sig_on()
|
|
435
|
+
padiclog(ans.unit, self.unit, p, prec, self.prime_pow.pow_mpz_t_tmp(prec))
|
|
436
|
+
sig_off()
|
|
437
|
+
ans._normalize()
|
|
438
|
+
|
|
439
|
+
return ans
|
|
440
|
+
|
|
441
|
+
def _exp_binary_splitting(self, aprec):
|
|
442
|
+
r"""
|
|
443
|
+
Compute the exponential power series of this element.
|
|
444
|
+
|
|
445
|
+
This is a helper method for :meth:`exp`.
|
|
446
|
+
|
|
447
|
+
INPUT:
|
|
448
|
+
|
|
449
|
+
- ``aprec`` -- integer; the precision to which to compute the
|
|
450
|
+
exponential
|
|
451
|
+
|
|
452
|
+
.. NOTE::
|
|
453
|
+
|
|
454
|
+
The function does not check that its argument ``self`` is
|
|
455
|
+
the disk of convergence of ``exp``. If this assumption is not
|
|
456
|
+
fulfilled the behaviour of the function is not specified.
|
|
457
|
+
|
|
458
|
+
ALGORITHM:
|
|
459
|
+
|
|
460
|
+
Write
|
|
461
|
+
|
|
462
|
+
.. MATH::
|
|
463
|
+
|
|
464
|
+
self = \sum_{i=1}^\infty a_i p^{2^i}
|
|
465
|
+
|
|
466
|
+
with `0 \leq a_i < p^{2^i}` and compute
|
|
467
|
+
`\exp(a_i p^{2^i})` using the standard Taylor expansion
|
|
468
|
+
|
|
469
|
+
.. MATH::
|
|
470
|
+
|
|
471
|
+
\exp(x) = 1 + x + x^2/2 + x^3/6 + x^4/24 + \cdots
|
|
472
|
+
|
|
473
|
+
together with a binary splitting method.
|
|
474
|
+
|
|
475
|
+
The binary complexity of this algorithm is quasi-linear.
|
|
476
|
+
|
|
477
|
+
EXAMPLES::
|
|
478
|
+
|
|
479
|
+
sage: R = Zp(7,5)
|
|
480
|
+
sage: x = R(7)
|
|
481
|
+
sage: x.exp(algorithm='binary_splitting') # indirect doctest
|
|
482
|
+
1 + 7 + 4*7^2 + 2*7^3 + O(7^5)
|
|
483
|
+
"""
|
|
484
|
+
cdef unsigned long p
|
|
485
|
+
cdef unsigned long prec = aprec
|
|
486
|
+
cdef pAdicCappedRelativeElement ans
|
|
487
|
+
cdef Integer selfint = self.lift_c()
|
|
488
|
+
|
|
489
|
+
if mpz_fits_slong_p(self.prime_pow.prime.value) == 0:
|
|
490
|
+
raise NotImplementedError("the prime %s does not fit in a long" % self.prime_pow.prime)
|
|
491
|
+
p = self.prime_pow.prime
|
|
492
|
+
|
|
493
|
+
ans = self._new_c()
|
|
494
|
+
ans.ordp = 0
|
|
495
|
+
ans.relprec = prec
|
|
496
|
+
sig_on()
|
|
497
|
+
padicexp(ans.unit, selfint.value, p, prec, self.prime_pow.pow_mpz_t_tmp(prec))
|
|
498
|
+
sig_off()
|
|
499
|
+
|
|
500
|
+
return ans
|
|
501
|
+
|
|
502
|
+
def _exp_newton(self, aprec, log_algorithm=None):
|
|
503
|
+
r"""
|
|
504
|
+
Compute the exponential power series of this element.
|
|
505
|
+
|
|
506
|
+
This is a helper method for :meth:`exp`.
|
|
507
|
+
|
|
508
|
+
INPUT:
|
|
509
|
+
|
|
510
|
+
- ``aprec`` -- integer; the precision to which to compute the
|
|
511
|
+
exponential
|
|
512
|
+
|
|
513
|
+
- ``log_algorithm`` -- (default: ``None``) the algorithm used for
|
|
514
|
+
computing the logarithm; this attribute is passed to the :meth:`log`
|
|
515
|
+
method. See :meth:`log` for more details about the possible
|
|
516
|
+
algorithms.
|
|
517
|
+
|
|
518
|
+
.. NOTE::
|
|
519
|
+
|
|
520
|
+
The function does not check that its argument ``self`` is
|
|
521
|
+
the disk of convergence of ``exp``. If this assumption is not
|
|
522
|
+
fulfilled the behaviour of the function is not specified.
|
|
523
|
+
|
|
524
|
+
ALGORITHM:
|
|
525
|
+
|
|
526
|
+
Solve the equation `\log(x) = self` using the Newton scheme::
|
|
527
|
+
|
|
528
|
+
.. MATH::
|
|
529
|
+
|
|
530
|
+
x_{i+1} = x_i \cdot (1 + self - \log(x_i))
|
|
531
|
+
|
|
532
|
+
The binary complexity of this algorithm is roughly the same
|
|
533
|
+
than that of the computation of the logarithm.
|
|
534
|
+
|
|
535
|
+
EXAMPLES::
|
|
536
|
+
|
|
537
|
+
sage: # needs sage.libs.ntl
|
|
538
|
+
sage: R.<w> = Zq(7^2,5)
|
|
539
|
+
sage: x = R(7*w)
|
|
540
|
+
sage: x.exp(algorithm='newton') # indirect doctest
|
|
541
|
+
1 + w*7 + (4*w + 2)*7^2 + (w + 6)*7^3 + 5*7^4 + O(7^5)
|
|
542
|
+
"""
|
|
543
|
+
cdef unsigned long p
|
|
544
|
+
cdef unsigned long prec = aprec
|
|
545
|
+
cdef pAdicCappedRelativeElement ans
|
|
546
|
+
cdef Integer selfint = self.lift_c()
|
|
547
|
+
|
|
548
|
+
if mpz_fits_slong_p(self.prime_pow.prime.value) == 0:
|
|
549
|
+
raise NotImplementedError("the prime %s does not fit in a long" % self.prime_pow.prime)
|
|
550
|
+
p = self.prime_pow.prime
|
|
551
|
+
|
|
552
|
+
ans = self._new_c()
|
|
553
|
+
ans.ordp = 0
|
|
554
|
+
ans.relprec = prec
|
|
555
|
+
mpz_set_ui(ans.unit, 1)
|
|
556
|
+
sig_on()
|
|
557
|
+
if p == 2:
|
|
558
|
+
padicexp_Newton(ans.unit, selfint.value, p, prec, 2, self.prime_pow.pow_mpz_t_tmp(prec))
|
|
559
|
+
else:
|
|
560
|
+
padicexp_Newton(ans.unit, selfint.value, p, prec, 1, self.prime_pow.pow_mpz_t_tmp(prec))
|
|
561
|
+
sig_off()
|
|
562
|
+
|
|
563
|
+
return ans
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
def unpickle_pcre_v1(R, unit, ordp, relprec):
|
|
567
|
+
"""
|
|
568
|
+
Unpickles a capped relative element.
|
|
569
|
+
|
|
570
|
+
EXAMPLES::
|
|
571
|
+
|
|
572
|
+
sage: from sage.rings.padics.padic_capped_relative_element import unpickle_pcre_v1
|
|
573
|
+
sage: R = Zp(5)
|
|
574
|
+
sage: a = unpickle_pcre_v1(R, 17, 2, 5); a
|
|
575
|
+
2*5^2 + 3*5^3 + O(5^7)
|
|
576
|
+
"""
|
|
577
|
+
return unpickle_cre_v2(pAdicCappedRelativeElement, R, unit, ordp, relprec)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
def base_p_list(Integer n, bint pos, PowComputer_class prime_pow):
|
|
581
|
+
r"""
|
|
582
|
+
Return a base-`p` list of digits of ``n``.
|
|
583
|
+
|
|
584
|
+
INPUT:
|
|
585
|
+
|
|
586
|
+
- ``n`` -- a positive :class:`Integer`
|
|
587
|
+
|
|
588
|
+
- ``pos`` -- boolean; if ``True``, then returns the standard base `p`
|
|
589
|
+
expansion, otherwise the digits lie in the range `-p/2` to `p/2`
|
|
590
|
+
|
|
591
|
+
- ``prime_pow`` -- a :class:`PowComputer` giving the prime
|
|
592
|
+
|
|
593
|
+
EXAMPLES::
|
|
594
|
+
|
|
595
|
+
sage: from sage.rings.padics.padic_capped_relative_element import base_p_list
|
|
596
|
+
sage: base_p_list(192837, True, Zp(5).prime_pow)
|
|
597
|
+
[2, 2, 3, 2, 3, 1, 2, 2]
|
|
598
|
+
sage: 2 + 2*5 + 3*5^2 + 2*5^3 + 3*5^4 + 5^5 + 2*5^6 + 2*5^7
|
|
599
|
+
192837
|
|
600
|
+
sage: base_p_list(192837, False, Zp(5).prime_pow)
|
|
601
|
+
[2, 2, -2, -2, -1, 2, 2, 2]
|
|
602
|
+
sage: 2 + 2*5 - 2*5^2 - 2*5^3 - 5^4 + 2*5^5 + 2*5^6 + 2*5^7
|
|
603
|
+
192837
|
|
604
|
+
"""
|
|
605
|
+
if mpz_sgn(n.value) < 0:
|
|
606
|
+
raise ValueError("n must be nonnegative")
|
|
607
|
+
cdef expansion_mode mode = simple_mode if pos else smallest_mode
|
|
608
|
+
# We need a p-adic element to feed to ExpansionIter before resetting its curvalue
|
|
609
|
+
from sage.rings.padics.factory import Zp
|
|
610
|
+
p = prime_pow.prime
|
|
611
|
+
dummy = Zp(p)(0)
|
|
612
|
+
cdef ExpansionIter expansion = ExpansionIter(dummy, n.exact_log(p) + 2, mode)
|
|
613
|
+
mpz_set(expansion.curvalue, n.value)
|
|
614
|
+
return trim_zeros(list(expansion))
|