passagemath-flint 10.6.1rc10__cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_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.
- passagemath_flint-10.6.1rc10.dist-info/METADATA +122 -0
- passagemath_flint-10.6.1rc10.dist-info/RECORD +361 -0
- passagemath_flint-10.6.1rc10.dist-info/WHEEL +6 -0
- passagemath_flint-10.6.1rc10.dist-info/top_level.txt +2 -0
- passagemath_flint.libs/libflint-aecb9cc5.so.21.0.0 +0 -0
- passagemath_flint.libs/libgf2x-a4cdec90.so.3.0.0 +0 -0
- passagemath_flint.libs/libgfortran-8f1e9814.so.5.0.0 +0 -0
- passagemath_flint.libs/libgmp-6e109695.so.10.5.0 +0 -0
- passagemath_flint.libs/libgsl-cda90e79.so.28.0.0 +0 -0
- passagemath_flint.libs/libmpfi-e3c25853.so.0.0.0 +0 -0
- passagemath_flint.libs/libmpfr-82690d50.so.6.2.1 +0 -0
- passagemath_flint.libs/libntl-74e7d9a3.so.44.0.1 +0 -0
- passagemath_flint.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
- passagemath_flint.libs/libquadmath-828275a7.so.0.0.0 +0 -0
- sage/all__sagemath_flint.py +29 -0
- sage/combinat/all__sagemath_flint.py +1 -0
- sage/combinat/posets/all__sagemath_flint.py +1 -0
- sage/combinat/posets/hasse_cython_flint.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/combinat/posets/hasse_cython_flint.pyx +194 -0
- sage/data_structures/all__sagemath_flint.py +1 -0
- sage/data_structures/bounded_integer_sequences.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/data_structures/bounded_integer_sequences.pxd +62 -0
- sage/data_structures/bounded_integer_sequences.pyx +1418 -0
- sage/graphs/all__sagemath_flint.py +1 -0
- sage/graphs/chrompoly.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/graphs/chrompoly.pyx +555 -0
- sage/graphs/matchpoly.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/graphs/matchpoly.pyx +412 -0
- sage/libs/all__sagemath_flint.py +17 -0
- sage/libs/arb/__init__.py +1 -0
- sage/libs/arb/acb.pxd +154 -0
- sage/libs/arb/acb_calc.pxd +9 -0
- sage/libs/arb/acb_elliptic.pxd +25 -0
- sage/libs/arb/acb_hypgeom.pxd +74 -0
- sage/libs/arb/acb_mat.pxd +62 -0
- sage/libs/arb/acb_modular.pxd +17 -0
- sage/libs/arb/acb_poly.pxd +216 -0
- sage/libs/arb/arb.pxd +240 -0
- sage/libs/arb/arb_fmpz_poly.pxd +21 -0
- sage/libs/arb/arb_hypgeom.pxd +83 -0
- sage/libs/arb/arb_wrap.h +34 -0
- sage/libs/arb/arf.pxd +131 -0
- sage/libs/arb/arith.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/arb/arith.pyx +87 -0
- sage/libs/arb/bernoulli.pxd +6 -0
- sage/libs/arb/mag.pxd +77 -0
- sage/libs/arb/types.pxd +37 -0
- sage/libs/flint/__init__.py +1 -0
- sage/libs/flint/acb.pxd +270 -0
- sage/libs/flint/acb_calc.pxd +22 -0
- sage/libs/flint/acb_dft.pxd +51 -0
- sage/libs/flint/acb_dirichlet.pxd +112 -0
- sage/libs/flint/acb_elliptic.pxd +42 -0
- sage/libs/flint/acb_hypgeom.pxd +169 -0
- sage/libs/flint/acb_macros.pxd +9 -0
- sage/libs/flint/acb_mat.pxd +136 -0
- sage/libs/flint/acb_mat_macros.pxd +10 -0
- sage/libs/flint/acb_modular.pxd +62 -0
- sage/libs/flint/acb_poly.pxd +251 -0
- sage/libs/flint/acb_poly_macros.pxd +8 -0
- sage/libs/flint/acb_theta.pxd +124 -0
- sage/libs/flint/acf.pxd +32 -0
- sage/libs/flint/aprcl.pxd +84 -0
- sage/libs/flint/arb.pxd +382 -0
- sage/libs/flint/arb_calc.pxd +31 -0
- sage/libs/flint/arb_fmpz_poly.pxd +34 -0
- sage/libs/flint/arb_fpwrap.pxd +215 -0
- sage/libs/flint/arb_hypgeom.pxd +147 -0
- sage/libs/flint/arb_macros.pxd +9 -0
- sage/libs/flint/arb_mat.pxd +140 -0
- sage/libs/flint/arb_mat_macros.pxd +10 -0
- sage/libs/flint/arb_poly.pxd +237 -0
- sage/libs/flint/arf.pxd +167 -0
- sage/libs/flint/arith.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/arith.pxd +76 -0
- sage/libs/flint/arith.pyx +77 -0
- sage/libs/flint/arith_sage.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/arith_sage.pyx +308 -0
- sage/libs/flint/bernoulli.pxd +28 -0
- sage/libs/flint/bool_mat.pxd +52 -0
- sage/libs/flint/ca.pxd +203 -0
- sage/libs/flint/ca_ext.pxd +34 -0
- sage/libs/flint/ca_field.pxd +32 -0
- sage/libs/flint/ca_mat.pxd +117 -0
- sage/libs/flint/ca_poly.pxd +104 -0
- sage/libs/flint/ca_vec.pxd +46 -0
- sage/libs/flint/calcium.pxd +27 -0
- sage/libs/flint/d_mat.pxd +39 -0
- sage/libs/flint/d_vec.pxd +32 -0
- sage/libs/flint/dirichlet.pxd +57 -0
- sage/libs/flint/dlog.pxd +53 -0
- sage/libs/flint/double_extras.pxd +24 -0
- sage/libs/flint/double_interval.pxd +36 -0
- sage/libs/flint/fexpr.pxd +104 -0
- sage/libs/flint/fexpr_builtin.pxd +20 -0
- sage/libs/flint/fft.pxd +66 -0
- sage/libs/flint/flint.pxd +36 -0
- sage/libs/flint/flint_ntl_wrap.h +35 -0
- sage/libs/flint/flint_sage.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/flint_sage.pyx +163 -0
- sage/libs/flint/flint_wrap.h +190 -0
- sage/libs/flint/fmpq.pxd +137 -0
- sage/libs/flint/fmpq_mat.pxd +105 -0
- sage/libs/flint/fmpq_mat_macros.pxd +10 -0
- sage/libs/flint/fmpq_mpoly.pxd +165 -0
- sage/libs/flint/fmpq_mpoly_factor.pxd +30 -0
- sage/libs/flint/fmpq_poly.pxd +241 -0
- sage/libs/flint/fmpq_poly_macros.pxd +9 -0
- sage/libs/flint/fmpq_poly_sage.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/fmpq_poly_sage.pxd +31 -0
- sage/libs/flint/fmpq_poly_sage.pyx +48 -0
- sage/libs/flint/fmpq_vec.pxd +27 -0
- sage/libs/flint/fmpz.pxd +256 -0
- sage/libs/flint/fmpz_extras.pxd +32 -0
- sage/libs/flint/fmpz_factor.pxd +42 -0
- sage/libs/flint/fmpz_factor_sage.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/fmpz_factor_sage.pxd +4 -0
- sage/libs/flint/fmpz_factor_sage.pyx +29 -0
- sage/libs/flint/fmpz_lll.pxd +49 -0
- sage/libs/flint/fmpz_macros.pxd +8 -0
- sage/libs/flint/fmpz_mat.pxd +184 -0
- sage/libs/flint/fmpz_mat_macros.pxd +10 -0
- sage/libs/flint/fmpz_mod.pxd +46 -0
- sage/libs/flint/fmpz_mod_mat.pxd +71 -0
- sage/libs/flint/fmpz_mod_mpoly.pxd +161 -0
- sage/libs/flint/fmpz_mod_mpoly_factor.pxd +28 -0
- sage/libs/flint/fmpz_mod_poly.pxd +249 -0
- sage/libs/flint/fmpz_mod_poly_factor.pxd +46 -0
- sage/libs/flint/fmpz_mod_vec.pxd +27 -0
- sage/libs/flint/fmpz_mpoly.pxd +224 -0
- sage/libs/flint/fmpz_mpoly_factor.pxd +29 -0
- sage/libs/flint/fmpz_mpoly_q.pxd +57 -0
- sage/libs/flint/fmpz_poly.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/fmpz_poly.pxd +407 -0
- sage/libs/flint/fmpz_poly.pyx +19 -0
- sage/libs/flint/fmpz_poly_factor.pxd +33 -0
- sage/libs/flint/fmpz_poly_macros.pxd +8 -0
- sage/libs/flint/fmpz_poly_mat.pxd +71 -0
- sage/libs/flint/fmpz_poly_q.pxd +55 -0
- sage/libs/flint/fmpz_poly_sage.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/fmpz_poly_sage.pxd +20 -0
- sage/libs/flint/fmpz_poly_sage.pyx +500 -0
- sage/libs/flint/fmpz_vec.pxd +80 -0
- sage/libs/flint/fmpzi.pxd +52 -0
- sage/libs/flint/fq.pxd +97 -0
- sage/libs/flint/fq_default.pxd +84 -0
- sage/libs/flint/fq_default_mat.pxd +70 -0
- sage/libs/flint/fq_default_poly.pxd +97 -0
- sage/libs/flint/fq_default_poly_factor.pxd +39 -0
- sage/libs/flint/fq_embed.pxd +28 -0
- sage/libs/flint/fq_mat.pxd +83 -0
- sage/libs/flint/fq_nmod.pxd +95 -0
- sage/libs/flint/fq_nmod_embed.pxd +28 -0
- sage/libs/flint/fq_nmod_mat.pxd +83 -0
- sage/libs/flint/fq_nmod_mpoly.pxd +130 -0
- sage/libs/flint/fq_nmod_mpoly_factor.pxd +28 -0
- sage/libs/flint/fq_nmod_poly.pxd +202 -0
- sage/libs/flint/fq_nmod_poly_factor.pxd +47 -0
- sage/libs/flint/fq_nmod_vec.pxd +33 -0
- sage/libs/flint/fq_poly.pxd +204 -0
- sage/libs/flint/fq_poly_factor.pxd +47 -0
- sage/libs/flint/fq_vec.pxd +33 -0
- sage/libs/flint/fq_zech.pxd +99 -0
- sage/libs/flint/fq_zech_embed.pxd +28 -0
- sage/libs/flint/fq_zech_mat.pxd +78 -0
- sage/libs/flint/fq_zech_poly.pxd +198 -0
- sage/libs/flint/fq_zech_poly_factor.pxd +47 -0
- sage/libs/flint/fq_zech_vec.pxd +33 -0
- sage/libs/flint/gr.pxd +174 -0
- sage/libs/flint/gr_generic.pxd +215 -0
- sage/libs/flint/gr_mat.pxd +161 -0
- sage/libs/flint/gr_mpoly.pxd +68 -0
- sage/libs/flint/gr_poly.pxd +276 -0
- sage/libs/flint/gr_special.pxd +237 -0
- sage/libs/flint/gr_vec.pxd +120 -0
- sage/libs/flint/hypgeom.pxd +24 -0
- sage/libs/flint/long_extras.pxd +23 -0
- sage/libs/flint/mag.pxd +131 -0
- sage/libs/flint/mag_macros.pxd +8 -0
- sage/libs/flint/mpf_mat.pxd +36 -0
- sage/libs/flint/mpf_vec.pxd +34 -0
- sage/libs/flint/mpfr_mat.pxd +27 -0
- sage/libs/flint/mpfr_vec.pxd +25 -0
- sage/libs/flint/mpn_extras.pxd +41 -0
- sage/libs/flint/mpoly.pxd +72 -0
- sage/libs/flint/nf.pxd +19 -0
- sage/libs/flint/nf_elem.pxd +74 -0
- sage/libs/flint/nmod.pxd +35 -0
- sage/libs/flint/nmod_mat.pxd +104 -0
- sage/libs/flint/nmod_mpoly.pxd +144 -0
- sage/libs/flint/nmod_mpoly_factor.pxd +28 -0
- sage/libs/flint/nmod_poly.pxd +339 -0
- sage/libs/flint/nmod_poly_factor.pxd +44 -0
- sage/libs/flint/nmod_poly_linkage.pxi +710 -0
- sage/libs/flint/nmod_poly_mat.pxd +76 -0
- sage/libs/flint/nmod_vec.pxd +40 -0
- sage/libs/flint/ntl_interface.pxd +17 -0
- sage/libs/flint/padic.pxd +93 -0
- sage/libs/flint/padic_mat.pxd +64 -0
- sage/libs/flint/padic_poly.pxd +88 -0
- sage/libs/flint/partitions.pxd +23 -0
- sage/libs/flint/perm.pxd +26 -0
- sage/libs/flint/profiler.pxd +24 -0
- sage/libs/flint/qadic.pxd +77 -0
- sage/libs/flint/qfb.pxd +44 -0
- sage/libs/flint/qqbar.pxd +172 -0
- sage/libs/flint/qsieve.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/qsieve.pxd +41 -0
- sage/libs/flint/qsieve.pyx +21 -0
- sage/libs/flint/qsieve_sage.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/qsieve_sage.pyx +67 -0
- sage/libs/flint/thread_pool.pxd +25 -0
- sage/libs/flint/types.pxd +2076 -0
- sage/libs/flint/ulong_extras.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/ulong_extras.pxd +141 -0
- sage/libs/flint/ulong_extras.pyx +21 -0
- sage/libs/flint/ulong_extras_sage.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/libs/flint/ulong_extras_sage.pyx +21 -0
- sage/matrix/all__sagemath_flint.py +1 -0
- sage/matrix/change_ring.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/change_ring.pyx +43 -0
- sage/matrix/matrix_complex_ball_dense.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/matrix_complex_ball_dense.pxd +14 -0
- sage/matrix/matrix_complex_ball_dense.pyx +973 -0
- sage/matrix/matrix_cyclo_dense.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/matrix_cyclo_dense.pxd +16 -0
- sage/matrix/matrix_cyclo_dense.pyx +1761 -0
- sage/matrix/matrix_integer_dense.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/matrix_integer_dense.pxd +32 -0
- sage/matrix/matrix_integer_dense.pyx +5801 -0
- sage/matrix/matrix_integer_dense_hnf.py +1294 -0
- sage/matrix/matrix_integer_dense_saturation.py +346 -0
- sage/matrix/matrix_integer_sparse.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/matrix_integer_sparse.pxd +9 -0
- sage/matrix/matrix_integer_sparse.pyx +1090 -0
- sage/matrix/matrix_rational_dense.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/matrix_rational_dense.pxd +23 -0
- sage/matrix/matrix_rational_dense.pyx +2995 -0
- sage/matrix/matrix_rational_sparse.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/matrix_rational_sparse.pxd +11 -0
- sage/matrix/matrix_rational_sparse.pyx +789 -0
- sage/matrix/misc_flint.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/matrix/misc_flint.pyx +109 -0
- sage/modular/all__sagemath_flint.py +1 -0
- sage/modular/modform/all__sagemath_flint.py +1 -0
- sage/modular/modform/eis_series_cython.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/modular/modform/eis_series_cython.pyx +226 -0
- sage/modular/modsym/all__sagemath_flint.py +1 -0
- sage/modular/modsym/apply.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/modular/modsym/apply.pxd +6 -0
- sage/modular/modsym/apply.pyx +113 -0
- sage/modular/modsym/heilbronn.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/modular/modsym/heilbronn.pyx +966 -0
- sage/modular/pollack_stevens/all__sagemath_flint.py +1 -0
- sage/modular/pollack_stevens/dist.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/modular/pollack_stevens/dist.pxd +38 -0
- sage/modular/pollack_stevens/dist.pyx +1439 -0
- sage/quivers/algebra.py +691 -0
- sage/quivers/algebra_elements.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/quivers/algebra_elements.pxd +97 -0
- sage/quivers/algebra_elements.pxi +1324 -0
- sage/quivers/algebra_elements.pyx +1424 -0
- sage/quivers/all.py +1 -0
- sage/quivers/ar_quiver.py +917 -0
- sage/quivers/homspace.py +640 -0
- sage/quivers/morphism.py +1282 -0
- sage/quivers/path_semigroup.py +1155 -0
- sage/quivers/paths.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/quivers/paths.pxd +13 -0
- sage/quivers/paths.pyx +809 -0
- sage/quivers/representation.py +2975 -0
- sage/rings/all__sagemath_flint.py +37 -0
- sage/rings/cif.py +4 -0
- sage/rings/complex_arb.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/complex_arb.pxd +29 -0
- sage/rings/complex_arb.pyx +5176 -0
- sage/rings/complex_interval.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/complex_interval.pxd +30 -0
- sage/rings/complex_interval.pyx +2475 -0
- sage/rings/complex_interval_field.py +711 -0
- sage/rings/convert/all.py +1 -0
- sage/rings/convert/mpfi.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/convert/mpfi.pxd +6 -0
- sage/rings/convert/mpfi.pyx +576 -0
- sage/rings/factorint_flint.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/factorint_flint.pyx +99 -0
- sage/rings/fraction_field_FpT.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/fraction_field_FpT.pxd +28 -0
- sage/rings/fraction_field_FpT.pyx +2043 -0
- sage/rings/imaginary_unit.py +5 -0
- sage/rings/monomials.py +73 -0
- sage/rings/number_field/S_unit_solver.py +2870 -0
- sage/rings/number_field/all__sagemath_flint.py +7 -0
- sage/rings/number_field/bdd_height.py +664 -0
- sage/rings/number_field/class_group.py +762 -0
- sage/rings/number_field/galois_group.py +1307 -0
- sage/rings/number_field/homset.py +612 -0
- sage/rings/number_field/maps.py +687 -0
- sage/rings/number_field/morphism.py +272 -0
- sage/rings/number_field/number_field.py +12820 -0
- sage/rings/number_field/number_field_element.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/number_field/number_field_element.pxd +59 -0
- sage/rings/number_field/number_field_element.pyx +5735 -0
- sage/rings/number_field/number_field_element_quadratic.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/number_field/number_field_element_quadratic.pxd +34 -0
- sage/rings/number_field/number_field_element_quadratic.pyx +3185 -0
- sage/rings/number_field/number_field_ideal_rel.py +925 -0
- sage/rings/number_field/number_field_morphisms.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/number_field/number_field_morphisms.pyx +781 -0
- sage/rings/number_field/number_field_rel.py +2734 -0
- sage/rings/number_field/order.py +2981 -0
- sage/rings/number_field/order_ideal.py +804 -0
- sage/rings/number_field/selmer_group.py +715 -0
- sage/rings/number_field/small_primes_of_degree_one.py +242 -0
- sage/rings/number_field/splitting_field.py +606 -0
- sage/rings/number_field/structure.py +380 -0
- sage/rings/number_field/unit_group.py +721 -0
- sage/rings/padics/all__sagemath_flint.py +3 -0
- sage/rings/polynomial/all__sagemath_flint.py +1 -0
- sage/rings/polynomial/complex_roots.py +312 -0
- sage/rings/polynomial/evaluation_flint.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/evaluation_flint.pxd +7 -0
- sage/rings/polynomial/evaluation_flint.pyx +68 -0
- sage/rings/polynomial/hilbert.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/hilbert.pyx +602 -0
- sage/rings/polynomial/polynomial_complex_arb.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_complex_arb.pxd +7 -0
- sage/rings/polynomial/polynomial_complex_arb.pyx +963 -0
- sage/rings/polynomial/polynomial_integer_dense_flint.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_integer_dense_flint.pxd +13 -0
- sage/rings/polynomial/polynomial_integer_dense_flint.pyx +1881 -0
- sage/rings/polynomial/polynomial_number_field.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_number_field.pyx +345 -0
- sage/rings/polynomial/polynomial_rational_flint.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_rational_flint.pxd +20 -0
- sage/rings/polynomial/polynomial_rational_flint.pyx +2598 -0
- sage/rings/polynomial/polynomial_zmod_flint.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_zmod_flint.pxd +20 -0
- sage/rings/polynomial/polynomial_zmod_flint.pyx +1063 -0
- sage/rings/polynomial/real_roots.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/real_roots.pxd +81 -0
- sage/rings/polynomial/real_roots.pyx +4704 -0
- sage/rings/polynomial/refine_root.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/refine_root.pyx +142 -0
- sage/rings/polynomial/weil/all.py +4 -0
- sage/rings/polynomial/weil/power_sums.h +46 -0
- sage/rings/polynomial/weil/weil_polynomials.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/weil/weil_polynomials.pyx +596 -0
- sage/rings/qqbar.py +9025 -0
- sage/rings/real_arb.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/real_arb.pxd +21 -0
- sage/rings/real_arb.pyx +4065 -0
- sage/rings/real_interval_absolute.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/real_interval_absolute.pyx +1073 -0
- sage/rings/real_mpfi.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/rings/real_mpfi.pyx +5428 -0
- sage/schemes/all__sagemath_flint.py +1 -0
- sage/schemes/elliptic_curves/all__sagemath_flint.py +1 -0
- sage/schemes/elliptic_curves/descent_two_isogeny.cpython-311-x86_64-linux-gnu.so +0 -0
- sage/schemes/elliptic_curves/descent_two_isogeny.pyx +1387 -0
- sage/schemes/elliptic_curves/descent_two_isogeny_pari.pxd +5 -0
@@ -0,0 +1,1063 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-flint
|
2
|
+
# distutils: libraries = gmp NTL_LIBRARIES
|
3
|
+
# distutils: extra_compile_args = NTL_CFLAGS
|
4
|
+
# distutils: include_dirs = NTL_INCDIR
|
5
|
+
# distutils: library_dirs = NTL_LIBDIR
|
6
|
+
# distutils: extra_link_args = NTL_LIBEXTRA
|
7
|
+
# distutils: language = c++
|
8
|
+
r"""
|
9
|
+
Dense univariate polynomials over `\ZZ/n\ZZ`, implemented using FLINT
|
10
|
+
|
11
|
+
This module gives a fast implementation of `(\ZZ/n\ZZ)[x]` whenever `n` is at
|
12
|
+
most ``sys.maxsize``. We use it by default in preference to NTL when the modulus
|
13
|
+
is small, falling back to NTL if the modulus is too large, as in the example
|
14
|
+
below.
|
15
|
+
|
16
|
+
EXAMPLES::
|
17
|
+
|
18
|
+
sage: R.<a> = PolynomialRing(Integers(100))
|
19
|
+
sage: type(a)
|
20
|
+
<class 'sage.rings.polynomial.polynomial_zmod_flint.Polynomial_zmod_flint'>
|
21
|
+
sage: R.<a> = PolynomialRing(Integers(5*2^64)) # needs sage.rings.finite_rings
|
22
|
+
sage: type(a) # needs sage.rings.finite_rings
|
23
|
+
<class 'sage.rings.polynomial.polynomial_modn_dense_ntl.Polynomial_dense_modn_ntl_ZZ'>
|
24
|
+
sage: R.<a> = PolynomialRing(Integers(5*2^64), implementation="FLINT") # needs sage.rings.finite_rings
|
25
|
+
Traceback (most recent call last):
|
26
|
+
...
|
27
|
+
ValueError: FLINT does not support modulus 92233720368547758080
|
28
|
+
|
29
|
+
AUTHORS:
|
30
|
+
|
31
|
+
- Burcin Erocal (2008-11) initial implementation
|
32
|
+
- Martin Albrecht (2009-01) another initial implementation
|
33
|
+
"""
|
34
|
+
# ****************************************************************************
|
35
|
+
# Copyright (C) 2009-2010 Burcin Erocal <burcin@erocal.org>
|
36
|
+
# Copyright (C) 2009 Martin Albrecht <M.R.Albrecht@rhul.ac.uk>
|
37
|
+
#
|
38
|
+
# Distributed under the terms of the GNU General Public License (GPL),
|
39
|
+
# version 2 or any later version. The full text of the GPL is available at:
|
40
|
+
# https://www.gnu.org/licenses/
|
41
|
+
# ****************************************************************************
|
42
|
+
|
43
|
+
from sage.libs.ntl.ntl_lzz_pX import ntl_zz_pX
|
44
|
+
from sage.structure.element cimport parent
|
45
|
+
from sage.structure.element import coerce_binop, canonical_coercion, have_same_parent
|
46
|
+
from sage.rings.polynomial.polynomial_integer_dense_flint cimport Polynomial_integer_dense_flint
|
47
|
+
|
48
|
+
from sage.misc.superseded import deprecated_function_alias
|
49
|
+
|
50
|
+
# We need to define this stuff before including the templating stuff
|
51
|
+
# to make sure the function get_cparent is found since it is used in
|
52
|
+
# 'polynomial_template.pxi'.
|
53
|
+
|
54
|
+
cdef inline cparent get_cparent(parent) except? 0:
|
55
|
+
try:
|
56
|
+
return <unsigned long>(parent.modulus())
|
57
|
+
except AttributeError:
|
58
|
+
return 0
|
59
|
+
|
60
|
+
# first we include the definitions
|
61
|
+
include "sage/libs/flint/nmod_poly_linkage.pxi"
|
62
|
+
|
63
|
+
# and then the interface
|
64
|
+
include "polynomial_template.pxi"
|
65
|
+
|
66
|
+
from sage.libs.flint.fmpz cimport *
|
67
|
+
from sage.libs.flint.fmpz_poly cimport *
|
68
|
+
from sage.libs.flint.nmod_poly cimport *
|
69
|
+
|
70
|
+
from sage.misc.cachefunc import cached_method
|
71
|
+
|
72
|
+
cdef class Polynomial_zmod_flint(Polynomial_template):
|
73
|
+
r"""
|
74
|
+
Polynomial on `\ZZ/n\ZZ` implemented via FLINT.
|
75
|
+
|
76
|
+
TESTS::
|
77
|
+
|
78
|
+
sage: f = Integers(4)['x'].random_element()
|
79
|
+
sage: from sage.rings.polynomial.polynomial_zmod_flint import Polynomial_zmod_flint
|
80
|
+
sage: isinstance(f, Polynomial_zmod_flint)
|
81
|
+
True
|
82
|
+
|
83
|
+
.. automethod:: _add_
|
84
|
+
.. automethod:: _sub_
|
85
|
+
.. automethod:: _lmul_
|
86
|
+
.. automethod:: _rmul_
|
87
|
+
.. automethod:: _mul_
|
88
|
+
.. automethod:: _mul_trunc_
|
89
|
+
"""
|
90
|
+
def __init__(self, parent, x=None, check=True, is_gen=False, construct=False):
|
91
|
+
"""
|
92
|
+
EXAMPLES::
|
93
|
+
|
94
|
+
sage: P.<x> = GF(32003)[] # needs sage.rings.finite_rings
|
95
|
+
sage: f = 24998*x^2 + 29761*x + 2252 # needs sage.rings.finite_rings
|
96
|
+
"""
|
97
|
+
cdef long nlen
|
98
|
+
|
99
|
+
if isinstance(x, (list, tuple)):
|
100
|
+
k = parent._base
|
101
|
+
if check:
|
102
|
+
lst = [k(i) for i in x]
|
103
|
+
else:
|
104
|
+
lst = x
|
105
|
+
# remove trailing zeroes
|
106
|
+
nlen = len(lst)
|
107
|
+
while nlen and lst[nlen-1] == 0:
|
108
|
+
nlen -= 1
|
109
|
+
lst = lst[:nlen]
|
110
|
+
Polynomial_template.__init__(self, parent, 0, check, is_gen, construct)
|
111
|
+
self._set_list(lst)
|
112
|
+
return
|
113
|
+
elif isinstance(x, Polynomial_integer_dense_flint):
|
114
|
+
Polynomial_template.__init__(self, parent, 0, check, is_gen, construct)
|
115
|
+
self._set_fmpz_poly((<Polynomial_integer_dense_flint>x)._poly)
|
116
|
+
return
|
117
|
+
else:
|
118
|
+
if isinstance(x, ntl_zz_pX):
|
119
|
+
x = x.list()
|
120
|
+
try:
|
121
|
+
if x.parent() is parent.base_ring() or x.parent() == parent.base_ring():
|
122
|
+
x = int(x) % parent.modulus()
|
123
|
+
except AttributeError:
|
124
|
+
pass
|
125
|
+
Polynomial_template.__init__(self, parent, x, check, is_gen, construct)
|
126
|
+
|
127
|
+
cdef Polynomial_template _new(self):
|
128
|
+
"""
|
129
|
+
EXAMPLES::
|
130
|
+
|
131
|
+
sage: P.<x> = GF(5)[]
|
132
|
+
sage: (2*x+1).monic() #indirect doctest
|
133
|
+
x + 3
|
134
|
+
"""
|
135
|
+
cdef type t = type(self)
|
136
|
+
cdef Polynomial_template e = <Polynomial_template>t.__new__(t)
|
137
|
+
nmod_poly_init(&e.x, self._parent.modulus())
|
138
|
+
e._parent = self._parent
|
139
|
+
e._cparent = self._cparent
|
140
|
+
return e
|
141
|
+
|
142
|
+
cpdef Polynomial _new_constant_poly(self, x, Parent P):
|
143
|
+
r"""
|
144
|
+
Quickly create a new constant polynomial with value x in parent P.
|
145
|
+
|
146
|
+
ASSUMPTION:
|
147
|
+
|
148
|
+
x must convertible to an int.
|
149
|
+
|
150
|
+
The modulus of P must coincide with the modulus of this element.
|
151
|
+
That assumption is not verified!
|
152
|
+
|
153
|
+
EXAMPLES::
|
154
|
+
|
155
|
+
sage: R.<x> = GF(3)[]
|
156
|
+
sage: x._new_constant_poly(4,R)
|
157
|
+
1
|
158
|
+
sage: x._new_constant_poly('4',R)
|
159
|
+
1
|
160
|
+
sage: x._new_constant_poly('4.1',R)
|
161
|
+
Traceback (most recent call last):
|
162
|
+
...
|
163
|
+
ValueError: invalid literal for int() with base 10: '4.1'
|
164
|
+
"""
|
165
|
+
cdef type t = type(self)
|
166
|
+
cdef Polynomial_template r = <Polynomial_template>t.__new__(t)
|
167
|
+
r._parent = P
|
168
|
+
r._cparent = get_cparent(P)
|
169
|
+
nmod_poly_init(&r.x, nmod_poly_modulus(&self.x))
|
170
|
+
celement_set_si(&r.x, int(x), (<Polynomial_template>self)._cparent)
|
171
|
+
return r
|
172
|
+
|
173
|
+
cdef int _set_list(self, x) except -1:
|
174
|
+
"""
|
175
|
+
Set the coefficients of ``self`` from a list of coefficients.
|
176
|
+
|
177
|
+
INPUT:
|
178
|
+
|
179
|
+
- ``x`` -- list of coefficients; the coefficients are assumed to be
|
180
|
+
reduced already and the list contains no trailing zeroes
|
181
|
+
|
182
|
+
EXAMPLES::
|
183
|
+
|
184
|
+
sage: P.<a> = GF(7)[]
|
185
|
+
sage: P([2^60,0,1])
|
186
|
+
a^2 + 1
|
187
|
+
sage: P([])
|
188
|
+
0
|
189
|
+
sage: P(range(15))
|
190
|
+
6*a^13 + 5*a^12 + 4*a^11 + 3*a^10 + 2*a^9 + a^8 + 6*a^6 + 5*a^5 + 4*a^4 + 3*a^3 + 2*a^2 + a
|
191
|
+
"""
|
192
|
+
cdef list l_in = x
|
193
|
+
cdef unsigned long length = len(l_in)
|
194
|
+
cdef int i
|
195
|
+
if length == 0:
|
196
|
+
nmod_poly_zero(&self.x)
|
197
|
+
return 0
|
198
|
+
|
199
|
+
# resize to length of list
|
200
|
+
sig_on()
|
201
|
+
nmod_poly_realloc(&self.x, length)
|
202
|
+
sig_off()
|
203
|
+
|
204
|
+
sig_on()
|
205
|
+
# The following depends on the internals of FLINT
|
206
|
+
for i from 0 <= i < length:
|
207
|
+
self.x.coeffs[i] = l_in[i]
|
208
|
+
self.x.length = length
|
209
|
+
sig_off()
|
210
|
+
return 0
|
211
|
+
|
212
|
+
cdef int _set_fmpz_poly(self, fmpz_poly_t x) except -1:
|
213
|
+
"""
|
214
|
+
Set the coefficients of ``self`` from the coefficients of an ``fmpz_poly_t`` element.
|
215
|
+
|
216
|
+
INPUT:
|
217
|
+
|
218
|
+
- ``x`` -- an ``fmpz_poly_t`` element
|
219
|
+
|
220
|
+
EXAMPLES::
|
221
|
+
|
222
|
+
sage: a = ZZ['x'](range(17))
|
223
|
+
sage: R = Integers(7)['x']
|
224
|
+
sage: R(a)
|
225
|
+
2*x^16 + x^15 + 6*x^13 + 5*x^12 + 4*x^11 + 3*x^10 + 2*x^9 + x^8 + 6*x^6 + 5*x^5 + 4*x^4 + 3*x^3 + 2*x^2 + x
|
226
|
+
|
227
|
+
TESTS:
|
228
|
+
|
229
|
+
The following test from :issue:`12173` used to be horribly slow::
|
230
|
+
|
231
|
+
sage: a = ZZ['x'](range(100000))
|
232
|
+
sage: R = Integers(3)['x']
|
233
|
+
sage: p = R(a)
|
234
|
+
sage: d, v = p.degree(), p.valuation()
|
235
|
+
sage: d, v
|
236
|
+
(99998, 1)
|
237
|
+
sage: p[d], p[v]
|
238
|
+
(2, 1)
|
239
|
+
"""
|
240
|
+
sig_on()
|
241
|
+
fmpz_poly_get_nmod_poly(&self.x, x)
|
242
|
+
sig_off()
|
243
|
+
return 0
|
244
|
+
|
245
|
+
cdef get_unsafe(self, Py_ssize_t i):
|
246
|
+
"""
|
247
|
+
Return the `i`-th coefficient of ``self``.
|
248
|
+
|
249
|
+
EXAMPLES::
|
250
|
+
|
251
|
+
sage: # needs sage.rings.finite_rings
|
252
|
+
sage: P.<x> = GF(32003)[]
|
253
|
+
sage: f = 24998*x^2 + 29761*x + 2252
|
254
|
+
sage: f[100]
|
255
|
+
0
|
256
|
+
sage: f[1]
|
257
|
+
29761
|
258
|
+
sage: f[0]
|
259
|
+
2252
|
260
|
+
sage: f[-1]
|
261
|
+
0
|
262
|
+
sage: f[:2]
|
263
|
+
29761*x + 2252
|
264
|
+
sage: f[:50] == f
|
265
|
+
True
|
266
|
+
"""
|
267
|
+
cdef unsigned long c = nmod_poly_get_coeff_ui(&self.x, i)
|
268
|
+
return self._parent.base_ring()(c)
|
269
|
+
|
270
|
+
def __call__(self, *x, **kwds):
|
271
|
+
"""
|
272
|
+
Evaluate polynomial at x=a.
|
273
|
+
|
274
|
+
INPUT: **either**
|
275
|
+
|
276
|
+
- ``a`` -- ring element; need not be in the coefficient ring of the
|
277
|
+
polynomial
|
278
|
+
- a dictionary for kwds:value pairs; if the variable name of the
|
279
|
+
polynomial is a keyword it is substituted in, otherwise this
|
280
|
+
polynomial is returned unchanged
|
281
|
+
|
282
|
+
EXAMPLES::
|
283
|
+
|
284
|
+
sage: P.<x> = PolynomialRing(GF(7))
|
285
|
+
sage: f = x^2 + 1
|
286
|
+
sage: f(0)
|
287
|
+
1
|
288
|
+
sage: f(2)
|
289
|
+
5
|
290
|
+
sage: f(3)
|
291
|
+
3
|
292
|
+
|
293
|
+
sage: f(x+1)
|
294
|
+
x^2 + 2*x + 2
|
295
|
+
|
296
|
+
Test some simple (but important) optimizations::
|
297
|
+
|
298
|
+
sage: f(2) == f(P(2))
|
299
|
+
True
|
300
|
+
sage: f(x) is f
|
301
|
+
True
|
302
|
+
sage: f(1/x)
|
303
|
+
(x^2 + 1)/x^2
|
304
|
+
"""
|
305
|
+
cdef Polynomial_zmod_flint t, y
|
306
|
+
cdef long c
|
307
|
+
K = self._parent.base_ring()
|
308
|
+
if not kwds and len(x) == 1:
|
309
|
+
P = parent(x[0])
|
310
|
+
if K.has_coerce_map_from(P):
|
311
|
+
x = K(x[0])
|
312
|
+
return K(nmod_poly_evaluate_nmod(&self.x, x))
|
313
|
+
elif self._parent.has_coerce_map_from(P):
|
314
|
+
y = <Polynomial_zmod_flint>self._parent(x[0])
|
315
|
+
t = self._new()
|
316
|
+
if nmod_poly_degree(&y.x) == 0:
|
317
|
+
c = nmod_poly_evaluate_nmod(&self.x, nmod_poly_get_coeff_ui(&y.x, 0))
|
318
|
+
nmod_poly_set_coeff_ui(&t.x, 0, c)
|
319
|
+
elif nmod_poly_degree(&y.x) == 1 and nmod_poly_get_coeff_ui(&y.x, 0) == 0:
|
320
|
+
c = nmod_poly_get_coeff_ui(&y.x, 1)
|
321
|
+
if c == 1:
|
322
|
+
return self
|
323
|
+
nmod_poly_compose(&t.x, &self.x, &y.x)
|
324
|
+
return t
|
325
|
+
return Polynomial.__call__(self, *x, **kwds)
|
326
|
+
|
327
|
+
@coerce_binop
|
328
|
+
def resultant(self, Polynomial_zmod_flint other):
|
329
|
+
"""
|
330
|
+
Return the resultant of ``self`` and ``other``, which must lie in the same
|
331
|
+
polynomial ring.
|
332
|
+
|
333
|
+
INPUT:
|
334
|
+
|
335
|
+
- ``other`` -- a polynomial
|
336
|
+
|
337
|
+
OUTPUT: an element of the base ring of the polynomial ring
|
338
|
+
|
339
|
+
EXAMPLES::
|
340
|
+
|
341
|
+
sage: R.<x> = GF(19)['x']
|
342
|
+
sage: f = x^3 + x + 1; g = x^3 - x - 1
|
343
|
+
sage: r = f.resultant(g); r
|
344
|
+
11
|
345
|
+
sage: r.parent() is GF(19)
|
346
|
+
True
|
347
|
+
|
348
|
+
The following example shows that :issue:`11782` has been fixed::
|
349
|
+
|
350
|
+
sage: R.<x> = ZZ.quo(9)['x']
|
351
|
+
sage: f = 2*x^3 + x^2 + x; g = 6*x^2 + 2*x + 1
|
352
|
+
sage: f.resultant(g)
|
353
|
+
5
|
354
|
+
"""
|
355
|
+
# As of version 1.6 of FLINT, the base ring must be a field to compute
|
356
|
+
# resultants correctly. (see http://www.flintlib.org/flint-1.6.pdf p.58)
|
357
|
+
# If it is not a field we fall back to direct computation through the
|
358
|
+
# Sylvester matrix.
|
359
|
+
if self.base_ring().is_field():
|
360
|
+
res = nmod_poly_resultant(&(<Polynomial_template>self).x,
|
361
|
+
&(<Polynomial_template>other).x)
|
362
|
+
return self.parent().base_ring()(res)
|
363
|
+
else:
|
364
|
+
return self.sylvester_matrix(other).determinant()
|
365
|
+
|
366
|
+
def small_roots(self, *args, **kwds):
|
367
|
+
r"""
|
368
|
+
See :func:`sage.rings.polynomial.polynomial_modn_dense_ntl.small_roots`
|
369
|
+
for the documentation of this function.
|
370
|
+
|
371
|
+
EXAMPLES::
|
372
|
+
|
373
|
+
sage: # needs sage.rings.finite_rings
|
374
|
+
sage: N = 10001
|
375
|
+
sage: K = Zmod(10001)
|
376
|
+
sage: P.<x> = PolynomialRing(K)
|
377
|
+
sage: f = x^3 + 10*x^2 + 5000*x - 222
|
378
|
+
sage: f.small_roots() # needs fpylll
|
379
|
+
[4]
|
380
|
+
"""
|
381
|
+
from sage.rings.polynomial.polynomial_modn_dense_ntl import small_roots
|
382
|
+
return small_roots(self, *args, **kwds)
|
383
|
+
|
384
|
+
def _unsafe_mutate(self, n, value):
|
385
|
+
r"""
|
386
|
+
Never use this unless you really know what you are doing.
|
387
|
+
|
388
|
+
INPUT:
|
389
|
+
|
390
|
+
- ``n`` -- degree
|
391
|
+
- ``value`` -- coefficient
|
392
|
+
|
393
|
+
.. warning::
|
394
|
+
|
395
|
+
This could easily introduce subtle bugs, since Sage assumes
|
396
|
+
everywhere that polynomials are immutable. It's OK to use this if
|
397
|
+
you really know what you're doing.
|
398
|
+
|
399
|
+
EXAMPLES::
|
400
|
+
|
401
|
+
sage: R.<x> = GF(7)[]
|
402
|
+
sage: f = (1+2*x)^2; f
|
403
|
+
4*x^2 + 4*x + 1
|
404
|
+
sage: f._unsafe_mutate(1, -5)
|
405
|
+
sage: f
|
406
|
+
4*x^2 + 2*x + 1
|
407
|
+
"""
|
408
|
+
n = int(n)
|
409
|
+
value = self.base_ring()(value)
|
410
|
+
if n >= 0:
|
411
|
+
nmod_poly_set_coeff_ui(&self.x, n, int(value) % nmod_poly_modulus(&self.x))
|
412
|
+
else:
|
413
|
+
raise IndexError("polynomial coefficient index must be nonnegative")
|
414
|
+
|
415
|
+
cpdef Polynomial _mul_trunc_(self, Polynomial right, long n):
|
416
|
+
"""
|
417
|
+
Return the product of this polynomial and other truncated to the
|
418
|
+
given length `n`.
|
419
|
+
|
420
|
+
This function is usually more efficient than simply doing the
|
421
|
+
multiplication and then truncating. The function is tuned for length
|
422
|
+
`n` about half the length of a full product.
|
423
|
+
|
424
|
+
EXAMPLES::
|
425
|
+
|
426
|
+
sage: P.<a> = GF(7)[]
|
427
|
+
sage: a = P(range(10)); b = P(range(5, 15))
|
428
|
+
sage: a._mul_trunc_(b, 5)
|
429
|
+
4*a^4 + 6*a^3 + 2*a^2 + 5*a
|
430
|
+
|
431
|
+
TESTS::
|
432
|
+
|
433
|
+
sage: a._mul_trunc_(b, 0)
|
434
|
+
Traceback (most recent call last):
|
435
|
+
...
|
436
|
+
ValueError: length must be > 0
|
437
|
+
"""
|
438
|
+
if n <= 0:
|
439
|
+
raise ValueError("length must be > 0")
|
440
|
+
cdef Polynomial_zmod_flint op2 = <Polynomial_zmod_flint> right
|
441
|
+
cdef Polynomial_zmod_flint res = self._new()
|
442
|
+
nmod_poly_mullow(&res.x, &self.x, &op2.x, n)
|
443
|
+
return res
|
444
|
+
|
445
|
+
_mul_short = _mul_trunc_
|
446
|
+
|
447
|
+
cpdef Polynomial _mul_trunc_opposite(self, Polynomial_zmod_flint other, n):
|
448
|
+
"""
|
449
|
+
Return the product of this polynomial and other ignoring the least
|
450
|
+
significant `n` terms of the result which may be set to anything.
|
451
|
+
|
452
|
+
This function is more efficient than doing the full multiplication if
|
453
|
+
the operands are relatively short. It is tuned for `n` about half the
|
454
|
+
length of a full product.
|
455
|
+
|
456
|
+
EXAMPLES::
|
457
|
+
|
458
|
+
sage: P.<a> = GF(7)[]
|
459
|
+
sage: b = P(range(10)); c = P(range(5, 15))
|
460
|
+
sage: b._mul_trunc_opposite(c, 10)
|
461
|
+
5*a^17 + 2*a^16 + 6*a^15 + 4*a^14 + 4*a^13 + 5*a^10 + 2*a^9 + 5*a^8 + 4*a^5 + 4*a^4 + 6*a^3 + 2*a^2 + 5*a
|
462
|
+
sage: list(b._mul_trunc_opposite(c, 10))[10:18]
|
463
|
+
[5, 0, 0, 4, 4, 6, 2, 5]
|
464
|
+
sage: list(b*c)[10:18]
|
465
|
+
[5, 0, 0, 4, 4, 6, 2, 5]
|
466
|
+
sage: list(b._mul_trunc_opposite(c, 18))[18:]
|
467
|
+
[]
|
468
|
+
|
469
|
+
TESTS::
|
470
|
+
|
471
|
+
sage: a._mul_trunc_opposite(b, -1)
|
472
|
+
Traceback (most recent call last):
|
473
|
+
...
|
474
|
+
ValueError: length must be >= 0
|
475
|
+
"""
|
476
|
+
cdef Polynomial_zmod_flint res = self._new()
|
477
|
+
if n < 0:
|
478
|
+
raise ValueError("length must be >= 0")
|
479
|
+
nmod_poly_mulhigh(&res.x, &self.x, &other.x, n)
|
480
|
+
return res
|
481
|
+
|
482
|
+
_mul_short_opposite = _mul_trunc_opposite
|
483
|
+
|
484
|
+
def __pow__(self, exp, modulus):
|
485
|
+
r"""
|
486
|
+
Exponentiation of ``self``.
|
487
|
+
|
488
|
+
If ``modulus`` is not ``None``, the exponentiation is performed
|
489
|
+
modulo the polynomial ``modulus``.
|
490
|
+
|
491
|
+
EXAMPLES::
|
492
|
+
|
493
|
+
sage: R.<x> = GF(5)[]
|
494
|
+
sage: pow(x+1, 5**50, x^5 + 4*x + 3)
|
495
|
+
x + 1
|
496
|
+
sage: pow(x+1, 5**64, x^5 + 4*x + 3)
|
497
|
+
x + 4
|
498
|
+
sage: pow(x, 5**64, x^5 + 4*x + 3)
|
499
|
+
x + 3
|
500
|
+
|
501
|
+
The modulus can have smaller degree than ``self``::
|
502
|
+
|
503
|
+
sage: R.<x> = PolynomialRing(GF(5), implementation="FLINT")
|
504
|
+
sage: pow(x^4, 6, x^2 + x + 1)
|
505
|
+
1
|
506
|
+
|
507
|
+
TESTS:
|
508
|
+
|
509
|
+
Canonical coercion applies::
|
510
|
+
|
511
|
+
sage: R.<x> = PolynomialRing(GF(5), implementation="FLINT")
|
512
|
+
sage: x_ZZ = ZZ["x"].gen()
|
513
|
+
sage: pow(x+1, 25, 2)
|
514
|
+
0
|
515
|
+
sage: pow(x+1, 4, x_ZZ^2 + x_ZZ + 1)
|
516
|
+
4*x + 4
|
517
|
+
sage: pow(x+1, int(4), x_ZZ^2 + x_ZZ + 1)
|
518
|
+
4*x + 4
|
519
|
+
sage: xx = polygen(GF(97))
|
520
|
+
sage: pow(x + 1, 3, xx^3 + xx + 1)
|
521
|
+
Traceback (most recent call last):
|
522
|
+
...
|
523
|
+
TypeError: no common canonical parent for objects with parents: ...
|
524
|
+
"""
|
525
|
+
exp = Integer(exp)
|
526
|
+
if modulus is not None:
|
527
|
+
# Similar to coerce_binop
|
528
|
+
if not have_same_parent(self, modulus):
|
529
|
+
a, m = canonical_coercion(self, modulus)
|
530
|
+
if a is not self:
|
531
|
+
return pow(a, exp, m)
|
532
|
+
modulus = m
|
533
|
+
self = self % modulus
|
534
|
+
if exp > 0 and exp.bit_length() >= 32:
|
535
|
+
return (<Polynomial_zmod_flint>self)._powmod_bigexp(exp, modulus)
|
536
|
+
|
537
|
+
return Polynomial_template.__pow__(self, exp, modulus)
|
538
|
+
|
539
|
+
cdef Polynomial _powmod_bigexp(Polynomial_zmod_flint self, Integer exp, Polynomial_zmod_flint m):
|
540
|
+
r"""
|
541
|
+
Modular exponentiation with a large integer exponent.
|
542
|
+
|
543
|
+
It is assumed that checks and coercions have been already performed on arguments.
|
544
|
+
|
545
|
+
TESTS::
|
546
|
+
|
547
|
+
sage: R.<x> = PolynomialRing(GF(5), implementation="FLINT")
|
548
|
+
sage: f = x+1
|
549
|
+
sage: pow(f, 5**50, x^5 + 4*x + 3) # indirect doctest
|
550
|
+
x + 1
|
551
|
+
sage: pow(x, 5**64, x^5 + 4*x + 3) # indirect doctest
|
552
|
+
x + 3
|
553
|
+
"""
|
554
|
+
cdef Polynomial_zmod_flint ans = self._new()
|
555
|
+
# Preconditioning is useful for large exponents: the inverse
|
556
|
+
# power series helps computing fast quotients.
|
557
|
+
cdef Polynomial_zmod_flint minv = self._new()
|
558
|
+
cdef fmpz_t exp_fmpz
|
559
|
+
|
560
|
+
fmpz_init(exp_fmpz)
|
561
|
+
fmpz_set_mpz(exp_fmpz, (<Integer>exp).value)
|
562
|
+
nmod_poly_reverse(&minv.x, &m.x, nmod_poly_length(&m.x))
|
563
|
+
nmod_poly_inv_series(&minv.x, &minv.x, nmod_poly_length(&m.x))
|
564
|
+
|
565
|
+
if self == self._parent.gen():
|
566
|
+
nmod_poly_powmod_x_fmpz_preinv(&ans.x, exp_fmpz, &m.x, &minv.x)
|
567
|
+
else:
|
568
|
+
nmod_poly_powmod_fmpz_binexp_preinv(&ans.x, &self.x, exp_fmpz, &m.x, &minv.x)
|
569
|
+
|
570
|
+
fmpz_clear(exp_fmpz)
|
571
|
+
return ans
|
572
|
+
|
573
|
+
cpdef Polynomial _power_trunc(self, unsigned long n, long prec):
|
574
|
+
r"""
|
575
|
+
TESTS::
|
576
|
+
|
577
|
+
sage: R.<x> = GF(5)[]
|
578
|
+
sage: (x+3).power_trunc(30, 10)
|
579
|
+
3*x^5 + 4
|
580
|
+
sage: (x^4 - x + 1).power_trunc(88, 20)
|
581
|
+
2*x^19 + 3*x^18 + 3*x^17 + 3*x^16 + ... + 3*x^2 + 2*x + 1
|
582
|
+
|
583
|
+
For high powers, the generic method is called::
|
584
|
+
|
585
|
+
sage: (x^2 + 1).power_trunc(2^100, 10)
|
586
|
+
x^2 + 1
|
587
|
+
sage: (x^2 + 1).power_trunc(2^100+1, 10)
|
588
|
+
x^4 + 2*x^2 + 1
|
589
|
+
sage: (x^2 + 1).power_trunc(2^100+2, 10)
|
590
|
+
x^6 + 3*x^4 + 3*x^2 + 1
|
591
|
+
sage: (x^2 + 1).power_trunc(2^100+3, 10)
|
592
|
+
x^8 + 4*x^6 + x^4 + 4*x^2 + 1
|
593
|
+
|
594
|
+
Check boundary values::
|
595
|
+
|
596
|
+
sage: x._power_trunc(2, -1)
|
597
|
+
0
|
598
|
+
sage: parent(_) is R
|
599
|
+
True
|
600
|
+
"""
|
601
|
+
if prec <= 0:
|
602
|
+
# NOTE: flint crashes if prec < 0
|
603
|
+
return self._parent.zero()
|
604
|
+
|
605
|
+
cdef Polynomial_zmod_flint ans
|
606
|
+
ans = self._new()
|
607
|
+
nmod_poly_pow_trunc(&ans.x, &self.x, n, prec)
|
608
|
+
return ans
|
609
|
+
|
610
|
+
cpdef rational_reconstruction(self, m, n_deg=0, d_deg=0):
|
611
|
+
"""
|
612
|
+
Construct a rational function `n/d` such that `p*d` is equivalent to `n`
|
613
|
+
modulo `m` where `p` is this polynomial.
|
614
|
+
|
615
|
+
EXAMPLES::
|
616
|
+
|
617
|
+
sage: P.<x> = GF(5)[]
|
618
|
+
sage: p = 4*x^5 + 3*x^4 + 2*x^3 + 2*x^2 + 4*x + 2
|
619
|
+
sage: n, d = p.rational_reconstruction(x^9, 4, 4); n, d
|
620
|
+
(3*x^4 + 2*x^3 + x^2 + 2*x, x^4 + 3*x^3 + x^2 + x)
|
621
|
+
sage: (p*d % x^9) == n
|
622
|
+
True
|
623
|
+
|
624
|
+
Check that :issue:`37169` is fixed - it does not throw an error::
|
625
|
+
|
626
|
+
sage: # needs sage.rings.finite_rings
|
627
|
+
sage: R.<x> = Zmod(4)[]
|
628
|
+
sage: _.<z> = R.quotient_ring(x^2 - 1)
|
629
|
+
sage: c = 2 * z + 1
|
630
|
+
sage: c * Zmod(2).zero()
|
631
|
+
Traceback (most recent call last):
|
632
|
+
...
|
633
|
+
RuntimeError: Aborted
|
634
|
+
"""
|
635
|
+
if n_deg < 0 or d_deg < 0:
|
636
|
+
raise ValueError("The degree bounds n_deg and d_deg should be positive.")
|
637
|
+
|
638
|
+
if n_deg == 0:
|
639
|
+
n_deg = (m.degree() - 1)//2
|
640
|
+
if d_deg == 0:
|
641
|
+
d_deg = (m.degree() - 1)//2
|
642
|
+
P = self._parent
|
643
|
+
|
644
|
+
cdef Polynomial_zmod_flint s0 = self._new()
|
645
|
+
cdef Polynomial_zmod_flint t0 = P.one()
|
646
|
+
cdef Polynomial_zmod_flint s1 = m
|
647
|
+
cdef Polynomial_zmod_flint t1 = self % m
|
648
|
+
|
649
|
+
cdef Polynomial_zmod_flint q
|
650
|
+
cdef Polynomial_zmod_flint r0
|
651
|
+
cdef Polynomial_zmod_flint r1
|
652
|
+
|
653
|
+
while nmod_poly_length(&t1.x) != 0 and n_deg < nmod_poly_degree(&t1.x):
|
654
|
+
q = self._new()
|
655
|
+
r1 = self._new()
|
656
|
+
|
657
|
+
sig_on()
|
658
|
+
nmod_poly_divrem(&q.x, &r1.x, &s1.x, &t1.x)
|
659
|
+
sig_off()
|
660
|
+
|
661
|
+
r0 = s0 - q*t0
|
662
|
+
s0 = t0
|
663
|
+
s1 = t1
|
664
|
+
t0 = r0
|
665
|
+
t1 = r1
|
666
|
+
|
667
|
+
assert(t0 != 0)
|
668
|
+
if d_deg < nmod_poly_degree(&t0.x):
|
669
|
+
raise ValueError("could not complete rational reconstruction")
|
670
|
+
|
671
|
+
# make the denominator monic
|
672
|
+
c = t0.leading_coefficient()
|
673
|
+
t0 = t0.monic()
|
674
|
+
t1 = t1/c
|
675
|
+
|
676
|
+
return t1, t0
|
677
|
+
|
678
|
+
rational_reconstruct = deprecated_function_alias(12696, rational_reconstruction)
|
679
|
+
|
680
|
+
@cached_method
|
681
|
+
def is_irreducible(self):
|
682
|
+
"""
|
683
|
+
Return whether this polynomial is irreducible.
|
684
|
+
|
685
|
+
EXAMPLES::
|
686
|
+
|
687
|
+
sage: R.<x> = GF(5)[]
|
688
|
+
sage: (x^2 + 1).is_irreducible()
|
689
|
+
False
|
690
|
+
sage: (x^3 + x + 1).is_irreducible()
|
691
|
+
True
|
692
|
+
|
693
|
+
Not implemented when the base ring is not a field::
|
694
|
+
|
695
|
+
sage: S.<s> = Zmod(10)[]
|
696
|
+
sage: (s^2).is_irreducible()
|
697
|
+
Traceback (most recent call last):
|
698
|
+
...
|
699
|
+
NotImplementedError: checking irreducibility of polynomials
|
700
|
+
over rings with composite characteristic is not implemented
|
701
|
+
|
702
|
+
TESTS::
|
703
|
+
|
704
|
+
sage: R(0).is_irreducible()
|
705
|
+
False
|
706
|
+
sage: R(1).is_irreducible()
|
707
|
+
False
|
708
|
+
sage: R(2).is_irreducible()
|
709
|
+
False
|
710
|
+
|
711
|
+
sage: S(1).is_irreducible()
|
712
|
+
False
|
713
|
+
sage: S(2).is_irreducible()
|
714
|
+
Traceback (most recent call last):
|
715
|
+
...
|
716
|
+
NotImplementedError: checking irreducibility of polynomials
|
717
|
+
over rings with composite characteristic is not implemented
|
718
|
+
|
719
|
+
Test that caching works::
|
720
|
+
|
721
|
+
sage: S.<s> = Zmod(7)[]
|
722
|
+
sage: s.is_irreducible()
|
723
|
+
True
|
724
|
+
sage: s.is_irreducible.cache
|
725
|
+
True
|
726
|
+
"""
|
727
|
+
if not self:
|
728
|
+
return False
|
729
|
+
if self.is_unit():
|
730
|
+
return False
|
731
|
+
|
732
|
+
if not self.base_ring().is_field():
|
733
|
+
raise NotImplementedError("checking irreducibility of polynomials over rings with composite characteristic is not implemented")
|
734
|
+
|
735
|
+
sig_on()
|
736
|
+
if 1 == nmod_poly_is_irreducible(&self.x):
|
737
|
+
sig_off()
|
738
|
+
return True
|
739
|
+
else:
|
740
|
+
sig_off()
|
741
|
+
return False
|
742
|
+
|
743
|
+
def squarefree_decomposition(self):
|
744
|
+
"""
|
745
|
+
Return the squarefree decomposition of this polynomial.
|
746
|
+
|
747
|
+
EXAMPLES::
|
748
|
+
|
749
|
+
sage: R.<x> = GF(5)[]
|
750
|
+
sage: ((x+1)*(x^2+1)^2*x^3).squarefree_decomposition()
|
751
|
+
(x + 1) * (x^2 + 1)^2 * x^3
|
752
|
+
|
753
|
+
TESTS::
|
754
|
+
|
755
|
+
sage: (2*x*(x+1)^2).squarefree_decomposition()
|
756
|
+
(2) * x * (x + 1)^2
|
757
|
+
sage: P.<x> = Zmod(10)[]
|
758
|
+
sage: (x^2).squarefree_decomposition()
|
759
|
+
Traceback (most recent call last):
|
760
|
+
...
|
761
|
+
NotImplementedError: square free factorization of polynomials over rings with composite characteristic is not implemented
|
762
|
+
|
763
|
+
:issue:`20003`::
|
764
|
+
|
765
|
+
sage: P.<x> = GF(7)[]
|
766
|
+
sage: (6*x+3).squarefree_decomposition()
|
767
|
+
(6) * (x + 4)
|
768
|
+
|
769
|
+
Test zero polynomial::
|
770
|
+
|
771
|
+
sage: # needs sage.rings.finite_rings
|
772
|
+
sage: R.<x> = PolynomialRing(GF(65537), implementation="FLINT")
|
773
|
+
sage: R.zero().squarefree_decomposition()
|
774
|
+
Traceback (most recent call last):
|
775
|
+
...
|
776
|
+
ArithmeticError: square-free decomposition of 0 is not defined
|
777
|
+
"""
|
778
|
+
if self.is_zero():
|
779
|
+
raise ArithmeticError(
|
780
|
+
"square-free decomposition of 0 is not defined"
|
781
|
+
)
|
782
|
+
if not self.base_ring().is_field():
|
783
|
+
raise NotImplementedError("square free factorization of polynomials over rings with composite characteristic is not implemented")
|
784
|
+
|
785
|
+
return factor_helper(self, True)
|
786
|
+
|
787
|
+
def factor(self):
|
788
|
+
"""
|
789
|
+
Return the factorization of the polynomial.
|
790
|
+
|
791
|
+
EXAMPLES::
|
792
|
+
|
793
|
+
sage: R.<x> = GF(5)[]
|
794
|
+
sage: (x^2 + 1).factor()
|
795
|
+
(x + 2) * (x + 3)
|
796
|
+
|
797
|
+
It also works for prime-power moduli::
|
798
|
+
|
799
|
+
sage: R.<x> = Zmod(23^5)[] # needs sage.rings.finite_rings
|
800
|
+
sage: (x^3 + 1).factor() # needs sage.rings.finite_rings
|
801
|
+
(x + 1) * (x^2 + 6436342*x + 1)
|
802
|
+
|
803
|
+
TESTS::
|
804
|
+
|
805
|
+
sage: R.<x> = GF(5)[]
|
806
|
+
sage: (2*x^2 + 2).factor()
|
807
|
+
(2) * (x + 2) * (x + 3)
|
808
|
+
sage: P.<x> = Zmod(10)[]
|
809
|
+
sage: (x^2).factor()
|
810
|
+
Traceback (most recent call last):
|
811
|
+
...
|
812
|
+
NotImplementedError: factorization of polynomials over rings with composite characteristic is not implemented
|
813
|
+
|
814
|
+
Test that factorization can be interrupted::
|
815
|
+
|
816
|
+
sage: # needs sage.rings.finite_rings
|
817
|
+
sage: R.<x> = PolynomialRing(GF(65537), implementation="FLINT")
|
818
|
+
sage: f = R.random_element(9973) * R.random_element(10007)
|
819
|
+
sage: from sage.doctest.util import ensure_interruptible_after
|
820
|
+
sage: with ensure_interruptible_after(0.5): f.factor()
|
821
|
+
|
822
|
+
Test zero polynomial::
|
823
|
+
|
824
|
+
sage: # needs sage.rings.finite_rings
|
825
|
+
sage: R.<x> = PolynomialRing(GF(65537), implementation="FLINT")
|
826
|
+
sage: R.zero().factor()
|
827
|
+
Traceback (most recent call last):
|
828
|
+
...
|
829
|
+
ArithmeticError: factorization of 0 is not defined
|
830
|
+
|
831
|
+
"""
|
832
|
+
if self.is_zero():
|
833
|
+
raise ArithmeticError("factorization of 0 is not defined")
|
834
|
+
|
835
|
+
R = self.base_ring()
|
836
|
+
if not R.is_field():
|
837
|
+
p,e = R.characteristic().is_prime_power(get_data=True)
|
838
|
+
if not e:
|
839
|
+
raise NotImplementedError("factorization of polynomials over rings with composite characteristic is not implemented")
|
840
|
+
|
841
|
+
# Factoring is well-defined for prime-power moduli.
|
842
|
+
# For simplicity we reuse the implementation for p-adics;
|
843
|
+
# presumably this can be done faster.
|
844
|
+
from sage.rings.padics.factory import Zp
|
845
|
+
f = self.change_ring(Zp(p, prec=e))
|
846
|
+
return f.factor().base_change(self.parent())
|
847
|
+
|
848
|
+
return factor_helper(self)
|
849
|
+
|
850
|
+
def monic(self):
|
851
|
+
"""
|
852
|
+
Return this polynomial divided by its leading coefficient.
|
853
|
+
|
854
|
+
Raises :exc:`ValueError` if the leading coefficient is not invertible in the
|
855
|
+
base ring.
|
856
|
+
|
857
|
+
EXAMPLES::
|
858
|
+
|
859
|
+
sage: R.<x> = GF(5)[]
|
860
|
+
sage: (2*x^2 + 1).monic()
|
861
|
+
x^2 + 3
|
862
|
+
|
863
|
+
TESTS::
|
864
|
+
|
865
|
+
sage: R.<x> = Zmod(10)[]
|
866
|
+
sage: (5*x).monic()
|
867
|
+
Traceback (most recent call last):
|
868
|
+
...
|
869
|
+
ValueError: leading coefficient must be invertible
|
870
|
+
"""
|
871
|
+
cdef unsigned long leadcoeff, modulus
|
872
|
+
leadcoeff = nmod_poly_get_coeff_ui(&self.x, nmod_poly_degree(&self.x))
|
873
|
+
modulus = nmod_poly_modulus(&self.x)
|
874
|
+
if leadcoeff > 1 and n_gcd(modulus, leadcoeff) != 1:
|
875
|
+
raise ValueError("leading coefficient must be invertible")
|
876
|
+
|
877
|
+
cdef Polynomial_zmod_flint res = self._new()
|
878
|
+
nmod_poly_make_monic(&res.x, &self.x)
|
879
|
+
return res
|
880
|
+
|
881
|
+
def reverse(self, degree=None):
|
882
|
+
"""
|
883
|
+
Return a polynomial with the coefficients of this polynomial reversed.
|
884
|
+
|
885
|
+
If the optional argument ``degree`` is given, the coefficient list will be
|
886
|
+
truncated or zero padded as necessary before computing the reverse.
|
887
|
+
|
888
|
+
EXAMPLES::
|
889
|
+
|
890
|
+
sage: R.<x> = GF(5)[]
|
891
|
+
sage: p = R([1,2,3,4]); p
|
892
|
+
4*x^3 + 3*x^2 + 2*x + 1
|
893
|
+
sage: p.reverse()
|
894
|
+
x^3 + 2*x^2 + 3*x + 4
|
895
|
+
sage: p.reverse(degree=6)
|
896
|
+
x^6 + 2*x^5 + 3*x^4 + 4*x^3
|
897
|
+
sage: p.reverse(degree=2)
|
898
|
+
x^2 + 2*x + 3
|
899
|
+
|
900
|
+
sage: R.<x> = GF(101)[]
|
901
|
+
sage: f = x^3 - x + 2; f
|
902
|
+
x^3 + 100*x + 2
|
903
|
+
sage: f.reverse()
|
904
|
+
2*x^3 + 100*x^2 + 1
|
905
|
+
sage: f.reverse() == f(1/x) * x^f.degree()
|
906
|
+
True
|
907
|
+
|
908
|
+
Note that if `f` has zero constant coefficient, its reverse will
|
909
|
+
have lower degree.
|
910
|
+
|
911
|
+
::
|
912
|
+
|
913
|
+
sage: f = x^3 + 2*x
|
914
|
+
sage: f.reverse()
|
915
|
+
2*x^2 + 1
|
916
|
+
|
917
|
+
In this case, reverse is not an involution unless we explicitly
|
918
|
+
specify a degree.
|
919
|
+
|
920
|
+
::
|
921
|
+
|
922
|
+
sage: f
|
923
|
+
x^3 + 2*x
|
924
|
+
sage: f.reverse().reverse()
|
925
|
+
x^2 + 2
|
926
|
+
sage: f.reverse(5).reverse(5)
|
927
|
+
x^3 + 2*x
|
928
|
+
|
929
|
+
TESTS::
|
930
|
+
|
931
|
+
sage: p.reverse(degree=1.5r)
|
932
|
+
Traceback (most recent call last):
|
933
|
+
...
|
934
|
+
ValueError: degree argument must be a nonnegative integer, got 1.5
|
935
|
+
|
936
|
+
Check that this implementation is compatible with the generic one::
|
937
|
+
|
938
|
+
sage: p = R([0,1,0,2])
|
939
|
+
sage: all(p.reverse(d) == Polynomial.reverse(p, d)
|
940
|
+
....: for d in [None, 0, 1, 2, 3, 4])
|
941
|
+
True
|
942
|
+
"""
|
943
|
+
cdef Polynomial_zmod_flint res = self._new()
|
944
|
+
cdef unsigned long d
|
945
|
+
if degree is not None:
|
946
|
+
if degree < 0:
|
947
|
+
raise ValueError("degree argument must be a nonnegative integer, got %s" % (degree))
|
948
|
+
d = degree
|
949
|
+
if d != degree:
|
950
|
+
raise ValueError("degree argument must be a nonnegative integer, got %s" % (degree))
|
951
|
+
nmod_poly_reverse(&res.x, &self.x, d+1) # FLINT expects length
|
952
|
+
else:
|
953
|
+
nmod_poly_reverse(&res.x, &self.x, nmod_poly_length(&self.x))
|
954
|
+
return res
|
955
|
+
|
956
|
+
def revert_series(self, n):
|
957
|
+
r"""
|
958
|
+
Return a polynomial `f` such that ``f(self(x)) = self(f(x)) = x`` (mod `x^n`).
|
959
|
+
|
960
|
+
EXAMPLES::
|
961
|
+
|
962
|
+
sage: R.<t> = GF(5)[]
|
963
|
+
sage: f = t + 2*t^2 - t^3 - 3*t^4
|
964
|
+
sage: f.revert_series(5)
|
965
|
+
3*t^4 + 4*t^3 + 3*t^2 + t
|
966
|
+
|
967
|
+
sage: f.revert_series(-1)
|
968
|
+
Traceback (most recent call last):
|
969
|
+
...
|
970
|
+
ValueError: argument n must be a nonnegative integer, got -1
|
971
|
+
|
972
|
+
sage: g = - t^3 + t^5
|
973
|
+
sage: g.revert_series(6)
|
974
|
+
Traceback (most recent call last):
|
975
|
+
...
|
976
|
+
ValueError: self must have constant coefficient 0 and a unit for coefficient t^1
|
977
|
+
|
978
|
+
sage: g = t + 2*t^2 - t^3 -3*t^4 + t^5
|
979
|
+
sage: g.revert_series(6)
|
980
|
+
Traceback (most recent call last):
|
981
|
+
...
|
982
|
+
ValueError: the integers 1 up to n=5 are required to be invertible over the base field
|
983
|
+
"""
|
984
|
+
cdef Polynomial_zmod_flint res = self._new()
|
985
|
+
cdef unsigned long m
|
986
|
+
if n < 0:
|
987
|
+
raise ValueError("argument n must be a nonnegative integer, got {}".format(n))
|
988
|
+
m = n
|
989
|
+
if not self[0].is_zero() or not self[1].is_unit():
|
990
|
+
raise ValueError("self must have constant coefficient 0 and a unit for coefficient {}^1".format(self.parent().gen()))
|
991
|
+
if not all((self.base_ring())(i) != 0 for i in range(1,n)):
|
992
|
+
raise ValueError("the integers 1 up to n={} are required to be invertible over the base field".format(n-1))
|
993
|
+
|
994
|
+
sig_on()
|
995
|
+
nmod_poly_revert_series(&res.x, &self.x, m)
|
996
|
+
sig_off()
|
997
|
+
|
998
|
+
return res
|
999
|
+
|
1000
|
+
@coerce_binop
|
1001
|
+
def minpoly_mod(self, other):
|
1002
|
+
r"""
|
1003
|
+
Thin wrapper for
|
1004
|
+
:meth:`sage.rings.polynomial.polynomial_modn_dense_ntl.Polynomial_dense_mod_n.minpoly_mod`.
|
1005
|
+
|
1006
|
+
EXAMPLES::
|
1007
|
+
|
1008
|
+
sage: R.<x> = GF(127)[]
|
1009
|
+
sage: type(x)
|
1010
|
+
<class 'sage.rings.polynomial.polynomial_zmod_flint.Polynomial_zmod_flint'>
|
1011
|
+
sage: (x^5 - 3).minpoly_mod(x^3 + 5*x - 1)
|
1012
|
+
x^3 + 34*x^2 + 125*x + 95
|
1013
|
+
"""
|
1014
|
+
parent = self.parent()
|
1015
|
+
name, = parent.variable_names()
|
1016
|
+
from sage.rings.polynomial.polynomial_ring_constructor import _single_variate
|
1017
|
+
R = _single_variate(parent.base_ring(), name=name, implementation='NTL')
|
1018
|
+
return parent(R(self % other).minpoly_mod(R(other)))
|
1019
|
+
|
1020
|
+
def compose_mod(self, other, modulus):
|
1021
|
+
r"""
|
1022
|
+
Compute `f(g) \bmod h`.
|
1023
|
+
|
1024
|
+
To be precise about the order fo compostion, given ``self``, ``other``
|
1025
|
+
and ``modulus`` as `f(x)`, `g(x)` and `h(x)` compute `f(g(x)) \bmod h(x)`.
|
1026
|
+
|
1027
|
+
INPUT:
|
1028
|
+
|
1029
|
+
- ``other`` -- a polynomial `g(x)`
|
1030
|
+
- ``modulus`` -- a polynomial `h(x)`
|
1031
|
+
|
1032
|
+
EXAMPLES::
|
1033
|
+
|
1034
|
+
sage: R.<x> = GF(163)[]
|
1035
|
+
sage: f = R.random_element()
|
1036
|
+
sage: g = R.random_element()
|
1037
|
+
sage: g.compose_mod(g, f) == g(g) % f
|
1038
|
+
True
|
1039
|
+
|
1040
|
+
sage: f = R([i for i in range(100)])
|
1041
|
+
sage: g = R([i**2 for i in range(100)])
|
1042
|
+
sage: h = 1 + x + x**5
|
1043
|
+
sage: f.compose_mod(g, h)
|
1044
|
+
82*x^4 + 56*x^3 + 45*x^2 + 60*x + 127
|
1045
|
+
sage: f.compose_mod(g, h) == f(g) % h
|
1046
|
+
True
|
1047
|
+
|
1048
|
+
AUTHORS:
|
1049
|
+
|
1050
|
+
- Giacomo Pope (2024-08) initial implementation
|
1051
|
+
"""
|
1052
|
+
cdef Polynomial_zmod_flint res = self._new()
|
1053
|
+
|
1054
|
+
sig_on()
|
1055
|
+
nmod_poly_compose_mod(&res.x, &(<Polynomial_zmod_flint>self).x, &(<Polynomial_zmod_flint>other).x, &(<Polynomial_zmod_flint>modulus).x)
|
1056
|
+
sig_off()
|
1057
|
+
|
1058
|
+
return res
|
1059
|
+
|
1060
|
+
# compose_mod is the natural name from the Flint bindings, but
|
1061
|
+
# polynomial_gf2x has modular_composition as the method name so here we
|
1062
|
+
# allow both
|
1063
|
+
modular_composition = compose_mod
|