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,238 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
"""
|
|
3
|
+
Finite fields implemented via PARI's FFELT type
|
|
4
|
+
|
|
5
|
+
AUTHORS:
|
|
6
|
+
|
|
7
|
+
- Peter Bruin (June 2013): initial version, based on
|
|
8
|
+
finite_field_ext_pari.py by William Stein et al.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
#*****************************************************************************
|
|
12
|
+
# Copyright (C) 2013 Peter Bruin <peter.bruin@math.uzh.ch>
|
|
13
|
+
#
|
|
14
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
15
|
+
# as published by the Free Software Foundation; either version 2 of
|
|
16
|
+
# the License, or (at your option) any later version.
|
|
17
|
+
# http://www.gnu.org/licenses/
|
|
18
|
+
#*****************************************************************************
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
from .element_pari_ffelt import FiniteFieldElement_pari_ffelt
|
|
22
|
+
from .finite_field_base import FiniteField
|
|
23
|
+
from .finite_field_constructor import GF
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class FiniteField_pari_ffelt(FiniteField):
|
|
27
|
+
"""
|
|
28
|
+
Finite fields whose cardinality is a prime power (not a prime),
|
|
29
|
+
implemented using PARI's ``FFELT`` type.
|
|
30
|
+
|
|
31
|
+
INPUT:
|
|
32
|
+
|
|
33
|
+
- ``p`` -- prime number
|
|
34
|
+
|
|
35
|
+
- ``modulus`` -- an irreducible polynomial of degree at least 2
|
|
36
|
+
over the field of `p` elements
|
|
37
|
+
|
|
38
|
+
- ``name`` -- string: name of the distinguished generator
|
|
39
|
+
(default: variable name of ``modulus``)
|
|
40
|
+
|
|
41
|
+
OUTPUT:
|
|
42
|
+
|
|
43
|
+
A finite field of order `q = p^n`, generated by a distinguished
|
|
44
|
+
element with minimal polynomial ``modulus``. Elements are
|
|
45
|
+
represented as polynomials in ``name`` of degree less than `n`.
|
|
46
|
+
|
|
47
|
+
.. NOTE::
|
|
48
|
+
|
|
49
|
+
Direct construction of :class:`FiniteField_pari_ffelt` objects
|
|
50
|
+
requires specifying a characteristic and a modulus. To
|
|
51
|
+
construct a finite field by specifying a cardinality and an
|
|
52
|
+
algorithm for finding an irreducible polynomial, use the
|
|
53
|
+
``FiniteField`` constructor with ``impl='pari_ffelt'``.
|
|
54
|
+
|
|
55
|
+
EXAMPLES:
|
|
56
|
+
|
|
57
|
+
Some computations with a finite field of order 9::
|
|
58
|
+
|
|
59
|
+
sage: k = FiniteField(9, 'a', impl='pari_ffelt')
|
|
60
|
+
sage: k
|
|
61
|
+
Finite Field in a of size 3^2
|
|
62
|
+
sage: k.is_field()
|
|
63
|
+
True
|
|
64
|
+
sage: k.characteristic()
|
|
65
|
+
3
|
|
66
|
+
sage: a = k.gen()
|
|
67
|
+
sage: a
|
|
68
|
+
a
|
|
69
|
+
sage: a.parent()
|
|
70
|
+
Finite Field in a of size 3^2
|
|
71
|
+
sage: a.charpoly('x')
|
|
72
|
+
x^2 + 2*x + 2
|
|
73
|
+
sage: [a^i for i in range(8)]
|
|
74
|
+
[1, a, a + 1, 2*a + 1, 2, 2*a, 2*a + 2, a + 2]
|
|
75
|
+
sage: TestSuite(k).run() # needs sage.modules
|
|
76
|
+
|
|
77
|
+
Next we compute with a finite field of order 16::
|
|
78
|
+
|
|
79
|
+
sage: k16 = FiniteField(16, 'b', impl='pari_ffelt')
|
|
80
|
+
sage: z = k16.gen()
|
|
81
|
+
sage: z
|
|
82
|
+
b
|
|
83
|
+
sage: z.charpoly('x')
|
|
84
|
+
x^4 + x + 1
|
|
85
|
+
sage: k16.is_field()
|
|
86
|
+
True
|
|
87
|
+
sage: k16.characteristic()
|
|
88
|
+
2
|
|
89
|
+
sage: z.multiplicative_order()
|
|
90
|
+
15
|
|
91
|
+
|
|
92
|
+
Illustration of dumping and loading::
|
|
93
|
+
|
|
94
|
+
sage: K = FiniteField(7^10, 'b', impl='pari_ffelt')
|
|
95
|
+
sage: loads(K.dumps()) == K
|
|
96
|
+
True
|
|
97
|
+
|
|
98
|
+
sage: K = FiniteField(10007^10, 'a', impl='pari_ffelt')
|
|
99
|
+
sage: loads(K.dumps()) == K
|
|
100
|
+
True
|
|
101
|
+
"""
|
|
102
|
+
def __init__(self, p, modulus, name=None):
|
|
103
|
+
"""
|
|
104
|
+
Create a finite field of characteristic `p` defined by the
|
|
105
|
+
polynomial ``modulus``, with distinguished generator called
|
|
106
|
+
``name``.
|
|
107
|
+
|
|
108
|
+
EXAMPLES::
|
|
109
|
+
|
|
110
|
+
sage: from sage.rings.finite_rings.finite_field_pari_ffelt import FiniteField_pari_ffelt
|
|
111
|
+
sage: R.<x> = PolynomialRing(GF(3))
|
|
112
|
+
sage: k = FiniteField_pari_ffelt(3, x^2 + 2*x + 2, 'a'); k
|
|
113
|
+
Finite Field in a of size 3^2
|
|
114
|
+
"""
|
|
115
|
+
n = modulus.degree()
|
|
116
|
+
if n < 2:
|
|
117
|
+
raise ValueError("the degree must be at least 2")
|
|
118
|
+
|
|
119
|
+
FiniteField.__init__(self, base=GF(p), names=name, normalize=True)
|
|
120
|
+
|
|
121
|
+
self._modulus = modulus
|
|
122
|
+
self._degree = n
|
|
123
|
+
|
|
124
|
+
self._gen_pari = modulus._pari_with_name(self._names[0]).ffgen()
|
|
125
|
+
self._zero_element = self.element_class(self, 0)
|
|
126
|
+
self._one_element = self.element_class(self, 1)
|
|
127
|
+
self._gen = self.element_class(self, self._gen_pari)
|
|
128
|
+
|
|
129
|
+
# Cache for Frobenius endomorphisms (O(n) field elements)
|
|
130
|
+
self.__pari_frobenius_powers = []
|
|
131
|
+
|
|
132
|
+
Element = FiniteFieldElement_pari_ffelt
|
|
133
|
+
|
|
134
|
+
def __reduce__(self):
|
|
135
|
+
"""
|
|
136
|
+
For pickling.
|
|
137
|
+
|
|
138
|
+
EXAMPLES::
|
|
139
|
+
|
|
140
|
+
sage: k.<b> = FiniteField(5^20, impl='pari_ffelt')
|
|
141
|
+
sage: type(k)
|
|
142
|
+
<class 'sage.rings.finite_rings.finite_field_pari_ffelt.FiniteField_pari_ffelt_with_category'>
|
|
143
|
+
sage: k is loads(dumps(k))
|
|
144
|
+
True
|
|
145
|
+
"""
|
|
146
|
+
return self._factory_data[0].reduce_data(self)
|
|
147
|
+
|
|
148
|
+
def gen(self, n=0):
|
|
149
|
+
"""
|
|
150
|
+
Return a generator of ``self`` over its prime field, which is a
|
|
151
|
+
root of ``self.modulus()``.
|
|
152
|
+
|
|
153
|
+
INPUT:
|
|
154
|
+
|
|
155
|
+
- ``n`` -- must be 0
|
|
156
|
+
|
|
157
|
+
OUTPUT:
|
|
158
|
+
|
|
159
|
+
An element `a` of ``self`` such that ``self.modulus()(a) == 0``.
|
|
160
|
+
|
|
161
|
+
.. WARNING::
|
|
162
|
+
|
|
163
|
+
This generator is not guaranteed to be a generator for the
|
|
164
|
+
multiplicative group. To obtain the latter, use
|
|
165
|
+
:meth:`~sage.rings.finite_rings.finite_field_base.FiniteFields.multiplicative_generator()`
|
|
166
|
+
or use the ``modulus="primitive"`` option when constructing
|
|
167
|
+
the field.
|
|
168
|
+
|
|
169
|
+
EXAMPLES::
|
|
170
|
+
|
|
171
|
+
sage: R.<x> = PolynomialRing(GF(2))
|
|
172
|
+
sage: FiniteField(2^4, 'b', impl='pari_ffelt').gen()
|
|
173
|
+
b
|
|
174
|
+
sage: k = FiniteField(3^4, 'alpha', impl='pari_ffelt')
|
|
175
|
+
sage: a = k.gen()
|
|
176
|
+
sage: a
|
|
177
|
+
alpha
|
|
178
|
+
sage: a^4
|
|
179
|
+
alpha^3 + 1
|
|
180
|
+
"""
|
|
181
|
+
if n:
|
|
182
|
+
raise IndexError("only one generator")
|
|
183
|
+
return self._gen
|
|
184
|
+
|
|
185
|
+
def characteristic(self):
|
|
186
|
+
"""
|
|
187
|
+
Return the characteristic of ``self``.
|
|
188
|
+
|
|
189
|
+
EXAMPLES::
|
|
190
|
+
|
|
191
|
+
sage: F = FiniteField(3^4, 'a', impl='pari_ffelt')
|
|
192
|
+
sage: F.characteristic()
|
|
193
|
+
3
|
|
194
|
+
"""
|
|
195
|
+
# This works since self is not its own prime field.
|
|
196
|
+
return self.base_ring().characteristic()
|
|
197
|
+
|
|
198
|
+
def degree(self):
|
|
199
|
+
"""
|
|
200
|
+
Return the degree of ``self`` over its prime field.
|
|
201
|
+
|
|
202
|
+
EXAMPLES::
|
|
203
|
+
|
|
204
|
+
sage: F = FiniteField(3^20, 'a', impl='pari_ffelt')
|
|
205
|
+
sage: F.degree()
|
|
206
|
+
20
|
|
207
|
+
"""
|
|
208
|
+
return self._degree
|
|
209
|
+
|
|
210
|
+
def _pari_frobenius(self, k=1):
|
|
211
|
+
"""
|
|
212
|
+
Return a cached PARI Frobenius endomorphism (internally defined
|
|
213
|
+
by the image of the generator).
|
|
214
|
+
|
|
215
|
+
TESTS::
|
|
216
|
+
|
|
217
|
+
sage: F = FiniteField(37^10, 'a', impl='pari_ffelt')
|
|
218
|
+
sage: x = F.random_element() # needs sage.modules
|
|
219
|
+
sage: all(x**(37**k) == F(F._pari_frobenius(k).ffmap(x)) # needs sage.modules
|
|
220
|
+
....: for k in range(1, 30) if k % 10 != 0)
|
|
221
|
+
True
|
|
222
|
+
sage: F(F._pari_frobenius(-1).ffmap(x))**37 == x # needs sage.modules
|
|
223
|
+
True
|
|
224
|
+
"""
|
|
225
|
+
k = k % self.degree()
|
|
226
|
+
if k == 0:
|
|
227
|
+
raise ValueError("_pari_frobenius requires a nonzero exponent")
|
|
228
|
+
g = self.gen()
|
|
229
|
+
i = len(self.__pari_frobenius_powers)
|
|
230
|
+
if i == 0:
|
|
231
|
+
self.__pari_frobenius_powers.append(g.__pari__().fffrobenius(1))
|
|
232
|
+
i = 1
|
|
233
|
+
f1 = self.__pari_frobenius_powers[0]
|
|
234
|
+
while i < k:
|
|
235
|
+
i += 1
|
|
236
|
+
fi = self.__pari_frobenius_powers[-1].ffcompomap(f1)
|
|
237
|
+
self.__pari_frobenius_powers.append(fi)
|
|
238
|
+
return self.__pari_frobenius_powers[k-1]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
from sage.rings.finite_rings.hom_finite_field cimport (SectionFiniteFieldHomomorphism_generic,
|
|
3
|
+
FiniteFieldHomomorphism_generic, FrobeniusEndomorphism_finite_field)
|
|
4
|
+
|
|
5
|
+
from sage.structure.element cimport Element
|
|
6
|
+
from sage.rings.finite_rings.element_givaro cimport Cache_givaro
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_generic):
|
|
10
|
+
cdef long _order_codomain
|
|
11
|
+
cdef long _gcd
|
|
12
|
+
cdef long _power
|
|
13
|
+
cdef Cache_givaro _codomain_cache
|
|
14
|
+
|
|
15
|
+
cpdef Element _call_(self, x)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
cdef class FiniteFieldHomomorphism_givaro(FiniteFieldHomomorphism_generic):
|
|
19
|
+
cdef long _order_domain
|
|
20
|
+
cdef long _order_codomain
|
|
21
|
+
cdef long _power
|
|
22
|
+
cdef Cache_givaro _codomain_cache
|
|
23
|
+
|
|
24
|
+
cpdef Element _call_(self, x)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
cdef class FrobeniusEndomorphism_givaro(FrobeniusEndomorphism_finite_field):
|
|
28
|
+
pass
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
# distutils: extra_compile_args = -std=c++11
|
|
3
|
+
# distutils: libraries = givaro gmp M_LIBRARIES
|
|
4
|
+
# distutils: language = c++
|
|
5
|
+
"""
|
|
6
|
+
Givaro finite field morphisms
|
|
7
|
+
|
|
8
|
+
Special implementation for givaro finite fields of:
|
|
9
|
+
|
|
10
|
+
- embeddings between finite fields
|
|
11
|
+
|
|
12
|
+
- frobenius endomorphisms
|
|
13
|
+
|
|
14
|
+
SEEALSO::
|
|
15
|
+
|
|
16
|
+
:mod:`sage.rings.finite_rings.hom_finite_field`
|
|
17
|
+
|
|
18
|
+
AUTHOR:
|
|
19
|
+
|
|
20
|
+
- Xavier Caruso (2012-06-29)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
# ###########################################################################
|
|
24
|
+
# Copyright (C) 2012 Xavier Caruso <xavier.caruso@normalesup.org>
|
|
25
|
+
#
|
|
26
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
27
|
+
#
|
|
28
|
+
# https://www.gnu.org/licenses/
|
|
29
|
+
# ***************************************************************************
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
from sage.rings.finite_rings.finite_field_constructor import FiniteField
|
|
33
|
+
|
|
34
|
+
from sage.rings.finite_rings.hom_finite_field cimport SectionFiniteFieldHomomorphism_generic
|
|
35
|
+
from sage.rings.finite_rings.hom_finite_field cimport FiniteFieldHomomorphism_generic
|
|
36
|
+
from sage.rings.finite_rings.hom_finite_field cimport FrobeniusEndomorphism_finite_field
|
|
37
|
+
|
|
38
|
+
from sage.rings.finite_rings.hom_prime_finite_field cimport FiniteFieldHomomorphism_prime
|
|
39
|
+
|
|
40
|
+
from sage.categories.homset import Hom
|
|
41
|
+
from sage.structure.element cimport Element
|
|
42
|
+
|
|
43
|
+
from sage.rings.finite_rings.finite_field_givaro import FiniteField_givaro
|
|
44
|
+
from sage.rings.finite_rings.element_givaro cimport FiniteField_givaroElement
|
|
45
|
+
#from element_givaro cimport make_FiniteField_givaroElement
|
|
46
|
+
|
|
47
|
+
from sage.structure.parent cimport Parent
|
|
48
|
+
from sage.rings.finite_rings.element_givaro cimport Cache_givaro
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_generic):
|
|
52
|
+
def __init__(self, inverse):
|
|
53
|
+
"""
|
|
54
|
+
TESTS::
|
|
55
|
+
|
|
56
|
+
sage: from sage.rings.finite_rings.hom_finite_field_givaro import FiniteFieldHomomorphism_givaro
|
|
57
|
+
sage: k.<t> = GF(3^2)
|
|
58
|
+
sage: K.<T> = GF(3^4)
|
|
59
|
+
sage: f = FiniteFieldHomomorphism_givaro(Hom(k, K))
|
|
60
|
+
sage: g = f.section(); g # random
|
|
61
|
+
Section of Ring morphism:
|
|
62
|
+
From: Finite Field in t of size 3^2
|
|
63
|
+
To: Finite Field in T of size 3^4
|
|
64
|
+
Defn: t |--> 2*T^3 + 2*T^2 + 1
|
|
65
|
+
sage: a = k.random_element()
|
|
66
|
+
sage: b = k.random_element()
|
|
67
|
+
sage: g(f(a) + f(b)) == g(f(a)) + g(f(b)) == a + b
|
|
68
|
+
True
|
|
69
|
+
"""
|
|
70
|
+
if not isinstance(inverse, FiniteFieldHomomorphism_givaro):
|
|
71
|
+
raise TypeError("The given map is not an instance of FiniteFieldHomomorphism_givaro")
|
|
72
|
+
SectionFiniteFieldHomomorphism_generic.__init__(self, inverse)
|
|
73
|
+
|
|
74
|
+
cdef long inverse_power = (<FiniteFieldHomomorphism_givaro>inverse)._power
|
|
75
|
+
cdef long order = self.domain().cardinality() - 1
|
|
76
|
+
self._order_codomain = self.codomain().cardinality() - 1
|
|
77
|
+
|
|
78
|
+
# Compute a = gcd(inverse_power, order)
|
|
79
|
+
# and solve inverse_power*x = a (mod order)
|
|
80
|
+
cdef long a = inverse_power, b = order
|
|
81
|
+
cdef unsigned long q
|
|
82
|
+
cdef long x = 1, y = 0
|
|
83
|
+
cdef long sb, sy
|
|
84
|
+
while b != 0:
|
|
85
|
+
q = a // b
|
|
86
|
+
sb = b
|
|
87
|
+
b = a - q * b
|
|
88
|
+
a = sb
|
|
89
|
+
sy = y
|
|
90
|
+
y = x - q * y
|
|
91
|
+
x = sy
|
|
92
|
+
|
|
93
|
+
self._gcd = a
|
|
94
|
+
if x < 0:
|
|
95
|
+
x += order
|
|
96
|
+
self._power = x % self._order_codomain
|
|
97
|
+
|
|
98
|
+
self._codomain_cache = (<FiniteField_givaroElement>(self._codomain.gen()))._cache
|
|
99
|
+
|
|
100
|
+
cpdef Element _call_(self, x):
|
|
101
|
+
"""
|
|
102
|
+
TESTS::
|
|
103
|
+
|
|
104
|
+
sage: from sage.rings.finite_rings.hom_finite_field_givaro import FiniteFieldHomomorphism_givaro
|
|
105
|
+
sage: k.<t> = GF(3^2)
|
|
106
|
+
sage: K.<T> = GF(3^4)
|
|
107
|
+
sage: f = FiniteFieldHomomorphism_givaro(Hom(k, K))
|
|
108
|
+
sage: g = f.section()
|
|
109
|
+
sage: g(f(t+1))
|
|
110
|
+
t + 1
|
|
111
|
+
|
|
112
|
+
sage: g(T)
|
|
113
|
+
Traceback (most recent call last):
|
|
114
|
+
...
|
|
115
|
+
ValueError: T is not in the image of Ring morphism:
|
|
116
|
+
From: Finite Field in t of size 3^2
|
|
117
|
+
To: Finite Field in T of size 3^4
|
|
118
|
+
Defn: t |--> ...
|
|
119
|
+
"""
|
|
120
|
+
if x.parent() != self.domain():
|
|
121
|
+
raise TypeError("%s is not in %s" % (x, self.domain()))
|
|
122
|
+
cdef FiniteField_givaroElement y = <FiniteField_givaroElement?>x
|
|
123
|
+
if y._cache.objectptr.isZero(y.element):
|
|
124
|
+
return make_FiniteField_givaroElement(self._codomain_cache, self._codomain_cache.objectptr.zero)
|
|
125
|
+
if y._cache.objectptr.isOne(y.element):
|
|
126
|
+
return make_FiniteField_givaroElement(self._codomain_cache, self._codomain_cache.objectptr.one)
|
|
127
|
+
cdef int log = y.element
|
|
128
|
+
cdef int q = log / self._gcd
|
|
129
|
+
if log == q*self._gcd:
|
|
130
|
+
q = (q*self._power) % self._order_codomain
|
|
131
|
+
return make_FiniteField_givaroElement(self._codomain_cache, q)
|
|
132
|
+
else:
|
|
133
|
+
raise ValueError("%s is not in the image of %s" % (x, self._inverse))
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
cdef class FiniteFieldHomomorphism_givaro(FiniteFieldHomomorphism_generic):
|
|
137
|
+
def __init__(self, parent, im_gens=None, check=False):
|
|
138
|
+
"""
|
|
139
|
+
TESTS::
|
|
140
|
+
|
|
141
|
+
sage: from sage.rings.finite_rings.hom_finite_field_givaro import FiniteFieldHomomorphism_givaro
|
|
142
|
+
sage: k.<t> = GF(3^2)
|
|
143
|
+
sage: K.<T> = GF(3^4)
|
|
144
|
+
sage: f = FiniteFieldHomomorphism_givaro(Hom(k, K)); f # random
|
|
145
|
+
Ring morphism:
|
|
146
|
+
From: Finite Field in t of size 3^2
|
|
147
|
+
To: Finite Field in T of size 3^4
|
|
148
|
+
Defn: t |--> 2*T^3 + 2*T^2 + 1
|
|
149
|
+
sage: a = k.random_element()
|
|
150
|
+
sage: b = k.random_element()
|
|
151
|
+
sage: f(a) + f(b) == f(a + b)
|
|
152
|
+
True
|
|
153
|
+
|
|
154
|
+
sage: k.<t> = GF(3^10)
|
|
155
|
+
sage: K.<T> = GF(3^20)
|
|
156
|
+
sage: f = FiniteFieldHomomorphism_givaro(Hom(k, K)); f
|
|
157
|
+
Traceback (most recent call last):
|
|
158
|
+
...
|
|
159
|
+
TypeError: The codomain is not an instance of FiniteField_givaro
|
|
160
|
+
"""
|
|
161
|
+
domain = parent.domain()
|
|
162
|
+
codomain = parent.codomain()
|
|
163
|
+
if not isinstance(domain, FiniteField_givaro):
|
|
164
|
+
raise TypeError("The domain is not an instance of FiniteField_givaro")
|
|
165
|
+
if not isinstance(codomain, FiniteField_givaro):
|
|
166
|
+
raise TypeError("The codomain is not an instance of FiniteField_givaro")
|
|
167
|
+
|
|
168
|
+
FiniteFieldHomomorphism_generic.__init__(self, parent, im_gens, check=check,
|
|
169
|
+
section_class=SectionFiniteFieldHomomorphism_givaro)
|
|
170
|
+
|
|
171
|
+
cdef Cache_givaro domain_cache = (<FiniteField_givaroElement>(domain.gen()))._cache
|
|
172
|
+
self._codomain_cache = (<FiniteField_givaroElement>(codomain.gen()))._cache
|
|
173
|
+
|
|
174
|
+
cdef FiniteField_givaroElement g = make_FiniteField_givaroElement(domain_cache, 1)
|
|
175
|
+
cdef FiniteField_givaroElement G = FiniteFieldHomomorphism_generic._call_(self, g)
|
|
176
|
+
self._power = G.element
|
|
177
|
+
|
|
178
|
+
self._order_domain = domain.cardinality() - 1
|
|
179
|
+
self._order_codomain = codomain.cardinality() - 1
|
|
180
|
+
|
|
181
|
+
cpdef Element _call_(self, x):
|
|
182
|
+
"""
|
|
183
|
+
TESTS::
|
|
184
|
+
|
|
185
|
+
sage: from sage.rings.finite_rings.hom_finite_field_givaro import FiniteFieldHomomorphism_givaro
|
|
186
|
+
sage: k.<t> = GF(3^2)
|
|
187
|
+
sage: K.<T> = GF(3^4)
|
|
188
|
+
sage: f = FiniteFieldHomomorphism_givaro(Hom(k, K))
|
|
189
|
+
sage: f(t) # random
|
|
190
|
+
2*T^3 + 2*T^2 + 1
|
|
191
|
+
sage: f(t) == f.im_gens()[0]
|
|
192
|
+
True
|
|
193
|
+
"""
|
|
194
|
+
if x.parent() != self.domain():
|
|
195
|
+
raise TypeError("%s is not in %s" % (x, self.domain()))
|
|
196
|
+
cdef FiniteField_givaroElement y = <FiniteField_givaroElement?>x
|
|
197
|
+
if y._cache.objectptr.isZero(y.element):
|
|
198
|
+
return make_FiniteField_givaroElement(self._codomain_cache, self._codomain_cache.objectptr.zero)
|
|
199
|
+
if y._cache.objectptr.isOne(y.element):
|
|
200
|
+
return make_FiniteField_givaroElement(self._codomain_cache, self._codomain_cache.objectptr.one)
|
|
201
|
+
cdef int log = y.element
|
|
202
|
+
log = (log*self._power) % self._order_codomain
|
|
203
|
+
return make_FiniteField_givaroElement(self._codomain_cache, log)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
cdef class FrobeniusEndomorphism_givaro(FrobeniusEndomorphism_finite_field):
|
|
207
|
+
def __init__(self, domain, power=1):
|
|
208
|
+
"""
|
|
209
|
+
TESTS::
|
|
210
|
+
|
|
211
|
+
sage: k.<t> = GF(5^3)
|
|
212
|
+
sage: Frob = k.frobenius_endomorphism(); Frob
|
|
213
|
+
Frobenius endomorphism t |--> t^5 on Finite Field in t of size 5^3
|
|
214
|
+
sage: type(Frob)
|
|
215
|
+
<class 'sage.rings.finite_rings.hom_finite_field_givaro.FrobeniusEndomorphism_givaro'>
|
|
216
|
+
|
|
217
|
+
sage: k.<t> = GF(5^20)
|
|
218
|
+
sage: Frob = k.frobenius_endomorphism(); Frob
|
|
219
|
+
Frobenius endomorphism t |--> t^5 on Finite Field in t of size 5^20
|
|
220
|
+
sage: type(Frob)
|
|
221
|
+
<class 'sage.rings.finite_rings.hom_finite_field.FrobeniusEndomorphism_finite_field'>
|
|
222
|
+
"""
|
|
223
|
+
if not isinstance(domain, FiniteField_givaro):
|
|
224
|
+
raise TypeError("The domain is not an instance of FiniteField_givaro")
|
|
225
|
+
FrobeniusEndomorphism_finite_field.__init__(self, domain, power)
|
|
226
|
+
|
|
227
|
+
def fixed_field(self):
|
|
228
|
+
"""
|
|
229
|
+
Return the fixed field of ``self``.
|
|
230
|
+
|
|
231
|
+
OUTPUT:
|
|
232
|
+
|
|
233
|
+
- a tuple `(K, e)`, where `K` is the subfield of the domain
|
|
234
|
+
consisting of elements fixed by ``self`` and `e` is an
|
|
235
|
+
embedding of `K` into the domain.
|
|
236
|
+
|
|
237
|
+
.. NOTE::
|
|
238
|
+
|
|
239
|
+
The name of the variable used for the subfield (if it
|
|
240
|
+
is not a prime subfield) is suffixed by ``_fixed``.
|
|
241
|
+
|
|
242
|
+
EXAMPLES::
|
|
243
|
+
|
|
244
|
+
sage: k.<t> = GF(5^6)
|
|
245
|
+
sage: f = k.frobenius_endomorphism(2)
|
|
246
|
+
sage: kfixed, embed = f.fixed_field()
|
|
247
|
+
sage: kfixed
|
|
248
|
+
Finite Field in t_fixed of size 5^2
|
|
249
|
+
sage: embed # random
|
|
250
|
+
Ring morphism:
|
|
251
|
+
From: Finite Field in t_fixed of size 5^2
|
|
252
|
+
To: Finite Field in t of size 5^6
|
|
253
|
+
Defn: t_fixed |--> 4*t^5 + 2*t^4 + 4*t^2 + t
|
|
254
|
+
|
|
255
|
+
sage: tfixed = kfixed.gen()
|
|
256
|
+
sage: embed(tfixed) # random
|
|
257
|
+
4*t^5 + 2*t^4 + 4*t^2 + t
|
|
258
|
+
"""
|
|
259
|
+
if self._degree_fixed == 1:
|
|
260
|
+
k = FiniteField(self.domain().characteristic())
|
|
261
|
+
f = FiniteFieldHomomorphism_prime(Hom(k, self.domain()))
|
|
262
|
+
else:
|
|
263
|
+
k = FiniteField(self.domain().characteristic()**self._degree_fixed,
|
|
264
|
+
name=self.domain().variable_name() + "_fixed")
|
|
265
|
+
f = FiniteFieldHomomorphism_givaro(Hom(k, self.domain()))
|
|
266
|
+
return k, f
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
# copied from element_givaro.pyx
|
|
270
|
+
cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x):
|
|
271
|
+
cdef FiniteField_givaroElement y
|
|
272
|
+
|
|
273
|
+
if cache._has_array:
|
|
274
|
+
return <FiniteField_givaroElement>cache._array[x]
|
|
275
|
+
else:
|
|
276
|
+
y = FiniteField_givaroElement.__new__(FiniteField_givaroElement)
|
|
277
|
+
y._parent = <Parent> cache.parent
|
|
278
|
+
y._cache = cache
|
|
279
|
+
y.element = x
|
|
280
|
+
return y
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
r"""
|
|
3
|
+
Finite residue fields (Givaro implementation)
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# *****************************************************************************
|
|
7
|
+
# Copyright (C) 2007-2019 David Roe <roed@math.harvard.edu>
|
|
8
|
+
# 2007 William Stein <wstein@gmail.com>
|
|
9
|
+
# 2008 John Cremona
|
|
10
|
+
# 2008 Robert Bradshaw
|
|
11
|
+
# 2009 Nick Alexander
|
|
12
|
+
# 2010 Robert L. Miller
|
|
13
|
+
# 2010-2013 Simon King
|
|
14
|
+
# 2010-2017 Jeroen Demeyer
|
|
15
|
+
# 2012 Travis Scrimshaw
|
|
16
|
+
# 2016-2021 Frédéric Chapoton
|
|
17
|
+
# 2021-2022 Antonio Rojas
|
|
18
|
+
#
|
|
19
|
+
# This program is free software: you can redistribute it and/or modify
|
|
20
|
+
# it under the terms of the GNU General Public License as published by
|
|
21
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
22
|
+
# (at your option) any later version.
|
|
23
|
+
# http://www.gnu.org/licenses/
|
|
24
|
+
# *****************************************************************************
|
|
25
|
+
|
|
26
|
+
from sage.rings.finite_rings.finite_field_givaro import FiniteField_givaro
|
|
27
|
+
from sage.rings.finite_rings.residue_field import ResidueField_generic, ResidueFieldHomomorphism_global, ReductionMap
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ResidueFiniteField_givaro(ResidueField_generic, FiniteField_givaro):
|
|
31
|
+
"""
|
|
32
|
+
The class representing residue fields of number fields that have non-prime
|
|
33
|
+
order strictly less than `2^16`.
|
|
34
|
+
|
|
35
|
+
EXAMPLES::
|
|
36
|
+
|
|
37
|
+
sage: # needs sage.rings.number_field
|
|
38
|
+
sage: R.<x> = QQ[]
|
|
39
|
+
sage: K.<a> = NumberField(x^3 - 7)
|
|
40
|
+
sage: P = K.ideal(29).factor()[0][0]
|
|
41
|
+
sage: k = K.residue_field(P)
|
|
42
|
+
sage: k.degree()
|
|
43
|
+
2
|
|
44
|
+
sage: OK = K.maximal_order()
|
|
45
|
+
sage: c = OK(a)
|
|
46
|
+
sage: b = k(c)
|
|
47
|
+
sage: b*c^2
|
|
48
|
+
7
|
|
49
|
+
sage: b*c
|
|
50
|
+
13*abar + 5
|
|
51
|
+
|
|
52
|
+
sage: R.<t> = GF(7)[]; P = R.ideal(t^2 + 4)
|
|
53
|
+
sage: k.<a> = R.residue_field(P); type(k)
|
|
54
|
+
<class 'sage.rings.finite_rings.residue_field_givaro.ResidueFiniteField_givaro_with_category'>
|
|
55
|
+
sage: k(1/t)
|
|
56
|
+
5*a
|
|
57
|
+
"""
|
|
58
|
+
def __init__(self, p, q, name, modulus, to_vs, to_order, PB):
|
|
59
|
+
r"""
|
|
60
|
+
INPUT:
|
|
61
|
+
|
|
62
|
+
- ``p`` -- the prime ideal defining this residue field
|
|
63
|
+
|
|
64
|
+
- ``q`` -- the order of this residue field (a power of intp)
|
|
65
|
+
|
|
66
|
+
- ``name`` -- the name of the generator of this extension
|
|
67
|
+
|
|
68
|
+
- ``modulus`` -- the polynomial modulus for this extension
|
|
69
|
+
|
|
70
|
+
- ``to_vs`` -- the map from the number field (or function field) to
|
|
71
|
+
the appropriate vector space (over `\QQ` or `F_p(t)`)
|
|
72
|
+
|
|
73
|
+
- ``to_order`` -- the map from a lattice in that vector space to the maximal order
|
|
74
|
+
|
|
75
|
+
- ``PB`` -- a matrix used in defining the reduction and lifting maps
|
|
76
|
+
|
|
77
|
+
EXAMPLES::
|
|
78
|
+
|
|
79
|
+
sage: R.<x> = QQ[]
|
|
80
|
+
sage: K.<a> = NumberField(x^4 + 3*x^2 - 17) # needs sage.rings.number_field
|
|
81
|
+
sage: P = K.ideal(61).factor()[0][0] # needs sage.rings.number_field
|
|
82
|
+
sage: k = K.residue_field(P) # needs sage.rings.number_field
|
|
83
|
+
|
|
84
|
+
sage: R.<t> = GF(3)[]; P = R.ideal(t^4 - t^3 + t + 1); k.<a> = P.residue_field(); type(k)
|
|
85
|
+
<class 'sage.rings.finite_rings.residue_field_givaro.ResidueFiniteField_givaro_with_category'>
|
|
86
|
+
sage: a^5
|
|
87
|
+
a^3 + 2*a^2 + a + 2
|
|
88
|
+
"""
|
|
89
|
+
ResidueField_generic.__init__(self, p)
|
|
90
|
+
FiniteField_givaro.__init__(self, q, name, modulus)
|
|
91
|
+
K = OK = p.ring()
|
|
92
|
+
if OK.is_field():
|
|
93
|
+
OK = OK.ring_of_integers()
|
|
94
|
+
else:
|
|
95
|
+
K = K.fraction_field()
|
|
96
|
+
if PB is None:
|
|
97
|
+
PBinv = None
|
|
98
|
+
else:
|
|
99
|
+
PBinv = PB**(-1)
|
|
100
|
+
self._populate_coercion_lists_(coerce_list=[self.base_ring(),
|
|
101
|
+
ResidueFieldHomomorphism_global(OK, self, to_vs, to_order, PB, PBinv)],
|
|
102
|
+
convert_list=[ReductionMap(K, self, to_vs, to_order, PB, PBinv)])
|
|
103
|
+
|
|
104
|
+
def _element_constructor_(self, x):
|
|
105
|
+
"""
|
|
106
|
+
INPUT:
|
|
107
|
+
|
|
108
|
+
- ``x`` -- something to cast into ``self``
|
|
109
|
+
|
|
110
|
+
EXAMPLES::
|
|
111
|
+
|
|
112
|
+
sage: # needs sage.rings.number_field
|
|
113
|
+
sage: R.<x> = QQ[]
|
|
114
|
+
sage: K.<a> = NumberField(x^4 + 3*x^2 - 17)
|
|
115
|
+
sage: P = K.ideal(61).factor()[0][0]
|
|
116
|
+
sage: k = K.residue_field(P)
|
|
117
|
+
sage: k(77*a^7 + 4)
|
|
118
|
+
2*abar + 4
|
|
119
|
+
sage: V = k.vector_space(map=False); v = V([3,-2])
|
|
120
|
+
sage: type(k.convert_map_from(V))
|
|
121
|
+
<class 'sage.structure.coerce_maps.DefaultConvertMap_unique'>
|
|
122
|
+
sage: k(v) # indirect doctest
|
|
123
|
+
59*abar + 3
|
|
124
|
+
|
|
125
|
+
sage: R.<t> = GF(3)[]; P = R.ideal(t^4 - t^3 + t + 1); k.<a> = P.residue_field()
|
|
126
|
+
sage: V = k.vector_space(map=False); v = V([0,1,2,3]) # needs sage.modules
|
|
127
|
+
sage: k(v) # indirect doctest # needs sage.modules
|
|
128
|
+
2*a^2 + a
|
|
129
|
+
"""
|
|
130
|
+
try:
|
|
131
|
+
return FiniteField_givaro._element_constructor_(self, x)
|
|
132
|
+
except TypeError:
|
|
133
|
+
return ResidueField_generic._element_constructor_(self, x)
|