passagemath-flint 10.6.1rc10__cp310-cp310-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-310-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-310-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-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/chrompoly.pyx +555 -0
- sage/graphs/matchpoly.cpython-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-aarch64-linux-gnu.so +0 -0
- sage/matrix/change_ring.pyx +43 -0
- sage/matrix/matrix_complex_ball_dense.cpython-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-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-310-aarch64-linux-gnu.so +0 -0
- sage/rings/factorint_flint.pyx +99 -0
- sage/rings/fraction_field_FpT.cpython-310-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-310-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-310-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-310-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-310-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-310-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/hilbert.pyx +602 -0
- sage/rings/polynomial/polynomial_complex_arb.cpython-310-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-310-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-310-aarch64-linux-gnu.so +0 -0
- sage/rings/polynomial/polynomial_number_field.pyx +345 -0
- sage/rings/polynomial/polynomial_rational_flint.cpython-310-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-310-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-310-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-310-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-310-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-310-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-310-aarch64-linux-gnu.so +0 -0
- sage/rings/real_interval_absolute.pyx +1073 -0
- sage/rings/real_mpfi.cpython-310-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-310-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,1424 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-flint
|
2
|
+
# sage.doctest: needs sage.graphs
|
3
|
+
"""
|
4
|
+
Path algebra elements
|
5
|
+
|
6
|
+
AUTHORS:
|
7
|
+
|
8
|
+
- Simon King (2015-08)
|
9
|
+
"""
|
10
|
+
|
11
|
+
# ****************************************************************************
|
12
|
+
# Copyright (C) 2015 Simon King <simon.king@uni-jena.de>
|
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
|
+
# https://www.gnu.org/licenses/
|
18
|
+
# ****************************************************************************
|
19
|
+
include "algebra_elements.pxi"
|
20
|
+
|
21
|
+
from sage.misc.repr import repr_lincomb
|
22
|
+
from sage.structure.richcmp cimport richcmp_not_equal, rich_to_bool
|
23
|
+
|
24
|
+
|
25
|
+
cdef class PathAlgebraElement(RingElement):
|
26
|
+
"""
|
27
|
+
Elements of a :class:`~sage.quivers.algebra.PathAlgebra`.
|
28
|
+
|
29
|
+
.. NOTE::
|
30
|
+
|
31
|
+
Upon creation of a path algebra, one can choose among several
|
32
|
+
monomial orders, which are all positive or negative degree
|
33
|
+
orders. Monomial orders that are not degree orders are not
|
34
|
+
supported.
|
35
|
+
|
36
|
+
EXAMPLES:
|
37
|
+
|
38
|
+
After creating a path algebra and getting hold of its generators, one can
|
39
|
+
create elements just as usual::
|
40
|
+
|
41
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
42
|
+
sage: A.inject_variables()
|
43
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
44
|
+
sage: x = a+2*b+3*c+5*e_0+3*e_2
|
45
|
+
sage: x
|
46
|
+
5*e_0 + a + 2*b + 3*c + 3*e_2
|
47
|
+
|
48
|
+
The path algebra decomposes as a direct sum according to start- and endpoints::
|
49
|
+
|
50
|
+
sage: x.sort_by_vertices()
|
51
|
+
[(5*e_0, 0, 0),
|
52
|
+
(a, 0, 1),
|
53
|
+
(2*b, 0, 2),
|
54
|
+
(3*c, 1, 0),
|
55
|
+
(3*e_2, 2, 2)]
|
56
|
+
sage: (x^3+x^2).sort_by_vertices()
|
57
|
+
[(150*e_0 + 33*a*c, 0, 0),
|
58
|
+
(30*a + 3*a*c*a, 0, 1),
|
59
|
+
(114*b + 6*a*c*b, 0, 2),
|
60
|
+
(90*c + 9*c*a*c, 1, 0),
|
61
|
+
(18*c*a, 1, 1),
|
62
|
+
(54*c*b, 1, 2),
|
63
|
+
(36*e_2, 2, 2)]
|
64
|
+
|
65
|
+
For a consistency test, we create a path algebra that is isomorphic to a
|
66
|
+
free associative algebra, and compare arithmetic with two other
|
67
|
+
implementations of free algebras (note that the letterplace implementation
|
68
|
+
only allows weighted homogeneous elements)::
|
69
|
+
|
70
|
+
sage: # needs sage.combinat
|
71
|
+
sage: F.<x,y,z> = FreeAlgebra(GF(25,'t'))
|
72
|
+
sage: pF = x+y*z*x+2*y-z+1
|
73
|
+
sage: pF2 = x^4+x*y*x*z+2*z^2*x*y
|
74
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'))
|
75
|
+
sage: pP = sage_eval('x+y*z*x+2*y-z+1', P.gens_dict())
|
76
|
+
sage: pP^5+3*pP^3 == sage_eval(repr(pF^5+3*pF^3), P.gens_dict())
|
77
|
+
True
|
78
|
+
sage: L.<x,y,z> = FreeAlgebra(GF(25,'t'), implementation='letterplace')
|
79
|
+
sage: pL2 = x^4+x*y*x*z+2*z^2*x*y
|
80
|
+
sage: pP2 = sage_eval('x^4+x*y*x*z+2*z^2*x*y', P.gens_dict())
|
81
|
+
sage: pP2^7 == sage_eval(repr(pF2^7), P.gens_dict())
|
82
|
+
True
|
83
|
+
sage: pP2^7 == sage_eval(repr(pL2^7), P.gens_dict())
|
84
|
+
True
|
85
|
+
|
86
|
+
When the Cython implementation of path algebra elements was
|
87
|
+
introduced, it was faster than both the default implementation and
|
88
|
+
the letterplace implementation of free algebras. The following
|
89
|
+
timings where obtained with a 32-bit operating system; using 64-bit
|
90
|
+
on the same machine, the letterplace implementation has not become
|
91
|
+
faster, but the timing for path algebra elements has improved by
|
92
|
+
about 20%::
|
93
|
+
|
94
|
+
sage: # not tested
|
95
|
+
sage: timeit('pF^5+3*pF^3')
|
96
|
+
1 loops, best of 3: 338 ms per loop
|
97
|
+
sage: timeit('pP^5+3*pP^3')
|
98
|
+
100 loops, best of 3: 2.55 ms per loop
|
99
|
+
sage: timeit('pF2^7')
|
100
|
+
10000 loops, best of 3: 513 ms per loop
|
101
|
+
sage: timeit('pL2^7')
|
102
|
+
125 loops, best of 3: 1.99 ms per loop
|
103
|
+
sage: timeit('pP2^7')
|
104
|
+
10000 loops, best of 3: 1.54 ms per loop
|
105
|
+
|
106
|
+
So, if one is merely interested in basic arithmetic operations for
|
107
|
+
free associative algebras, it could make sense to model the free
|
108
|
+
associative algebra as a path algebra. However, standard basis
|
109
|
+
computations are not available for path algebras, yet. Hence, to
|
110
|
+
implement computations in graded quotients of free algebras, the
|
111
|
+
letterplace implementation currently is the only option.
|
112
|
+
"""
|
113
|
+
def __cinit__(self):
|
114
|
+
"""
|
115
|
+
EXAMPLES::
|
116
|
+
|
117
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
118
|
+
sage: A.inject_variables()
|
119
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
120
|
+
sage: x = a+2*b+3*c+5*e_0+3*e_2 # indirect doctest
|
121
|
+
sage: x
|
122
|
+
5*e_0 + a + 2*b + 3*c + 3*e_2
|
123
|
+
"""
|
124
|
+
self.data = NULL
|
125
|
+
|
126
|
+
def __dealloc__(self):
|
127
|
+
"""
|
128
|
+
EXAMPLES::
|
129
|
+
|
130
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
131
|
+
sage: A.inject_variables()
|
132
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
133
|
+
sage: x = a+2*b+3*c+5*e_0+3*e_2
|
134
|
+
sage: del x # indirect doctest
|
135
|
+
"""
|
136
|
+
homog_poly_free(self.data)
|
137
|
+
|
138
|
+
def __init__(self, S, data):
|
139
|
+
"""
|
140
|
+
Do not call directly.
|
141
|
+
|
142
|
+
INPUT:
|
143
|
+
|
144
|
+
- ``S`` -- path algebra
|
145
|
+
|
146
|
+
- ``data`` -- dictionary; most of its keys are
|
147
|
+
:class:`~sage.quivers.paths.QuiverPath`, the value giving its
|
148
|
+
coefficient
|
149
|
+
|
150
|
+
.. NOTE::
|
151
|
+
|
152
|
+
Monomial orders that are not degree orders are not supported.
|
153
|
+
|
154
|
+
EXAMPLES::
|
155
|
+
|
156
|
+
sage: P1 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'))
|
157
|
+
sage: P1.inject_variables() # indirect doctest
|
158
|
+
Defining e_1, x, y, z
|
159
|
+
sage: (x+2*z+1)^2
|
160
|
+
e_1 + 4*z + 2*x + 4*z*z + 2*x*z + 2*z*x + x*x
|
161
|
+
sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
162
|
+
sage: P2.inject_variables()
|
163
|
+
Defining e_1, x, y, z
|
164
|
+
sage: (x+2*z+1)^2
|
165
|
+
4*z*z + 2*x*z + 2*z*x + x*x + 4*z + 2*x + e_1
|
166
|
+
sage: P3 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='negdeglex')
|
167
|
+
sage: P3.inject_variables()
|
168
|
+
Defining e_1, x, y, z
|
169
|
+
sage: (x+2*z+1)^2
|
170
|
+
e_1 + 4*z + 2*x + 4*z*z + 2*z*x + 2*x*z + x*x
|
171
|
+
sage: P4 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='deglex')
|
172
|
+
sage: P4.inject_variables()
|
173
|
+
Defining e_1, x, y, z
|
174
|
+
sage: (x+2*z+1)^2
|
175
|
+
4*z*z + 2*z*x + 2*x*z + x*x + 4*z + 2*x + e_1
|
176
|
+
"""
|
177
|
+
self._hash = -1
|
178
|
+
order = S.order_string()
|
179
|
+
if order == "negdegrevlex":
|
180
|
+
self.cmp_terms = negdegrevlex
|
181
|
+
elif order == "degrevlex":
|
182
|
+
self.cmp_terms = degrevlex
|
183
|
+
elif order == "negdeglex":
|
184
|
+
self.cmp_terms = negdeglex
|
185
|
+
elif order == "deglex":
|
186
|
+
self.cmp_terms = deglex
|
187
|
+
else:
|
188
|
+
raise ValueError("unknown term order '{}'".format(order))
|
189
|
+
cdef QuiverPath tmp = None
|
190
|
+
RingElement.__init__(self, S)
|
191
|
+
cdef dict homog = {}
|
192
|
+
cdef list L
|
193
|
+
for tmp, c in data.iteritems():
|
194
|
+
sig_check()
|
195
|
+
homog.setdefault((tmp.initial_vertex(),
|
196
|
+
tmp.terminal_vertex()), []).append((tmp, c))
|
197
|
+
cdef path_homog_poly_t *HP
|
198
|
+
for (s, e), L in sorted(homog.iteritems(), reverse=True):
|
199
|
+
sig_check()
|
200
|
+
HP = homog_poly_init_list(s, e, L, self.cmp_terms, -1)
|
201
|
+
HP.nxt = self.data
|
202
|
+
self.data = HP
|
203
|
+
|
204
|
+
def __reduce__(self):
|
205
|
+
"""
|
206
|
+
EXAMPLES::
|
207
|
+
|
208
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'))
|
209
|
+
sage: p = sage_eval('(x+2*z+1)^3', P.gens_dict())
|
210
|
+
sage: loads(dumps(p)) == p # indirect doctest
|
211
|
+
True
|
212
|
+
"""
|
213
|
+
return path_algebra_element_unpickle, (self._parent, homog_poly_pickle(self.data))
|
214
|
+
|
215
|
+
cdef list _sorted_items_for_printing(self):
|
216
|
+
"""
|
217
|
+
Return list of pairs ``(M,c)``, where ``c`` is a coefficient and ``M``
|
218
|
+
will be passed to ``self.parent()._repr_monomial`` resp. to
|
219
|
+
``self.parent()._latex_monomial``, providing the indices of the
|
220
|
+
algebra generators occurring in the monomial.
|
221
|
+
|
222
|
+
EXAMPLES::
|
223
|
+
|
224
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
225
|
+
sage: X = sage_eval('a+2*b+3*c+5*e_0+3*e_2', A.gens_dict())
|
226
|
+
sage: X # indirect doctest
|
227
|
+
5*e_0 + a + 2*b + 3*c + 3*e_2
|
228
|
+
sage: latex(X) # indirect doctest
|
229
|
+
5 e_0 + a + 2 b + 3 c + 3 e_2
|
230
|
+
"""
|
231
|
+
cdef path_homog_poly_t *H = self.data
|
232
|
+
cdef list L, L_total
|
233
|
+
cdef size_t i
|
234
|
+
cdef path_term_t * T
|
235
|
+
L_total = []
|
236
|
+
cdef list vertices = self._parent.quiver().vertices(sort=True)
|
237
|
+
cdef mp_size_t offset = len(vertices)
|
238
|
+
while H != NULL:
|
239
|
+
L = [] # data for a single component (given by start- and endpoints)
|
240
|
+
T = H.poly.lead
|
241
|
+
while T != NULL:
|
242
|
+
sig_check()
|
243
|
+
if T.mon.path.length:
|
244
|
+
L.append(([offset + biseq_getitem(T.mon.path, i) for i in range(<size_t>T.mon.path.length)],
|
245
|
+
<object>(T.coef)))
|
246
|
+
else:
|
247
|
+
L.append(([vertices.index(H.start)], <object>(T.coef)))
|
248
|
+
T = T.nxt
|
249
|
+
if <size_t>len(L) != H.poly.nterms:
|
250
|
+
print("Term count of polynomial is wrong, got", len(L),
|
251
|
+
"expected", H.poly.nterms)
|
252
|
+
L_total.extend(L)
|
253
|
+
H = H.nxt
|
254
|
+
return L_total
|
255
|
+
|
256
|
+
def _repr_(self):
|
257
|
+
"""
|
258
|
+
String representation.
|
259
|
+
|
260
|
+
.. NOTE::
|
261
|
+
|
262
|
+
The terms are first sorted by initial and terminal
|
263
|
+
vertices, and only then by the given monomial order.
|
264
|
+
|
265
|
+
EXAMPLES::
|
266
|
+
|
267
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
268
|
+
sage: X = sage_eval('a+2*b+3*c+5*e_0+3*e_2', A.gens_dict())
|
269
|
+
sage: X # indirect doctest
|
270
|
+
5*e_0 + a + 2*b + 3*c + 3*e_2
|
271
|
+
"""
|
272
|
+
parent = self._parent
|
273
|
+
return repr_lincomb(self._sorted_items_for_printing(), strip_one=True,
|
274
|
+
scalar_mult=parent._print_options['scalar_mult'],
|
275
|
+
repr_monomial=parent._repr_monomial)
|
276
|
+
|
277
|
+
def _latex_(self):
|
278
|
+
r"""
|
279
|
+
Latex string representation.
|
280
|
+
|
281
|
+
EXAMPLES::
|
282
|
+
|
283
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
284
|
+
sage: X = sage_eval('a+2*b+3*c+5*e_0+3*e_2', A.gens_dict())
|
285
|
+
sage: latex(X) # indirect doctest
|
286
|
+
5 e_0 + a + 2 b + 3 c + 3 e_2
|
287
|
+
sage: latex(X*X)
|
288
|
+
10 e_0 + 3 a\cdot c + 5 a + b + 3 c\cdot a + 6 c\cdot b + 9 e_2
|
289
|
+
"""
|
290
|
+
parent = self._parent
|
291
|
+
return repr_lincomb(self._sorted_items_for_printing(),
|
292
|
+
scalar_mult=parent._print_options['scalar_mult'],
|
293
|
+
latex_scalar_mult=parent._print_options['latex_scalar_mult'],
|
294
|
+
repr_monomial=parent._latex_monomial,
|
295
|
+
is_latex=True, strip_one=True)
|
296
|
+
|
297
|
+
# Basic properties
|
298
|
+
|
299
|
+
def __bool__(self):
|
300
|
+
"""
|
301
|
+
EXAMPLES::
|
302
|
+
|
303
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
304
|
+
sage: A.inject_variables()
|
305
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
306
|
+
sage: bool(a+b+c+d) # indirect doctest
|
307
|
+
True
|
308
|
+
sage: bool(((a+b+c+d)-(a+b))-(c+d))
|
309
|
+
False
|
310
|
+
"""
|
311
|
+
return self.data != NULL
|
312
|
+
|
313
|
+
def __len__(self):
|
314
|
+
"""
|
315
|
+
Return the number of terms appearing in this element.
|
316
|
+
|
317
|
+
EXAMPLES::
|
318
|
+
|
319
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
320
|
+
sage: A.inject_variables()
|
321
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
322
|
+
sage: X = a+2*b+3*c+5*e_0+3*e_2
|
323
|
+
sage: len(X)
|
324
|
+
5
|
325
|
+
sage: len(X^5)
|
326
|
+
17
|
327
|
+
"""
|
328
|
+
cdef size_t ell = 0
|
329
|
+
cdef path_homog_poly_t *H = self.data
|
330
|
+
while H != NULL:
|
331
|
+
sig_check()
|
332
|
+
ell += H.poly.nterms
|
333
|
+
H = H.nxt
|
334
|
+
return ell
|
335
|
+
|
336
|
+
cpdef ssize_t degree(self) except -2:
|
337
|
+
"""
|
338
|
+
Return the degree, provided the element is homogeneous.
|
339
|
+
|
340
|
+
An error is raised if the element is not homogeneous.
|
341
|
+
|
342
|
+
EXAMPLES::
|
343
|
+
|
344
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'))
|
345
|
+
sage: P.inject_variables()
|
346
|
+
Defining e_1, x, y, z
|
347
|
+
sage: q = (x+y+2*z)^3
|
348
|
+
sage: q.degree()
|
349
|
+
3
|
350
|
+
sage: p = (x+2*z+1)^3
|
351
|
+
sage: p.degree()
|
352
|
+
Traceback (most recent call last):
|
353
|
+
...
|
354
|
+
ValueError: element is not homogeneous
|
355
|
+
"""
|
356
|
+
cdef path_homog_poly_t *H = self.data
|
357
|
+
cdef path_term_t *T
|
358
|
+
cdef mp_size_t deg = 0
|
359
|
+
cdef bint zero = True
|
360
|
+
while H != NULL:
|
361
|
+
sig_check()
|
362
|
+
T = H.poly.lead
|
363
|
+
while T != NULL:
|
364
|
+
if zero:
|
365
|
+
deg = term_total_degree(T)
|
366
|
+
elif deg != term_total_degree(T):
|
367
|
+
raise ValueError("element is not homogeneous")
|
368
|
+
zero = False
|
369
|
+
T = T.nxt
|
370
|
+
H = H.nxt
|
371
|
+
if zero:
|
372
|
+
return -1
|
373
|
+
return deg
|
374
|
+
|
375
|
+
def is_homogeneous(self) -> bool:
|
376
|
+
"""
|
377
|
+
Tell whether this element is homogeneous.
|
378
|
+
|
379
|
+
EXAMPLES::
|
380
|
+
|
381
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'))
|
382
|
+
sage: P.inject_variables()
|
383
|
+
Defining e_1, x, y, z
|
384
|
+
sage: q = (x+y+2*z)^3
|
385
|
+
sage: q.is_homogeneous()
|
386
|
+
True
|
387
|
+
sage: p = (x+2*z+1)^3
|
388
|
+
sage: p.is_homogeneous()
|
389
|
+
False
|
390
|
+
"""
|
391
|
+
cdef path_homog_poly_t *H = self.data
|
392
|
+
cdef path_term_t *T
|
393
|
+
cdef mp_size_t deg = 0
|
394
|
+
cdef bint zero = True
|
395
|
+
while H != NULL:
|
396
|
+
T = H.poly.lead
|
397
|
+
while T != NULL:
|
398
|
+
sig_check()
|
399
|
+
if zero:
|
400
|
+
deg = term_total_degree(T)
|
401
|
+
elif deg != term_total_degree(T):
|
402
|
+
return False
|
403
|
+
zero = False
|
404
|
+
T = T.nxt
|
405
|
+
H = H.nxt
|
406
|
+
return True
|
407
|
+
|
408
|
+
cpdef dict monomial_coefficients(self):
|
409
|
+
"""
|
410
|
+
Return the dictionary keyed by the monomials appearing
|
411
|
+
in this element, the values being the coefficients.
|
412
|
+
|
413
|
+
EXAMPLES::
|
414
|
+
|
415
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
416
|
+
sage: P.inject_variables()
|
417
|
+
Defining e_1, x, y, z
|
418
|
+
sage: p = (x+2*z+1)^3
|
419
|
+
sage: sorted(p.monomial_coefficients().items())
|
420
|
+
[(x*x*x, 1),
|
421
|
+
(z*x*x, 2),
|
422
|
+
(x*z*x, 2),
|
423
|
+
(z*z*x, 4),
|
424
|
+
(x*x*z, 2),
|
425
|
+
(z*x*z, 4),
|
426
|
+
(x*z*z, 4),
|
427
|
+
(z*z*z, 3),
|
428
|
+
(x*x, 3),
|
429
|
+
(z*x, 1),
|
430
|
+
(x*z, 1),
|
431
|
+
(z*z, 2),
|
432
|
+
(x, 3),
|
433
|
+
(z, 1),
|
434
|
+
(e_1, 1)]
|
435
|
+
|
436
|
+
Note that the dictionary can be fed to the algebra, to reconstruct the
|
437
|
+
element::
|
438
|
+
|
439
|
+
sage: P(p.monomial_coefficients()) == p
|
440
|
+
True
|
441
|
+
"""
|
442
|
+
cdef path_homog_poly_t *H = self.data
|
443
|
+
cdef path_term_t *T
|
444
|
+
cdef QuiverPath sample = self._parent.semigroup().gen(0)
|
445
|
+
cdef QuiverPath tmp
|
446
|
+
cdef dict D = {}
|
447
|
+
while H != NULL:
|
448
|
+
T = H.poly.lead
|
449
|
+
while T != NULL:
|
450
|
+
tmp = sample._new_(H.start, H.end)
|
451
|
+
biseq_init_copy(tmp._path, T.mon.path)
|
452
|
+
D[tmp] = <object>T.coef
|
453
|
+
T = T.nxt
|
454
|
+
H = H.nxt
|
455
|
+
return D
|
456
|
+
|
457
|
+
cpdef list coefficients(self):
|
458
|
+
"""
|
459
|
+
Return the list of coefficients.
|
460
|
+
|
461
|
+
.. NOTE::
|
462
|
+
|
463
|
+
The order in which the coefficients are returned corresponds to the
|
464
|
+
order in which the terms are printed. That is *not* the same as the
|
465
|
+
order given by the monomial order, since the terms are first ordered
|
466
|
+
according to initial and terminal vertices, before applying the
|
467
|
+
monomial order of the path algebra.
|
468
|
+
|
469
|
+
EXAMPLES::
|
470
|
+
|
471
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
472
|
+
sage: P.inject_variables()
|
473
|
+
Defining e_1, x, y, z
|
474
|
+
sage: p = (x+2*z+1)^3
|
475
|
+
sage: p
|
476
|
+
3*z*z*z + 4*x*z*z + 4*z*x*z + 2*x*x*z + 4*z*z*x + 2*x*z*x + 2*z*x*x + x*x*x + 2*z*z + x*z + z*x + 3*x*x + z + 3*x + e_1
|
477
|
+
sage: p.coefficients()
|
478
|
+
[3, 4, 4, 2, 4, 2, 2, 1, 2, 1, 1, 3, 1, 3, 1]
|
479
|
+
"""
|
480
|
+
cdef path_homog_poly_t *H = self.data
|
481
|
+
cdef path_term_t *T
|
482
|
+
cdef list L = []
|
483
|
+
while H != NULL:
|
484
|
+
T = H.poly.lead
|
485
|
+
while T != NULL:
|
486
|
+
L.append(<object>T.coef)
|
487
|
+
T = T.nxt
|
488
|
+
H = H.nxt
|
489
|
+
return L
|
490
|
+
|
491
|
+
cpdef list monomials(self):
|
492
|
+
"""
|
493
|
+
Return the list of monomials appearing in this element.
|
494
|
+
|
495
|
+
.. NOTE::
|
496
|
+
|
497
|
+
The order in which the monomials are returned corresponds to the
|
498
|
+
order in which the element's terms are printed. That is *not* the
|
499
|
+
same as the order given by the monomial order, since the terms are
|
500
|
+
first ordered according to initial and terminal vertices, before
|
501
|
+
applying the monomial order of the path algebra.
|
502
|
+
|
503
|
+
The monomials are not elements of the underlying partial
|
504
|
+
semigroup, but of the algebra.
|
505
|
+
|
506
|
+
.. SEEALSO:: :meth:`support`
|
507
|
+
|
508
|
+
EXAMPLES::
|
509
|
+
|
510
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
511
|
+
sage: P.inject_variables()
|
512
|
+
Defining e_1, x, y, z
|
513
|
+
sage: p = (x+2*z+1)^3
|
514
|
+
sage: p
|
515
|
+
3*z*z*z + 4*x*z*z + 4*z*x*z + 2*x*x*z + 4*z*z*x + 2*x*z*x + 2*z*x*x + x*x*x + 2*z*z + x*z + z*x + 3*x*x + z + 3*x + e_1
|
516
|
+
sage: p.monomials()
|
517
|
+
[z*z*z,
|
518
|
+
x*z*z,
|
519
|
+
z*x*z,
|
520
|
+
x*x*z,
|
521
|
+
z*z*x,
|
522
|
+
x*z*x,
|
523
|
+
z*x*x,
|
524
|
+
x*x*x,
|
525
|
+
z*z,
|
526
|
+
x*z,
|
527
|
+
z*x,
|
528
|
+
x*x,
|
529
|
+
z,
|
530
|
+
x,
|
531
|
+
e_1]
|
532
|
+
sage: p.monomials()[1].parent() is P
|
533
|
+
True
|
534
|
+
"""
|
535
|
+
cdef path_homog_poly_t *H = self.data
|
536
|
+
cdef path_homog_poly_t *out
|
537
|
+
cdef path_term_t *T
|
538
|
+
cdef object one = self.base_ring().one()
|
539
|
+
cdef list L = []
|
540
|
+
while H != NULL:
|
541
|
+
T = H.poly.lead
|
542
|
+
while T != NULL:
|
543
|
+
out = homog_poly_create(H.start, H.end)
|
544
|
+
out.poly.lead = term_create_blank(one)
|
545
|
+
mon_copy(out.poly.lead.mon, T.mon)
|
546
|
+
out.poly.lead.nxt = NULL
|
547
|
+
out.poly.nterms = 1
|
548
|
+
L.append(self._new_(out))
|
549
|
+
T = T.nxt
|
550
|
+
H = H.nxt
|
551
|
+
return L
|
552
|
+
|
553
|
+
cpdef list terms(self):
|
554
|
+
"""
|
555
|
+
Return the list of terms.
|
556
|
+
|
557
|
+
.. NOTE::
|
558
|
+
|
559
|
+
The order in which the terms are returned corresponds to the order
|
560
|
+
in which they are printed. That is *not* the same as the
|
561
|
+
order given by the monomial order, since the terms are first
|
562
|
+
ordered according to initial and terminal vertices, before
|
563
|
+
applying the monomial order of the path algebra.
|
564
|
+
|
565
|
+
EXAMPLES::
|
566
|
+
|
567
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
568
|
+
sage: P.inject_variables()
|
569
|
+
Defining e_1, x, y, z
|
570
|
+
sage: p = (x+2*z+1)^3
|
571
|
+
sage: p
|
572
|
+
3*z*z*z + 4*x*z*z + 4*z*x*z + 2*x*x*z + 4*z*z*x + 2*x*z*x + 2*z*x*x + x*x*x + 2*z*z + x*z + z*x + 3*x*x + z + 3*x + e_1
|
573
|
+
sage: p.terms()
|
574
|
+
[3*z*z*z,
|
575
|
+
4*x*z*z,
|
576
|
+
4*z*x*z,
|
577
|
+
2*x*x*z,
|
578
|
+
4*z*z*x,
|
579
|
+
2*x*z*x,
|
580
|
+
2*z*x*x,
|
581
|
+
x*x*x,
|
582
|
+
2*z*z,
|
583
|
+
x*z,
|
584
|
+
z*x,
|
585
|
+
3*x*x,
|
586
|
+
z,
|
587
|
+
3*x,
|
588
|
+
e_1]
|
589
|
+
"""
|
590
|
+
cdef path_homog_poly_t *H = self.data
|
591
|
+
cdef path_homog_poly_t *out
|
592
|
+
cdef path_term_t *T
|
593
|
+
cdef list L = []
|
594
|
+
while H != NULL:
|
595
|
+
T = H.poly.lead
|
596
|
+
while T != NULL:
|
597
|
+
out = homog_poly_create(H.start, H.end)
|
598
|
+
out.poly.lead = term_copy(T)
|
599
|
+
out.poly.lead.nxt = NULL
|
600
|
+
out.poly.nterms = 1
|
601
|
+
L.append(self._new_(out))
|
602
|
+
T = T.nxt
|
603
|
+
H = H.nxt
|
604
|
+
return L
|
605
|
+
|
606
|
+
cpdef list support(self):
|
607
|
+
"""
|
608
|
+
Return the list of monomials, as elements of the underlying partial semigroup.
|
609
|
+
|
610
|
+
.. NOTE::
|
611
|
+
|
612
|
+
The order in which the monomials are returned corresponds to the
|
613
|
+
order in which the element's terms are printed. That is *not* the
|
614
|
+
same as the order given by the monomial order, since the terms are
|
615
|
+
first ordered according to initial and terminal vertices, before
|
616
|
+
applying the monomial order of the path algebra.
|
617
|
+
|
618
|
+
.. SEEALSO:: :meth:`monomials`
|
619
|
+
|
620
|
+
EXAMPLES::
|
621
|
+
|
622
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
623
|
+
sage: P.inject_variables()
|
624
|
+
Defining e_1, x, y, z
|
625
|
+
sage: p = (x+2*z+1)^3
|
626
|
+
sage: p
|
627
|
+
3*z*z*z + 4*x*z*z + 4*z*x*z + 2*x*x*z + 4*z*z*x + 2*x*z*x + 2*z*x*x + x*x*x + 2*z*z + x*z + z*x + 3*x*x + z + 3*x + e_1
|
628
|
+
sage: p.support()
|
629
|
+
[z*z*z,
|
630
|
+
x*z*z,
|
631
|
+
z*x*z,
|
632
|
+
x*x*z,
|
633
|
+
z*z*x,
|
634
|
+
x*z*x,
|
635
|
+
z*x*x,
|
636
|
+
x*x*x,
|
637
|
+
z*z,
|
638
|
+
x*z,
|
639
|
+
z*x,
|
640
|
+
x*x,
|
641
|
+
z,
|
642
|
+
x,
|
643
|
+
e_1]
|
644
|
+
sage: p.support()[1].parent() is P.semigroup()
|
645
|
+
True
|
646
|
+
"""
|
647
|
+
cdef path_homog_poly_t *H = self.data
|
648
|
+
cdef path_term_t *T
|
649
|
+
cdef QuiverPath sample = self._parent.semigroup().gen(0)
|
650
|
+
cdef QuiverPath tmp
|
651
|
+
cdef list L = []
|
652
|
+
while H != NULL:
|
653
|
+
T = H.poly.lead
|
654
|
+
while T != NULL:
|
655
|
+
tmp = sample._new_(H.start, H.end)
|
656
|
+
biseq_init_copy(tmp._path, T.mon.path)
|
657
|
+
L.append(tmp)
|
658
|
+
T = T.nxt
|
659
|
+
H = H.nxt
|
660
|
+
return L
|
661
|
+
|
662
|
+
def support_of_term(self):
|
663
|
+
"""
|
664
|
+
If ``self`` consists of a single term, return the corresponding
|
665
|
+
element of the underlying path semigroup.
|
666
|
+
|
667
|
+
EXAMPLES::
|
668
|
+
|
669
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
670
|
+
sage: A.inject_variables()
|
671
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
672
|
+
sage: x = 4*a*d*c*b*e
|
673
|
+
sage: x.support_of_term()
|
674
|
+
a*d*c*b*e
|
675
|
+
sage: x.support_of_term().parent() is A.semigroup()
|
676
|
+
True
|
677
|
+
sage: (x + f).support_of_term()
|
678
|
+
Traceback (most recent call last):
|
679
|
+
...
|
680
|
+
ValueError: 4*a*d*c*b*e + f is not a single term
|
681
|
+
"""
|
682
|
+
cdef QuiverPath sample = self._parent.semigroup().gen(0)
|
683
|
+
cdef QuiverPath tmp
|
684
|
+
if self.data != NULL and self.data.nxt == NULL:
|
685
|
+
if self.data.poly.lead != NULL:
|
686
|
+
tmp = sample._new_(self.data.start, self.data.end)
|
687
|
+
biseq_init_copy(tmp._path, self.data.poly.lead.mon.path)
|
688
|
+
return tmp
|
689
|
+
raise ValueError("{} is not a single term".format(self))
|
690
|
+
|
691
|
+
cpdef object coefficient(self, QuiverPath P):
|
692
|
+
"""
|
693
|
+
Return the coefficient of a monomial.
|
694
|
+
|
695
|
+
INPUT:
|
696
|
+
|
697
|
+
- ``P`` -- an element of the underlying partial semigroup
|
698
|
+
|
699
|
+
OUTPUT:
|
700
|
+
|
701
|
+
The coefficient of the given semigroup element in ``self``, or zero if
|
702
|
+
it does not appear.
|
703
|
+
|
704
|
+
EXAMPLES::
|
705
|
+
|
706
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
707
|
+
sage: P.inject_variables()
|
708
|
+
Defining e_1, x, y, z
|
709
|
+
sage: p = (x+2*z+1)^3
|
710
|
+
sage: p
|
711
|
+
3*z*z*z + 4*x*z*z + 4*z*x*z + 2*x*x*z + 4*z*z*x + 2*x*z*x + 2*z*x*x + x*x*x + 2*z*z + x*z + z*x + 3*x*x + z + 3*x + e_1
|
712
|
+
sage: p.coefficient(sage_eval('x*x*z', P.semigroup().gens_dict()))
|
713
|
+
2
|
714
|
+
sage: p.coefficient(sage_eval('z*x*x*x', P.semigroup().gens_dict()))
|
715
|
+
0
|
716
|
+
"""
|
717
|
+
if self.data == NULL:
|
718
|
+
return self.base_ring().zero()
|
719
|
+
H = homog_poly_get_predecessor_of_component(self.data, P._start, P._end)
|
720
|
+
if H == NULL:
|
721
|
+
if self.data.start != P._start or self.data.end != P._end:
|
722
|
+
return self.base_ring().zero()
|
723
|
+
H = self.data
|
724
|
+
else:
|
725
|
+
H = H.nxt
|
726
|
+
if H == NULL:
|
727
|
+
return self.base_ring().zero()
|
728
|
+
# Now, H points to the component that belongs to K
|
729
|
+
cdef path_mon_t pM
|
730
|
+
mon_create_keep(pM, P._path, -1, 0, 0)
|
731
|
+
T = H.poly.lead
|
732
|
+
while T != NULL:
|
733
|
+
if self.cmp_terms(T.mon, pM) == 0:
|
734
|
+
return <object>T.coef
|
735
|
+
T = T.nxt
|
736
|
+
return self.base_ring().zero()
|
737
|
+
|
738
|
+
def __iter__(self):
|
739
|
+
"""
|
740
|
+
Iterate over the pairs (monomial, coefficient) appearing in ``self``.
|
741
|
+
|
742
|
+
EXAMPLES::
|
743
|
+
|
744
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
745
|
+
sage: P.inject_variables()
|
746
|
+
Defining e_1, x, y, z
|
747
|
+
sage: p = (x+2*z+1)^3
|
748
|
+
sage: p
|
749
|
+
3*z*z*z + 4*x*z*z + 4*z*x*z + 2*x*x*z + 4*z*z*x + 2*x*z*x + 2*z*x*x + x*x*x + 2*z*z + x*z + z*x + 3*x*x + z + 3*x + e_1
|
750
|
+
sage: list(p) # indirect doctest
|
751
|
+
[(z*z*z, 3),
|
752
|
+
(x*z*z, 4),
|
753
|
+
(z*x*z, 4),
|
754
|
+
(x*x*z, 2),
|
755
|
+
(z*z*x, 4),
|
756
|
+
(x*z*x, 2),
|
757
|
+
(z*x*x, 2),
|
758
|
+
(x*x*x, 1),
|
759
|
+
(z*z, 2),
|
760
|
+
(x*z, 1),
|
761
|
+
(z*x, 1),
|
762
|
+
(x*x, 3),
|
763
|
+
(z, 1),
|
764
|
+
(x, 3),
|
765
|
+
(e_1, 1)]
|
766
|
+
"""
|
767
|
+
cdef path_homog_poly_t *H = self.data
|
768
|
+
cdef path_term_t *T
|
769
|
+
cdef QuiverPath sample = self._parent.semigroup().gen(0)
|
770
|
+
cdef QuiverPath tmp
|
771
|
+
while H != NULL:
|
772
|
+
T = H.poly.lead
|
773
|
+
while T != NULL:
|
774
|
+
sig_check()
|
775
|
+
tmp = sample._new_(H.start, H.end)
|
776
|
+
biseq_init_copy(tmp._path, T.mon.path)
|
777
|
+
yield (tmp, <object>T.coef)
|
778
|
+
T = T.nxt
|
779
|
+
H = H.nxt
|
780
|
+
|
781
|
+
cdef PathAlgebraElement _new_(self, path_homog_poly_t *h):
|
782
|
+
"""
|
783
|
+
Create a new path algebra element from C interface data.
|
784
|
+
"""
|
785
|
+
cdef PathAlgebraElement out = type(self).__new__(type(self))
|
786
|
+
out._parent = self._parent
|
787
|
+
out.cmp_terms = self.cmp_terms
|
788
|
+
out.data = h
|
789
|
+
out._hash = -1
|
790
|
+
return out
|
791
|
+
|
792
|
+
def __copy__(self):
|
793
|
+
"""
|
794
|
+
EXAMPLES::
|
795
|
+
|
796
|
+
sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex')
|
797
|
+
sage: P.inject_variables()
|
798
|
+
Defining e_1, x, y, z
|
799
|
+
sage: p = (x+2*z+1)^3
|
800
|
+
sage: copy(p) is p
|
801
|
+
False
|
802
|
+
sage: copy(p) == p # indirect doctest
|
803
|
+
True
|
804
|
+
"""
|
805
|
+
return self._new_(homog_poly_copy(self.data))
|
806
|
+
|
807
|
+
def __getitem__(self, k):
|
808
|
+
"""
|
809
|
+
Either return the coefficient in ``self`` of an element of the
|
810
|
+
underlying partial semigroup, or the sum of terms of ``self`` whose
|
811
|
+
monomials have a given initial and terminal vertex.
|
812
|
+
|
813
|
+
EXAMPLES::
|
814
|
+
|
815
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
816
|
+
sage: A.inject_variables()
|
817
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
818
|
+
sage: X = (a+2*b+3*c+5*e_0+3*e_2)^3
|
819
|
+
sage: X[A.semigroup()('c')]
|
820
|
+
75
|
821
|
+
sage: X.sort_by_vertices()
|
822
|
+
[(125*e_0 + 30*a*c, 0, 0),
|
823
|
+
(25*a + 3*a*c*a, 0, 1),
|
824
|
+
(98*b + 6*a*c*b, 0, 2),
|
825
|
+
(75*c + 9*c*a*c, 1, 0),
|
826
|
+
(15*c*a, 1, 1),
|
827
|
+
(48*c*b, 1, 2),
|
828
|
+
(27*e_2, 2, 2)]
|
829
|
+
sage: X.sort_by_vertices()
|
830
|
+
[(125*e_0 + 30*a*c, 0, 0),
|
831
|
+
(25*a + 3*a*c*a, 0, 1),
|
832
|
+
(98*b + 6*a*c*b, 0, 2),
|
833
|
+
(75*c + 9*c*a*c, 1, 0),
|
834
|
+
(15*c*a, 1, 1),
|
835
|
+
(48*c*b, 1, 2),
|
836
|
+
(27*e_2, 2, 2)]
|
837
|
+
sage: X[0,2]
|
838
|
+
98*b + 6*a*c*b
|
839
|
+
"""
|
840
|
+
cdef path_homog_poly_t *H
|
841
|
+
cdef path_term_t *T
|
842
|
+
cdef path_mon_t kM
|
843
|
+
cdef PathAlgebraElement out
|
844
|
+
cdef QuiverPath K
|
845
|
+
if isinstance(k, tuple):
|
846
|
+
H = homog_poly_get_predecessor_of_component(self.data, k[0], k[1])
|
847
|
+
if H == NULL:
|
848
|
+
if self.data.start == k[0] and self.data.end == k[1]:
|
849
|
+
out = self._new_(homog_poly_create(self.data.start, self.data.end))
|
850
|
+
out.data.nxt = NULL
|
851
|
+
poly_icopy(out.data.poly, self.data.poly)
|
852
|
+
else:
|
853
|
+
return self._new_(NULL)
|
854
|
+
else:
|
855
|
+
if H.nxt == NULL or H.nxt.start != k[0] or H.nxt.end != k[1]:
|
856
|
+
return self._new_(NULL)
|
857
|
+
out = self._new_(homog_poly_create(H.nxt.start, H.nxt.end))
|
858
|
+
out.data.nxt = NULL
|
859
|
+
poly_icopy(out.data.poly, H.nxt.poly)
|
860
|
+
return out
|
861
|
+
elif isinstance(k, QuiverPath):
|
862
|
+
if self.data == NULL:
|
863
|
+
return self.base_ring().zero()
|
864
|
+
K = k
|
865
|
+
H = homog_poly_get_predecessor_of_component(self.data, K._start, K._end)
|
866
|
+
if H == NULL:
|
867
|
+
if self.data.start != K._start or self.data.end != K._end:
|
868
|
+
return self.base_ring().zero()
|
869
|
+
H = self.data
|
870
|
+
else:
|
871
|
+
H = H.nxt
|
872
|
+
if H == NULL:
|
873
|
+
return self.base_ring().zero()
|
874
|
+
# Now, H points to the component that belongs to K
|
875
|
+
mon_create_keep(kM, K._path, -1, 0, 0)
|
876
|
+
T = H.poly.lead
|
877
|
+
while T != NULL:
|
878
|
+
sig_check()
|
879
|
+
if self.cmp_terms(T.mon, kM) == 0:
|
880
|
+
return <object>T.coef
|
881
|
+
T = T.nxt
|
882
|
+
return self.base_ring().zero()
|
883
|
+
|
884
|
+
def sort_by_vertices(self):
|
885
|
+
"""
|
886
|
+
Return a list of triples ``(element, v1, v2)``, where ``element`` is
|
887
|
+
an element whose monomials all have initial vertex ``v1`` and terminal
|
888
|
+
vertex ``v2``, so that the sum of elements is ``self``.
|
889
|
+
|
890
|
+
EXAMPLES::
|
891
|
+
|
892
|
+
sage: A1 = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
893
|
+
sage: A1.inject_variables()
|
894
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
895
|
+
sage: x = (b*e*b*e+4*b+e_0)^2
|
896
|
+
sage: y = (a*c*b+1)^3
|
897
|
+
sage: x.sort_by_vertices()
|
898
|
+
[(e_0 + 2*b*e*b*e + b*e*b*e*b*e*b*e, 0, 0), (4*b + 4*b*e*b*e*b, 0, 2)]
|
899
|
+
sage: sum(c[0] for c in x.sort_by_vertices()) == x
|
900
|
+
True
|
901
|
+
sage: y.sort_by_vertices()
|
902
|
+
[(e_0, 0, 0), (3*a*c*b, 0, 2), (e_1, 1, 1), (e_2, 2, 2)]
|
903
|
+
sage: sum(c[0] for c in y.sort_by_vertices()) == y
|
904
|
+
True
|
905
|
+
"""
|
906
|
+
cdef path_homog_poly_t * H = self.data
|
907
|
+
cdef PathAlgebraElement out
|
908
|
+
cdef list C = []
|
909
|
+
while H != NULL:
|
910
|
+
out = self._new_(homog_poly_create(H.start, H.end))
|
911
|
+
out.data.nxt = NULL
|
912
|
+
sig_check()
|
913
|
+
poly_icopy(out.data.poly, H.poly)
|
914
|
+
C.append((out, H.start, H.end))
|
915
|
+
H = H.nxt
|
916
|
+
return C
|
917
|
+
|
918
|
+
####
|
919
|
+
# Arithmetics
|
920
|
+
# Hash and Comparison
|
921
|
+
def __hash__(self):
|
922
|
+
"""
|
923
|
+
The hash is cached, to make it faster.
|
924
|
+
|
925
|
+
EXAMPLES::
|
926
|
+
|
927
|
+
sage: P1 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(3,'t'))
|
928
|
+
sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(3,'t'), order='deglex')
|
929
|
+
sage: P1.inject_variables()
|
930
|
+
Defining e_1, x, y, z
|
931
|
+
sage: p = x+y
|
932
|
+
sage: P2.inject_variables()
|
933
|
+
Defining e_1, x, y, z
|
934
|
+
sage: q = x+y
|
935
|
+
sage: D = dict([(p^i,i) for i in range(1,8)])
|
936
|
+
sage: len(D)
|
937
|
+
7
|
938
|
+
sage: hash(q^5) == hash(p^5) # indirect doctest
|
939
|
+
True
|
940
|
+
sage: D[q^6]
|
941
|
+
6
|
942
|
+
"""
|
943
|
+
if self._hash == -1:
|
944
|
+
self._hash = hash(frozenset(self.monomial_coefficients().items()))
|
945
|
+
return self._hash
|
946
|
+
|
947
|
+
cpdef _richcmp_(left, right, int op):
|
948
|
+
"""
|
949
|
+
Helper for comparison of path algebra elements.
|
950
|
+
|
951
|
+
.. NOTE::
|
952
|
+
|
953
|
+
First, the comparison is by initial vertices of
|
954
|
+
monomials. Then, the terminal vertices are compared. Last,
|
955
|
+
the given monomial order is applied for monomials that
|
956
|
+
have the same initial and terminal vertices.
|
957
|
+
|
958
|
+
EXAMPLES::
|
959
|
+
|
960
|
+
sage: A1 = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
961
|
+
sage: A1.inject_variables()
|
962
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
963
|
+
sage: x = (b*e*b*e+4*b+e_0)^2
|
964
|
+
sage: y = (a*c*b+1)^3
|
965
|
+
sage: x.sort_by_vertices()
|
966
|
+
[(e_0 + 2*b*e*b*e + b*e*b*e*b*e*b*e, 0, 0), (4*b + 4*b*e*b*e*b, 0, 2)]
|
967
|
+
sage: y.sort_by_vertices()
|
968
|
+
[(e_0, 0, 0), (3*a*c*b, 0, 2), (e_1, 1, 1), (e_2, 2, 2)]
|
969
|
+
|
970
|
+
The two elements are distinguished by monomials with initial and
|
971
|
+
terminal vertex `0`. Hence, `x` should evaluate bigger than `y`::
|
972
|
+
|
973
|
+
sage: x > y # indirect doctest
|
974
|
+
True
|
975
|
+
"""
|
976
|
+
cdef PathAlgebraElement other = right
|
977
|
+
cdef PathAlgebraElement self = left
|
978
|
+
cdef path_homog_poly_t *H1 = self.data
|
979
|
+
cdef path_homog_poly_t *H2 = other.data
|
980
|
+
while H1 != NULL and H2 != NULL:
|
981
|
+
v1 = H1.start
|
982
|
+
v2 = H2.start
|
983
|
+
if v1 != v2:
|
984
|
+
return richcmp_not_equal(v1, v2, op)
|
985
|
+
|
986
|
+
v1 = H1.end
|
987
|
+
v2 = H2.end
|
988
|
+
if v1 != v2:
|
989
|
+
return richcmp_not_equal(v1, v2, op)
|
990
|
+
|
991
|
+
w1 = H1.poly
|
992
|
+
w2 = H2.poly
|
993
|
+
if w1 != w2:
|
994
|
+
return poly_richcmp(H1.poly, H2.poly, self.cmp_terms, op)
|
995
|
+
|
996
|
+
H1 = H1.nxt
|
997
|
+
H2 = H2.nxt
|
998
|
+
if H1 == NULL:
|
999
|
+
if H2 == NULL:
|
1000
|
+
return rich_to_bool(op, 0)
|
1001
|
+
return rich_to_bool(op, -1)
|
1002
|
+
return rich_to_bool(op, 1)
|
1003
|
+
|
1004
|
+
# negation
|
1005
|
+
cpdef _neg_(self):
|
1006
|
+
"""
|
1007
|
+
EXAMPLES::
|
1008
|
+
|
1009
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(GF(3))
|
1010
|
+
sage: A.inject_variables()
|
1011
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
1012
|
+
sage: x = b*e*b*e+4*b*e+e_0
|
1013
|
+
sage: -x # indirect doctest
|
1014
|
+
2*e_0 + 2*b*e + 2*b*e*b*e
|
1015
|
+
"""
|
1016
|
+
return self._new_(homog_poly_neg(self.data))
|
1017
|
+
|
1018
|
+
# addition
|
1019
|
+
cpdef _add_(self, other):
|
1020
|
+
"""
|
1021
|
+
EXAMPLES::
|
1022
|
+
|
1023
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(GF(3))
|
1024
|
+
sage: A.inject_variables()
|
1025
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
1026
|
+
sage: x = b*e*b*e+4*b*e+e_0
|
1027
|
+
sage: y = a*c+1
|
1028
|
+
sage: x+y # indirect doctest
|
1029
|
+
2*e_0 + b*e + a*c + b*e*b*e + e_1 + e_2
|
1030
|
+
"""
|
1031
|
+
cdef PathAlgebraElement right = other
|
1032
|
+
cdef path_homog_poly_t *H1 = self.data
|
1033
|
+
cdef path_homog_poly_t *H2 = right.data
|
1034
|
+
cdef path_poly_t *P
|
1035
|
+
cdef path_homog_poly_t *out = NULL
|
1036
|
+
cdef path_homog_poly_t *tmp
|
1037
|
+
while True:
|
1038
|
+
sig_check()
|
1039
|
+
if H1 == NULL:
|
1040
|
+
if out == NULL:
|
1041
|
+
if H2 == NULL:
|
1042
|
+
return self._new_(NULL)
|
1043
|
+
return self._new_(homog_poly_copy(H2))
|
1044
|
+
else:
|
1045
|
+
if H2 != NULL:
|
1046
|
+
# If out is not NULL then tmp isn't either
|
1047
|
+
tmp.nxt = homog_poly_copy(H2)
|
1048
|
+
return self._new_(out)
|
1049
|
+
elif H2 == NULL:
|
1050
|
+
if out == NULL:
|
1051
|
+
if H1 == NULL:
|
1052
|
+
return self._new_(NULL)
|
1053
|
+
return self._new_(homog_poly_copy(H1))
|
1054
|
+
else:
|
1055
|
+
if H1 != NULL:
|
1056
|
+
# If out is not NULL then tmp isn't either
|
1057
|
+
tmp.nxt = homog_poly_copy(H1)
|
1058
|
+
return self._new_(out)
|
1059
|
+
else:
|
1060
|
+
if (H1.start > H2.start) or (H1.start == H2.start and H1.end > H2.end):
|
1061
|
+
if out == NULL:
|
1062
|
+
out = homog_poly_create(H2.start, H2.end)
|
1063
|
+
poly_icopy(out.poly, H2.poly)
|
1064
|
+
tmp = out
|
1065
|
+
else:
|
1066
|
+
tmp.nxt = homog_poly_create(H2.start, H2.end)
|
1067
|
+
tmp = tmp.nxt
|
1068
|
+
poly_icopy(tmp.poly, H2.poly)
|
1069
|
+
H2 = H2.nxt
|
1070
|
+
elif (H1.start < H2.start) or (H1.end < H2.end):
|
1071
|
+
if out == NULL:
|
1072
|
+
out = homog_poly_create(H1.start, H1.end)
|
1073
|
+
poly_icopy(out.poly, H1.poly)
|
1074
|
+
tmp = out
|
1075
|
+
else:
|
1076
|
+
tmp.nxt = homog_poly_create(H1.start, H1.end)
|
1077
|
+
tmp = tmp.nxt
|
1078
|
+
poly_icopy(tmp.poly, H1.poly)
|
1079
|
+
H1 = H1.nxt
|
1080
|
+
else:
|
1081
|
+
# start- and endpoints match
|
1082
|
+
P = poly_add(H1.poly, H2.poly, self.cmp_terms)
|
1083
|
+
if P.lead != NULL:
|
1084
|
+
if out == NULL:
|
1085
|
+
out = homog_poly_init_poly(H1.start, H1.end, P)
|
1086
|
+
tmp = out
|
1087
|
+
else:
|
1088
|
+
tmp.nxt = homog_poly_init_poly(H1.start, H1.end, P)
|
1089
|
+
tmp = tmp.nxt
|
1090
|
+
else:
|
1091
|
+
poly_free(P)
|
1092
|
+
H1 = H1.nxt
|
1093
|
+
H2 = H2.nxt
|
1094
|
+
|
1095
|
+
cpdef _sub_(self, other):
|
1096
|
+
"""
|
1097
|
+
EXAMPLES::
|
1098
|
+
|
1099
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(GF(3))
|
1100
|
+
sage: A.inject_variables()
|
1101
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
1102
|
+
sage: x = b*e*b*e+4*b*e+1
|
1103
|
+
sage: y = a*c-1 # indirect doctest
|
1104
|
+
sage: x-y # indirect doctest
|
1105
|
+
2*e_0 + b*e + 2*a*c + b*e*b*e
|
1106
|
+
"""
|
1107
|
+
cdef PathAlgebraElement right = other
|
1108
|
+
cdef path_homog_poly_t *H1 = self.data
|
1109
|
+
cdef path_homog_poly_t *H2 = right.data
|
1110
|
+
cdef path_poly_t *P
|
1111
|
+
cdef path_homog_poly_t *out = NULL
|
1112
|
+
cdef path_homog_poly_t *tmp
|
1113
|
+
while True:
|
1114
|
+
sig_check()
|
1115
|
+
if H1 == NULL:
|
1116
|
+
if out == NULL:
|
1117
|
+
if H2 == NULL:
|
1118
|
+
return self._new_(NULL)
|
1119
|
+
sig_check()
|
1120
|
+
return self._new_(homog_poly_copy(H2))
|
1121
|
+
else:
|
1122
|
+
if H2 != NULL:
|
1123
|
+
# If out is not NULL then tmp isn't either
|
1124
|
+
tmp.nxt = homog_poly_copy(H2)
|
1125
|
+
return self._new_(out)
|
1126
|
+
elif H2 == NULL:
|
1127
|
+
if out == NULL:
|
1128
|
+
if H1 == NULL:
|
1129
|
+
return self._new_(NULL)
|
1130
|
+
return self._new_(homog_poly_copy(H1))
|
1131
|
+
else:
|
1132
|
+
if H1 != NULL:
|
1133
|
+
# If out is not NULL then tmp isn't either
|
1134
|
+
tmp.nxt = homog_poly_copy(H1)
|
1135
|
+
return self._new_(out)
|
1136
|
+
else:
|
1137
|
+
if (H1.start > H2.start) or (H1.start == H2.start and H1.end > H2.end):
|
1138
|
+
if out == NULL:
|
1139
|
+
sig_on()
|
1140
|
+
out = homog_poly_create(H2.start, H2.end)
|
1141
|
+
poly_icopy(out.poly, H2.poly)
|
1142
|
+
sig_off()
|
1143
|
+
tmp = out
|
1144
|
+
else:
|
1145
|
+
sig_on()
|
1146
|
+
tmp.nxt = homog_poly_create(H2.start, H2.end)
|
1147
|
+
tmp = tmp.nxt
|
1148
|
+
poly_icopy(tmp.poly, H2.poly)
|
1149
|
+
sig_off()
|
1150
|
+
H2 = H2.nxt
|
1151
|
+
elif (H1.start < H2.start) or (H1.end < H2.end):
|
1152
|
+
if out == NULL:
|
1153
|
+
sig_on()
|
1154
|
+
out = homog_poly_create(H1.start, H1.end)
|
1155
|
+
poly_icopy(out.poly, H1.poly)
|
1156
|
+
sig_off()
|
1157
|
+
tmp = out
|
1158
|
+
else:
|
1159
|
+
sig_on()
|
1160
|
+
tmp.nxt = homog_poly_create(H1.start, H1.end)
|
1161
|
+
tmp = tmp.nxt
|
1162
|
+
poly_icopy(tmp.poly, H1.poly)
|
1163
|
+
sig_off()
|
1164
|
+
H1 = H1.nxt
|
1165
|
+
else:
|
1166
|
+
# start- and endpoints match
|
1167
|
+
sig_on()
|
1168
|
+
P = poly_sub(H1.poly, H2.poly, self.cmp_terms)
|
1169
|
+
if P.lead != NULL:
|
1170
|
+
if out == NULL:
|
1171
|
+
out = homog_poly_init_poly(H1.start, H1.end, P)
|
1172
|
+
tmp = out
|
1173
|
+
else:
|
1174
|
+
tmp.nxt = homog_poly_init_poly(H1.start, H1.end, P)
|
1175
|
+
tmp = tmp.nxt
|
1176
|
+
else:
|
1177
|
+
poly_free(P)
|
1178
|
+
sig_off()
|
1179
|
+
H1 = H1.nxt
|
1180
|
+
H2 = H2.nxt
|
1181
|
+
|
1182
|
+
# (scalar) multiplication
|
1183
|
+
|
1184
|
+
cpdef _lmul_(self, Element right):
|
1185
|
+
"""
|
1186
|
+
EXAMPLES::
|
1187
|
+
|
1188
|
+
sage: from sage.quivers.algebra_elements import PathAlgebraElement
|
1189
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
1190
|
+
sage: x = sage_eval('3*a+3*b+3*c+3*e_0+3*e_2', A.gens_dict())
|
1191
|
+
sage: x*2 # indirect doctest
|
1192
|
+
6*e_0 + 6*a + 6*b + 6*c + 6*e_2
|
1193
|
+
|
1194
|
+
::
|
1195
|
+
|
1196
|
+
sage: z = sage_eval('a+2*b+5*c+5*e_0+3*e_2', A.gens_dict())
|
1197
|
+
sage: z
|
1198
|
+
5*e_0 + a + 2*b + 5*c + 3*e_2
|
1199
|
+
sage: z*3
|
1200
|
+
3*a + 6*b + 9*e_2
|
1201
|
+
"""
|
1202
|
+
if self.data == NULL:
|
1203
|
+
return self
|
1204
|
+
cdef path_homog_poly_t * out = homog_poly_scale(self.data, right)
|
1205
|
+
cdef path_homog_poly_t * outnxt
|
1206
|
+
if out.poly.nterms == 0:
|
1207
|
+
# homog_poly_scale will remove zero components, except the first.
|
1208
|
+
# Thus, we can return self._new_(out.nxt), but need to free the
|
1209
|
+
# memory occupied by out first.
|
1210
|
+
outnxt = out.nxt
|
1211
|
+
poly_free(out.poly)
|
1212
|
+
sig_free(out)
|
1213
|
+
return self._new_(outnxt)
|
1214
|
+
return self._new_(out)
|
1215
|
+
|
1216
|
+
cpdef _rmul_(self, Element left):
|
1217
|
+
"""
|
1218
|
+
EXAMPLES::
|
1219
|
+
|
1220
|
+
sage: from sage.quivers.algebra_elements import PathAlgebraElement
|
1221
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
1222
|
+
sage: x = sage_eval('3*a+3*b+3*c+3*e_0+3*e_2', A.gens_dict())
|
1223
|
+
sage: 2*x # indirect doctest
|
1224
|
+
6*e_0 + 6*a + 6*b + 6*c + 6*e_2
|
1225
|
+
|
1226
|
+
::
|
1227
|
+
|
1228
|
+
sage: z = sage_eval('a+2*b+5*c+5*e_0+3*e_2', A.gens_dict())
|
1229
|
+
sage: z
|
1230
|
+
5*e_0 + a + 2*b + 5*c + 3*e_2
|
1231
|
+
sage: 3*z
|
1232
|
+
3*a + 6*b + 9*e_2
|
1233
|
+
"""
|
1234
|
+
if self.data == NULL:
|
1235
|
+
return self
|
1236
|
+
cdef path_homog_poly_t * out = homog_poly_scale(self.data, left)
|
1237
|
+
cdef path_homog_poly_t * outnxt
|
1238
|
+
if out.poly.nterms == 0:
|
1239
|
+
# homog_poly_scale will remove zero components, except the first.
|
1240
|
+
# Thus, we can return self._new_(out.nxt), but need to free the
|
1241
|
+
# memory occupied by out first.
|
1242
|
+
outnxt = out.nxt
|
1243
|
+
poly_free(out.poly)
|
1244
|
+
sig_free(out)
|
1245
|
+
return self._new_(outnxt)
|
1246
|
+
return self._new_(out)
|
1247
|
+
|
1248
|
+
def __truediv__(self, x):
|
1249
|
+
"""
|
1250
|
+
Division by coefficients.
|
1251
|
+
|
1252
|
+
EXAMPLES::
|
1253
|
+
|
1254
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
1255
|
+
sage: X = sage_eval('a+2*b+3*c+5*e_0+3*e_2', A.gens_dict())
|
1256
|
+
sage: X/2
|
1257
|
+
10*e_0 + 8*a + b + 9*c + 9*e_2
|
1258
|
+
sage: (X/2)*2 == X # indirect doctest
|
1259
|
+
True
|
1260
|
+
|
1261
|
+
::
|
1262
|
+
|
1263
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ)
|
1264
|
+
sage: A.inject_variables()
|
1265
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
1266
|
+
sage: X = a+2*b+3*c+5*e_0+3*e_2
|
1267
|
+
sage: X/4
|
1268
|
+
5/4*e_0 + 1/4*a + 1/2*b + 3/4*c + 3/4*e_2
|
1269
|
+
sage: (X/4).parent()
|
1270
|
+
Path algebra of Looped multi-digraph on 3 vertices over Rational Field
|
1271
|
+
sage: (X/4)*4 == X
|
1272
|
+
True
|
1273
|
+
"""
|
1274
|
+
cdef PathAlgebraElement sample
|
1275
|
+
if isinstance(self, PathAlgebraElement):
|
1276
|
+
sample = self
|
1277
|
+
x = ~(sample._parent._base(x))
|
1278
|
+
if x.parent() is not sample._parent._base:
|
1279
|
+
sample = sample._parent._semigroup.algebra(x.parent())(0)
|
1280
|
+
return sample._new_(homog_poly_scale((<PathAlgebraElement>self).data, x))
|
1281
|
+
raise TypeError("do not know how to divide {} by {}".format(x, self))
|
1282
|
+
|
1283
|
+
# Multiplication in the algebra
|
1284
|
+
|
1285
|
+
cpdef _mul_(self, other):
|
1286
|
+
"""
|
1287
|
+
EXAMPLES::
|
1288
|
+
|
1289
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15))
|
1290
|
+
sage: A.inject_variables()
|
1291
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
1292
|
+
sage: x = b*e*b*e+4*b*e+e_0
|
1293
|
+
sage: y = a*c+5*f*e
|
1294
|
+
sage: x*y
|
1295
|
+
a*c + 4*b*e*a*c + b*e*b*e*a*c
|
1296
|
+
sage: y*x
|
1297
|
+
a*c + 4*a*c*b*e + a*c*b*e*b*e + 5*f*e + 5*f*e*b*e + 5*f*e*b*e*b*e
|
1298
|
+
sage: y*y
|
1299
|
+
a*c*a*c + 5*f*e*a*c
|
1300
|
+
sage: x*x
|
1301
|
+
e_0 + 8*b*e + 3*b*e*b*e + 8*b*e*b*e*b*e + b*e*b*e*b*e*b*e
|
1302
|
+
|
1303
|
+
::
|
1304
|
+
|
1305
|
+
sage: x = b*e*b*e+4*b*e+e_0
|
1306
|
+
sage: y = a*c+d*c*b*f
|
1307
|
+
sage: x*(y+x) == x*y+x*x
|
1308
|
+
True
|
1309
|
+
|
1310
|
+
TESTS:
|
1311
|
+
|
1312
|
+
We compare against the multiplication in free algebras, which is
|
1313
|
+
implemented independently::
|
1314
|
+
|
1315
|
+
sage: # needs sage.combinat
|
1316
|
+
sage: F.<x,y,z> = FreeAlgebra(GF(25,'t'))
|
1317
|
+
sage: A = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'))
|
1318
|
+
sage: pF = x+2*y-z+1
|
1319
|
+
sage: pA = sage_eval('x+2*y-z+1', A.gens_dict())
|
1320
|
+
sage: pA^5 == sage_eval(repr(pF^5), A.gens_dict())
|
1321
|
+
True
|
1322
|
+
"""
|
1323
|
+
if self.data == NULL:
|
1324
|
+
return self
|
1325
|
+
cdef PathAlgebraElement right = other
|
1326
|
+
if right.data == NULL:
|
1327
|
+
return right
|
1328
|
+
cdef path_homog_poly_t *H1 = self.data
|
1329
|
+
cdef path_homog_poly_t *H2
|
1330
|
+
cdef path_term_t *T2
|
1331
|
+
cdef path_homog_poly_t *out_orig = NULL
|
1332
|
+
cdef path_homog_poly_t *out = NULL
|
1333
|
+
cdef path_homog_poly_t *nxt
|
1334
|
+
cdef path_term_t *P1start
|
1335
|
+
while H1 != NULL:
|
1336
|
+
H2 = right.data
|
1337
|
+
while H2 != NULL:
|
1338
|
+
sig_check()
|
1339
|
+
if H2.start == H1.end:
|
1340
|
+
out = homog_poly_get_predecessor_of_component(out_orig, H1.start, H2.end)
|
1341
|
+
if out == NULL:
|
1342
|
+
if out_orig == NULL:
|
1343
|
+
out_orig = homog_poly_create(H1.start, H2.end)
|
1344
|
+
else:
|
1345
|
+
if out_orig.start != H1.start or out_orig.end != H2.end:
|
1346
|
+
nxt = out_orig
|
1347
|
+
out_orig = homog_poly_create(H1.start, H2.end)
|
1348
|
+
out_orig.nxt = nxt
|
1349
|
+
else:
|
1350
|
+
if out.nxt==NULL or out.nxt.start != H1.start or out.nxt.end != H2.end:
|
1351
|
+
nxt = out.nxt
|
1352
|
+
out.nxt = homog_poly_create(H1.start, H2.end)
|
1353
|
+
out.nxt.nxt = nxt
|
1354
|
+
T2 = H2.poly.lead
|
1355
|
+
# now, either out==NULL, and we need to put the product
|
1356
|
+
# into out_orig; or out!=NULL, and we need to put the
|
1357
|
+
# product into out.nxt
|
1358
|
+
if out == NULL:
|
1359
|
+
P1start = out_orig.poly.lead
|
1360
|
+
while T2 != NULL:
|
1361
|
+
P1start = poly_iadd_lmul(out_orig.poly, <object>T2.coef, H1.poly,
|
1362
|
+
T2.mon.path, self.cmp_terms, -1, 0, 0, P1start)
|
1363
|
+
if P1start == H1.poly.lead:
|
1364
|
+
P1start = out_orig.poly.lead
|
1365
|
+
T2 = T2.nxt
|
1366
|
+
else:
|
1367
|
+
P1start = out.nxt.poly.lead
|
1368
|
+
while T2 != NULL:
|
1369
|
+
P1start = poly_iadd_lmul(out.nxt.poly, <object>T2.coef, H1.poly,
|
1370
|
+
T2.mon.path, self.cmp_terms, -1, 0, 0, P1start)
|
1371
|
+
if P1start == H1.poly.lead:
|
1372
|
+
P1start = out.nxt.poly.lead
|
1373
|
+
T2 = T2.nxt
|
1374
|
+
H2 = H2.nxt
|
1375
|
+
H1 = H1.nxt
|
1376
|
+
while out_orig != NULL and out_orig.poly.lead == NULL:
|
1377
|
+
tmp = out_orig.nxt
|
1378
|
+
sig_check()
|
1379
|
+
sig_free(out_orig.poly)
|
1380
|
+
sig_free(out_orig)
|
1381
|
+
out_orig = tmp
|
1382
|
+
if out_orig == NULL:
|
1383
|
+
return self._new_(NULL)
|
1384
|
+
tmp = out_orig
|
1385
|
+
while tmp.nxt != NULL:
|
1386
|
+
if tmp.nxt.poly.lead == NULL:
|
1387
|
+
sig_check()
|
1388
|
+
nxt = tmp.nxt.nxt
|
1389
|
+
sig_free(tmp.nxt.poly)
|
1390
|
+
sig_free(tmp.nxt)
|
1391
|
+
tmp.nxt = nxt
|
1392
|
+
else:
|
1393
|
+
tmp = tmp.nxt
|
1394
|
+
return self._new_(out_orig)
|
1395
|
+
|
1396
|
+
cpdef PathAlgebraElement path_algebra_element_unpickle(P, list data):
|
1397
|
+
"""
|
1398
|
+
Auxiliary function for unpickling.
|
1399
|
+
|
1400
|
+
EXAMPLES::
|
1401
|
+
|
1402
|
+
sage: A = DiGraph({0:{1:['a'], 2:['b']}, 1:{0:['c'], 1:['d']}, 2:{0:['e'],2:['f']}}).path_semigroup().algebra(ZZ.quo(15), order='negdeglex')
|
1403
|
+
sage: A.inject_variables()
|
1404
|
+
Defining e_0, e_1, e_2, a, b, c, d, e, f
|
1405
|
+
sage: X = a+2*b+3*c+5*e_0+3*e_2
|
1406
|
+
sage: loads(dumps(X)) == X # indirect doctest
|
1407
|
+
True
|
1408
|
+
"""
|
1409
|
+
cdef PathAlgebraElement out = P.element_class.__new__(P.element_class)
|
1410
|
+
out._parent = P
|
1411
|
+
order = P.order_string()
|
1412
|
+
if order == "negdegrevlex":
|
1413
|
+
out.cmp_terms = negdegrevlex
|
1414
|
+
elif order == "degrevlex":
|
1415
|
+
out.cmp_terms = degrevlex
|
1416
|
+
elif order == "negdeglex":
|
1417
|
+
out.cmp_terms = negdeglex
|
1418
|
+
elif order == "deglex":
|
1419
|
+
out.cmp_terms = deglex
|
1420
|
+
else:
|
1421
|
+
raise ValueError("unknown term order '{}'".format(order))
|
1422
|
+
out.data = homog_poly_unpickle(data)
|
1423
|
+
out._hash = -1
|
1424
|
+
return out
|