passagemath-flint 10.6.1rc10__cp312-cp312-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-312-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-312-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-312-x86_64-linux-gnu.so +0 -0
- sage/graphs/chrompoly.pyx +555 -0
- sage/graphs/matchpoly.cpython-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-x86_64-linux-gnu.so +0 -0
- sage/matrix/change_ring.pyx +43 -0
- sage/matrix/matrix_complex_ball_dense.cpython-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-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-312-x86_64-linux-gnu.so +0 -0
- sage/rings/factorint_flint.pyx +99 -0
- sage/rings/fraction_field_FpT.cpython-312-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-312-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-312-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-312-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-312-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-312-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/hilbert.pyx +602 -0
- sage/rings/polynomial/polynomial_complex_arb.cpython-312-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-312-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-312-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_number_field.pyx +345 -0
- sage/rings/polynomial/polynomial_rational_flint.cpython-312-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-312-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-312-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-312-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-312-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-312-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-312-x86_64-linux-gnu.so +0 -0
- sage/rings/real_interval_absolute.pyx +1073 -0
- sage/rings/real_mpfi.cpython-312-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-312-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,789 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-flint
|
2
|
+
"""
|
3
|
+
Sparse rational matrices
|
4
|
+
|
5
|
+
AUTHORS:
|
6
|
+
|
7
|
+
- William Stein (2007-02-21)
|
8
|
+
- Soroosh Yazdani (2007-02-21)
|
9
|
+
|
10
|
+
TESTS::
|
11
|
+
|
12
|
+
sage: a = matrix(QQ,2,range(4), sparse=True)
|
13
|
+
sage: TestSuite(a).run()
|
14
|
+
sage: matrix(QQ,0,0,sparse=True).inverse()
|
15
|
+
[]
|
16
|
+
"""
|
17
|
+
|
18
|
+
#*****************************************************************************
|
19
|
+
# Copyright (C) 2007 William Stein <wstein@gmail.com>
|
20
|
+
#
|
21
|
+
# This program is free software: you can redistribute it and/or modify
|
22
|
+
# it under the terms of the GNU General Public License as published by
|
23
|
+
# the Free Software Foundation, either version 2 of the License, or
|
24
|
+
# (at your option) any later version.
|
25
|
+
# http://www.gnu.org/licenses/
|
26
|
+
#*****************************************************************************
|
27
|
+
|
28
|
+
from cysignals.signals cimport sig_on, sig_off
|
29
|
+
from cysignals.memory cimport check_calloc, sig_free
|
30
|
+
|
31
|
+
from sage.data_structures.binary_search cimport *
|
32
|
+
from sage.modules.vector_integer_sparse cimport *
|
33
|
+
from sage.modules.vector_rational_sparse cimport *
|
34
|
+
|
35
|
+
from cpython.sequence cimport *
|
36
|
+
|
37
|
+
from sage.rings.rational cimport Rational
|
38
|
+
from sage.rings.integer cimport Integer
|
39
|
+
from sage.matrix.matrix cimport Matrix
|
40
|
+
from sage.matrix.args cimport SparseEntry, MatrixArgs_init
|
41
|
+
|
42
|
+
from sage.libs.gmp.mpz cimport *
|
43
|
+
from sage.libs.gmp.mpq cimport *
|
44
|
+
|
45
|
+
from sage.libs.flint.fmpq cimport fmpq_set_mpq
|
46
|
+
from sage.libs.flint.fmpq_mat cimport fmpq_mat_entry
|
47
|
+
|
48
|
+
from sage.rings.integer_ring import ZZ
|
49
|
+
from sage.rings.rational_field import QQ
|
50
|
+
|
51
|
+
cimport sage.structure.element
|
52
|
+
|
53
|
+
import sage.matrix.matrix_space
|
54
|
+
|
55
|
+
from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
|
56
|
+
from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense
|
57
|
+
|
58
|
+
|
59
|
+
cdef class Matrix_rational_sparse(Matrix_sparse):
|
60
|
+
def __cinit__(self):
|
61
|
+
self._matrix = <mpq_vector*>check_calloc(self._nrows, sizeof(mpq_vector))
|
62
|
+
# initialize the rows
|
63
|
+
cdef Py_ssize_t i
|
64
|
+
for i in range(self._nrows):
|
65
|
+
mpq_vector_init(&self._matrix[i], self._ncols, 0)
|
66
|
+
|
67
|
+
def __dealloc__(self):
|
68
|
+
cdef Py_ssize_t i
|
69
|
+
if self._matrix is not NULL:
|
70
|
+
for i in range(self._nrows):
|
71
|
+
mpq_vector_clear(&self._matrix[i])
|
72
|
+
sig_free(self._matrix)
|
73
|
+
|
74
|
+
def __init__(self, parent, entries=None, copy=None, bint coerce=True):
|
75
|
+
r"""
|
76
|
+
Create a sparse matrix over the rational numbers.
|
77
|
+
|
78
|
+
INPUT:
|
79
|
+
|
80
|
+
- ``parent`` -- a matrix space over `\QQ`
|
81
|
+
|
82
|
+
- ``entries`` -- see :func:`matrix`
|
83
|
+
|
84
|
+
- ``copy`` -- ignored (for backwards compatibility)
|
85
|
+
|
86
|
+
- ``coerce`` -- if ``False``, assume without checking that the
|
87
|
+
entries are of type :class:`Rational`
|
88
|
+
"""
|
89
|
+
ma = MatrixArgs_init(parent, entries)
|
90
|
+
cdef Rational z
|
91
|
+
for t in ma.iter(coerce, True):
|
92
|
+
se = <SparseEntry>t
|
93
|
+
z = <Rational>se.entry
|
94
|
+
if z:
|
95
|
+
mpq_vector_set_entry(&self._matrix[se.i], se.j, z.value)
|
96
|
+
|
97
|
+
cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x):
|
98
|
+
mpq_vector_set_entry(&self._matrix[i], j, (<Rational> x).value)
|
99
|
+
|
100
|
+
cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j):
|
101
|
+
cdef Rational x
|
102
|
+
x = Rational()
|
103
|
+
mpq_vector_get_entry(x.value, &self._matrix[i], j)
|
104
|
+
return x
|
105
|
+
|
106
|
+
cdef bint get_is_zero_unsafe(self, Py_ssize_t i, Py_ssize_t j) except -1:
|
107
|
+
"""
|
108
|
+
Return 1 if the entry ``(i, j)`` is zero, otherwise 0.
|
109
|
+
|
110
|
+
EXAMPLES::
|
111
|
+
|
112
|
+
sage: M = matrix(QQ, [[0,1,0],[0,0,0]], sparse=True)
|
113
|
+
sage: M.zero_pattern_matrix() # indirect doctest
|
114
|
+
[1 0 1]
|
115
|
+
[1 1 1]
|
116
|
+
"""
|
117
|
+
return mpq_vector_is_entry_zero_unsafe(&self._matrix[i], j)
|
118
|
+
|
119
|
+
def add_to_entry(self, Py_ssize_t i, Py_ssize_t j, elt):
|
120
|
+
r"""
|
121
|
+
Add ``elt`` to the entry at position ``(i, j)``.
|
122
|
+
|
123
|
+
EXAMPLES::
|
124
|
+
|
125
|
+
sage: m = matrix(QQ, 2, 2, sparse=True)
|
126
|
+
sage: m.add_to_entry(0, 0, -1/3)
|
127
|
+
sage: m
|
128
|
+
[-1/3 0]
|
129
|
+
[ 0 0]
|
130
|
+
sage: m.add_to_entry(0, 0, 1/3)
|
131
|
+
sage: m
|
132
|
+
[0 0]
|
133
|
+
[0 0]
|
134
|
+
sage: m.nonzero_positions()
|
135
|
+
[]
|
136
|
+
"""
|
137
|
+
if not isinstance(elt, Rational):
|
138
|
+
elt = Rational(elt)
|
139
|
+
if i < 0:
|
140
|
+
i += self._nrows
|
141
|
+
if i < 0 or i >= self._nrows:
|
142
|
+
raise IndexError("row index out of range")
|
143
|
+
if j < 0:
|
144
|
+
j += self._ncols
|
145
|
+
if j < 0 or j >= self._ncols:
|
146
|
+
raise IndexError("column index out of range")
|
147
|
+
|
148
|
+
cdef mpq_t z
|
149
|
+
mpq_init(z)
|
150
|
+
mpq_vector_get_entry(z, &self._matrix[i], j)
|
151
|
+
mpq_add(z, z, (<Rational>elt).value)
|
152
|
+
mpq_vector_set_entry(&self._matrix[i], j, z)
|
153
|
+
mpq_clear(z)
|
154
|
+
|
155
|
+
########################################################################
|
156
|
+
# LEVEL 2 functionality
|
157
|
+
# * def _pickle
|
158
|
+
# * def _unpickle
|
159
|
+
# * cdef _add_
|
160
|
+
# * cdef _sub_
|
161
|
+
# * cdef _mul_
|
162
|
+
# * cpdef _richcmp_
|
163
|
+
# * __neg__
|
164
|
+
# * __invert__
|
165
|
+
# * __copy__
|
166
|
+
# * _multiply_classical
|
167
|
+
# * _matrix_times_matrix_
|
168
|
+
# * _list -- list of underlying elements (need not be a copy)
|
169
|
+
# * x _dict -- sparse dictionary of underlying elements (need not be a copy)
|
170
|
+
|
171
|
+
cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix _right):
|
172
|
+
cdef Matrix_rational_sparse right, ans
|
173
|
+
right = _right
|
174
|
+
|
175
|
+
cdef mpq_vector* v
|
176
|
+
|
177
|
+
# Build a table that gives the nonzero positions in each column of right
|
178
|
+
cdef list nonzero_positions_in_columns = [set() for _ in range(right._ncols)]
|
179
|
+
cdef Py_ssize_t i, j, k
|
180
|
+
for i in range(right._nrows):
|
181
|
+
v = &(right._matrix[i])
|
182
|
+
for j in range(v.num_nonzero):
|
183
|
+
(<set> nonzero_positions_in_columns[v.positions[j]]).add(i)
|
184
|
+
# pre-computes the list of nonzero columns of right
|
185
|
+
cdef list right_indices
|
186
|
+
right_indices = [j for j in range(right._ncols)
|
187
|
+
if nonzero_positions_in_columns[j]]
|
188
|
+
|
189
|
+
ans = self.new_matrix(self._nrows, right._ncols)
|
190
|
+
|
191
|
+
# Now do the multiplication, getting each row completely before filling it in.
|
192
|
+
cdef set c
|
193
|
+
cdef mpq_t x, y, s
|
194
|
+
mpq_init(x)
|
195
|
+
mpq_init(y)
|
196
|
+
mpq_init(s)
|
197
|
+
for i in range(self._nrows):
|
198
|
+
v = &(self._matrix[i])
|
199
|
+
if not v.num_nonzero:
|
200
|
+
continue
|
201
|
+
for j in right_indices:
|
202
|
+
mpq_set_si(s, 0, 1)
|
203
|
+
c = <set> nonzero_positions_in_columns[j]
|
204
|
+
for k in range(v.num_nonzero):
|
205
|
+
if v.positions[k] in c:
|
206
|
+
mpq_vector_get_entry(y, &right._matrix[v.positions[k]], j)
|
207
|
+
mpq_mul(x, v.entries[k], y)
|
208
|
+
mpq_add(s, s, x)
|
209
|
+
mpq_vector_set_entry(&ans._matrix[i], j, s)
|
210
|
+
|
211
|
+
mpq_clear(x)
|
212
|
+
mpq_clear(y)
|
213
|
+
mpq_clear(s)
|
214
|
+
return ans
|
215
|
+
|
216
|
+
def _matrix_times_matrix_dense(self, sage.structure.element.Matrix _right):
|
217
|
+
"""
|
218
|
+
Do the sparse matrix multiply, but return a dense matrix as the result.
|
219
|
+
|
220
|
+
EXAMPLES::
|
221
|
+
|
222
|
+
sage: a = matrix(QQ, 2, [1,2,3,4], sparse=True)
|
223
|
+
sage: b = matrix(QQ, 2, 3, [1..6], sparse=True)
|
224
|
+
sage: a * b
|
225
|
+
[ 9 12 15]
|
226
|
+
[19 26 33]
|
227
|
+
sage: c = a._matrix_times_matrix_dense(b); c
|
228
|
+
[ 9 12 15]
|
229
|
+
[19 26 33]
|
230
|
+
sage: type(c)
|
231
|
+
<class 'sage.matrix.matrix_rational_dense.Matrix_rational_dense'>
|
232
|
+
"""
|
233
|
+
cdef Matrix_rational_sparse right
|
234
|
+
cdef Matrix_rational_dense ans
|
235
|
+
right = _right
|
236
|
+
|
237
|
+
cdef mpq_vector* v
|
238
|
+
|
239
|
+
# Build a table that gives the nonzero positions in each column of right
|
240
|
+
nonzero_positions_in_columns = [set() for _ in range(right._ncols)]
|
241
|
+
cdef Py_ssize_t i, j, k
|
242
|
+
for i in range(right._nrows):
|
243
|
+
v = &(right._matrix[i])
|
244
|
+
for j in range(right._matrix[i].num_nonzero):
|
245
|
+
nonzero_positions_in_columns[v.positions[j]].add(i)
|
246
|
+
|
247
|
+
ans = self.new_matrix(self._nrows, right._ncols, sparse=False)
|
248
|
+
|
249
|
+
# Now do the multiplication, getting each row completely before filling it in.
|
250
|
+
cdef mpq_t x, y, s
|
251
|
+
mpq_init(x)
|
252
|
+
mpq_init(y)
|
253
|
+
mpq_init(s)
|
254
|
+
for i in range(self._nrows):
|
255
|
+
v = &self._matrix[i]
|
256
|
+
for j in range(right._ncols):
|
257
|
+
mpq_set_si(s, 0, 1)
|
258
|
+
c = nonzero_positions_in_columns[j]
|
259
|
+
for k in range(v.num_nonzero):
|
260
|
+
if v.positions[k] in c:
|
261
|
+
mpq_vector_get_entry(y, &right._matrix[v.positions[k]], j)
|
262
|
+
mpq_mul(x, v.entries[k], y)
|
263
|
+
mpq_add(s, s, x)
|
264
|
+
fmpq_set_mpq(fmpq_mat_entry(ans._matrix, i, j), s)
|
265
|
+
|
266
|
+
mpq_clear(x)
|
267
|
+
mpq_clear(y)
|
268
|
+
mpq_clear(s)
|
269
|
+
return ans
|
270
|
+
|
271
|
+
########################################################################
|
272
|
+
# def _pickle(self):
|
273
|
+
# def _unpickle(self, data, int version): # use version >= 0
|
274
|
+
# cpdef _add_(self, right):
|
275
|
+
# cdef _mul_(self, Matrix right):
|
276
|
+
# cpdef _richcmp_(self, Matrix right, int op):
|
277
|
+
# def __neg__(self):
|
278
|
+
# def __invert__(self):
|
279
|
+
# def __copy__(self):
|
280
|
+
# def _multiply_classical(left, matrix.Matrix _right):
|
281
|
+
# def _list(self):
|
282
|
+
|
283
|
+
# TODO
|
284
|
+
## cpdef _lmul_(self, Element right):
|
285
|
+
## """
|
286
|
+
## EXAMPLES::
|
287
|
+
##
|
288
|
+
## sage: a = matrix(QQ,2,range(6))
|
289
|
+
## sage: (3/4) * a
|
290
|
+
## [ 0 3/4 3/2]
|
291
|
+
## [ 9/4 3 15/4]
|
292
|
+
## """
|
293
|
+
|
294
|
+
def _dict(self):
|
295
|
+
"""
|
296
|
+
Unsafe version of the dict method, mainly for internal use.
|
297
|
+
|
298
|
+
This may return the dict of elements, but as an *unsafe*
|
299
|
+
reference to the underlying dict of the object. It might
|
300
|
+
be dangerous if you change entries of the returned dict.
|
301
|
+
"""
|
302
|
+
d = self.fetch('dict')
|
303
|
+
if d is not None:
|
304
|
+
return d
|
305
|
+
|
306
|
+
cdef Py_ssize_t i, j
|
307
|
+
d = {}
|
308
|
+
for i in range(self._nrows):
|
309
|
+
for j in range(self._matrix[i].num_nonzero):
|
310
|
+
x = Rational()
|
311
|
+
mpq_set((<Rational>x).value, self._matrix[i].entries[j])
|
312
|
+
d[(int(i), int(self._matrix[i].positions[j]))] = x
|
313
|
+
self.cache('dict', d)
|
314
|
+
return d
|
315
|
+
|
316
|
+
########################################################################
|
317
|
+
# LEVEL 3 functionality (Optional)
|
318
|
+
# * cdef _sub_
|
319
|
+
# * __deepcopy__
|
320
|
+
# * __invert__
|
321
|
+
# * Matrix windows -- only if you need strassen for that base
|
322
|
+
# * Other functions (list them here):
|
323
|
+
########################################################################
|
324
|
+
|
325
|
+
def _nonzero_positions_by_row(self, copy=True):
|
326
|
+
"""
|
327
|
+
Return the list of pairs (i,j) such that self[i,j] != 0.
|
328
|
+
|
329
|
+
It is safe to change the resulting list (unless you give the option copy=False).
|
330
|
+
|
331
|
+
EXAMPLES::
|
332
|
+
|
333
|
+
sage: M = Matrix(QQ, [[0,0,0,1,0,0,0,0],[0,1,0,0,0,0,1,0]], sparse=True); M
|
334
|
+
[0 0 0 1 0 0 0 0]
|
335
|
+
[0 1 0 0 0 0 1 0]
|
336
|
+
sage: M.nonzero_positions()
|
337
|
+
[(0, 3), (1, 1), (1, 6)]
|
338
|
+
"""
|
339
|
+
x = self.fetch('nonzero_positions')
|
340
|
+
if x is not None:
|
341
|
+
if copy:
|
342
|
+
return list(x)
|
343
|
+
return x
|
344
|
+
nzp = []
|
345
|
+
cdef Py_ssize_t i, j
|
346
|
+
for i from 0 <= i < self._nrows:
|
347
|
+
for j from 0 <= j < self._matrix[i].num_nonzero:
|
348
|
+
nzp.append((i,self._matrix[i].positions[j]))
|
349
|
+
self.cache('nonzero_positions', nzp)
|
350
|
+
if copy:
|
351
|
+
return list(nzp)
|
352
|
+
return nzp
|
353
|
+
|
354
|
+
def height(self):
|
355
|
+
"""
|
356
|
+
Return the height of this matrix, which is the least common
|
357
|
+
multiple of all numerators and denominators of elements of
|
358
|
+
this matrix.
|
359
|
+
|
360
|
+
OUTPUT: integer
|
361
|
+
|
362
|
+
EXAMPLES::
|
363
|
+
|
364
|
+
sage: b = matrix(QQ,2,range(6), sparse=True); b[0,0]=-5007/293; b
|
365
|
+
[-5007/293 1 2]
|
366
|
+
[ 3 4 5]
|
367
|
+
sage: b.height()
|
368
|
+
5007
|
369
|
+
"""
|
370
|
+
cdef Integer z = Integer.__new__(Integer)
|
371
|
+
self.mpz_height(z.value)
|
372
|
+
return z
|
373
|
+
|
374
|
+
cdef int mpz_height(self, mpz_t height) except -1:
|
375
|
+
cdef mpz_t x, h
|
376
|
+
mpz_init(x)
|
377
|
+
mpz_init_set_si(h, 0)
|
378
|
+
cdef Py_ssize_t i, j
|
379
|
+
sig_on()
|
380
|
+
for i from 0 <= i < self._nrows:
|
381
|
+
for j from 0 <= j < self._matrix[i].num_nonzero:
|
382
|
+
mpq_get_num(x, self._matrix[i].entries[j])
|
383
|
+
mpz_abs(x, x)
|
384
|
+
if mpz_cmp(h,x) < 0:
|
385
|
+
mpz_set(h,x)
|
386
|
+
mpq_get_den(x, self._matrix[i].entries[j])
|
387
|
+
mpz_abs(x, x)
|
388
|
+
if mpz_cmp(h,x) < 0:
|
389
|
+
mpz_set(h,x)
|
390
|
+
sig_off()
|
391
|
+
mpz_set(height, h)
|
392
|
+
mpz_clear(h)
|
393
|
+
mpz_clear(x)
|
394
|
+
return 0
|
395
|
+
|
396
|
+
cdef int mpz_denom(self, mpz_t d) except -1:
|
397
|
+
mpz_set_si(d, 1)
|
398
|
+
cdef Py_ssize_t i, j
|
399
|
+
|
400
|
+
sig_on()
|
401
|
+
for i in range(self._nrows):
|
402
|
+
for j in range(self._matrix[i].num_nonzero):
|
403
|
+
mpz_lcm(d, d, mpq_denref(self._matrix[i].entries[j]))
|
404
|
+
sig_off()
|
405
|
+
return 0
|
406
|
+
|
407
|
+
def denominator(self):
|
408
|
+
"""
|
409
|
+
Return the denominator of this matrix.
|
410
|
+
|
411
|
+
OUTPUT: Sage Integer
|
412
|
+
|
413
|
+
EXAMPLES::
|
414
|
+
|
415
|
+
sage: b = matrix(QQ,2,range(6)); b[0,0]=-5007/293; b
|
416
|
+
[-5007/293 1 2]
|
417
|
+
[ 3 4 5]
|
418
|
+
sage: b.denominator()
|
419
|
+
293
|
420
|
+
"""
|
421
|
+
cdef Integer z = Integer.__new__(Integer)
|
422
|
+
self.mpz_denom(z.value)
|
423
|
+
return z
|
424
|
+
|
425
|
+
def _clear_denom(self):
|
426
|
+
"""
|
427
|
+
OUTPUT: ``d*self, D``
|
428
|
+
|
429
|
+
The product D*self is a matrix over ZZ
|
430
|
+
|
431
|
+
EXAMPLES::
|
432
|
+
|
433
|
+
sage: a = matrix(QQ,3,[-2/7, -1/4, -2, 0, 1/7, 1, 0, 1/2, 1/5],sparse=True)
|
434
|
+
sage: a.denominator()
|
435
|
+
140
|
436
|
+
sage: a._clear_denom()
|
437
|
+
(
|
438
|
+
[ -40 -35 -280]
|
439
|
+
[ 0 20 140]
|
440
|
+
[ 0 70 28], 140
|
441
|
+
)
|
442
|
+
"""
|
443
|
+
cdef Integer D
|
444
|
+
cdef Py_ssize_t i, j
|
445
|
+
cdef Matrix_integer_sparse A
|
446
|
+
cdef mpz_t t
|
447
|
+
cdef mpq_vector* v
|
448
|
+
|
449
|
+
D = Integer()
|
450
|
+
self.mpz_denom(D.value)
|
451
|
+
|
452
|
+
MZ = sage.matrix.matrix_space.MatrixSpace(ZZ, self._nrows, self._ncols, sparse=True)
|
453
|
+
A = MZ.zero_matrix().__copy__()
|
454
|
+
|
455
|
+
mpz_init(t)
|
456
|
+
sig_on()
|
457
|
+
for i from 0 <= i < self._nrows:
|
458
|
+
v = &(self._matrix[i])
|
459
|
+
for j from 0 <= j < v.num_nonzero:
|
460
|
+
mpz_divexact(t, D.value, mpq_denref(v.entries[j]))
|
461
|
+
mpz_mul(t, t, mpq_numref(v.entries[j]))
|
462
|
+
mpz_vector_set_entry(&(A._matrix[i]), v.positions[j], t)
|
463
|
+
sig_off()
|
464
|
+
mpz_clear(t)
|
465
|
+
return A, D
|
466
|
+
|
467
|
+
################################################
|
468
|
+
# Echelon form
|
469
|
+
################################################
|
470
|
+
def echelonize(self, height_guess=None, proof=True, **kwds):
|
471
|
+
"""
|
472
|
+
Transform the matrix ``self`` into reduced row echelon form
|
473
|
+
in place.
|
474
|
+
|
475
|
+
INPUT:
|
476
|
+
|
477
|
+
- ``height_guess``, ``proof``, ``**kwds`` -- all passed to the multimodular
|
478
|
+
algorithm; ignored by the `p`-adic algorithm
|
479
|
+
|
480
|
+
OUTPUT:
|
481
|
+
|
482
|
+
Nothing. The matrix ``self`` is transformed into reduced row
|
483
|
+
echelon form in place.
|
484
|
+
|
485
|
+
ALGORITHM: a multimodular algorithm.
|
486
|
+
|
487
|
+
EXAMPLES::
|
488
|
+
|
489
|
+
sage: a = matrix(QQ, 4, range(16), sparse=True); a[0,0] = 1/19; a[0,1] = 1/5; a
|
490
|
+
[1/19 1/5 2 3]
|
491
|
+
[ 4 5 6 7]
|
492
|
+
[ 8 9 10 11]
|
493
|
+
[ 12 13 14 15]
|
494
|
+
sage: a.echelonize(); a
|
495
|
+
[ 1 0 0 -76/157]
|
496
|
+
[ 0 1 0 -5/157]
|
497
|
+
[ 0 0 1 238/157]
|
498
|
+
[ 0 0 0 0]
|
499
|
+
|
500
|
+
:issue:`10319` has been fixed::
|
501
|
+
|
502
|
+
sage: m = Matrix(QQ, [1], sparse=True); m.echelonize()
|
503
|
+
sage: m = Matrix(QQ, [1], sparse=True); m.echelonize(); m
|
504
|
+
[1]
|
505
|
+
"""
|
506
|
+
|
507
|
+
x = self.fetch('in_echelon_form')
|
508
|
+
if x is not None:
|
509
|
+
return # already known to be in echelon form
|
510
|
+
self.check_mutability()
|
511
|
+
|
512
|
+
pivots = self._echelonize_multimodular(height_guess, proof, **kwds)
|
513
|
+
|
514
|
+
self.cache('in_echelon_form', True)
|
515
|
+
self.cache('echelon_form', self)
|
516
|
+
self.cache('pivots', pivots)
|
517
|
+
self.cache('rank', len(pivots))
|
518
|
+
|
519
|
+
def echelon_form(self, algorithm='default',
|
520
|
+
height_guess=None, proof=True, **kwds):
|
521
|
+
"""
|
522
|
+
INPUT:
|
523
|
+
|
524
|
+
- ``height_guess``, ``proof``, ``**kwds`` -- all passed to the multimodular
|
525
|
+
algorithm; ignored by the `p`-adic algorithm
|
526
|
+
|
527
|
+
OUTPUT: ``self`` is no in reduced row echelon form
|
528
|
+
|
529
|
+
EXAMPLES::
|
530
|
+
|
531
|
+
sage: a = matrix(QQ, 4, range(16), sparse=True); a[0,0] = 1/19; a[0,1] = 1/5; a
|
532
|
+
[1/19 1/5 2 3]
|
533
|
+
[ 4 5 6 7]
|
534
|
+
[ 8 9 10 11]
|
535
|
+
[ 12 13 14 15]
|
536
|
+
sage: a.echelon_form()
|
537
|
+
[ 1 0 0 -76/157]
|
538
|
+
[ 0 1 0 -5/157]
|
539
|
+
[ 0 0 1 238/157]
|
540
|
+
[ 0 0 0 0]
|
541
|
+
"""
|
542
|
+
label = 'echelon_form_%s' % algorithm
|
543
|
+
x = self.fetch(label)
|
544
|
+
if x is not None:
|
545
|
+
return x
|
546
|
+
if self.fetch('in_echelon_form'):
|
547
|
+
return self
|
548
|
+
|
549
|
+
E, pivots = self._echelon_form_multimodular(height_guess, proof=proof)
|
550
|
+
|
551
|
+
self.cache(label, E)
|
552
|
+
self.cache('pivots', pivots)
|
553
|
+
return E
|
554
|
+
|
555
|
+
# Multimodular echelonization algorithms
|
556
|
+
def _echelonize_multimodular(self, height_guess=None, proof=True, **kwds):
|
557
|
+
cdef Matrix_rational_sparse E
|
558
|
+
E, pivots = self._echelon_form_multimodular(height_guess, proof=proof, **kwds)
|
559
|
+
self.clear_cache()
|
560
|
+
# Swap the data of E and self (effectively moving E to self)
|
561
|
+
self._matrix, E._matrix = E._matrix, self._matrix
|
562
|
+
return pivots
|
563
|
+
|
564
|
+
def _echelon_form_multimodular(self, height_guess=None, proof=True):
|
565
|
+
"""
|
566
|
+
Return reduced row-echelon form using a multi-modular
|
567
|
+
algorithm. Does not change ``self``.
|
568
|
+
|
569
|
+
INPUT:
|
570
|
+
|
571
|
+
- ``height_guess`` -- integer or ``None``
|
572
|
+
- ``proof`` -- boolean (default: ``True``)
|
573
|
+
"""
|
574
|
+
from sage.matrix.misc import matrix_rational_echelon_form_multimodular
|
575
|
+
cdef Matrix E
|
576
|
+
E, pivots = matrix_rational_echelon_form_multimodular(self,
|
577
|
+
height_guess=height_guess, proof=proof)
|
578
|
+
E._parent = self._parent
|
579
|
+
return E, pivots
|
580
|
+
|
581
|
+
def set_row_to_multiple_of_row(self, i, j, s):
|
582
|
+
"""
|
583
|
+
Set row i equal to s times row j.
|
584
|
+
|
585
|
+
EXAMPLES::
|
586
|
+
|
587
|
+
sage: a = matrix(QQ,2,3,range(6), sparse=True); a
|
588
|
+
[0 1 2]
|
589
|
+
[3 4 5]
|
590
|
+
sage: a.set_row_to_multiple_of_row(1,0,-3)
|
591
|
+
sage: a
|
592
|
+
[ 0 1 2]
|
593
|
+
[ 0 -3 -6]
|
594
|
+
"""
|
595
|
+
self.check_row_bounds_and_mutability(i, j)
|
596
|
+
cdef Rational _s
|
597
|
+
_s = Rational(s)
|
598
|
+
mpq_vector_scalar_multiply(&self._matrix[i], &self._matrix[j], _s.value)
|
599
|
+
|
600
|
+
def dense_matrix(self):
|
601
|
+
"""
|
602
|
+
Return dense version of this matrix.
|
603
|
+
|
604
|
+
EXAMPLES::
|
605
|
+
|
606
|
+
sage: a = matrix(QQ,2,[1..4],sparse=True); type(a)
|
607
|
+
<class 'sage.matrix.matrix_rational_sparse.Matrix_rational_sparse'>
|
608
|
+
sage: type(a.dense_matrix())
|
609
|
+
<class 'sage.matrix.matrix_rational_dense.Matrix_rational_dense'>
|
610
|
+
sage: a.dense_matrix()
|
611
|
+
[1 2]
|
612
|
+
[3 4]
|
613
|
+
|
614
|
+
Check that subdivisions are preserved when converting between
|
615
|
+
dense and sparse matrices::
|
616
|
+
|
617
|
+
sage: a.subdivide([1,1], [2])
|
618
|
+
sage: b = a.dense_matrix().sparse_matrix().dense_matrix()
|
619
|
+
sage: b.subdivisions() == a.subdivisions()
|
620
|
+
True
|
621
|
+
"""
|
622
|
+
cdef Matrix_rational_dense B
|
623
|
+
cdef mpq_vector* v
|
624
|
+
|
625
|
+
B = self.matrix_space(sparse=False).zero_matrix().__copy__()
|
626
|
+
for i from 0 <= i < self._nrows:
|
627
|
+
v = &(self._matrix[i])
|
628
|
+
for j from 0 <= j < v.num_nonzero:
|
629
|
+
fmpq_set_mpq(fmpq_mat_entry(B._matrix, i, v.positions[j]), v.entries[j])
|
630
|
+
B.subdivide(self.subdivisions())
|
631
|
+
return B
|
632
|
+
|
633
|
+
## def _set_row_to_negative_of_row_of_A_using_subset_of_columns(self, Py_ssize_t i, Matrix A,
|
634
|
+
## Py_ssize_t r, cols):
|
635
|
+
## B = self.__copy__()
|
636
|
+
## B.x_set_row_to_negative_of_row_of_A_using_subset_of_columns(i, A, r, cols)
|
637
|
+
## cdef Py_ssize_t l
|
638
|
+
## l = 0
|
639
|
+
## for z in range(self.ncols()):
|
640
|
+
## self[i,z] = 0
|
641
|
+
## for k in cols:
|
642
|
+
## self.set_unsafe(i,l,-A.get_unsafe(r,k)) #self[i,l] = -A[r,k]
|
643
|
+
## l += 1
|
644
|
+
## if self != B:
|
645
|
+
## print("correct =\n", self.str())
|
646
|
+
## print("wrong = \n", B.str())
|
647
|
+
## print("diff = \n", (self-B).str())
|
648
|
+
|
649
|
+
def _set_row_to_negative_of_row_of_A_using_subset_of_columns(self, Py_ssize_t i, Matrix A,
|
650
|
+
Py_ssize_t r, cols,
|
651
|
+
cols_index=None):
|
652
|
+
"""
|
653
|
+
Set row i of ``self`` to -(row r of A), but where we only take the
|
654
|
+
given column positions in that row of A. Note that we *DO*
|
655
|
+
zero out the other entries of ``self``'s row i.
|
656
|
+
|
657
|
+
INPUT:
|
658
|
+
|
659
|
+
- ``i`` -- integer, index into the rows of self
|
660
|
+
- ``A`` -- a sparse matrix
|
661
|
+
- ``r`` -- integer, index into rows of A
|
662
|
+
- ``cols`` -- a *sorted* list of integers
|
663
|
+
- ``cols_index`` -- (optional) set it to this to vastly speed up
|
664
|
+
calls to this function::
|
665
|
+
|
666
|
+
dict([(cols[i], i) for i in range(len(cols))])
|
667
|
+
|
668
|
+
EXAMPLES::
|
669
|
+
|
670
|
+
sage: a = matrix(QQ,2,3,range(6), sparse=True); a
|
671
|
+
[0 1 2]
|
672
|
+
[3 4 5]
|
673
|
+
|
674
|
+
Note that the row is zeroed out before being set in the sparse case. ::
|
675
|
+
|
676
|
+
sage: a._set_row_to_negative_of_row_of_A_using_subset_of_columns(0,a,1,[1,2])
|
677
|
+
sage: a
|
678
|
+
[-4 -5 0]
|
679
|
+
[ 3 4 5]
|
680
|
+
"""
|
681
|
+
# this function exists just because it is useful for modular symbols presentations.
|
682
|
+
self.check_row_bounds_and_mutability(i,i)
|
683
|
+
if r < 0 or r >= A.nrows():
|
684
|
+
raise IndexError("invalid row")
|
685
|
+
|
686
|
+
if not A.is_sparse():
|
687
|
+
A = A.sparse_matrix()
|
688
|
+
|
689
|
+
if A.base_ring() != QQ:
|
690
|
+
A = A.change_ring(QQ)
|
691
|
+
|
692
|
+
cdef Matrix_rational_sparse _A
|
693
|
+
_A = A
|
694
|
+
|
695
|
+
cdef Py_ssize_t l, n
|
696
|
+
|
697
|
+
cdef mpq_vector *v
|
698
|
+
cdef mpq_vector *w
|
699
|
+
v = &self._matrix[i]
|
700
|
+
w = &_A._matrix[r]
|
701
|
+
|
702
|
+
if cols_index is None:
|
703
|
+
cols_index = dict([(cols[i], i) for i in range(len(cols))])
|
704
|
+
|
705
|
+
_cols = set(cols)
|
706
|
+
pos = [i for i from 0 <= i < w.num_nonzero if w.positions[i] in _cols]
|
707
|
+
n = len(pos)
|
708
|
+
|
709
|
+
mpq_vector_clear(v)
|
710
|
+
allocate_mpq_vector(v, n)
|
711
|
+
v.num_nonzero = n
|
712
|
+
v.degree = self._ncols
|
713
|
+
|
714
|
+
for l from 0 <= l < n:
|
715
|
+
v.positions[l] = cols_index[w.positions[pos[l]]]
|
716
|
+
mpq_mul(v.entries[l], w.entries[pos[l]], minus_one)
|
717
|
+
|
718
|
+
def _right_kernel_matrix(self, **kwds):
|
719
|
+
r"""
|
720
|
+
Return a pair that includes a matrix of basis vectors
|
721
|
+
for the right kernel of ``self``.
|
722
|
+
|
723
|
+
INPUT:
|
724
|
+
|
725
|
+
- ``kwds`` -- these are provided for consistency with other versions
|
726
|
+
of this method. Here they are ignored as there is no optional
|
727
|
+
behavior available.
|
728
|
+
|
729
|
+
OUTPUT:
|
730
|
+
|
731
|
+
Returns a pair. First item is the string 'computed-iml-rational'
|
732
|
+
that identifies the nature of the basis vectors.
|
733
|
+
|
734
|
+
Second item is a matrix whose rows are a basis for the right kernel,
|
735
|
+
over the rationals, as computed by the IML library. Notice that the
|
736
|
+
IML library returns a matrix that is in the 'pivot' format, once the
|
737
|
+
whole matrix is multiplied by -1. So the 'computed' format is very
|
738
|
+
close to the 'pivot' format.
|
739
|
+
|
740
|
+
EXAMPLES::
|
741
|
+
|
742
|
+
sage: A = matrix(QQ, [
|
743
|
+
....: [1, 0, 1, -3, 1],
|
744
|
+
....: [-5, 1, 0, 7, -3],
|
745
|
+
....: [0, -1, -4, 6, -2],
|
746
|
+
....: [4, -1, 0, -6, 2]],
|
747
|
+
....: sparse=True)
|
748
|
+
sage: result = A._right_kernel_matrix()
|
749
|
+
sage: result[0]
|
750
|
+
'computed-iml-rational'
|
751
|
+
sage: result[1]
|
752
|
+
[-1 2 -2 -1 0]
|
753
|
+
[ 1 2 0 0 -1]
|
754
|
+
sage: X = result[1].transpose()
|
755
|
+
sage: A*X == zero_matrix(QQ, 4, 2)
|
756
|
+
True
|
757
|
+
|
758
|
+
Computed result is the negative of the pivot basis, which
|
759
|
+
is just slightly more efficient to compute. ::
|
760
|
+
|
761
|
+
sage: A.right_kernel_matrix(basis='pivot') == -A.right_kernel_matrix(basis='computed')
|
762
|
+
True
|
763
|
+
|
764
|
+
TESTS:
|
765
|
+
|
766
|
+
We test three trivial cases. ::
|
767
|
+
|
768
|
+
sage: A = matrix(QQ, 0, 2, sparse=True)
|
769
|
+
sage: A._right_kernel_matrix()[1]
|
770
|
+
[1 0]
|
771
|
+
[0 1]
|
772
|
+
sage: A = matrix(QQ, 2, 0, sparse=True)
|
773
|
+
sage: A._right_kernel_matrix()[1].parent()
|
774
|
+
Full MatrixSpace of 0 by 0 dense matrices over Rational Field
|
775
|
+
sage: A = zero_matrix(QQ, 4, 3, sparse=True)
|
776
|
+
sage: A._right_kernel_matrix()[1]
|
777
|
+
[1 0 0]
|
778
|
+
[0 1 0]
|
779
|
+
[0 0 1]
|
780
|
+
"""
|
781
|
+
return self.dense_matrix()._right_kernel_matrix()
|
782
|
+
|
783
|
+
|
784
|
+
#########################
|
785
|
+
|
786
|
+
# used for a function above
|
787
|
+
cdef mpq_t minus_one
|
788
|
+
mpq_init(minus_one)
|
789
|
+
mpq_set_si(minus_one, -1,1)
|