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
|
Binary file
|
cypari2/closure.pxd
ADDED
cypari2/closure.pyx
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
"""
|
|
3
|
+
Convert Python functions to PARI closures
|
|
4
|
+
*****************************************
|
|
5
|
+
|
|
6
|
+
AUTHORS:
|
|
7
|
+
|
|
8
|
+
- Jeroen Demeyer (2015-04-10): initial version, :trac:`18052`.
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
|
|
12
|
+
>>> def the_answer():
|
|
13
|
+
... return 42
|
|
14
|
+
>>> import cypari2
|
|
15
|
+
>>> pari = cypari2.Pari()
|
|
16
|
+
>>> f = pari(the_answer)
|
|
17
|
+
>>> f()
|
|
18
|
+
42
|
|
19
|
+
|
|
20
|
+
>>> cube = pari(lambda i: i**3)
|
|
21
|
+
>>> cube.apply(range(10))
|
|
22
|
+
[0, 1, 8, 27, 64, 125, 216, 343, 512, 729]
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
# ****************************************************************************
|
|
26
|
+
# Copyright (C) 2015 Jeroen Demeyer <jdemeyer@cage.ugent.be>
|
|
27
|
+
#
|
|
28
|
+
# This program is free software: you can redistribute it and/or modify
|
|
29
|
+
# it under the terms of the GNU General Public License as published by
|
|
30
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
31
|
+
# (at your option) any later version.
|
|
32
|
+
# https://www.gnu.org/licenses/
|
|
33
|
+
# ****************************************************************************
|
|
34
|
+
|
|
35
|
+
from cysignals.signals cimport sig_on, sig_off, sig_block, sig_unblock, sig_error
|
|
36
|
+
|
|
37
|
+
from cpython.tuple cimport *
|
|
38
|
+
from cpython.object cimport PyObject_Call
|
|
39
|
+
from cpython.ref cimport Py_INCREF
|
|
40
|
+
|
|
41
|
+
from .paridecl cimport *
|
|
42
|
+
from .stack cimport new_gen, new_gen_noclear, clone_gen_noclear, DetachGen
|
|
43
|
+
from .gen cimport objtogen
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
from inspect import getfullargspec as getargspec
|
|
47
|
+
except ImportError:
|
|
48
|
+
from inspect import getargspec
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
cdef inline GEN call_python_func_impl "call_python_func"(GEN* args, object py_func) except NULL:
|
|
52
|
+
"""
|
|
53
|
+
Call ``py_func(*args)`` where ``py_func`` is a Python function
|
|
54
|
+
and ``args`` is an array of ``GEN``s terminated by ``NULL``.
|
|
55
|
+
|
|
56
|
+
The arguments are converted from ``GEN`` to a cypari ``gen`` before
|
|
57
|
+
calling ``py_func``. The result is converted back to a PARI ``GEN``.
|
|
58
|
+
"""
|
|
59
|
+
# We need to ensure that nothing above avma is touched
|
|
60
|
+
avmaguard = new_gen_noclear(<GEN>avma)
|
|
61
|
+
|
|
62
|
+
# How many arguments are there?
|
|
63
|
+
cdef Py_ssize_t n = 0
|
|
64
|
+
while args[n] is not NULL:
|
|
65
|
+
n += 1
|
|
66
|
+
|
|
67
|
+
# Construct a Python tuple for args
|
|
68
|
+
cdef tuple t = PyTuple_New(n)
|
|
69
|
+
cdef Py_ssize_t i
|
|
70
|
+
for i in range(n):
|
|
71
|
+
a = clone_gen_noclear(args[i])
|
|
72
|
+
Py_INCREF(a) # Need to increase refcount because the tuple steals it
|
|
73
|
+
PyTuple_SET_ITEM(t, i, a)
|
|
74
|
+
|
|
75
|
+
# Call the Python function
|
|
76
|
+
r = PyObject_Call(py_func, t, <dict>NULL)
|
|
77
|
+
|
|
78
|
+
# Convert the result to a GEN and copy it to the PARI stack
|
|
79
|
+
# (with a special case for None)
|
|
80
|
+
if r is None:
|
|
81
|
+
return gnil
|
|
82
|
+
|
|
83
|
+
# Safely delete r and avmaguard
|
|
84
|
+
d = DetachGen(objtogen(r))
|
|
85
|
+
del r
|
|
86
|
+
res = d.detach()
|
|
87
|
+
d = DetachGen(avmaguard)
|
|
88
|
+
del avmaguard
|
|
89
|
+
d.detach()
|
|
90
|
+
|
|
91
|
+
return res
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# We rename this function to be able to call it with a different
|
|
95
|
+
# signature. In particular, we want manual exception handling and we
|
|
96
|
+
# implicitly convert py_func from a PyObject* to an object.
|
|
97
|
+
cdef extern from *:
|
|
98
|
+
GEN call_python_func(GEN* args, PyObject* py_func)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
cdef GEN call_python(GEN arg1, GEN arg2, GEN arg3, GEN arg4, GEN arg5,
|
|
102
|
+
ulong nargs, ulong py_func) noexcept:
|
|
103
|
+
"""
|
|
104
|
+
This function, which will be installed in PARI, is a front-end for
|
|
105
|
+
``call_python_func_impl``.
|
|
106
|
+
|
|
107
|
+
It has 5 optional ``GEN``s as argument, a ``nargs`` argument
|
|
108
|
+
specifying how many arguments are valid and one ``ulong``, which is
|
|
109
|
+
actually a Python callable object cast to ``ulong``.
|
|
110
|
+
"""
|
|
111
|
+
if nargs > 5:
|
|
112
|
+
sig_error()
|
|
113
|
+
|
|
114
|
+
# Convert arguments to a NULL-terminated array.
|
|
115
|
+
cdef GEN args[6]
|
|
116
|
+
args[0] = arg1
|
|
117
|
+
args[1] = arg2
|
|
118
|
+
args[2] = arg3
|
|
119
|
+
args[3] = arg4
|
|
120
|
+
args[4] = arg5
|
|
121
|
+
args[nargs] = NULL
|
|
122
|
+
|
|
123
|
+
sig_block()
|
|
124
|
+
# Disallow interrupts during the Python code inside
|
|
125
|
+
# call_python_func_impl(). We need to do this because this function
|
|
126
|
+
# is very likely called within sig_on() and interrupting arbitrary
|
|
127
|
+
# Python code is bad.
|
|
128
|
+
cdef GEN r = call_python_func(args, <PyObject*>py_func)
|
|
129
|
+
sig_unblock()
|
|
130
|
+
if not r: # An exception was raised
|
|
131
|
+
sig_error()
|
|
132
|
+
return r
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# Install the function "call_python" for use in the PARI library.
|
|
136
|
+
cdef entree* ep_call_python
|
|
137
|
+
|
|
138
|
+
cdef int _pari_init_closure() except -1:
|
|
139
|
+
sig_on()
|
|
140
|
+
global ep_call_python
|
|
141
|
+
ep_call_python = install(<void*>call_python, "call_python", 'DGDGDGDGDGD5,U,U')
|
|
142
|
+
sig_off()
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
cpdef Gen objtoclosure(f):
|
|
146
|
+
"""
|
|
147
|
+
Convert a Python function (more generally, any callable) to a PARI
|
|
148
|
+
``t_CLOSURE``.
|
|
149
|
+
|
|
150
|
+
.. NOTE::
|
|
151
|
+
|
|
152
|
+
With the current implementation, the function can be called
|
|
153
|
+
with at most 5 arguments.
|
|
154
|
+
|
|
155
|
+
.. WARNING::
|
|
156
|
+
|
|
157
|
+
The function ``f`` which is called through the closure cannot
|
|
158
|
+
be interrupted. Therefore, it is advised to use this only for
|
|
159
|
+
simple functions which do not take a long time.
|
|
160
|
+
|
|
161
|
+
Examples:
|
|
162
|
+
|
|
163
|
+
>>> from cypari2.closure import objtoclosure
|
|
164
|
+
>>> def pymul(i,j): return i*j
|
|
165
|
+
>>> mul = objtoclosure(pymul)
|
|
166
|
+
>>> mul
|
|
167
|
+
(v1,v2)->call_python(v1,v2,0,0,0,2,...)
|
|
168
|
+
>>> mul(6,9)
|
|
169
|
+
54
|
|
170
|
+
>>> mul.type()
|
|
171
|
+
't_CLOSURE'
|
|
172
|
+
>>> mul.arity()
|
|
173
|
+
2
|
|
174
|
+
>>> def printme(x):
|
|
175
|
+
... print(x)
|
|
176
|
+
>>> objtoclosure(printme)('matid(2)')
|
|
177
|
+
[1, 0; 0, 1]
|
|
178
|
+
|
|
179
|
+
Construct the Riemann zeta function using a closure:
|
|
180
|
+
|
|
181
|
+
>>> from cypari2 import Pari; pari = Pari()
|
|
182
|
+
>>> def coeffs(n):
|
|
183
|
+
... return [1 for i in range(n)]
|
|
184
|
+
>>> Z = pari.lfuncreate([coeffs, 0, [0], 1, 1, 1, 1])
|
|
185
|
+
>>> Z.lfun(2)
|
|
186
|
+
1.64493406684823
|
|
187
|
+
|
|
188
|
+
A trivial closure:
|
|
189
|
+
|
|
190
|
+
>>> f = pari(lambda x: x)
|
|
191
|
+
>>> f(10)
|
|
192
|
+
10
|
|
193
|
+
|
|
194
|
+
Test various kinds of errors:
|
|
195
|
+
|
|
196
|
+
>>> mul(4)
|
|
197
|
+
Traceback (most recent call last):
|
|
198
|
+
...
|
|
199
|
+
TypeError: pymul() ...
|
|
200
|
+
>>> mul(None, None)
|
|
201
|
+
Traceback (most recent call last):
|
|
202
|
+
...
|
|
203
|
+
ValueError: Cannot convert None to pari
|
|
204
|
+
>>> mul(*range(100))
|
|
205
|
+
Traceback (most recent call last):
|
|
206
|
+
...
|
|
207
|
+
PariError: call_python: too many parameters in user-defined function call
|
|
208
|
+
>>> mul([1], [2])
|
|
209
|
+
Traceback (most recent call last):
|
|
210
|
+
...
|
|
211
|
+
PariError: call_python: ...
|
|
212
|
+
"""
|
|
213
|
+
if not callable(f):
|
|
214
|
+
raise TypeError("argument to objtoclosure() must be callable")
|
|
215
|
+
|
|
216
|
+
# Determine number of arguments of f
|
|
217
|
+
cdef Py_ssize_t i, nargs
|
|
218
|
+
try:
|
|
219
|
+
argspec = getargspec(f)
|
|
220
|
+
except Exception:
|
|
221
|
+
nargs = 5
|
|
222
|
+
else:
|
|
223
|
+
nargs = len(argspec.args)
|
|
224
|
+
|
|
225
|
+
# Only 5 arguments are supported for now...
|
|
226
|
+
if nargs > 5:
|
|
227
|
+
nargs = 5
|
|
228
|
+
|
|
229
|
+
# Fill in default arguments of PARI function
|
|
230
|
+
sig_on()
|
|
231
|
+
cdef GEN args = cgetg((5 - nargs) + 2 + 1, t_VEC)
|
|
232
|
+
for i in range(5 - nargs):
|
|
233
|
+
set_gel(args, i + 1, gnil)
|
|
234
|
+
set_gel(args, (5 - nargs) + 1, stoi(nargs))
|
|
235
|
+
# Convert f to a t_INT containing the address of f
|
|
236
|
+
set_gel(args, (5 - nargs) + 1 + 1, utoi(<ulong><PyObject*>f))
|
|
237
|
+
|
|
238
|
+
# Create a t_CLOSURE which calls call_python() with py_func equal to f
|
|
239
|
+
cdef Gen res = new_gen(snm_closure(ep_call_python, args))
|
|
240
|
+
|
|
241
|
+
# We need to keep a reference to f somewhere and there is no way to
|
|
242
|
+
# have PARI handle this reference for us. So the only way out is to
|
|
243
|
+
# force f to be never deallocated
|
|
244
|
+
Py_INCREF(f)
|
|
245
|
+
|
|
246
|
+
return res
|
|
Binary file
|
cypari2/convert.pxd
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
|
|
3
|
+
from .paridecl cimport (GEN, t_COMPLEX, dbltor, real_0_bit, stoi, cgetg,
|
|
4
|
+
set_gel, gen_0)
|
|
5
|
+
from .gen cimport Gen
|
|
6
|
+
from cpython.long cimport PyLong_AsLong
|
|
7
|
+
from cpython.float cimport PyFloat_AS_DOUBLE
|
|
8
|
+
from cpython.complex cimport PyComplex_RealAsDouble, PyComplex_ImagAsDouble
|
|
9
|
+
from cpython.longintrepr cimport py_long
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Conversion PARI -> Python
|
|
13
|
+
|
|
14
|
+
cdef GEN gtoi(GEN g0) except NULL
|
|
15
|
+
|
|
16
|
+
cdef PyObject_FromGEN(GEN g)
|
|
17
|
+
|
|
18
|
+
cdef PyInt_FromGEN(GEN g)
|
|
19
|
+
|
|
20
|
+
cpdef gen_to_python(Gen z)
|
|
21
|
+
|
|
22
|
+
cpdef gen_to_integer(Gen x)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Conversion C -> PARI
|
|
26
|
+
|
|
27
|
+
cdef inline GEN double_to_REAL(double x) noexcept:
|
|
28
|
+
# PARI has an odd concept where it attempts to track the accuracy
|
|
29
|
+
# of floating-point 0; a floating-point zero might be 0.0e-20
|
|
30
|
+
# (meaning roughly that it might represent any number in the
|
|
31
|
+
# range -1e-20 <= x <= 1e20).
|
|
32
|
+
|
|
33
|
+
# PARI's dbltor converts a floating-point 0 into the PARI real
|
|
34
|
+
# 0.0e-307; PARI treats this as an extremely precise 0. This
|
|
35
|
+
# can cause problems; for instance, the PARI incgam() function can
|
|
36
|
+
# be very slow if the first argument is very precise.
|
|
37
|
+
|
|
38
|
+
# So we translate 0 into a floating-point 0 with 53 bits
|
|
39
|
+
# of precision (that's the number of mantissa bits in an IEEE
|
|
40
|
+
# double).
|
|
41
|
+
if x == 0:
|
|
42
|
+
return real_0_bit(-53)
|
|
43
|
+
else:
|
|
44
|
+
return dbltor(x)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
cdef inline GEN doubles_to_COMPLEX(double re, double im) noexcept:
|
|
48
|
+
cdef GEN g = cgetg(3, t_COMPLEX)
|
|
49
|
+
if re == 0:
|
|
50
|
+
set_gel(g, 1, gen_0)
|
|
51
|
+
else:
|
|
52
|
+
set_gel(g, 1, dbltor(re))
|
|
53
|
+
if im == 0:
|
|
54
|
+
set_gel(g, 2, gen_0)
|
|
55
|
+
else:
|
|
56
|
+
set_gel(g, 2, dbltor(im))
|
|
57
|
+
return g
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# Conversion Python -> PARI
|
|
61
|
+
|
|
62
|
+
cdef inline GEN PyInt_AS_GEN(x) except? NULL:
|
|
63
|
+
return stoi(PyLong_AsLong(x))
|
|
64
|
+
|
|
65
|
+
cdef GEN PyLong_AS_GEN(py_long x) noexcept
|
|
66
|
+
|
|
67
|
+
cdef inline GEN PyFloat_AS_GEN(x) except? NULL:
|
|
68
|
+
return double_to_REAL(PyFloat_AS_DOUBLE(x))
|
|
69
|
+
|
|
70
|
+
cdef inline GEN PyComplex_AS_GEN(x) except? NULL:
|
|
71
|
+
return doubles_to_COMPLEX(
|
|
72
|
+
PyComplex_RealAsDouble(x), PyComplex_ImagAsDouble(x))
|
|
73
|
+
|
|
74
|
+
cdef GEN PyObject_AsGEN(x) except? NULL
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# Deprecated functions still used by SageMath
|
|
78
|
+
|
|
79
|
+
cdef Gen new_gen_from_double(double)
|
|
80
|
+
cdef Gen new_t_COMPLEX_from_double(double re, double im)
|