passagemath-flint 10.6.1rc10__cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.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 +360 -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-3701249d.so.21.0.0 +0 -0
- passagemath_flint.libs/libgf2x-fbd36f80.so.3.0.0 +0 -0
- passagemath_flint.libs/libgfortran-8a9a71bc.so.5.0.0 +0 -0
- passagemath_flint.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
- passagemath_flint.libs/libgsl-e3525837.so.28.0.0 +0 -0
- passagemath_flint.libs/libmpfi-ad12a86d.so.0.0.0 +0 -0
- passagemath_flint.libs/libmpfr-e0f11cf3.so.6.2.1 +0 -0
- passagemath_flint.libs/libntl-1004113e.so.44.0.1 +0 -0
- passagemath_flint.libs/libopenblasp-r0-4c5b64b1.3.29.so +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-313-aarch64-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-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/graphs/chrompoly.pyx +555 -0
- sage/graphs/matchpoly.cpython-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/matrix/change_ring.pyx +43 -0
- sage/matrix/matrix_complex_ball_dense.cpython-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/modular/modsym/apply.pxd +6 -0
- sage/modular/modsym/apply.pyx +113 -0
- sage/modular/modsym/heilbronn.cpython-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/rings/complex_arb.pxd +29 -0
- sage/rings/complex_arb.pyx +5176 -0
- sage/rings/complex_interval.cpython-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/rings/convert/mpfi.pxd +6 -0
- sage/rings/convert/mpfi.pyx +576 -0
- sage/rings/factorint_flint.cpython-313-aarch64-linux-gnu.so +0 -0
- sage/rings/factorint_flint.pyx +99 -0
- sage/rings/fraction_field_FpT.cpython-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/hilbert.pyx +602 -0
- sage/rings/polynomial/polynomial_complex_arb.cpython-313-aarch64-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-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_number_field.pyx +345 -0
- sage/rings/polynomial/polynomial_rational_flint.cpython-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-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-313-aarch64-linux-gnu.so +0 -0
- sage/rings/real_interval_absolute.pyx +1073 -0
- sage/rings/real_mpfi.cpython-313-aarch64-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-313-aarch64-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,6 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-flint
|
2
|
+
from sage.libs.mpfi.types cimport mpfi_ptr
|
3
|
+
|
4
|
+
cdef int mpfi_set_sage(mpfi_ptr re, mpfi_ptr im, x, field, int base) except -1
|
5
|
+
cdef int mpfi_interv_sage(mpfi_ptr re, mpfi_ptr im, x, y, field, int base) except -1
|
6
|
+
cdef int mpfi_set_via_RR(mpfi_ptr re, x, field) except -1
|
@@ -0,0 +1,576 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-flint
|
2
|
+
"""
|
3
|
+
Convert Sage/Python objects to real/complex intervals
|
4
|
+
"""
|
5
|
+
#*****************************************************************************
|
6
|
+
# Copyright (C) 2018 Jeroen Demeyer <J.Demeyer@UGent.be>
|
7
|
+
#
|
8
|
+
# This program is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
# http://www.gnu.org/licenses/
|
13
|
+
#*****************************************************************************
|
14
|
+
|
15
|
+
import re
|
16
|
+
|
17
|
+
from cpython.float cimport PyFloat_AS_DOUBLE
|
18
|
+
from cpython.complex cimport PyComplex_RealAsDouble, PyComplex_ImagAsDouble
|
19
|
+
|
20
|
+
from libc.stdio cimport printf
|
21
|
+
|
22
|
+
from sage.libs.mpfr cimport *
|
23
|
+
from sage.libs.mpfi cimport *
|
24
|
+
from sage.libs.gmp.mpz cimport *
|
25
|
+
from sage.libs.gsl.complex cimport *
|
26
|
+
|
27
|
+
from sage.arith.long cimport integer_check_long
|
28
|
+
from sage.cpython.string cimport bytes_to_str
|
29
|
+
from sage.structure.element cimport Element
|
30
|
+
|
31
|
+
import sage.rings.abc
|
32
|
+
from sage.rings.integer cimport Integer
|
33
|
+
from sage.rings.rational cimport Rational
|
34
|
+
from sage.rings.real_mpfi cimport RealIntervalFieldElement, RealIntervalField_class
|
35
|
+
from sage.rings.real_mpfr cimport RealNumber
|
36
|
+
from sage.rings.real_double cimport RealDoubleElement
|
37
|
+
from sage.rings.complex_mpfr cimport ComplexNumber
|
38
|
+
from sage.rings.complex_interval cimport ComplexIntervalFieldElement
|
39
|
+
from sage.rings.complex_double cimport ComplexDoubleElement
|
40
|
+
|
41
|
+
try:
|
42
|
+
from cypari2.gen import Gen
|
43
|
+
except ImportError:
|
44
|
+
Gen = ()
|
45
|
+
|
46
|
+
|
47
|
+
cdef inline int return_real(mpfi_ptr im) noexcept:
|
48
|
+
"""
|
49
|
+
Called by ``mpfi_set_sage`` on the imaginary part when converting
|
50
|
+
a real number.
|
51
|
+
"""
|
52
|
+
if im is not NULL:
|
53
|
+
mpfi_set_ui(im, 0)
|
54
|
+
return 0
|
55
|
+
|
56
|
+
|
57
|
+
NUMBER = re.compile(rb'([+-]?(0[XxBb])?[0-9A-Za-z]+)\.([0-9A-Za-z]*)\?([0-9]*)(?:([EePp@])([+-]?[0-9]+))?')
|
58
|
+
# example: -0xABC.DEF?12@5
|
59
|
+
# match groups: (-0xABC) (0x) (DEF) (12) (@) (5)
|
60
|
+
|
61
|
+
cdef int _from_str_question_style(mpfi_ptr x, bytes s, int base) except -1:
|
62
|
+
"""
|
63
|
+
Convert a string in question style to an MPFI interval.
|
64
|
+
|
65
|
+
INPUT:
|
66
|
+
|
67
|
+
- ``x`` -- a pre-initialized MPFI interval
|
68
|
+
|
69
|
+
- ``s`` -- the string to convert
|
70
|
+
|
71
|
+
- ``base`` -- base to use for string conversion
|
72
|
+
|
73
|
+
OUTPUT:
|
74
|
+
|
75
|
+
- if conversion is possible: set ``x`` and return 0.
|
76
|
+
|
77
|
+
- in all other cases: return some nonzero value, or raise an exception.
|
78
|
+
|
79
|
+
TESTS:
|
80
|
+
|
81
|
+
Double check that ``ZZ``, ``RR`` and ``RIF`` follows the string
|
82
|
+
conversion rule for base different from `10` (except ``ZZ``
|
83
|
+
which only allows base up to `36`)::
|
84
|
+
|
85
|
+
sage: ZZ("0x123", base=0)
|
86
|
+
291
|
87
|
+
sage: RR("0x123.e1", base=0) # rel tol 1e-12
|
88
|
+
291.878906250000
|
89
|
+
sage: RR("0x123.@1", base=0) # rel tol 1e-12
|
90
|
+
4656.00000000000
|
91
|
+
sage: RIF("0x123.4@1", base=0)
|
92
|
+
4660
|
93
|
+
sage: ZZ("1Xx", base=36) # case insensitive
|
94
|
+
2517
|
95
|
+
sage: ZZ("1Xx", base=62)
|
96
|
+
Traceback (most recent call last):
|
97
|
+
...
|
98
|
+
ValueError: base (=62) must be 0 or between 2 and 36
|
99
|
+
sage: RR("1Xx", base=36) # rel tol 1e-12
|
100
|
+
2517.00000000000
|
101
|
+
sage: RR("0x123", base=36) # rel tol 1e-12
|
102
|
+
1.54101900000000e6
|
103
|
+
sage: RR("-1Xx@-1", base=62) # rel tol 1e-12
|
104
|
+
-95.9516129032258
|
105
|
+
sage: RIF("1Xx@-1", base=62) # rel tol 1e-12
|
106
|
+
95.95161290322580?
|
107
|
+
sage: RIF("1aE1", base=11)
|
108
|
+
Traceback (most recent call last):
|
109
|
+
...
|
110
|
+
TypeError: unable to convert '1aE1' to real interval
|
111
|
+
sage: RIF("1aE1", base=11)
|
112
|
+
Traceback (most recent call last):
|
113
|
+
...
|
114
|
+
TypeError: unable to convert '1aE1' to real interval
|
115
|
+
|
116
|
+
General checks::
|
117
|
+
|
118
|
+
sage: RIF("123456.?2").endpoints() # rel tol 1e-12
|
119
|
+
(123454.0, 123458.0)
|
120
|
+
sage: RIF("1234.56?2").endpoints() # rel tol 1e-12
|
121
|
+
(1234.54, 1234.58)
|
122
|
+
sage: RIF("1234.56?2e2").endpoints() # rel tol 1e-12
|
123
|
+
(123454.0, 123458.0)
|
124
|
+
sage: x = RIF("-1234.56?2e2"); x.endpoints() # rel tol 1e-12
|
125
|
+
(-123458.0, -123454.0)
|
126
|
+
sage: x
|
127
|
+
-1.2346?e5
|
128
|
+
sage: x.str(style="question", error_digits=1)
|
129
|
+
'-123456.?2'
|
130
|
+
sage: RIF("1.?100").endpoints() # rel tol 1e-12
|
131
|
+
(-99.0, 101.0)
|
132
|
+
sage: RIF("1.?100").str(style="question", error_digits=3)
|
133
|
+
'1.?100'
|
134
|
+
|
135
|
+
Large exponent (ensure precision is not lost)::
|
136
|
+
|
137
|
+
sage: x = RIF("1.123456?2e100000000"); x
|
138
|
+
1.12346?e100000000
|
139
|
+
sage: x.str(style="question", error_digits=3)
|
140
|
+
'1.12345600?201e100000000'
|
141
|
+
|
142
|
+
Large precision::
|
143
|
+
|
144
|
+
sage: # needs sage.symbolic
|
145
|
+
sage: F = RealIntervalField(1000)
|
146
|
+
sage: x = F(sqrt(2)); x.endpoints() # rel tol 1e-290
|
147
|
+
(1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140798,
|
148
|
+
1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799)
|
149
|
+
sage: x in F(x.str(style="question", error_digits=3))
|
150
|
+
True
|
151
|
+
sage: x in F(x.str(style="question", error_digits=0))
|
152
|
+
True
|
153
|
+
sage: F("1.123456789123456789123456789123456789123456789123456789123456789123456789?987654321987654321987654321e500").endpoints() # rel tol 1e-290
|
154
|
+
(1.123456789123456789123456789123456789123456788135802467135802467135802468e500,
|
155
|
+
1.12345678912345678912345678912345678912345679011111111111111111111111111e500)
|
156
|
+
|
157
|
+
Stress test::
|
158
|
+
|
159
|
+
sage: for F in [RealIntervalField(15), RIF, RealIntervalField(100), RealIntervalField(1000)]:
|
160
|
+
....: for i in range(1000):
|
161
|
+
....: a, b = randint(-10^9, 10^9), randint(0, 50)
|
162
|
+
....: c, d = randint(-2^b, 2^b), randint(2, 5)
|
163
|
+
....: x = a * F(d)^c
|
164
|
+
....: assert x in F(x.str(style="question", error_digits=3)), (x, a, c, d)
|
165
|
+
....: assert x in F(x.str(style="question", error_digits=0)), (x, a, c, d)
|
166
|
+
|
167
|
+
Base different from `10` (note that the error and exponent are specified in decimal)::
|
168
|
+
|
169
|
+
sage: RIF("10000.?0", base=2).endpoints() # rel tol 1e-12
|
170
|
+
(16.0, 16.0)
|
171
|
+
sage: RIF("10000.?0e10", base=2).endpoints() # rel tol 1e-12
|
172
|
+
(16384.0, 16384.0)
|
173
|
+
sage: x = RIF("10000.?10", base=2); x.endpoints() # rel tol 1e-12
|
174
|
+
(6.0, 26.0)
|
175
|
+
sage: x.str(base=2, style="question", error_digits=2)
|
176
|
+
'10000.000?80'
|
177
|
+
sage: x = RIF("10000.000?80", base=2); x.endpoints() # rel tol 1e-12
|
178
|
+
(6.0, 26.0)
|
179
|
+
sage: x = RIF("12a.?", base=16); x.endpoints() # rel tol 1e-12
|
180
|
+
(297.0, 299.0)
|
181
|
+
sage: x = RIF("12a.BcDeF?", base=16); x.endpoints() # rel tol 1e-12
|
182
|
+
(298.737775802611, 298.737777709962)
|
183
|
+
sage: x = RIF("12a.BcDeF?@10", base=16); x.endpoints() # rel tol 1e-12
|
184
|
+
(3.28465658150911e14, 3.28465660248065e14)
|
185
|
+
sage: x = RIF("12a.BcDeF?p10", base=16); x.endpoints() # rel tol 1e-12
|
186
|
+
(305907.482421875, 305907.484375000)
|
187
|
+
sage: x = RIF("0x12a.BcDeF?p10", base=0); x.endpoints() # rel tol 1e-12
|
188
|
+
(305907.482421875, 305907.484375000)
|
189
|
+
|
190
|
+
Space is allowed::
|
191
|
+
|
192
|
+
sage: RIF("-1234.56?2").endpoints() # rel tol 1e-12
|
193
|
+
(-1234.58, -1234.54)
|
194
|
+
sage: RIF("- 1234.56 ?2").endpoints() # rel tol 1e-12
|
195
|
+
(-1234.58, -1234.54)
|
196
|
+
|
197
|
+
Erroneous input::
|
198
|
+
|
199
|
+
sage: RIF("1234.56?2e2.3")
|
200
|
+
Traceback (most recent call last):
|
201
|
+
...
|
202
|
+
TypeError: unable to convert '1234.56?2e2.3' to real interval
|
203
|
+
sage: RIF("1234?2") # decimal point required
|
204
|
+
Traceback (most recent call last):
|
205
|
+
...
|
206
|
+
TypeError: unable to convert '1234?2' to real interval
|
207
|
+
sage: RIF("1234.?2e")
|
208
|
+
Traceback (most recent call last):
|
209
|
+
...
|
210
|
+
TypeError: unable to convert '1234.?2e' to real interval
|
211
|
+
sage: RIF("1.?e999999999999999999999999")
|
212
|
+
[-infinity .. +infinity]
|
213
|
+
sage: RIF("0X1.?", base=33) # X is not valid digit in base 33
|
214
|
+
Traceback (most recent call last):
|
215
|
+
...
|
216
|
+
TypeError: unable to convert '0X1.?' to real interval
|
217
|
+
sage: RIF("1.a?1e10", base=12)
|
218
|
+
Traceback (most recent call last):
|
219
|
+
...
|
220
|
+
TypeError: unable to convert '1.a?1e10' to real interval
|
221
|
+
sage: RIF("1.1?a@10", base=12)
|
222
|
+
Traceback (most recent call last):
|
223
|
+
...
|
224
|
+
TypeError: unable to convert '1.1?a@10' to real interval
|
225
|
+
sage: RIF("0x1?2e1", base=0) # e is not allowed in base > 10, use @ instead
|
226
|
+
Traceback (most recent call last):
|
227
|
+
...
|
228
|
+
TypeError: unable to convert '0x1?2e1' to real interval
|
229
|
+
sage: RIF("0x1?2p1", base=36)
|
230
|
+
Traceback (most recent call last):
|
231
|
+
...
|
232
|
+
TypeError: unable to convert '0x1?2p1' to real interval
|
233
|
+
"""
|
234
|
+
cdef mpz_t error_part
|
235
|
+
cdef mpfi_t error
|
236
|
+
cdef mpfr_t radius, neg_radius
|
237
|
+
cdef bytes int_part_string, base_prefix, frac_part_string, error_string, e, sci_expo_string, optional_expo, tmp
|
238
|
+
|
239
|
+
match = NUMBER.fullmatch(s)
|
240
|
+
if match is None:
|
241
|
+
return 1
|
242
|
+
int_part_string, base_prefix, frac_part_string, error_string, e, sci_expo_string = match.groups()
|
243
|
+
|
244
|
+
if (base > 10 or (base == 0 and base_prefix in (b'0X', b'0X'))) and e in (b'e', b'E'):
|
245
|
+
return 1
|
246
|
+
if base > 16 and e in (b'p', b'P'):
|
247
|
+
return 1
|
248
|
+
if base > 16 or not base_prefix:
|
249
|
+
base_prefix = b''
|
250
|
+
|
251
|
+
if error_string:
|
252
|
+
if mpz_init_set_str(error_part, error_string, 10):
|
253
|
+
mpz_clear(error_part)
|
254
|
+
return 1
|
255
|
+
else:
|
256
|
+
mpz_init_set_ui(error_part, 1)
|
257
|
+
|
258
|
+
optional_expo = e + sci_expo_string if e else b''
|
259
|
+
if mpfi_set_str(x, int_part_string + b'.' + frac_part_string + optional_expo, base):
|
260
|
+
mpz_clear(error_part)
|
261
|
+
return 1
|
262
|
+
|
263
|
+
mpfr_init2(radius, mpfi_get_prec(x))
|
264
|
+
tmp = base_prefix + (
|
265
|
+
b'0.' + b'0'*(len(frac_part_string)-1) + b'1' + optional_expo
|
266
|
+
if frac_part_string else
|
267
|
+
b'1.' + optional_expo)
|
268
|
+
# if base = 0:
|
269
|
+
# when s = '-0x123.456@7', tmp = '0x0.001@7'
|
270
|
+
# when s = '-0x123.@7', tmp = '0x1.@7'
|
271
|
+
# if base = 36:
|
272
|
+
# when s = '-0x123.456@7', tmp = '0.001@7'
|
273
|
+
if mpfr_set_str(radius, tmp, base, MPFR_RNDU):
|
274
|
+
mpfr_clear(radius)
|
275
|
+
mpz_clear(error_part)
|
276
|
+
return 1
|
277
|
+
|
278
|
+
mpfr_mul_z(radius, radius, error_part, MPFR_RNDU)
|
279
|
+
mpz_clear(error_part)
|
280
|
+
|
281
|
+
mpfr_init2(neg_radius, mpfi_get_prec(x))
|
282
|
+
mpfr_neg(neg_radius, radius, MPFR_RNDD)
|
283
|
+
|
284
|
+
mpfi_init2(error, mpfi_get_prec(x))
|
285
|
+
mpfi_interv_fr(error, neg_radius, radius)
|
286
|
+
mpfr_clear(radius)
|
287
|
+
mpfr_clear(neg_radius)
|
288
|
+
|
289
|
+
mpfi_add(x, x, error)
|
290
|
+
mpfi_clear(error)
|
291
|
+
|
292
|
+
return 0
|
293
|
+
|
294
|
+
|
295
|
+
cdef int mpfi_set_sage(mpfi_ptr re, mpfi_ptr im, x, field, int base) except -1:
|
296
|
+
"""
|
297
|
+
Convert any object ``x`` to an MPFI interval or a pair of
|
298
|
+
real and complex intervals.
|
299
|
+
|
300
|
+
INPUT:
|
301
|
+
|
302
|
+
- ``re`` -- a pre-initialized MPFI interval
|
303
|
+
|
304
|
+
- ``im`` -- a pre-initialized MPFI interval or NULL
|
305
|
+
|
306
|
+
- ``x`` -- any Sage or Python object to be converted to an interval
|
307
|
+
|
308
|
+
- ``field`` -- a ``RealIntervalField`` or ``ComplexIntervalField``
|
309
|
+
of the right precision (real or complex doesn't matter)
|
310
|
+
|
311
|
+
- ``base`` -- base to use for string conversion
|
312
|
+
|
313
|
+
OUTPUT:
|
314
|
+
|
315
|
+
- if conversion is possible: set ``re`` and ``im`` (if applicable)
|
316
|
+
and return 0.
|
317
|
+
|
318
|
+
- if ``x`` is complex but ``im`` is ``NULL``: convert only if the
|
319
|
+
imaginary component is 0.
|
320
|
+
|
321
|
+
- in all other cases: raise an exception.
|
322
|
+
|
323
|
+
TESTS::
|
324
|
+
|
325
|
+
sage: RIF('0xabc')
|
326
|
+
Traceback (most recent call last):
|
327
|
+
...
|
328
|
+
TypeError: unable to convert '0xabc' to real interval
|
329
|
+
sage: RIF("0x123.e1", base=0) # rel tol 1e-12
|
330
|
+
291.87890625000000?
|
331
|
+
sage: RIF("0x123.@1", base=0) # rel tol 1e-12
|
332
|
+
4656
|
333
|
+
sage: RIF("1Xx", base=36) # rel tol 1e-12
|
334
|
+
2517
|
335
|
+
sage: RIF("-1Xx@-10", base=62) # rel tol 1e-12
|
336
|
+
-7.088054920481391?e-15
|
337
|
+
sage: RIF("1", base=1)
|
338
|
+
Traceback (most recent call last):
|
339
|
+
...
|
340
|
+
ValueError: base (=1) must be 0 or between 2 and 62
|
341
|
+
sage: RIF("1", base=-1)
|
342
|
+
Traceback (most recent call last):
|
343
|
+
...
|
344
|
+
ValueError: base (=-1) must be 0 or between 2 and 62
|
345
|
+
sage: RIF("1", base=63)
|
346
|
+
Traceback (most recent call last):
|
347
|
+
...
|
348
|
+
ValueError: base (=63) must be 0 or between 2 and 62
|
349
|
+
"""
|
350
|
+
cdef RealIntervalFieldElement ri
|
351
|
+
cdef ComplexIntervalFieldElement zi
|
352
|
+
cdef ComplexNumber zn
|
353
|
+
cdef ComplexDoubleElement zd
|
354
|
+
cdef bytes s
|
355
|
+
|
356
|
+
if base != 0 and (base < 2 or base > 62):
|
357
|
+
raise ValueError(f"base (={base}) must be 0 or between 2 and 62")
|
358
|
+
if im is not NULL and isinstance(x, tuple):
|
359
|
+
# For complex numbers, interpret tuples as real/imag parts
|
360
|
+
if len(x) != 2:
|
361
|
+
raise TypeError("tuple defining a complex number must have length 2")
|
362
|
+
mpfi_set_sage(re, NULL, x[0], field, base)
|
363
|
+
mpfi_set_sage(im, NULL, x[1], field, base)
|
364
|
+
return 0
|
365
|
+
if isinstance(x, (list, tuple)):
|
366
|
+
# Interpret entries in x as endpoints of interval
|
367
|
+
if len(x) != 2:
|
368
|
+
raise TypeError("list defining an interval must have length 2")
|
369
|
+
return mpfi_interv_sage(re, im, x[0], x[1], field, base)
|
370
|
+
|
371
|
+
cdef long value
|
372
|
+
cdef int err
|
373
|
+
|
374
|
+
# Check for known types. First check for Element to reduce the
|
375
|
+
# number of checks below.
|
376
|
+
if isinstance(x, Element):
|
377
|
+
# Real
|
378
|
+
if isinstance(x, RealIntervalFieldElement):
|
379
|
+
mpfi_set(re, (<RealIntervalFieldElement>x).value)
|
380
|
+
return return_real(im)
|
381
|
+
if isinstance(x, RealNumber):
|
382
|
+
mpfi_set_fr(re, (<RealNumber>x).value)
|
383
|
+
return return_real(im)
|
384
|
+
if isinstance(x, Rational):
|
385
|
+
mpfi_set_q(re, (<Rational>x).value)
|
386
|
+
return return_real(im)
|
387
|
+
if isinstance(x, Integer):
|
388
|
+
mpfi_set_z(re, (<Integer>x).value)
|
389
|
+
return return_real(im)
|
390
|
+
if isinstance(x, RealDoubleElement):
|
391
|
+
mpfi_set_d(re, (<RealDoubleElement>x)._value)
|
392
|
+
return return_real(im)
|
393
|
+
|
394
|
+
# Complex
|
395
|
+
if isinstance(x, ComplexIntervalFieldElement):
|
396
|
+
zi = <ComplexIntervalFieldElement>x
|
397
|
+
if im is NULL:
|
398
|
+
if not mpfi_is_zero(zi.__im):
|
399
|
+
raise TypeError(f"unable to convert complex interval {x!r} to real interval")
|
400
|
+
else:
|
401
|
+
mpfi_set(im, zi.__im)
|
402
|
+
mpfi_set(re, zi.__re)
|
403
|
+
return 0
|
404
|
+
if isinstance(x, ComplexNumber):
|
405
|
+
zn = <ComplexNumber>x
|
406
|
+
if im is NULL:
|
407
|
+
if mpfr_sgn(zn.__im) != 0:
|
408
|
+
raise TypeError(f"unable to convert complex number {x!r} to real interval")
|
409
|
+
else:
|
410
|
+
mpfi_set_fr(im, zn.__im)
|
411
|
+
mpfi_set_fr(re, zn.__re)
|
412
|
+
return 0
|
413
|
+
if isinstance(x, ComplexDoubleElement):
|
414
|
+
zd = <ComplexDoubleElement>x
|
415
|
+
if im is NULL:
|
416
|
+
if GSL_IMAG(zd._complex):
|
417
|
+
raise TypeError(f"unable to convert complex number {x!r} to real interval")
|
418
|
+
else:
|
419
|
+
mpfi_set_d(im, GSL_IMAG(zd._complex))
|
420
|
+
mpfi_set_d(re, GSL_REAL(zd._complex))
|
421
|
+
return 0
|
422
|
+
else: # not a Sage Element
|
423
|
+
# Real
|
424
|
+
if isinstance(x, float):
|
425
|
+
mpfi_set_d(re, PyFloat_AS_DOUBLE(x))
|
426
|
+
return return_real(im)
|
427
|
+
if integer_check_long(x, &value, &err):
|
428
|
+
if err == 0:
|
429
|
+
mpfi_set_si(re, value)
|
430
|
+
else:
|
431
|
+
mpfi_set_via_RR(re, x, field)
|
432
|
+
return return_real(im)
|
433
|
+
if isinstance(x, unicode):
|
434
|
+
x = x.encode("ascii")
|
435
|
+
if isinstance(x, bytes):
|
436
|
+
if b"?" in x:
|
437
|
+
if _from_str_question_style(re, (<bytes>x).replace(b' ', b''), base):
|
438
|
+
x = bytes_to_str(x)
|
439
|
+
raise TypeError(f"unable to convert {x!r} to real interval")
|
440
|
+
return return_real(im)
|
441
|
+
s = (<bytes>x).replace(b'..', b',').replace(b' ', b'').replace(b'+infinity', b'@inf@').replace(b'-infinity', b'-@inf@')
|
442
|
+
if mpfi_set_str(re, s, base):
|
443
|
+
x = bytes_to_str(x)
|
444
|
+
raise TypeError(f"unable to convert {x!r} to real interval")
|
445
|
+
return return_real(im)
|
446
|
+
|
447
|
+
# Complex
|
448
|
+
if isinstance(x, Gen):
|
449
|
+
imag = x.imag()
|
450
|
+
if im is NULL:
|
451
|
+
if imag:
|
452
|
+
raise TypeError(f"unable to convert complex PARI/GP element {x!r} to real interval")
|
453
|
+
else:
|
454
|
+
mpfi_set_via_RR(im, imag, field)
|
455
|
+
mpfi_set_via_RR(re, x.real(), field)
|
456
|
+
return 0
|
457
|
+
if isinstance(x, complex):
|
458
|
+
imag = PyComplex_ImagAsDouble(x)
|
459
|
+
if im is NULL:
|
460
|
+
if imag:
|
461
|
+
raise TypeError(f"unable to convert complex number {x!r} to real interval")
|
462
|
+
else:
|
463
|
+
mpfi_set_d(im, imag)
|
464
|
+
mpfi_set_d(re, PyComplex_RealAsDouble(x))
|
465
|
+
return 0
|
466
|
+
|
467
|
+
# No known type, try _real_mpfi_ or _complex_mpfi_ methods
|
468
|
+
if im is not NULL:
|
469
|
+
try:
|
470
|
+
m = x._complex_mpfi_
|
471
|
+
except AttributeError:
|
472
|
+
pass
|
473
|
+
else:
|
474
|
+
if not isinstance(field, sage.rings.abc.ComplexIntervalField):
|
475
|
+
field = field.complex_field()
|
476
|
+
e = <ComplexIntervalFieldElement?>m(field)
|
477
|
+
mpfi_swap(re, e.__re)
|
478
|
+
mpfi_swap(im, e.__im)
|
479
|
+
return 0
|
480
|
+
|
481
|
+
try:
|
482
|
+
m = x._real_mpfi_
|
483
|
+
except AttributeError:
|
484
|
+
pass
|
485
|
+
else:
|
486
|
+
if not isinstance(field, RealIntervalField_class):
|
487
|
+
field = field.real_field()
|
488
|
+
ri = <RealIntervalFieldElement?>m(field)
|
489
|
+
mpfi_swap(re, ri.value)
|
490
|
+
return return_real(im)
|
491
|
+
|
492
|
+
# Finally, try converting via the corresponding RealField
|
493
|
+
mpfi_set_via_RR(re, x, field)
|
494
|
+
return return_real(im)
|
495
|
+
|
496
|
+
|
497
|
+
cdef int mpfi_interv_sage(mpfi_ptr re, mpfi_ptr im, x, y, field, int base) except -1:
|
498
|
+
"""
|
499
|
+
Like ``mpfi_set_sage`` but construct the interval around ``x`` and
|
500
|
+
``y``. It is not required that ``x <= y`` or that ``x`` and ``y``
|
501
|
+
are of the same type.
|
502
|
+
|
503
|
+
INPUT: see ``mpfi_set_sage``
|
504
|
+
"""
|
505
|
+
cdef long valx, valy
|
506
|
+
cdef int err
|
507
|
+
if type(x) is type(y):
|
508
|
+
if isinstance(x, RealNumber):
|
509
|
+
mpfi_interv_fr(re, (<RealNumber>x).value, (<RealNumber>y).value)
|
510
|
+
return return_real(im)
|
511
|
+
if isinstance(x, RealDoubleElement):
|
512
|
+
mpfi_interv_d(re, (<RealDoubleElement>x)._value, (<RealDoubleElement>y)._value)
|
513
|
+
return return_real(im)
|
514
|
+
if isinstance(x, Integer):
|
515
|
+
mpfi_interv_z(re, (<Integer>x).value, (<Integer>y).value)
|
516
|
+
return return_real(im)
|
517
|
+
if isinstance(x, Rational):
|
518
|
+
mpfi_interv_q(re, (<Rational>x).value, (<Rational>y).value)
|
519
|
+
return return_real(im)
|
520
|
+
if isinstance(x, float):
|
521
|
+
mpfi_interv_d(re, PyFloat_AS_DOUBLE(x), PyFloat_AS_DOUBLE(y))
|
522
|
+
return return_real(im)
|
523
|
+
# General check for C long
|
524
|
+
integer_check_long(x, &valx, &err)
|
525
|
+
if err == 0:
|
526
|
+
integer_check_long(y, &valy, &err)
|
527
|
+
if err == 0:
|
528
|
+
mpfi_interv_si(re, valx, valy)
|
529
|
+
return return_real(im)
|
530
|
+
|
531
|
+
# General case: convert both x and y to an interval and take the
|
532
|
+
# union
|
533
|
+
|
534
|
+
# First handle x
|
535
|
+
mpfi_set_sage(re, im, x, field, base)
|
536
|
+
|
537
|
+
# Now handle y, which requires temporary mpfi variables.
|
538
|
+
cdef mpfi_t tmp1, tmp2
|
539
|
+
cdef mpfr_prec_t prec = mpfi_get_prec(re)
|
540
|
+
|
541
|
+
mpfi_init2(tmp1, prec)
|
542
|
+
cdef mpfi_ptr tmpim = NULL
|
543
|
+
if im is not NULL:
|
544
|
+
mpfi_init2(tmp2, prec)
|
545
|
+
tmpim = tmp2
|
546
|
+
|
547
|
+
try:
|
548
|
+
mpfi_set_sage(tmp1, tmpim, y, field, base)
|
549
|
+
mpfi_union(re, re, tmp1)
|
550
|
+
if im is not NULL:
|
551
|
+
mpfi_union(im, im, tmpim)
|
552
|
+
finally:
|
553
|
+
mpfi_clear(tmp1)
|
554
|
+
if tmpim is not NULL:
|
555
|
+
mpfi_clear(tmpim)
|
556
|
+
|
557
|
+
|
558
|
+
cdef int mpfi_set_via_RR(mpfi_ptr re, x, field) except -1:
|
559
|
+
"""
|
560
|
+
Convert ``x`` to an MPFI interval by converting ``x`` to the
|
561
|
+
appropriate real fields.
|
562
|
+
|
563
|
+
INPUT: see ``mpfi_set_sage``
|
564
|
+
"""
|
565
|
+
cdef RealIntervalField_class RIF
|
566
|
+
if isinstance(field, RealIntervalField_class):
|
567
|
+
RIF = <RealIntervalField_class>field
|
568
|
+
else:
|
569
|
+
RIF = <RealIntervalField_class?>field.real_field()
|
570
|
+
|
571
|
+
try:
|
572
|
+
ra = RIF.__lower_field(x)
|
573
|
+
rb = RIF.__upper_field(x)
|
574
|
+
except TypeError:
|
575
|
+
raise TypeError(f"unable to convert {x!r} to real interval")
|
576
|
+
mpfi_interv_fr(re, (<RealNumber>ra).value, (<RealNumber>rb).value)
|
Binary file
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-flint
|
2
|
+
# sage.doctest: needs sage.libs.flint
|
3
|
+
r"""
|
4
|
+
Integer factorization using FLINT
|
5
|
+
|
6
|
+
AUTHORS:
|
7
|
+
|
8
|
+
- Michael Orlitzky (2023)
|
9
|
+
"""
|
10
|
+
|
11
|
+
#*****************************************************************************
|
12
|
+
# Copyright (C) 2023 Michael Orlitzky
|
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
|
+
from cysignals.signals cimport sig_on, sig_off
|
21
|
+
|
22
|
+
from sage.libs.flint.fmpz cimport fmpz_t, fmpz_init, fmpz_set_mpz
|
23
|
+
from sage.libs.flint.fmpz_factor cimport *
|
24
|
+
from sage.libs.flint.fmpz_factor_sage cimport *
|
25
|
+
from sage.rings.integer cimport Integer
|
26
|
+
|
27
|
+
|
28
|
+
def factor_using_flint(Integer n):
|
29
|
+
r"""
|
30
|
+
Factor the nonzero integer ``n`` using FLINT.
|
31
|
+
|
32
|
+
This function returns a list of (factor, exponent) pairs. The
|
33
|
+
factors will be of type ``Integer``, and the exponents will be of
|
34
|
+
type ``int``.
|
35
|
+
|
36
|
+
INPUT:
|
37
|
+
|
38
|
+
- ``n`` -- a nonzero sage Integer; the number to factor
|
39
|
+
|
40
|
+
OUTPUT:
|
41
|
+
|
42
|
+
A list of ``(Integer, int)`` pairs representing the factors and
|
43
|
+
their exponents.
|
44
|
+
|
45
|
+
EXAMPLES::
|
46
|
+
|
47
|
+
sage: from sage.rings.factorint_flint import factor_using_flint
|
48
|
+
sage: n = ZZ(9962572652930382)
|
49
|
+
sage: factors = factor_using_flint(n)
|
50
|
+
sage: factors
|
51
|
+
[(2, 1), (3, 1), (1660428775488397, 1)]
|
52
|
+
sage: prod( f^e for (f,e) in factors ) == n
|
53
|
+
True
|
54
|
+
|
55
|
+
Negative numbers will have a leading factor of ``(-1)^1``::
|
56
|
+
|
57
|
+
sage: n = ZZ(-1 * 2 * 3)
|
58
|
+
sage: factor_using_flint(n)
|
59
|
+
[(-1, 1), (2, 1), (3, 1)]
|
60
|
+
|
61
|
+
The factorization of unity is empty::
|
62
|
+
|
63
|
+
sage: factor_using_flint(ZZ.one())
|
64
|
+
[]
|
65
|
+
|
66
|
+
While zero has a single factor, of... zero::
|
67
|
+
|
68
|
+
sage: factor_using_flint(ZZ.zero())
|
69
|
+
[(0, 1)]
|
70
|
+
|
71
|
+
TESTS:
|
72
|
+
|
73
|
+
Check that the integers [-10,000, 10,000] are factored correctly::
|
74
|
+
|
75
|
+
sage: all(
|
76
|
+
....: prod( f^e for (f,e) in factor_using_flint(ZZ(c*k)) ) == c*k
|
77
|
+
....: for k in range(10000)
|
78
|
+
....: for c in [-1, 1]
|
79
|
+
....: )
|
80
|
+
True
|
81
|
+
"""
|
82
|
+
if n.is_zero():
|
83
|
+
return [(n, int(1))]
|
84
|
+
|
85
|
+
cdef fmpz_t p
|
86
|
+
fmpz_init(p)
|
87
|
+
fmpz_set_mpz(p, (<Integer>n).value)
|
88
|
+
|
89
|
+
cdef fmpz_factor_t factors
|
90
|
+
fmpz_factor_init(factors)
|
91
|
+
|
92
|
+
sig_on()
|
93
|
+
fmpz_factor(factors, p)
|
94
|
+
sig_off()
|
95
|
+
|
96
|
+
pairs = fmpz_factor_to_pairlist(factors)
|
97
|
+
|
98
|
+
fmpz_factor_clear(factors)
|
99
|
+
return pairs
|
Binary file
|