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,588 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
r"""
|
|
3
|
+
Convert PARI objects to Sage types
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ****************************************************************************
|
|
7
|
+
# Copyright (C) 2016 Jeroen Demeyer <jdemeyer@cage.ugent.be>
|
|
8
|
+
# Copyright (C) 2016 Luca De Feo <luca.defeo@polytechnique.edu>
|
|
9
|
+
# Copyright (C) 2016 Vincent Delecroix <vincent.delecroix@u-bordeaux.fr>
|
|
10
|
+
#
|
|
11
|
+
# This program is free software: you can redistribute it and/or modify
|
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
|
13
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
14
|
+
# (at your option) any later version.
|
|
15
|
+
# https://www.gnu.org/licenses/
|
|
16
|
+
# ****************************************************************************
|
|
17
|
+
|
|
18
|
+
from cysignals.signals cimport sig_on, sig_off
|
|
19
|
+
|
|
20
|
+
from cypari2.types cimport (GEN, typ, t_INT, t_FRAC, t_REAL, t_COMPLEX,
|
|
21
|
+
t_INTMOD, t_PADIC, t_INFINITY, t_VEC, t_COL,
|
|
22
|
+
t_VECSMALL, t_MAT, t_STR,
|
|
23
|
+
lg, precp)
|
|
24
|
+
from cypari2.paridecl cimport *
|
|
25
|
+
from cypari2.stack cimport new_gen
|
|
26
|
+
from sage.libs.pari.convert_gmp cimport INT_to_mpz, new_gen_from_mpz_t, new_gen_from_mpq_t, INTFRAC_to_mpq
|
|
27
|
+
|
|
28
|
+
from sage.ext.stdsage cimport PY_NEW
|
|
29
|
+
from sage.libs.gmp.mpz cimport mpz_fits_slong_p, mpz_sgn, mpz_get_ui, mpz_set, mpz_set_si, mpz_set_ui
|
|
30
|
+
from sage.libs.gmp.mpq cimport mpq_denref, mpq_numref
|
|
31
|
+
from sage.misc.lazy_import import LazyImport
|
|
32
|
+
from sage.rings.integer cimport smallInteger
|
|
33
|
+
from sage.rings.infinity import Infinity
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
from sage.rings.real_mpfr import RealField
|
|
37
|
+
from sage.rings.complex_mpfr import ComplexField
|
|
38
|
+
except ImportError:
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
from sage.rings.number_field.number_field import QuadraticField
|
|
43
|
+
except ImportError:
|
|
44
|
+
pass
|
|
45
|
+
else:
|
|
46
|
+
QQi = QuadraticField(-1, 'i')
|
|
47
|
+
|
|
48
|
+
try:
|
|
49
|
+
from sage.rings.padics.factory import Qp
|
|
50
|
+
except ImportError:
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
pari_typ_to_entries_type = LazyImport('sage.libs.pari.convert_sage_matrix', 'pari_typ_to_entries_type')
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
cpdef gen_to_sage(Gen z, locals=None):
|
|
57
|
+
"""
|
|
58
|
+
Convert a PARI gen to a Sage/Python object.
|
|
59
|
+
|
|
60
|
+
INPUT:
|
|
61
|
+
|
|
62
|
+
- ``z`` -- PARI ``gen``
|
|
63
|
+
|
|
64
|
+
- ``locals`` -- (optional) dictionary used in fallback cases that
|
|
65
|
+
involve :func:`sage_eval`
|
|
66
|
+
|
|
67
|
+
OUTPUT: one of the following depending on the PARI type of ``z``
|
|
68
|
+
|
|
69
|
+
- a :class:`~sage.rings.integer.Integer` if ``z`` is an integer (type ``t_INT``)
|
|
70
|
+
|
|
71
|
+
- a :class:`~sage.rings.rational.Rational` if ``z`` is a rational (type ``t_FRAC``)
|
|
72
|
+
|
|
73
|
+
- a :class:`~sage.rings.real_mpfr.RealNumber` if ``z`` is a real
|
|
74
|
+
number (type ``t_REAL``). The precision will be equivalent.
|
|
75
|
+
|
|
76
|
+
- a :class:`~sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic`
|
|
77
|
+
or a :class:`~sage.rings.complex_mpfr.ComplexNumber` if ``z`` is a complex
|
|
78
|
+
number (type ``t_COMPLEX``). The former is used when the real and imaginary parts are
|
|
79
|
+
integers or rationals and the latter when they are floating point numbers. In that
|
|
80
|
+
case The precision will be the maximal precision of the real and imaginary parts.
|
|
81
|
+
|
|
82
|
+
- a Python list if ``z`` is a vector or a list (type ``t_VEC``, ``t_COL``)
|
|
83
|
+
|
|
84
|
+
- a Python string if ``z`` is a string (type ``t_STR``)
|
|
85
|
+
|
|
86
|
+
- a Python list of Python integers if ``z`` is a small vector (type ``t_VECSMALL``)
|
|
87
|
+
|
|
88
|
+
- a matrix if ``z`` is a matrix (type ``t_MAT``)
|
|
89
|
+
|
|
90
|
+
- a `p`-adic element (type ``t_PADIC``)
|
|
91
|
+
|
|
92
|
+
- a :class:`~sage.rings.infinity.Infinity` if ``z`` is an infinity
|
|
93
|
+
(type ``t_INF``)
|
|
94
|
+
|
|
95
|
+
EXAMPLES::
|
|
96
|
+
|
|
97
|
+
sage: from sage.libs.pari.convert_sage import gen_to_sage
|
|
98
|
+
|
|
99
|
+
Converting an integer::
|
|
100
|
+
|
|
101
|
+
sage: z = pari('12'); z
|
|
102
|
+
12
|
|
103
|
+
sage: z.type()
|
|
104
|
+
't_INT'
|
|
105
|
+
sage: a = gen_to_sage(z); a
|
|
106
|
+
12
|
|
107
|
+
sage: a.parent()
|
|
108
|
+
Integer Ring
|
|
109
|
+
|
|
110
|
+
sage: gen_to_sage(pari('7^42'))
|
|
111
|
+
311973482284542371301330321821976049
|
|
112
|
+
|
|
113
|
+
Converting a rational number::
|
|
114
|
+
|
|
115
|
+
sage: z = pari('389/17'); z
|
|
116
|
+
389/17
|
|
117
|
+
sage: z.type()
|
|
118
|
+
't_FRAC'
|
|
119
|
+
sage: a = gen_to_sage(z); a
|
|
120
|
+
389/17
|
|
121
|
+
sage: a.parent()
|
|
122
|
+
Rational Field
|
|
123
|
+
|
|
124
|
+
sage: gen_to_sage(pari('5^30 / 3^50'))
|
|
125
|
+
931322574615478515625/717897987691852588770249
|
|
126
|
+
|
|
127
|
+
Converting a real number::
|
|
128
|
+
|
|
129
|
+
sage: pari.set_real_precision(70)
|
|
130
|
+
15
|
|
131
|
+
sage: z = pari('1.234'); z
|
|
132
|
+
1.234000000000000000000000000000000000000000000000000000000000000000000
|
|
133
|
+
sage: a = gen_to_sage(z); a # needs sage.rings.real_mpfr
|
|
134
|
+
1.234000000000000000000000000000000000000000000000000000000000000000000000000
|
|
135
|
+
sage: a.parent() # needs sage.rings.real_mpfr
|
|
136
|
+
Real Field with 256 bits of precision
|
|
137
|
+
sage: pari.set_real_precision(15)
|
|
138
|
+
70
|
|
139
|
+
sage: a = gen_to_sage(pari('1.234')); a # needs sage.rings.real_mpfr
|
|
140
|
+
1.23400000000000000
|
|
141
|
+
sage: a.parent() # needs sage.rings.real_mpfr
|
|
142
|
+
Real Field with 64 bits of precision
|
|
143
|
+
|
|
144
|
+
For complex numbers, the parent depends on the PARI type::
|
|
145
|
+
|
|
146
|
+
sage: z = pari('(3+I)'); z
|
|
147
|
+
3 + I
|
|
148
|
+
sage: z.type()
|
|
149
|
+
't_COMPLEX'
|
|
150
|
+
sage: a = gen_to_sage(z); a # needs sage.rings.number_field
|
|
151
|
+
i + 3
|
|
152
|
+
sage: a.parent() # needs sage.rings.number_field
|
|
153
|
+
Number Field in i with defining polynomial x^2 + 1 with i = 1*I
|
|
154
|
+
|
|
155
|
+
sage: z = pari('(3+I)/2'); z
|
|
156
|
+
3/2 + 1/2*I
|
|
157
|
+
sage: a = gen_to_sage(z); a # needs sage.rings.number_field
|
|
158
|
+
1/2*i + 3/2
|
|
159
|
+
sage: a.parent() # needs sage.rings.number_field
|
|
160
|
+
Number Field in i with defining polynomial x^2 + 1 with i = 1*I
|
|
161
|
+
|
|
162
|
+
sage: z = pari('1.0 + 2.0*I'); z
|
|
163
|
+
1.00000000000000 + 2.00000000000000*I
|
|
164
|
+
sage: a = gen_to_sage(z); a # needs sage.rings.real_mpfr
|
|
165
|
+
1.00000000000000000 + 2.00000000000000000*I
|
|
166
|
+
sage: a.parent() # needs sage.rings.real_mpfr
|
|
167
|
+
Complex Field with 64 bits of precision
|
|
168
|
+
|
|
169
|
+
sage: z = pari('1 + 1.0*I'); z
|
|
170
|
+
1 + 1.00000000000000*I
|
|
171
|
+
sage: a = gen_to_sage(z); a # needs sage.rings.real_mpfr
|
|
172
|
+
1.00000000000000000 + 1.00000000000000000*I
|
|
173
|
+
sage: a.parent() # needs sage.rings.real_mpfr
|
|
174
|
+
Complex Field with 64 bits of precision
|
|
175
|
+
|
|
176
|
+
sage: z = pari('1.0 + 1*I'); z
|
|
177
|
+
1.00000000000000 + I
|
|
178
|
+
sage: a = gen_to_sage(z); a # needs sage.rings.real_mpfr
|
|
179
|
+
1.00000000000000000 + 1.00000000000000000*I
|
|
180
|
+
sage: a.parent() # needs sage.rings.real_mpfr
|
|
181
|
+
Complex Field with 64 bits of precision
|
|
182
|
+
|
|
183
|
+
Converting polynomials::
|
|
184
|
+
|
|
185
|
+
sage: f = pari('(2/3)*x^3 + x - 5/7 + y')
|
|
186
|
+
sage: f.type()
|
|
187
|
+
't_POL'
|
|
188
|
+
|
|
189
|
+
sage: R.<x,y> = QQ[]
|
|
190
|
+
sage: gen_to_sage(f, {'x': x, 'y': y})
|
|
191
|
+
2/3*x^3 + x + y - 5/7
|
|
192
|
+
sage: parent(gen_to_sage(f, {'x': x, 'y': y}))
|
|
193
|
+
Multivariate Polynomial Ring in x, y over Rational Field
|
|
194
|
+
|
|
195
|
+
sage: # needs sage.symbolic
|
|
196
|
+
sage: x,y = SR.var('x,y')
|
|
197
|
+
sage: gen_to_sage(f, {'x': x, 'y': y})
|
|
198
|
+
2/3*x^3 + x + y - 5/7
|
|
199
|
+
sage: parent(gen_to_sage(f, {'x': x, 'y': y}))
|
|
200
|
+
Symbolic Ring
|
|
201
|
+
sage: gen_to_sage(f)
|
|
202
|
+
Traceback (most recent call last):
|
|
203
|
+
...
|
|
204
|
+
NameError: name 'x' is not defined
|
|
205
|
+
|
|
206
|
+
Converting vectors::
|
|
207
|
+
|
|
208
|
+
sage: # needs sage.rings.number_field sage.rings.real_mpfr
|
|
209
|
+
sage: z1 = pari('[-3, 2.1, 1+I]'); z1
|
|
210
|
+
[-3, 2.10000000000000, 1 + I]
|
|
211
|
+
sage: z2 = pari('[1.0*I, [1,2]]~'); z2
|
|
212
|
+
[1.00000000000000*I, [1, 2]]~
|
|
213
|
+
sage: z1.type(), z2.type()
|
|
214
|
+
('t_VEC', 't_COL')
|
|
215
|
+
sage: a1 = gen_to_sage(z1)
|
|
216
|
+
sage: a2 = gen_to_sage(z2)
|
|
217
|
+
sage: type(a1), type(a2)
|
|
218
|
+
(<... 'list'>, <... 'list'>)
|
|
219
|
+
sage: [parent(b) for b in a1]
|
|
220
|
+
[Integer Ring,
|
|
221
|
+
Real Field with 64 bits of precision,
|
|
222
|
+
Number Field in i with defining polynomial x^2 + 1 with i = 1*I]
|
|
223
|
+
sage: [parent(b) for b in a2]
|
|
224
|
+
[Complex Field with 64 bits of precision, <... 'list'>]
|
|
225
|
+
|
|
226
|
+
sage: z = pari('Vecsmall([1,2,3,4])')
|
|
227
|
+
sage: z.type()
|
|
228
|
+
't_VECSMALL'
|
|
229
|
+
sage: a = gen_to_sage(z); a
|
|
230
|
+
[1, 2, 3, 4]
|
|
231
|
+
sage: type(a)
|
|
232
|
+
<... 'list'>
|
|
233
|
+
sage: [parent(b) for b in a]
|
|
234
|
+
[<... 'int'>, <... 'int'>, <... 'int'>, <... 'int'>]
|
|
235
|
+
|
|
236
|
+
Matrices::
|
|
237
|
+
|
|
238
|
+
sage: z = pari('[1,2;3,4]')
|
|
239
|
+
sage: z.type()
|
|
240
|
+
't_MAT'
|
|
241
|
+
|
|
242
|
+
sage: # needs sage.modules
|
|
243
|
+
sage: a = gen_to_sage(z); a
|
|
244
|
+
[1 2]
|
|
245
|
+
[3 4]
|
|
246
|
+
sage: a.parent()
|
|
247
|
+
Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
|
|
248
|
+
|
|
249
|
+
Conversion of `p`-adics::
|
|
250
|
+
|
|
251
|
+
sage: # needs sage.rings.padics
|
|
252
|
+
sage: z = pari('569 + O(7^8)'); z
|
|
253
|
+
2 + 4*7 + 4*7^2 + 7^3 + O(7^8)
|
|
254
|
+
sage: a = gen_to_sage(z); a
|
|
255
|
+
2 + 4*7 + 4*7^2 + 7^3 + O(7^8)
|
|
256
|
+
sage: a.parent()
|
|
257
|
+
7-adic Field with capped relative precision 8
|
|
258
|
+
|
|
259
|
+
Conversion of infinities::
|
|
260
|
+
|
|
261
|
+
sage: gen_to_sage(pari('oo'))
|
|
262
|
+
+Infinity
|
|
263
|
+
sage: gen_to_sage(pari('-oo'))
|
|
264
|
+
-Infinity
|
|
265
|
+
|
|
266
|
+
Conversion of strings::
|
|
267
|
+
|
|
268
|
+
sage: s = pari('"foo"').sage(); s
|
|
269
|
+
'foo'
|
|
270
|
+
sage: type(s)
|
|
271
|
+
<class 'str'>
|
|
272
|
+
"""
|
|
273
|
+
cdef GEN g = z.g
|
|
274
|
+
cdef long t = typ(g)
|
|
275
|
+
cdef long tx, ty
|
|
276
|
+
cdef Gen real, imag, prec, xprec, yprec
|
|
277
|
+
cdef Py_ssize_t i, j, nr, nc
|
|
278
|
+
|
|
279
|
+
if t == t_INT:
|
|
280
|
+
return Integer(z)
|
|
281
|
+
elif t == t_FRAC:
|
|
282
|
+
return Rational(z)
|
|
283
|
+
elif t == t_REAL:
|
|
284
|
+
prec = z.bitprecision()
|
|
285
|
+
if typ(prec.g) == t_INFINITY:
|
|
286
|
+
sage_prec = 53
|
|
287
|
+
else:
|
|
288
|
+
sage_prec = prec
|
|
289
|
+
return RealField(sage_prec)(z)
|
|
290
|
+
elif t == t_COMPLEX:
|
|
291
|
+
real = z.real()
|
|
292
|
+
imag = z.imag()
|
|
293
|
+
tx = typ(real.g)
|
|
294
|
+
ty = typ(imag.g)
|
|
295
|
+
if tx in [t_INTMOD, t_PADIC] or ty in [t_INTMOD, t_PADIC]:
|
|
296
|
+
raise NotImplementedError("No conversion to python available for t_COMPLEX with t_INTMOD or t_PADIC components")
|
|
297
|
+
if tx == t_REAL or ty == t_REAL:
|
|
298
|
+
xprec = real.bitprecision() # will be infinite if exact
|
|
299
|
+
yprec = imag.bitprecision() # will be infinite if exact
|
|
300
|
+
if typ(xprec.g) == t_INFINITY:
|
|
301
|
+
if typ(yprec.g) == t_INFINITY:
|
|
302
|
+
sage_prec = 53
|
|
303
|
+
else:
|
|
304
|
+
sage_prec = yprec
|
|
305
|
+
elif typ(yprec.g) == t_INFINITY:
|
|
306
|
+
sage_prec = xprec
|
|
307
|
+
else:
|
|
308
|
+
sage_prec = max(xprec, yprec)
|
|
309
|
+
|
|
310
|
+
R = RealField(sage_prec)
|
|
311
|
+
C = ComplexField(sage_prec)
|
|
312
|
+
return C(R(real), R(imag))
|
|
313
|
+
else:
|
|
314
|
+
return QQi([gen_to_sage(real), gen_to_sage(imag)])
|
|
315
|
+
elif t == t_VEC or t == t_COL:
|
|
316
|
+
return [gen_to_sage(x, locals) for x in z.python_list()]
|
|
317
|
+
elif t == t_VECSMALL:
|
|
318
|
+
return z.python_list_small()
|
|
319
|
+
elif t == t_MAT:
|
|
320
|
+
from .convert_sage_matrix import gen_to_sage_matrix
|
|
321
|
+
return gen_to_sage_matrix(z, locals)
|
|
322
|
+
elif t == t_PADIC:
|
|
323
|
+
p = z.padicprime()
|
|
324
|
+
K = Qp(Integer(p), precp(g))
|
|
325
|
+
return K(z.lift())
|
|
326
|
+
elif t == t_STR:
|
|
327
|
+
return str(z)
|
|
328
|
+
elif t == t_INFINITY:
|
|
329
|
+
if inf_get_sign(g) >= 0:
|
|
330
|
+
return Infinity
|
|
331
|
+
else:
|
|
332
|
+
return -Infinity
|
|
333
|
+
|
|
334
|
+
# Fallback (e.g. polynomials): use string representation
|
|
335
|
+
from sage.misc.sage_eval import sage_eval
|
|
336
|
+
locals = {} if locals is None else locals
|
|
337
|
+
return sage_eval(str(z), locals=locals)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
cpdef set_integer_from_gen(Integer self, Gen x):
|
|
341
|
+
r"""
|
|
342
|
+
EXAMPLES::
|
|
343
|
+
|
|
344
|
+
sage: [Integer(pari(x)) for x in [1, 2^60, 2., GF(3)(1), GF(9,'a')(2)]] # needs sage.rings.finite_rings
|
|
345
|
+
[1, 1152921504606846976, 2, 1, 2]
|
|
346
|
+
sage: Integer(pari(2.1)) # indirect doctest
|
|
347
|
+
Traceback (most recent call last):
|
|
348
|
+
...
|
|
349
|
+
TypeError: Attempt to coerce non-integral real number to an Integer
|
|
350
|
+
"""
|
|
351
|
+
# Simplify and lift until we get an integer
|
|
352
|
+
while typ((<Gen>x).g) != t_INT:
|
|
353
|
+
x = x.simplify()
|
|
354
|
+
paritype = typ((<Gen>x).g)
|
|
355
|
+
if paritype == t_INT:
|
|
356
|
+
break
|
|
357
|
+
elif paritype == t_REAL:
|
|
358
|
+
# Check that the fractional part is zero
|
|
359
|
+
if not x.frac().gequal0():
|
|
360
|
+
raise TypeError("Attempt to coerce non-integral real number to an Integer")
|
|
361
|
+
# floor yields an integer
|
|
362
|
+
x = x.floor()
|
|
363
|
+
break
|
|
364
|
+
elif paritype == t_PADIC:
|
|
365
|
+
if x._valp() < 0:
|
|
366
|
+
raise TypeError("cannot convert p-adic with negative valuation to an integer")
|
|
367
|
+
# Lifting a PADIC yields an integer
|
|
368
|
+
x = x.lift()
|
|
369
|
+
break
|
|
370
|
+
elif paritype == t_INTMOD:
|
|
371
|
+
# Lifting an INTMOD yields an integer
|
|
372
|
+
x = x.lift()
|
|
373
|
+
break
|
|
374
|
+
elif paritype == t_POLMOD:
|
|
375
|
+
x = x.lift()
|
|
376
|
+
elif paritype == t_FFELT:
|
|
377
|
+
# x = (f modulo defining polynomial of finite field);
|
|
378
|
+
# we extract f.
|
|
379
|
+
sig_on()
|
|
380
|
+
x = new_gen(FF_to_FpXQ_i((<Gen>x).g))
|
|
381
|
+
else:
|
|
382
|
+
raise TypeError("Unable to coerce PARI %s to an Integer" % x)
|
|
383
|
+
|
|
384
|
+
# Now we have a true PARI integer, convert it to Sage
|
|
385
|
+
INT_to_mpz(self.value, (<Gen>x).g)
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
cpdef Gen new_gen_from_integer(Integer self):
|
|
389
|
+
"""
|
|
390
|
+
TESTS::
|
|
391
|
+
|
|
392
|
+
sage: Rational(pari(2)) # indirect doctest
|
|
393
|
+
2
|
|
394
|
+
sage: Rational(pari(-1))
|
|
395
|
+
-1
|
|
396
|
+
"""
|
|
397
|
+
return new_gen_from_mpz_t(self.value)
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
cpdef set_rational_from_gen(Rational self, Gen x):
|
|
401
|
+
r"""
|
|
402
|
+
EXAMPLES::
|
|
403
|
+
|
|
404
|
+
sage: [Rational(pari(x)) for x in [1, 1/2, 2^60, 2., GF(3)(1), GF(9,'a')(2)]] # needs sage.rings.finite_rings
|
|
405
|
+
[1, 1/2, 1152921504606846976, 2, 1, 2]
|
|
406
|
+
sage: Rational(pari(2.1)) # indirect doctest
|
|
407
|
+
Traceback (most recent call last):
|
|
408
|
+
...
|
|
409
|
+
TypeError: Attempt to coerce non-integral real number to an Integer
|
|
410
|
+
"""
|
|
411
|
+
x = x.simplify()
|
|
412
|
+
if is_rational_t(typ((<Gen>x).g)):
|
|
413
|
+
INTFRAC_to_mpq(self.value, (<Gen>x).g)
|
|
414
|
+
else:
|
|
415
|
+
a = Integer(x)
|
|
416
|
+
mpz_set(mpq_numref(self.value), a.value)
|
|
417
|
+
mpz_set_si(mpq_denref(self.value), 1)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
cpdef Gen new_gen_from_rational(Rational self):
|
|
421
|
+
"""
|
|
422
|
+
TESTS::
|
|
423
|
+
|
|
424
|
+
sage: Integer(pari(2/2)) # indirect doctest
|
|
425
|
+
1
|
|
426
|
+
sage: Rational(pari(-1/2))
|
|
427
|
+
-1/2
|
|
428
|
+
"""
|
|
429
|
+
return new_gen_from_mpq_t(self.value)
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
cpdef list pari_divisors_small(Integer self):
|
|
433
|
+
r"""
|
|
434
|
+
Return the list of divisors of this number using PARI ``divisorsu``.
|
|
435
|
+
|
|
436
|
+
.. SEEALSO::
|
|
437
|
+
|
|
438
|
+
This method is better used through :meth:`sage.rings.integer.Integer.divisors`.
|
|
439
|
+
|
|
440
|
+
EXAMPLES::
|
|
441
|
+
|
|
442
|
+
sage: from sage.libs.pari.convert_sage import pari_divisors_small
|
|
443
|
+
sage: pari_divisors_small(4)
|
|
444
|
+
[1, 2, 4]
|
|
445
|
+
|
|
446
|
+
The integer must fit into an unsigned long::
|
|
447
|
+
|
|
448
|
+
sage: pari_divisors_small(-4)
|
|
449
|
+
Traceback (most recent call last):
|
|
450
|
+
...
|
|
451
|
+
AssertionError
|
|
452
|
+
sage: pari_divisors_small(2**65)
|
|
453
|
+
Traceback (most recent call last):
|
|
454
|
+
...
|
|
455
|
+
AssertionError
|
|
456
|
+
"""
|
|
457
|
+
# we need n to fit into a long and not a unsigned long in order to use
|
|
458
|
+
# smallInteger
|
|
459
|
+
assert mpz_fits_slong_p(self.value) and mpz_sgn(self.value) > 0
|
|
460
|
+
|
|
461
|
+
cdef unsigned long n = mpz_get_ui(self.value)
|
|
462
|
+
|
|
463
|
+
global avma
|
|
464
|
+
cdef pari_sp ltop = avma
|
|
465
|
+
cdef GEN d
|
|
466
|
+
cdef list output
|
|
467
|
+
|
|
468
|
+
try:
|
|
469
|
+
sig_on()
|
|
470
|
+
d = divisorsu(n)
|
|
471
|
+
sig_off()
|
|
472
|
+
output = [smallInteger(d[i]) for i in range(1,lg(d))]
|
|
473
|
+
return output
|
|
474
|
+
finally:
|
|
475
|
+
avma = ltop
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
cpdef pari_is_prime(Integer p):
|
|
479
|
+
r"""
|
|
480
|
+
Return whether ``p`` is a prime.
|
|
481
|
+
|
|
482
|
+
The caller must ensure that ``p.value`` fits in a long.
|
|
483
|
+
|
|
484
|
+
EXAMPLES::
|
|
485
|
+
|
|
486
|
+
sage: from sage.libs.pari.convert_sage import pari_is_prime
|
|
487
|
+
sage: pari_is_prime(2)
|
|
488
|
+
True
|
|
489
|
+
sage: pari_is_prime(3)
|
|
490
|
+
True
|
|
491
|
+
sage: pari_is_prime(1)
|
|
492
|
+
False
|
|
493
|
+
sage: pari_is_prime(4)
|
|
494
|
+
False
|
|
495
|
+
|
|
496
|
+
Its recommended to use :meth:`sage.rings.integer.Integer.is_prime`, which checks overflow.
|
|
497
|
+
The following is incorrect, because the number does not fit into a long::
|
|
498
|
+
|
|
499
|
+
sage: pari_is_prime(2**64 + 2)
|
|
500
|
+
True
|
|
501
|
+
"""
|
|
502
|
+
return bool(uisprime(mpz_get_ui(p.value)))
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
cpdef pari_is_prime_power(Integer q, bint get_data):
|
|
506
|
+
r"""
|
|
507
|
+
Return whether ``q`` is a prime power.
|
|
508
|
+
|
|
509
|
+
The caller must ensure that ``q.value`` fits in a long.
|
|
510
|
+
|
|
511
|
+
OUTPUT:
|
|
512
|
+
|
|
513
|
+
If ``get_data`` return a tuple of the prime and the exponent.
|
|
514
|
+
Otherwise return a boolean.
|
|
515
|
+
|
|
516
|
+
EXAMPLES::
|
|
517
|
+
|
|
518
|
+
sage: from sage.libs.pari.convert_sage import pari_is_prime_power
|
|
519
|
+
sage: pari_is_prime_power(2, False)
|
|
520
|
+
True
|
|
521
|
+
sage: pari_is_prime_power(2, True)
|
|
522
|
+
(2, 1)
|
|
523
|
+
sage: pari_is_prime_power(4, False)
|
|
524
|
+
True
|
|
525
|
+
sage: pari_is_prime_power(4, True)
|
|
526
|
+
(2, 2)
|
|
527
|
+
sage: pari_is_prime_power(6, False)
|
|
528
|
+
False
|
|
529
|
+
sage: pari_is_prime_power(6, True)
|
|
530
|
+
(6, 0)
|
|
531
|
+
|
|
532
|
+
Its recommended to use :meth:`sage.rings.integer.Integer.is_prime_power`, which checks overflow.
|
|
533
|
+
The following is incorrect, because the number does not fit into a long::
|
|
534
|
+
|
|
535
|
+
sage: pari_is_prime_power(2**64 + 2, False)
|
|
536
|
+
True
|
|
537
|
+
"""
|
|
538
|
+
cdef long p, n
|
|
539
|
+
n = uisprimepower(mpz_get_ui(q.value), <ulong*>(&p))
|
|
540
|
+
if n:
|
|
541
|
+
return (smallInteger(p), smallInteger(n)) if get_data else True
|
|
542
|
+
else:
|
|
543
|
+
return (q, smallInteger(0)) if get_data else False
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
cpdef unsigned long pari_maxprime() noexcept:
|
|
547
|
+
"""
|
|
548
|
+
Return to which limit PARI has computed the primes.
|
|
549
|
+
|
|
550
|
+
EXAMPLES::
|
|
551
|
+
|
|
552
|
+
sage: from sage.libs.pari.convert_sage import pari_maxprime
|
|
553
|
+
sage: a = pari_maxprime()
|
|
554
|
+
sage: res = prime_range(2, 2*a)
|
|
555
|
+
sage: b = pari_maxprime()
|
|
556
|
+
sage: b >= 2*a
|
|
557
|
+
True
|
|
558
|
+
"""
|
|
559
|
+
return maxprime()
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False):
|
|
563
|
+
"""
|
|
564
|
+
Return a list of all primes between ``start`` and ``stop - 1``, inclusive.
|
|
565
|
+
|
|
566
|
+
.. SEEALSO::
|
|
567
|
+
|
|
568
|
+
:func:`sage.rings.fast_arith.prime_range`
|
|
569
|
+
|
|
570
|
+
TESTS::
|
|
571
|
+
|
|
572
|
+
sage: from sage.libs.pari.convert_sage import pari_prime_range
|
|
573
|
+
sage: pari_prime_range(2, 19)
|
|
574
|
+
[2, 3, 5, 7, 11, 13, 17]
|
|
575
|
+
"""
|
|
576
|
+
cdef ulong i = 1
|
|
577
|
+
res = []
|
|
578
|
+
while pari_PRIMES[i] < c_start:
|
|
579
|
+
i+=1
|
|
580
|
+
while pari_PRIMES[i] < c_stop:
|
|
581
|
+
if py_ints:
|
|
582
|
+
res.append(pari_PRIMES[i])
|
|
583
|
+
else:
|
|
584
|
+
z = <Integer>PY_NEW(Integer)
|
|
585
|
+
mpz_set_ui(z.value, pari_PRIMES[i])
|
|
586
|
+
res.append(z)
|
|
587
|
+
i+=1
|
|
588
|
+
return res
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
from cypari2.gen cimport Gen
|
|
3
|
+
from sage.rings.complex_double cimport ComplexDoubleElement
|
|
4
|
+
|
|
5
|
+
cpdef ComplexDoubleElement pari_to_cdf(Gen g)
|
|
6
|
+
|
|
7
|
+
cpdef Gen new_gen_from_complex_double_element(ComplexDoubleElement self)
|
|
8
|
+
|
|
9
|
+
cpdef ComplexDoubleElement complex_double_element_eta(ComplexDoubleElement self, int flag)
|
|
10
|
+
cpdef ComplexDoubleElement complex_double_element_agm(ComplexDoubleElement self, right)
|
|
11
|
+
cpdef ComplexDoubleElement complex_double_element_dilog(ComplexDoubleElement self)
|
|
12
|
+
cpdef ComplexDoubleElement complex_double_element_gamma(ComplexDoubleElement self)
|
|
13
|
+
cpdef ComplexDoubleElement complex_double_element_gamma_inc(ComplexDoubleElement self, t)
|
|
14
|
+
cpdef ComplexDoubleElement complex_double_element_zeta(ComplexDoubleElement self)
|